From 6af59cb3fbc8b8ef0f59f1f6f2bd087f8f5531c4 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Fri, 18 Apr 2025 02:02:15 +0200 Subject: [PATCH] reset alloc IDs --- src/actions.c | 446 ++++++++++---------- src/callback.c | 170 ++++---- src/check.c | 28 +- src/draw.c | 314 +++++++------- src/editprop.c | 146 +++---- src/eval_expr.y | 20 +- src/expandlabel.y | 102 ++--- src/findnet.c | 6 +- src/font.c | 4 +- src/hash_iterator.c | 12 +- src/hilight.c | 252 +++++------ src/in_memory_undo.c | 278 ++++++------- src/main.c | 6 +- src/move.c | 66 +-- src/netlist.c | 160 +++---- src/node_hash.c | 72 ++-- src/options.c | 6 +- src/parselabel.l | 26 +- src/paste.c | 30 +- src/psprint.c | 40 +- src/save.c | 532 ++++++++++++------------ src/scheduler.c | 206 ++++----- src/select.c | 54 +-- src/spice_netlist.c | 180 ++++---- src/store.c | 34 +- src/svgdraw.c | 38 +- src/tedax_netlist.c | 30 +- src/token.c | 946 +++++++++++++++++++++--------------------- src/verilog_netlist.c | 122 +++--- src/vhdl_netlist.c | 110 ++--- src/xinit.c | 238 +++++------ src/xschem.h | 2 +- 32 files changed, 2338 insertions(+), 2338 deletions(-) diff --git a/src/actions.c b/src/actions.c index 1d52cc79..37ef0423 100644 --- a/src/actions.c +++ b/src/actions.c @@ -52,11 +52,11 @@ unsigned int hash_file(const char *f, int skip_path_lines) * skip also .include /path/to/some/file */ if(skip_path_lines && n > 14) { if(!strncmp(line+2, " sch_path: ", 11) || !strncmp(line+2, " sym_path: ", 11) ) { - my_free(0, &line); + my_free(_ALLOC_ID_, &line); continue; } if(!strncmp(line, ".include ", 9) || !strncmp(line, ".INCLUDE ", 9) ) { - my_free(1, &line); + my_free(_ALLOC_ID_, &line); continue; } } @@ -73,7 +73,7 @@ unsigned int hash_file(const char *f, int skip_path_lines) } h += (h << 5) + (unsigned char)line[i]; } - my_free(2, &line); + my_free(_ALLOC_ID_, &line); } /* while(line ....) */ if(cr) h += (h << 5) + '\r'; /* file ends with \r not followed by \n: keep it */ fclose(fd); @@ -122,7 +122,7 @@ const char *get_text_floater(int i) txt_ptr = xctx->text[i].floater_ptr; } else { /* cache floater translated text to avoid re-evaluating every time schematic is drawn */ - my_strdup2(3, &xctx->text[i].floater_ptr, translate(inst, xctx->text[i].txt_ptr)); + my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_ptr, translate(inst, xctx->text[i].txt_ptr)); txt_ptr = xctx->text[i].floater_ptr; } dbg(1, "floater: %s\n",txt_ptr); @@ -131,8 +131,8 @@ const char *get_text_floater(int i) * (but name=something or floater=something attribute must be present) and text * matches tcleval(...) or contains '@' */ if(strstr(txt_ptr, "tcleval(") == txt_ptr || strchr(txt_ptr, '@')) { - /* my_strdup2(4, &xctx->text[i].floater_ptr, tcl_hook2(xctx->text[i].txt_ptr)); */ - my_strdup2(5, &xctx->text[i].floater_ptr, translate(-1, xctx->text[i].txt_ptr)); + /* my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_ptr, tcl_hook2(xctx->text[i].txt_ptr)); */ + my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_ptr, translate(-1, xctx->text[i].txt_ptr)); txt_ptr = xctx->text[i].floater_ptr; } } @@ -193,7 +193,7 @@ int set_modify(int mod) for(i = 0; i < xctx->texts; i++) if(xctx->text[i].flags & TEXT_FLOATER) { floaters++; - my_free(6, &xctx->text[i].floater_ptr); /* clear floater cached value */ + my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); /* clear floater cached value */ } int_hash_free(&xctx->floater_inst_table); } @@ -238,16 +238,16 @@ char *escape_chars(const char *source, const char *charset) size_t slen, size; if(!source) { - if(dest) my_free(7, &dest); + if(dest) my_free(_ALLOC_ID_, &dest); return NULL; } slen = strlen(source); size = slen + 1; - my_realloc(8, &dest, size); + my_realloc(_ALLOC_ID_, &dest, size); while(source && source[s]) { if(d >= size - 2) { size += 2; - my_realloc(9, &dest, size); + my_realloc(_ALLOC_ID_, &dest, size); } if(!strcmp(charset, "")) { switch(source[s]) { @@ -641,7 +641,7 @@ void ask_new_file(void) load_schematic(1, f, 1, 1); tclvareval("update_recent_file {", f, "}", NULL); if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]); - my_strdup(10, &xctx->sch_path[xctx->currsch],"."); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch],"."); xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_inst_number[xctx->currsch] = 1; zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); @@ -659,77 +659,77 @@ void remove_symbol(int j) xSymbol save; dbg(1,"clearing symbol %d: %s\n", j, xctx->sym[j].name); - my_free(11, &xctx->sym[j].prop_ptr); - my_free(12, &xctx->sym[j].templ); - my_free(13, &xctx->sym[j].parent_prop_ptr); - my_free(14, &xctx->sym[j].type); - my_free(15, &xctx->sym[j].name); + my_free(_ALLOC_ID_, &xctx->sym[j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].templ); + my_free(_ALLOC_ID_, &xctx->sym[j].parent_prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].type); + my_free(_ALLOC_ID_, &xctx->sym[j].name); /* /20150409 */ for(c=0;csym[j].polygons[c]; ++i) { if(xctx->sym[j].poly[c][i].prop_ptr != NULL) { - my_free(16, &xctx->sym[j].poly[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].prop_ptr); } - my_free(17, &xctx->sym[j].poly[c][i].x); - my_free(18, &xctx->sym[j].poly[c][i].y); - my_free(19, &xctx->sym[j].poly[c][i].selected_point); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].x); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].y); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].selected_point); } - my_free(20, &xctx->sym[j].poly[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].poly[c]); xctx->sym[j].polygons[c] = 0; for(i=0;isym[j].lines[c]; ++i) { if(xctx->sym[j].line[c][i].prop_ptr != NULL) { - my_free(21, &xctx->sym[j].line[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].line[c][i].prop_ptr); } } - my_free(22, &xctx->sym[j].line[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].line[c]); xctx->sym[j].lines[c] = 0; for(i=0;isym[j].arcs[c]; ++i) { if(xctx->sym[j].arc[c][i].prop_ptr != NULL) { - my_free(23, &xctx->sym[j].arc[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].arc[c][i].prop_ptr); } } - my_free(24, &xctx->sym[j].arc[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].arc[c]); xctx->sym[j].arcs[c] = 0; for(i=0;isym[j].rects[c]; ++i) { if(xctx->sym[j].rect[c][i].prop_ptr != NULL) { - my_free(25, &xctx->sym[j].rect[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].rect[c][i].prop_ptr); } set_rect_extraptr(0, &xctx->sym[j].rect[c][i]); } - my_free(26, &xctx->sym[j].rect[c]); + my_free(_ALLOC_ID_, &xctx->sym[j].rect[c]); xctx->sym[j].rects[c] = 0; } for(i=0;isym[j].texts; ++i) { if(xctx->sym[j].text[i].prop_ptr != NULL) { - my_free(27, &xctx->sym[j].text[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].prop_ptr); } if(xctx->sym[j].text[i].txt_ptr != NULL) { - my_free(28, &xctx->sym[j].text[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].txt_ptr); dbg(1, "remove_symbol(): freeing symbol %d text_ptr %d\n", j, i); } if(xctx->sym[j].text[i].font != NULL) { - my_free(29, &xctx->sym[j].text[i].font); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].font); } if(xctx->sym[j].text[i].floater_instname != NULL) { - my_free(30, &xctx->sym[j].text[i].floater_instname); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].floater_instname); } if(xctx->sym[j].text[i].floater_ptr != NULL) { - my_free(31, &xctx->sym[j].text[i].floater_ptr); + my_free(_ALLOC_ID_, &xctx->sym[j].text[i].floater_ptr); } } - my_free(32, &xctx->sym[j].text); + my_free(_ALLOC_ID_, &xctx->sym[j].text); - my_free(33, &xctx->sym[j].line); - my_free(34, &xctx->sym[j].rect); - my_free(35, &xctx->sym[j].arc); - my_free(36, &xctx->sym[j].poly); - my_free(37, &xctx->sym[j].lines); - my_free(38, &xctx->sym[j].polygons); - my_free(39, &xctx->sym[j].arcs); - my_free(40, &xctx->sym[j].rects); + my_free(_ALLOC_ID_, &xctx->sym[j].line); + my_free(_ALLOC_ID_, &xctx->sym[j].rect); + my_free(_ALLOC_ID_, &xctx->sym[j].arc); + my_free(_ALLOC_ID_, &xctx->sym[j].poly); + my_free(_ALLOC_ID_, &xctx->sym[j].lines); + my_free(_ALLOC_ID_, &xctx->sym[j].polygons); + my_free(_ALLOC_ID_, &xctx->sym[j].arcs); + my_free(_ALLOC_ID_, &xctx->sym[j].rects); xctx->sym[j].texts = 0; @@ -788,10 +788,10 @@ int set_sym_flags(xSymbol *sym) { const char *ptr; sym->flags = 0; - my_strdup2(41, &sym->templ, + my_strdup2(_ALLOC_ID_, &sym->templ, get_tok_value(sym->prop_ptr, "template", 0)); - my_strdup2(42, &sym->type, + my_strdup2(_ALLOC_ID_, &sym->type, get_tok_value(sym->prop_ptr, "type",0)); if(!strboolcmp(get_tok_value(sym->prop_ptr,"highlight",0), "true")) @@ -837,14 +837,14 @@ int set_inst_flags(xInstance *inst) { const char *ptr; inst->flags &= IGNORE_INST; /* do not clear IGNORE_INST bit, used in draw_symbol() */ - my_strdup2(43, &inst->instname, get_tok_value(inst->prop_ptr, "name", 0)); + my_strdup2(_ALLOC_ID_, &inst->instname, get_tok_value(inst->prop_ptr, "name", 0)); dbg(1, "set_inst_flags(): instname=%s\n", inst->instname); if(inst->ptr >=0) { char *type = xctx->sym[inst->ptr].type; int cond= type && IS_LABEL_SH_OR_PIN(type); if(cond) { inst->flags |= PIN_OR_LABEL; - my_strdup2(44, &(inst->lab), get_tok_value(inst->prop_ptr,"lab",0)); + my_strdup2(_ALLOC_ID_, &(inst->lab), get_tok_value(inst->prop_ptr,"lab",0)); } } @@ -900,7 +900,7 @@ int set_text_flags(xText *t) t->vcenter = 0; t->layer = -1; /* -1 means default TEXTLAYER is to be used */ if(t->prop_ptr) { - my_strdup(45, &t->font, get_tok_value(t->prop_ptr, "font", 0)); + my_strdup(_ALLOC_ID_, &t->font, get_tok_value(t->prop_ptr, "font", 0)); str = get_tok_value(t->prop_ptr, "hcenter", 0); t->hcenter = strboolcmp(str, "true") ? 0 : 1; str = get_tok_value(t->prop_ptr, "vcenter", 0); @@ -920,7 +920,7 @@ int set_text_flags(xText *t) str = get_tok_value(t->prop_ptr, "name", 0); if(!xctx->tok_size) str = get_tok_value(t->prop_ptr, "floater", 0); t->flags |= xctx->tok_size ? TEXT_FLOATER : 0; - my_strdup2(46, &t->floater_instname, str); + my_strdup2(_ALLOC_ID_, &t->floater_instname, str); } return 0; } @@ -949,7 +949,7 @@ int set_rect_extraptr(int what, xRect *drptr) if(drptr->flags & 1024) { /* embedded image */ if(!drptr->extraptr) { xEmb_image *d; - d = my_malloc(47, sizeof(xEmb_image)); + d = my_malloc(_ALLOC_ID_, sizeof(xEmb_image)); d->image = NULL; drptr->extraptr = d; } @@ -961,7 +961,7 @@ int set_rect_extraptr(int what, xRect *drptr) if(d->image) { cairo_surface_destroy(d->image); } - my_free(48, &drptr->extraptr); + my_free(_ALLOC_ID_, &drptr->extraptr); } } } @@ -975,57 +975,57 @@ void clear_drawing(void) xctx->graph_lastsel = -1; del_inst_table(); del_wire_table(); - my_free(49, &xctx->schtedaxprop); - my_free(50, &xctx->schsymbolprop); - my_free(51, &xctx->schprop); - my_free(52, &xctx->schvhdlprop); - my_free(53, &xctx->version_string); - if(xctx->header_text) my_free(54, &xctx->header_text); - my_free(55, &xctx->schverilogprop); + my_free(_ALLOC_ID_, &xctx->schtedaxprop); + my_free(_ALLOC_ID_, &xctx->schsymbolprop); + my_free(_ALLOC_ID_, &xctx->schprop); + my_free(_ALLOC_ID_, &xctx->schvhdlprop); + my_free(_ALLOC_ID_, &xctx->version_string); + if(xctx->header_text) my_free(_ALLOC_ID_, &xctx->header_text); + my_free(_ALLOC_ID_, &xctx->schverilogprop); for(i=0;iwires; ++i) { - my_free(56, &xctx->wire[i].prop_ptr); - my_free(57, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); } xctx->wires = 0; for(i=0;iinstances; ++i) { - my_free(58, &xctx->inst[i].prop_ptr); - my_free(59, &xctx->inst[i].name); - my_free(60, &xctx->inst[i].instname); - my_free(61, &xctx->inst[i].lab); + my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->inst[i].name); + my_free(_ALLOC_ID_, &xctx->inst[i].instname); + my_free(_ALLOC_ID_, &xctx->inst[i].lab); delete_inst_node(i); } xctx->instances = 0; for(i=0;itexts; ++i) { - my_free(62, &xctx->text[i].font); - my_free(63, &xctx->text[i].floater_instname); - my_free(64, &xctx->text[i].floater_ptr); - my_free(65, &xctx->text[i].prop_ptr); - my_free(66, &xctx->text[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].font); + my_free(_ALLOC_ID_, &xctx->text[i].floater_instname); + my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr); } xctx->texts = 0; for(i=0;ilines[i]; ++j) { - my_free(67, &xctx->line[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->line[i][j].prop_ptr); } for(j=0;jrects[i]; ++j) { - my_free(68, &xctx->rect[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->rect[i][j].prop_ptr); set_rect_extraptr(0, &xctx->rect[i][j]); } for(j=0;jarcs[i]; ++j) { - my_free(69, &xctx->arc[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->arc[i][j].prop_ptr); } for(j=0;jpolygons[i]; ++j) { - my_free(70, &xctx->poly[i][j].x); - my_free(71, &xctx->poly[i][j].y); - my_free(72, &xctx->poly[i][j].prop_ptr); - my_free(73, &xctx->poly[i][j].selected_point); + my_free(_ALLOC_ID_, &xctx->poly[i][j].x); + my_free(_ALLOC_ID_, &xctx->poly[i][j].y); + my_free(_ALLOC_ID_, &xctx->poly[i][j].prop_ptr); + my_free(_ALLOC_ID_, &xctx->poly[i][j].selected_point); } xctx->lines[i] = 0; xctx->arcs[i] = 0; @@ -1295,8 +1295,8 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 int use_label_prefix; int found=0; - my_strdup(74, &symname_pin, tcleval("find_file_first lab_pin.sym")); - my_strdup(75, &symname_wire, tcleval("find_file_first lab_wire.sym")); + my_strdup(_ALLOC_ID_, &symname_pin, tcleval("find_file_first lab_pin.sym")); + my_strdup(_ALLOC_ID_, &symname_wire, tcleval("find_file_first lab_wire.sym")); if(symname_pin && symname_wire) { rebuild_selected_array(); k = xctx->lastsel; @@ -1304,8 +1304,8 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 prepare_netlist_structs(0); for(j=0;jsel_array[j].type==ELEMENT) { found=1; - my_strdup(76, &prop, xctx->inst[xctx->sel_array[j].n].instname); - my_strcat(77, &prop, "_"); + my_strdup(_ALLOC_ID_, &prop, xctx->inst[xctx->sel_array[j].n].instname); + my_strcat(_ALLOC_ID_, &prop, "_"); tclsetvar("custom_label_prefix",prop); if(interactive && !do_all_inst) { @@ -1313,7 +1313,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 tcleval("attach_labels_to_inst"); if(!strcmp(tclgetvar("tctx::rcode"),"") ) { bbox(END, 0., 0., 0., 0.); - my_free(78, &prop); + my_free(_ALLOC_ID_, &prop); return; } } @@ -1327,7 +1327,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 use_label_prefix = tclgetboolvar("use_label_prefix"); rot_txt = tclgetvar("rotated_text"); if(strcmp(rot_txt,"")) rotated_text=atoi(rot_txt); - my_strdup(79, &type,(xctx->inst[xctx->sel_array[j].n].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[xctx->sel_array[j].n].ptr+ xctx->sym)->type); if( type && IS_LABEL_OR_PIN(type) ) { continue; } @@ -1347,7 +1347,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 rct=symbol->rect[PINLAYER]; for(i=0;i labname=%s\n", labname); pinx0 = (rct[i].x1+rct[i].x2)/2; @@ -1391,13 +1391,13 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 wptr = wptr->next; } if(!skip) { - my_strdup(81, &prop, "name=p1 lab="); + my_strdup(_ALLOC_ID_, &prop, "name=p1 lab="); if(use_label_prefix) { - my_strcat(82, &prop, (char *)tclgetvar("custom_label_prefix")); + my_strcat(_ALLOC_ID_, &prop, (char *)tclgetvar("custom_label_prefix")); } /* /20171005 */ - my_strcat(83, &prop, labname); + my_strcat(_ALLOC_ID_, &prop, labname); dir ^= flip; /* 20101129 20111030 */ if(rotated_text ==-1) { rot1=rot; @@ -1416,9 +1416,9 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 } } if(first_call == 0) set_modify(1); - my_free(84, &prop); - my_free(85, &labname); - my_free(86, &type); + my_free(_ALLOC_ID_, &prop); + my_free(_ALLOC_ID_, &labname); + my_free(_ALLOC_ID_, &type); if(!found) return; /* draw things */ if(!first_call) { @@ -1430,8 +1430,8 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710 fprintf(errfp, "attach_labels_to_inst(): location of schematic labels not found\n"); tcleval("alert_ {attach_labels_to_inst(): location of schematic labels not found} {}"); } - my_free(87, &symname_pin); - my_free(88, &symname_wire); + my_free(_ALLOC_ID_, &symname_pin); + my_free(_ALLOC_ID_, &symname_wire); } void delete_files(void) @@ -1539,7 +1539,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot xctx->inst[n].name=NULL; xctx->inst[n].lab=NULL; dbg(1, "place_symbol(): entering my_strdup: name=%s\n",name); /* 03-02-2000 */ - my_strdup2(89, &xctx->inst[n].name ,name); + my_strdup2(_ALLOC_ID_, &xctx->inst[n].name ,name); dbg(1, "place_symbol(): done my_strdup: name=%s\n",name); /* 03-02-2000 */ /* xctx->inst[n].x0=symbol_name ? x : xctx->mousex_snap; */ /* xctx->inst[n].y0=symbol_name ? y : xctx->mousey_snap; */ @@ -1590,46 +1590,46 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot if(xctx->sym[i].type && !strcmp(xctx->sym[i].type, "scope")) { char *prop = NULL; - my_strdup(90, &xctx->inst[n].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->inst[n].prop_ptr, subst_token(xctx->inst[n].prop_ptr, "attach", xctx->inst[n].instname)); - my_mstrcat(91, &prop, "name=", xctx->inst[n].instname, "\n", NULL); - my_mstrcat(92, &prop, "flags=graph,unlocked\n", NULL); - my_mstrcat(93, &prop, "lock=1\n", NULL); - my_mstrcat(94, &prop, "color=8\n", NULL); + my_mstrcat(_ALLOC_ID_, &prop, "name=", xctx->inst[n].instname, "\n", NULL); + my_mstrcat(_ALLOC_ID_, &prop, "flags=graph,unlocked\n", NULL); + my_mstrcat(_ALLOC_ID_, &prop, "lock=1\n", NULL); + my_mstrcat(_ALLOC_ID_, &prop, "color=8\n", NULL); if(xctx->sym[i].rects[PINLAYER] == 0) { if(xctx->lastsel == 1 && xctx->sel_array[0].type==ELEMENT) { - my_mstrcat(95, &prop, "node=\"tcleval([xschem get_fqdevice [xschem translate ", + my_mstrcat(_ALLOC_ID_, &prop, "node=\"tcleval([xschem get_fqdevice [xschem translate ", xctx->inst[n].instname, " @device]])\"\n", NULL); - my_strdup(96, &xctx->inst[n].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->inst[n].prop_ptr, subst_token(xctx->inst[n].prop_ptr, "device", xctx->inst[xctx->sel_array[0].n].instname)); } else { const char msg[]="scope_ammeter is being inserted but no selected ammeter device/vsource to link to\n"; dbg(0, "%s", msg); if(has_x) tclvareval("alert_ {", msg, "} {} 1", NULL); #if 1 - if(xctx->inst[n].instname) my_free(97, &xctx->inst[n].instname); - if(xctx->inst[n].name) my_free(98, &xctx->inst[n].name); - if(xctx->inst[n].prop_ptr) my_free(99, &xctx->inst[n].prop_ptr); - if(xctx->inst[n].lab) my_free(100, &xctx->inst[n].lab); - if(prop) my_free(101, &prop); + if(xctx->inst[n].instname) my_free(_ALLOC_ID_, &xctx->inst[n].instname); + if(xctx->inst[n].name) my_free(_ALLOC_ID_, &xctx->inst[n].name); + if(xctx->inst[n].prop_ptr) my_free(_ALLOC_ID_, &xctx->inst[n].prop_ptr); + if(xctx->inst[n].lab) my_free(_ALLOC_ID_, &xctx->inst[n].lab); + if(prop) my_free(_ALLOC_ID_, &prop); xctx->instances--; return 0; #endif } } else if(xctx->sym[i].rects[PINLAYER] == 1) { - my_mstrcat(102, &prop, + my_mstrcat(_ALLOC_ID_, &prop, "node=\"tcleval(", "[xschem translate ", xctx->inst[n].instname, " @#0:net_name]", ")\"\n", NULL); } else { - my_mstrcat(103, &prop, + my_mstrcat(_ALLOC_ID_, &prop, "node=\"tcleval(", "[xschem translate ", xctx->inst[n].instname, " @#0:net_name] ", "[xschem translate ", xctx->inst[n].instname, " @#1:net_name] -", ")\"\n", NULL); } storeobject(-1, x + 20, y-125, x + 130 , y - 25, xRECT, 2, SELECTED, prop); - my_free(104, &prop); + my_free(_ALLOC_ID_, &prop); } if(draw_sym & 3) { @@ -1716,8 +1716,8 @@ int copy_hierarchy_data(const char *from_win_path, const char *to_win_path) hier_attr = from->hier_attr; to->currsch = from->currsch; for(i = 0; i <= from->currsch; i++) { - my_strdup2(105, &to->sch[i], sch[i]); - my_strdup2(106, &to->sch_path[i], sch_path[i]); + my_strdup2(_ALLOC_ID_, &to->sch[i], sch[i]); + my_strdup2(_ALLOC_ID_, &to->sch_path[i], sch_path[i]); to->sch_path_hash[i] = sch_path_hash[i]; to->sch_inst_number[i] = sch_inst_number[i]; to->previous_instance[i] = previous_instance[i]; @@ -1729,9 +1729,9 @@ int copy_hierarchy_data(const char *from_win_path, const char *to_win_path) to->hier_attr[i].rot = hier_attr[i].rot; to->hier_attr[i].flip = hier_attr[i].flip; to->hier_attr[i].fd = NULL; /* Never used outside load_sym_def() */ - my_strdup2(107, &to->hier_attr[i].prop_ptr, hier_attr[i].prop_ptr); - my_strdup2(108, &to->hier_attr[i].templ, hier_attr[i].templ); - my_strdup2(109, &to->hier_attr[i].symname, hier_attr[i].symname); + my_strdup2(_ALLOC_ID_, &to->hier_attr[i].prop_ptr, hier_attr[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &to->hier_attr[i].templ, hier_attr[i].templ); + my_strdup2(_ALLOC_ID_, &to->hier_attr[i].symname, hier_attr[i].symname); if(to->portmap[i].table) str_hash_free(&to->portmap[i]); str_hash_init(&to->portmap[i], HASHSIZE); for(j = 0; j < HASHSIZE; j++) { @@ -1740,10 +1740,10 @@ int copy_hierarchy_data(const char *from_win_path, const char *to_win_path) tonext = &(to->portmap[i].table[j]); while(*fromnext) { Str_hashentry *e; - e = my_calloc(110, 1, sizeof(Str_hashentry)); + e = my_calloc(_ALLOC_ID_, 1, sizeof(Str_hashentry)); e->hash = (*fromnext)->hash; - my_strdup2(111, &e->token, (*fromnext)->token); - my_strdup2(112, &e->value, (*fromnext)->value); + my_strdup2(_ALLOC_ID_, &e->token, (*fromnext)->token); + my_strdup2(_ALLOC_ID_, &e->value, (*fromnext)->value); *tonext = e; fromnext = &( (*fromnext)->next ); tonext = &( (*tonext)->next ); @@ -1823,7 +1823,7 @@ void launcher(void) else if(xctx->sel_array[0].type==LINE) prop_ptr = xctx->line[c][n].prop_ptr; else if(xctx->sel_array[0].type==WIRE) prop_ptr = xctx->wire[n].prop_ptr; else if(xctx->sel_array[0].type==xTEXT) prop_ptr = xctx->text[n].prop_ptr; - my_strdup2(113, &command, get_tok_value(prop_ptr,"tclcommand",0)); + my_strdup2(_ALLOC_ID_, &command, get_tok_value(prop_ptr,"tclcommand",0)); my_strncpy(program, get_tok_value(prop_ptr,"program",0), S(program)); /* handle backslashes */ url = get_tok_value(prop_ptr,"url",0); /* handle backslashes */ dbg(1, "launcher(): url=%s\n", url); @@ -1840,7 +1840,7 @@ void launcher(void) dbg(0, "%s\n", msg); /* if(has_x) tclvareval("alert_ {", msg, "} {}", NULL); */ /* commented, annoying */ } - my_free(114, &command); + my_free(_ALLOC_ID_, &command); tcleval("after 300"); select_object(mx,my,0, 0, NULL); } @@ -1895,59 +1895,59 @@ void copy_symbol(xSymbol *dest_sym, xSymbol *src_sym) dest_sym->type = NULL; dest_sym->templ = NULL; dest_sym->parent_prop_ptr = NULL; - my_strdup2(115, &dest_sym->name, src_sym->name); - my_strdup2(116, &dest_sym->type, src_sym->type); - my_strdup2(117, &dest_sym->templ, src_sym->templ); - my_strdup(118, &dest_sym->parent_prop_ptr, src_sym->parent_prop_ptr); - my_strdup2(119, &dest_sym->prop_ptr, src_sym->prop_ptr); + my_strdup2(_ALLOC_ID_, &dest_sym->name, src_sym->name); + my_strdup2(_ALLOC_ID_, &dest_sym->type, src_sym->type); + my_strdup2(_ALLOC_ID_, &dest_sym->templ, src_sym->templ); + my_strdup(_ALLOC_ID_, &dest_sym->parent_prop_ptr, src_sym->parent_prop_ptr); + my_strdup2(_ALLOC_ID_, &dest_sym->prop_ptr, src_sym->prop_ptr); - dest_sym->line = my_calloc(120, cadlayers, sizeof(xLine *)); - dest_sym->poly = my_calloc(121, cadlayers, sizeof(xPoly *)); - dest_sym->arc = my_calloc(122, cadlayers, sizeof(xArc *)); - dest_sym->rect = my_calloc(123, cadlayers, sizeof(xRect *)); - dest_sym->lines = my_calloc(124, cadlayers, sizeof(int)); - dest_sym->rects = my_calloc(125, cadlayers, sizeof(int)); - dest_sym->arcs = my_calloc(126, cadlayers, sizeof(int)); - dest_sym->polygons = my_calloc(127, cadlayers, sizeof(int)); + dest_sym->line = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + dest_sym->poly = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); + dest_sym->arc = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); + dest_sym->rect = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + dest_sym->lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + dest_sym->rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + dest_sym->arcs = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + dest_sym->polygons = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); - dest_sym->text = my_calloc(128, src_sym->texts, sizeof(xText)); + dest_sym->text = my_calloc(_ALLOC_ID_, src_sym->texts, sizeof(xText)); memcpy(dest_sym->lines, src_sym->lines, sizeof(dest_sym->lines[0]) * cadlayers); memcpy(dest_sym->rects, src_sym->rects, sizeof(dest_sym->rects[0]) * cadlayers); memcpy(dest_sym->arcs, src_sym->arcs, sizeof(dest_sym->arcs[0]) * cadlayers); memcpy(dest_sym->polygons, src_sym->polygons, sizeof(dest_sym->polygons[0]) * cadlayers); for(c = 0;cline[c] = my_calloc(129, src_sym->lines[c], sizeof(xLine)); + dest_sym->line[c] = my_calloc(_ALLOC_ID_, src_sym->lines[c], sizeof(xLine)); for(j = 0; j < src_sym->lines[c]; ++j) { dest_sym->line[c][j] = src_sym->line[c][j]; dest_sym->line[c][j].prop_ptr = NULL; - my_strdup(130, &dest_sym->line[c][j].prop_ptr, src_sym->line[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, &dest_sym->line[c][j].prop_ptr, src_sym->line[c][j].prop_ptr); } /* symbol rects */ - dest_sym->rect[c] = my_calloc(131, src_sym->rects[c], sizeof(xRect)); + dest_sym->rect[c] = my_calloc(_ALLOC_ID_, src_sym->rects[c], sizeof(xRect)); for(j = 0; j < src_sym->rects[c]; ++j) { dest_sym->rect[c][j] = src_sym->rect[c][j]; dest_sym->rect[c][j].prop_ptr = NULL; dest_sym->rect[c][j].extraptr = NULL; - my_strdup(132, &dest_sym->rect[c][j].prop_ptr, src_sym->rect[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, &dest_sym->rect[c][j].prop_ptr, src_sym->rect[c][j].prop_ptr); } /* symbol arcs */ - dest_sym->arc[c] = my_calloc(133, src_sym->arcs[c], sizeof(xArc)); + dest_sym->arc[c] = my_calloc(_ALLOC_ID_, src_sym->arcs[c], sizeof(xArc)); for(j = 0; j < src_sym->arcs[c]; ++j) { dest_sym->arc[c][j] = src_sym->arc[c][j]; dest_sym->arc[c][j].prop_ptr = NULL; - my_strdup(134, &dest_sym->arc[c][j].prop_ptr, src_sym->arc[c][j].prop_ptr); + my_strdup(_ALLOC_ID_, &dest_sym->arc[c][j].prop_ptr, src_sym->arc[c][j].prop_ptr); } /* symbol polygons */ - dest_sym->poly[c] = my_calloc(135, src_sym->polygons[c], sizeof(xPoly)); + dest_sym->poly[c] = my_calloc(_ALLOC_ID_, src_sym->polygons[c], sizeof(xPoly)); for(j = 0; j < src_sym->polygons[c]; ++j) { int points = src_sym->poly[c][j].points; dest_sym->poly[c][j] = src_sym->poly[c][j]; dest_sym->poly[c][j].prop_ptr = NULL; - dest_sym->poly[c][j].x = my_malloc(136, points * sizeof(double)); - dest_sym->poly[c][j].y = my_malloc(137, points * sizeof(double)); - dest_sym->poly[c][j].selected_point = my_malloc(138, points * sizeof(unsigned short)); - my_strdup(139, &dest_sym->poly[c][j].prop_ptr, src_sym->poly[c][j].prop_ptr); + dest_sym->poly[c][j].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); + dest_sym->poly[c][j].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); + dest_sym->poly[c][j].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); + my_strdup(_ALLOC_ID_, &dest_sym->poly[c][j].prop_ptr, src_sym->poly[c][j].prop_ptr); memcpy(dest_sym->poly[c][j].x, src_sym->poly[c][j].x, points * sizeof(double)); memcpy(dest_sym->poly[c][j].y, src_sym->poly[c][j].y, points * sizeof(double)); memcpy(dest_sym->poly[c][j].selected_point, src_sym->poly[c][j].selected_point, @@ -1962,12 +1962,12 @@ void copy_symbol(xSymbol *dest_sym, xSymbol *src_sym) dest_sym->text[j].font = NULL; dest_sym->text[j].floater_instname = NULL; dest_sym->text[j].floater_ptr = NULL; - my_strdup2(140, &dest_sym->text[j].prop_ptr, src_sym->text[j].prop_ptr); - my_strdup2(141, &dest_sym->text[j].floater_ptr, src_sym->text[j].floater_ptr); + my_strdup2(_ALLOC_ID_, &dest_sym->text[j].prop_ptr, src_sym->text[j].prop_ptr); + my_strdup2(_ALLOC_ID_, &dest_sym->text[j].floater_ptr, src_sym->text[j].floater_ptr); dbg(1, "copy_symbol1(): allocating sym %d text %d\n", dest_sym - xctx->sym, j); - my_strdup2(142, &dest_sym->text[j].txt_ptr, src_sym->text[j].txt_ptr); - my_strdup2(143, &dest_sym->text[j].font, src_sym->text[j].font); - my_strdup2(144, &dest_sym->text[j].floater_instname, src_sym->text[j].floater_instname); + my_strdup2(_ALLOC_ID_, &dest_sym->text[j].txt_ptr, src_sym->text[j].txt_ptr); + my_strdup2(_ALLOC_ID_, &dest_sym->text[j].font, src_sym->text[j].font); + my_strdup2(_ALLOC_ID_, &dest_sym->text[j].floater_instname, src_sym->text[j].floater_instname); } } @@ -2002,11 +2002,11 @@ void toggle_ignore(void) if(flag == 1) { - my_strdup(145, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "true")); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "true")); } else if(flag == 2) { - my_strdup(146, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "short")); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "short")); } else { - my_strdup(147, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL)); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL)); } set_inst_flags(&xctx->inst[i]); set_modify(1); @@ -2047,18 +2047,18 @@ void get_additional_symbols(int what) if(xctx->inst[i].ptr < 0) continue; dbg(1, "get_additional_symbols(): inst=%d (%s) sch=%s\n",i, xctx->inst[i].name, sch); /* copy instance based *_sym_def attributes to symbol */ - my_strdup(148, &spice_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"spice_sym_def",6)); - my_strdup(149, &verilog_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"verilog_sym_def",4)); - my_strdup(150, &vhdl_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"vhdl_sym_def",4)); + my_strdup(_ALLOC_ID_, &spice_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"spice_sym_def",6)); + my_strdup(_ALLOC_ID_, &verilog_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"verilog_sym_def",4)); + my_strdup(_ALLOC_ID_, &vhdl_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"vhdl_sym_def",4)); /* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */ - my_strdup2(151, &sch, get_tok_value(xctx->inst[i].prop_ptr,"schematic", 6)); + my_strdup2(_ALLOC_ID_, &sch, get_tok_value(xctx->inst[i].prop_ptr,"schematic", 6)); dbg(1, "get_additional_symbols(): schematic=%s\n", sch); schematic_token_found = xctx->tok_size; - my_strdup2(152, &sch, translate3(sch, 1, xctx->inst[i].prop_ptr, NULL, NULL, NULL)); + my_strdup2(_ALLOC_ID_, &sch, translate3(sch, 1, xctx->inst[i].prop_ptr, NULL, NULL, NULL)); dbg(1, "get_additional_symbols(): sch=%s tok_size= %ld\n", sch, xctx->tok_size); - my_strdup2(153, &sch, tcl_hook2( + my_strdup2(_ALLOC_ID_, &sch, tcl_hook2( str_replace(sch, "@symname", get_cell(xctx->inst[i].name, 0), '\\', -1))); /* schematic does not exist */ @@ -2074,7 +2074,7 @@ void get_additional_symbols(int what) int ignore_schematic = 0; xSymbol *symptr = xctx->inst[i].ptr + xctx->sym; - my_strdup2(154, &default_schematic, get_tok_value(symptr->prop_ptr,"default_schematic",0)); + my_strdup2(_ALLOC_ID_, &default_schematic, get_tok_value(symptr->prop_ptr,"default_schematic",0)); ignore_schematic = !strcmp(default_schematic, "ignore"); dbg(1, "get_additional_symbols(): inst=%d, sch=%s instname=%s\n", i, sch, xctx->inst[i].instname); @@ -2083,20 +2083,20 @@ void get_additional_symbols(int what) is_gen = is_generator(sch); if(is_gen) { - my_strdup2(155, &sym, sch); + my_strdup2(_ALLOC_ID_, &sym, sch); dbg(1, "get_additional_symbols(): generator\n"); } else { - my_strdup2(156, &sym, add_ext(rel_sym_path(sch), ".sym")); + my_strdup2(_ALLOC_ID_, &sym, add_ext(rel_sym_path(sch), ".sym")); } - my_mstrcat(157, &symname_attr, "symname=", get_cell(sym, 0), NULL); - my_mstrcat(158, &symname_attr, " symref=", get_sym_name(i, 9999, 1, 1), NULL); - my_strdup(159, &spice_sym_def, + my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(sym, 0), NULL); + my_mstrcat(_ALLOC_ID_, &symname_attr, " symref=", get_sym_name(i, 9999, 1, 1), NULL); + my_strdup(_ALLOC_ID_, &spice_sym_def, translate3(spice_sym_def, 1, xctx->inst[i].prop_ptr, symptr->templ, symname_attr, NULL)); dbg(1, "get_additional_symbols(): spice_sym_def=%s\n", spice_sym_def); - my_free(160, &symname_attr); + my_free(_ALLOC_ID_, &symname_attr); /* if instance symbol has default_schematic set to ignore copy the symbol anyway, since * the base symbol will not be netlisted by *_block_netlist() */ found = ignore_schematic ? NULL : int_hash_lookup(&sym_table, sym, 0, XLOOKUP); @@ -2107,43 +2107,43 @@ void get_additional_symbols(int what) check_symbol_storage(); copy_symbol(&xctx->sym[j], symptr); xctx->sym[j].base_name = symptr->name; - my_strdup(161, &xctx->sym[j].name, sym); + my_strdup(_ALLOC_ID_, &xctx->sym[j].name, sym); - my_strdup(162, &xctx->sym[j].parent_prop_ptr, xctx->inst[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->sym[j].parent_prop_ptr, xctx->inst[i].prop_ptr); /* the copied symbol will not inherit the default_schematic attribute otherwise it will also * be skipped */ if(default_schematic) { - my_strdup(163, &xctx->sym[j].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, subst_token(xctx->sym[j].prop_ptr, "default_schematic", NULL)); /* delete attribute */ } /* if symbol has no corresponding schematic file use symbol base schematic */ if(!is_gen && symbol_base_sch[0]) { - my_strdup(164, &xctx->sym[j].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, subst_token(xctx->sym[j].prop_ptr, "schematic", symbol_base_sch)); } if(spice_sym_def) { - my_strdup(165, &xctx->sym[j].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, subst_token(xctx->sym[j].prop_ptr, "spice_sym_def", spice_sym_def)); } if(verilog_sym_def) { - my_strdup(166, &xctx->sym[j].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, subst_token(xctx->sym[j].prop_ptr, "verilog_sym_def", verilog_sym_def)); } if(vhdl_sym_def) { - my_strdup(167, &xctx->sym[j].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, subst_token(xctx->sym[j].prop_ptr, "vhdl_sym_def", vhdl_sym_def)); } xctx->symbols++; } else { j = found->value; } - my_free(168, &sym); - my_free(169, &default_schematic); + my_free(_ALLOC_ID_, &sym); + my_free(_ALLOC_ID_, &default_schematic); } /* if(xctx->tok_size && sch[0]) */ - my_free(170, &sch); - my_free(171, &spice_sym_def); - my_free(172, &vhdl_sym_def); - my_free(173, &verilog_sym_def); + my_free(_ALLOC_ID_, &sch); + my_free(_ALLOC_ID_, &spice_sym_def); + my_free(_ALLOC_ID_, &vhdl_sym_def); + my_free(_ALLOC_ID_, &verilog_sym_def); } /* for(i=0;iinstances; ++i) */ int_hash_free(&sym_table); } else { /* end */ @@ -2187,13 +2187,13 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) dbg(1, "get_sch_from_sym(): symbol %s inst=%d web_url=%d\n", sym->name, inst, web_url); /* resolve schematic=generator.tcl( @n ) where n=11 is defined in instance attrs */ if(inst >=0 ) { - my_strdup(174, &str_tmp, translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), + my_strdup(_ALLOC_ID_, &str_tmp, translate3(get_tok_value(xctx->inst[inst].prop_ptr,"schematic", 6), 1, xctx->inst[inst].prop_ptr, NULL, NULL, NULL)); } - if(!str_tmp) my_strdup2(175, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6)); + if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 6)); if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */ /* @symname in schematic attribute will be replaced with symbol name */ - my_strdup2(176, &sch, tcl_hook2(str_replace(str_tmp, "@symname", + my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(str_replace(str_tmp, "@symname", get_cell(sym->name, 0), '\\', -1))); if(is_generator(sch)) { /* generator: return as is */ my_strncpy(filename, sch, PATH_MAX); @@ -2237,7 +2237,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) } } } - if(sch) my_free(177, &sch); + if(sch) my_free(_ALLOC_ID_, &sch); if(web_url && filename[0] && xschem_web_dirname[0]) { char sympath[PATH_MAX]; @@ -2254,7 +2254,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback) my_strncpy(filename, sympath, PATH_MAX); } } - my_free(178, &str_tmp); + my_free(_ALLOC_ID_, &str_tmp); dbg(1, "get_sch_from_sym(): sym->name=%s, filename=%s\n", sym->name, filename); } @@ -2272,9 +2272,9 @@ int change_sch_path(int instnumber, int dr) size_t pathlen; int res = 0; if(level < 0 ) return 0; - my_strdup2(179, &instname, get_tok_value(xctx->hier_attr[level].prop_ptr, "name", 0)); - my_strdup2(180, &expanded_instname, expandlabel(instname, &inst_mult)); - my_strdup2(181, &path, xctx->sch_path[xctx->currsch]); + my_strdup2(_ALLOC_ID_, &instname, get_tok_value(xctx->hier_attr[level].prop_ptr, "name", 0)); + my_strdup2(_ALLOC_ID_, &expanded_instname, expandlabel(instname, &inst_mult)); + my_strdup2(_ALLOC_ID_, &path, xctx->sch_path[xctx->currsch]); if(instnumber < 0 ) instnumber += inst_mult+1; /* any invalid number->descend to leftmost inst */ if(instnumber <1 || instnumber > inst_mult) instnumber = 1; @@ -2284,10 +2284,10 @@ int change_sch_path(int instnumber, int dr) ptr = strrchr(path, '.'); if(!ptr) goto end; *(ptr+1) = '\0'; - my_free(182, &xctx->sch_path[xctx->currsch]); - my_strcat(183, &xctx->sch_path[xctx->currsch], path); - my_strcat(184, &xctx->sch_path[xctx->currsch], find_nth(expanded_instname, ",", "", 0, instnumber)); - my_strcat(185, &xctx->sch_path[xctx->currsch], "."); + my_free(_ALLOC_ID_, &xctx->sch_path[xctx->currsch]); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], path); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], find_nth(expanded_instname, ",", "", 0, instnumber)); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], "."); xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_inst_number[level] = instnumber; dbg(1, "instname=%s, path=%s\n", instname, path); @@ -2297,9 +2297,9 @@ int change_sch_path(int instnumber, int dr) draw(); } end: - my_free(186, &instname); - my_free(187, &path); - my_free(188, &expanded_instname); + my_free(_ALLOC_ID_, &instname); + my_free(_ALLOC_ID_, &path); + my_free(_ALLOC_ID_, &expanded_instname); return res; } @@ -2375,14 +2375,14 @@ int descend_schematic(int instnumber, int fallback, int alert, int set_title) if(xctx->inst[n].instname && xctx->inst[n].instname[0]) { if(set_title & 4) { - my_strdup2(189, &str, xctx->inst[n].instname); + my_strdup2(_ALLOC_ID_, &str, xctx->inst[n].instname); inst_mult = 1; instnumber = 1; } else { - my_strdup2(190, &str, expandlabel(xctx->inst[n].instname, &inst_mult)); + my_strdup2(_ALLOC_ID_, &str, expandlabel(xctx->inst[n].instname, &inst_mult)); } } else { - my_strdup2(191, &str, ""); + my_strdup2(_ALLOC_ID_, &str, ""); inst_mult = 1; } prepare_netlist_structs(0); /* for portmap feature (mapping subcircuit nodes connected to @@ -2399,7 +2399,7 @@ int descend_schematic(int instnumber, int fallback, int alert, int set_title) inum = tclresult(); dbg(1, "descend_schematic(): inum=%s\n", inum); if(!inum[0]) { - my_free(192, &str); + my_free(_ALLOC_ID_, &str); return 0; } inst_number=atoi(inum); @@ -2411,7 +2411,7 @@ int descend_schematic(int instnumber, int fallback, int alert, int set_title) if(inst_number <1 || inst_number > inst_mult) inst_number = 1; } - my_strdup(193, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); xctx->sch_path_hash[xctx->currsch+1] =0; if(xctx->portmap[xctx->currsch + 1].table) str_hash_free(&xctx->portmap[xctx->currsch + 1]); str_hash_init(&xctx->portmap[xctx->currsch + 1], HASHSIZE); @@ -2427,39 +2427,39 @@ int descend_schematic(int instnumber, int fallback, int alert, int set_title) if(!pin_name[0]) continue; if(!xctx->inst[n].node[i]) continue; - my_strdup2(194, &pin_node, expandlabel(pin_name, &mult)); - my_strdup2(195, &net_node, expandlabel(xctx->inst[n].node[i], &net_mult)); + my_strdup2(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); + my_strdup2(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[n].node[i], &net_mult)); p_n_s1 = pin_node; for(k = 1; k<=mult; ++k) { single_p = my_strtok_r(p_n_s1, ",", "", 0, &p_n_s2); p_n_s1 = NULL; - my_strdup2(196, &single_n, + my_strdup2(_ALLOC_ID_, &single_n, find_nth(net_node, ",", "", 0, ((inst_number - 1) * mult + k - 1) % net_mult + 1)); single_n_ptr = single_n; if(single_n_ptr[0] == '#') { if(mult > 1) { - my_mstrcat(197, &single_n, "[", my_itoa((inst_mult - inst_number + 1) * mult - k), "]", NULL); + my_mstrcat(_ALLOC_ID_, &single_n, "[", my_itoa((inst_mult - inst_number + 1) * mult - k), "]", NULL); } single_n_ptr = single_n + 1; } str_hash_lookup(&xctx->portmap[xctx->currsch + 1], single_p, single_n_ptr, XINSERT); dbg(1, "descend_schematic(): %s: %s ->%s\n", xctx->inst[n].instname, single_p, single_n_ptr); } - if(single_n) my_free(198, &single_n); - my_free(199, &net_node); - my_free(200, &pin_node); + if(single_n) my_free(_ALLOC_ID_, &single_n); + my_free(_ALLOC_ID_, &net_node); + my_free(_ALLOC_ID_, &pin_node); } - my_strdup(201, &xctx->hier_attr[xctx->currsch].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, xctx->inst[n].prop_ptr); - my_strdup(202, &xctx->hier_attr[xctx->currsch].templ, xctx->sym[xctx->inst[n].ptr].templ); + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, xctx->sym[xctx->inst[n].ptr].templ); dbg(1,"descend_schematic(): inst_number=%d\n", inst_number); - my_strcat(203, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", "", 0, inst_number)); - my_free(204, &str); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", "", 0, inst_number)); + my_free(_ALLOC_ID_, &str); dbg(1,"descend_schematic(): inst_number=%d\n", inst_number); - my_strcat(205, &xctx->sch_path[xctx->currsch+1], "."); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "."); xctx->sch_inst_number[xctx->currsch] = inst_number; dbg(1, "descend_schematic(): current path: %s\n", xctx->sch_path[xctx->currsch+1]); dbg(1, "descend_schematic(): inst_number=%d\n", inst_number); @@ -2544,13 +2544,13 @@ void go_back(int what) load_sym_def(xctx->sch[xctx->currsch], NULL); from_embedded_sym=1; } - my_free(206, &xctx->sch[xctx->currsch]); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]); xctx->sch_path_hash[xctx->currsch] = 0; xctx->currsch--; - my_free(207, &xctx->hier_attr[xctx->currsch].prop_ptr); - my_free(208, &xctx->hier_attr[xctx->currsch].templ); + my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr); + my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ); save_modified = xctx->modified; /* we propagate modified flag (cleared by load_schematic */ /* by default) to parent schematic if going back from embedded symbol */ @@ -2597,8 +2597,8 @@ void clear_schematic(int cancel, int symbol) else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i); if(stat(name, &buf)) break; } - my_free(209, &xctx->sch[xctx->currsch]); - my_mstrcat(210, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); + my_mstrcat(_ALLOC_ID_, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL); my_strncpy(xctx->current_name, name, S(xctx->current_name)); } else { xctx->netlist_type = CAD_SPICE_NETLIST; @@ -2608,8 +2608,8 @@ void clear_schematic(int cancel, int symbol) else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i); if(stat(name, &buf)) break; } - my_free(211, &xctx->sch[xctx->currsch]); - my_mstrcat(212, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); + my_mstrcat(_ALLOC_ID_, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL); my_strncpy(xctx->current_name, name, S(xctx->current_name)); } draw(); @@ -2762,7 +2762,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected) ++count; updatebbox(count,boundbox,&rect); } - my_free(213, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -3204,7 +3204,7 @@ void change_layer() else if(type==xTEXT && xctx->text[n].sel==SELECTED) { if(xctx->rectcolor != xctx->text[n].layer) { char *p; - my_strdup2(214, &xctx->text[n].prop_ptr, + my_strdup2(_ALLOC_ID_, &xctx->text[n].prop_ptr, subst_token(xctx->text[n].prop_ptr, "layer", dtoa(xctx->rectcolor) )); xctx->text[n].layer = xctx->rectcolor; p = xctx->text[n].prop_ptr; @@ -3402,8 +3402,8 @@ void new_polygon(int what, double mousex_snap, double mousey_snap) if(xctx->nl_points >= xctx->nl_maxpoints-1) { /* check storage for 2 xctx->nl_points */ xctx->nl_maxpoints = (1+xctx->nl_points / CADCHUNKALLOC) * CADCHUNKALLOC; - my_realloc(215, &xctx->nl_polyx, sizeof(double)*xctx->nl_maxpoints); - my_realloc(216, &xctx->nl_polyy, sizeof(double)*xctx->nl_maxpoints); + my_realloc(_ALLOC_ID_, &xctx->nl_polyx, sizeof(double)*xctx->nl_maxpoints); + my_realloc(_ALLOC_ID_, &xctx->nl_polyy, sizeof(double)*xctx->nl_maxpoints); } if( what & PLACE ) { @@ -3456,8 +3456,8 @@ void new_polygon(int what, double mousex_snap, double mousey_snap) drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0); xctx->ui_state &= ~STARTPOLYGON; drawpolygon(xctx->rectcolor, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0, 0, 0); - my_free(217, &xctx->nl_polyx); - my_free(218, &xctx->nl_polyy); + my_free(_ALLOC_ID_, &xctx->nl_polyx); + my_free(_ALLOC_ID_, &xctx->nl_polyy); xctx->nl_maxpoints = xctx->nl_points = 0; } if(what & RUBBER) @@ -3503,7 +3503,7 @@ int text_bbox(const char *str, double xscale, double yscale, ww=0.; hh=1.; c=0; *cairo_lines=1; - my_strdup2(219, &s, str); + my_strdup2(_ALLOC_ID_, &s, str); str_ptr = s; while( s && s[c] ) { if(s[c] == '\n') { @@ -3526,7 +3526,7 @@ int text_bbox(const char *str, double xscale, double yscale, maxw = ext.x_advance > ext.width ? ext.x_advance : ext.width; if(maxw > ww) ww= maxw; } - my_free(220, &s); + my_free(_ALLOC_ID_, &s); hh = hh*fext.height * cairo_font_line_spacing; *cairo_longest_line = ww; @@ -3671,7 +3671,7 @@ int create_text(int draw_text, double x, double y, int rot, int flip, const char t->floater_ptr = NULL; t->font=NULL; t->floater_instname=NULL; - my_strdup2(221, &t->txt_ptr, txt); + my_strdup2(_ALLOC_ID_, &t->txt_ptr, txt); t->x0=x; t->y0=y; t->rot=(short int) rot; @@ -3679,7 +3679,7 @@ int create_text(int draw_text, double x, double y, int rot, int flip, const char t->sel=0; t->xscale= hsize; t->yscale= vsize; - my_strdup(222, &t->prop_ptr, props); + my_strdup(_ALLOC_ID_, &t->prop_ptr, props); /* debug ... */ /* t->prop_ptr=NULL; */ dbg(1, "create_text(): done text input\n"); diff --git a/src/callback.c b/src/callback.c index a7f6ac94..c4c3e3c3 100644 --- a/src/callback.c +++ b/src/callback.c @@ -492,7 +492,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int c = G_Y(xctx->mousey); if(gr->logy) c = pow(10, c); - my_strdup(223, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", dtoa(c))); need_redraw_master = 1; } @@ -502,7 +502,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int c = G_Y(xctx->mousey); if(gr->logy) c = pow(10, c); - my_strdup(224, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", dtoa(c))); need_redraw_master = 1; } @@ -514,7 +514,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int c = G_X(xctx->mousex); if(gr->logx) c = pow(10, c); if(r->flags & 4) { /* private_cursor */ - my_strdup(225, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); } else { xctx->graph_cursor1_x = c; } @@ -529,7 +529,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int c = G_X(xctx->mousex); if(gr->logx) c = pow(10, c); if(r->flags & 4) { /* private_cursor */ - my_strdup(226, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); } else { xctx->graph_cursor2_x = c; } @@ -642,7 +642,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int tclvareval("input_line {Pos:} {} ", dtoa_eng(cursor), NULL); cursor = atof_eng(tclresult()); if(r->flags & 4) { - my_strdup(227, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor))); } else { xctx->graph_cursor1_x = cursor; } @@ -672,7 +672,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int tclvareval("input_line {Pos:} {} ", dtoa_eng(cursor), NULL); cursor = atof_eng(tclresult()); if(r->flags & 4) { - my_strdup(228, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor))); } else { xctx->graph_cursor2_x = cursor; } @@ -696,7 +696,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->mousey - W_Y(logcursor)) < 10) { tclvareval("input_line {Pos:} {} ", dtoa_eng(cursor), NULL); cursor = atof_eng(tclresult()); - my_strdup(229, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", dtoa(cursor))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", dtoa(cursor))); event = 0; button = 0; /* avoid further processing ButtonPress that might set GRAPHPAN */ } need_redraw_master = 1; @@ -711,7 +711,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->mousey - W_Y(logcursor)) < 10) { tclvareval("input_line {Pos:} {} ", dtoa_eng(cursor), NULL); cursor = atof_eng(tclresult()); - my_strdup(230, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", dtoa(cursor))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", dtoa(cursor))); event = 0; button = 0; /* avoid further processing ButtonPress that might set GRAPHPAN */ } need_redraw_master = 1; @@ -732,7 +732,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(gr->logx) c = pow(10, c); if(r->flags & 4) { if(!get_tok_value(r->prop_ptr, "cursor1_x", 0)[0]) { - my_strdup(231, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); } } else { xctx->graph_cursor1_x = c; @@ -750,7 +750,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(gr->logx) c = pow(10, c); if(r->flags & 4) { if(!get_tok_value(r->prop_ptr, "cursor2_x", 0)[0]) { - my_strdup(232, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); } } else { xctx->graph_cursor2_x = c; @@ -801,12 +801,12 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int cursor1 = tmp; if(r->flags & 4) { - my_strdup(233, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1))); } else { xctx->graph_cursor1_x = cursor1; } if(r->flags & 4) { - my_strdup(234, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2))); } else { xctx->graph_cursor2_x = cursor2; } @@ -865,11 +865,11 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int char *sim_type = NULL; int switched = 0; - my_strdup2(235, &rawfile, get_tok_value(r->prop_ptr, "rawfile", 0)); - my_strdup2(236, &sim_type, get_tok_value(r->prop_ptr, "sim_type", 0)); + my_strdup2(_ALLOC_ID_, &rawfile, get_tok_value(r->prop_ptr, "rawfile", 0)); + my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr, "sim_type", 0)); if(rawfile[0] && sim_type[0]) switched = extra_rawfile(2, rawfile, sim_type, -1.0, -1.0); - my_free(237, &rawfile); - my_free(238, &sim_type); + my_free(_ALLOC_ID_, &rawfile); + my_free(_ALLOC_ID_, &sim_type); idx = get_raw_index(find_nth(get_tok_value(r->prop_ptr, "sweep", 0), ", ", "\"", 0, 1), NULL); dset = dataset == -1 ? 0 : dataset; @@ -909,7 +909,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int r = &xctx->rect[GRIDLAYER][i]; need_redraw = 0; if( !(r->flags & 1) ) continue; /* 1: graph; 3: graph_unlocked */ - my_strdup2(239, &curr_sim_type, get_tok_value(r->prop_ptr, "sim_type", 0)); + my_strdup2(_ALLOC_ID_, &curr_sim_type, get_tok_value(r->prop_ptr, "sim_type", 0)); gr->gx1 = gr->master_gx1; gr->gx2 = gr->master_gx2; gr->gw = gr->master_gw; @@ -923,7 +923,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int get_tok_value(xctx->rect[GRIDLAYER][xctx->graph_master].prop_ptr, "sim_type", 0))) { same_sim_type = 1; } - my_free(240, &curr_sim_type); + my_free(_ALLOC_ID_, &curr_sim_type); if(event == MotionNotify && (state & Button1Mask) && !xctx->graph_bottom && !(xctx->graph_flags & (16 | 32 | 512 | 1024))) { @@ -937,8 +937,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->my_double_save - xctx->mousey_snap) > fabs(gr->dcy * delta) * delta_threshold) { yy1 = gr->ypos1 + (xctx->my_double_save - xctx->mousey_snap) / gr->dcy; yy2 = gr->ypos2 + (xctx->my_double_save - xctx->mousey_snap) / gr->dcy; - my_strdup(241, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(242, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); xctx->my_double_save = xctx->mousey_snap; need_redraw = 1; } @@ -948,8 +948,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->my_double_save - xctx->mousey_snap) > fabs(gr->cy * delta) * delta_threshold) { yy1 = gr->gy1 + (xctx->my_double_save - xctx->mousey_snap) / gr->cy; yy2 = gr->gy2 + (xctx->my_double_save - xctx->mousey_snap) / gr->cy; - my_strdup(243, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(244, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); xctx->my_double_save = xctx->mousey_snap; need_redraw = 1; } @@ -967,8 +967,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(fabs(xctx->mx_double_save - xctx->mousex_snap) > fabs(gr->cx * delta) * delta_threshold) { xx1 = gr->gx1 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx; xx2 = gr->gx2 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx; - my_strdup(245, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(246, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -984,16 +984,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta = gr->posh * 0.05; yy1 = gr->ypos1 + delta; yy2 = gr->ypos2 + delta; - my_strdup(247, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(248, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { delta = gr->gh/ gr->divy; delta_threshold = 1.0; yy1 = gr->gy1 + delta * delta_threshold; yy2 = gr->gy2 + delta * delta_threshold; - my_strdup(249, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(250, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -1006,8 +1006,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 - delta * delta_threshold; xx2 =gr->gx2 - delta * delta_threshold; - my_strdup(251, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(252, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1021,16 +1021,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta = gr->posh * 0.05; yy1 = gr->ypos1 - delta; yy2 = gr->ypos2 - delta; - my_strdup(253, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(254, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { delta = gr->gh / gr->divy; delta_threshold = 1.0; yy1 = gr->gy1 - delta * delta_threshold; yy2 = gr->gy2 - delta * delta_threshold; - my_strdup(255, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(256, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -1043,8 +1043,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 + delta * delta_threshold; xx2 = gr->gx2 + delta * delta_threshold; - my_strdup(257, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(258, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1060,8 +1060,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.05; yy2 = gr->ypos2 + var * b / delta; yy1 = gr->ypos1 - var * a / delta; - my_strdup(259, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(260, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { @@ -1072,8 +1072,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 + var * b / delta; yy1 = gr->gy1 - var * a / delta; - my_strdup(261, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(262, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -1083,8 +1083,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 + var * (1 - zoom_m); xx1 = gr->gx1 - var * zoom_m; - my_strdup(263, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(264, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1100,8 +1100,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.05; yy2 = gr->ypos2 - var * b / delta; yy1 = gr->ypos1 + var * a / delta; - my_strdup(265, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(266, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); need_redraw = 1; } else { double m = G_Y(xctx->mousey); @@ -1111,8 +1111,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 - var * b / delta; yy1 = gr->gy1 + var * a / delta; - my_strdup(267, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(268, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } @@ -1122,8 +1122,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 - var * (1 - zoom_m); xx1 = gr->gx1 + var * zoom_m; - my_strdup(269, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(270, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1135,9 +1135,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(xctx->graph_flags & 128) { double c = G_Y(xctx->mousey); if(gr->logy) c = pow(10, c); - my_strdup(271, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", dtoa(c))); } else { - my_strdup(272, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", NULL)); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor1_y", NULL)); } } /* y hcursor2 toggle */ @@ -1147,9 +1147,9 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(xctx->graph_flags & 256) { double c = G_Y(xctx->mousey); if(gr->logy) c = pow(10, c); - my_strdup(273, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", dtoa(c))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", dtoa(c))); } else { - my_strdup(274, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", NULL)); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hcursor2_y", NULL)); } } else if(event == KeyPress && key == 't' && access_cond ) { @@ -1161,7 +1161,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int int floaters = there_are_floaters(); if(i == xctx->graph_master || !unlocked) { gr->dataset = track_dset; - my_strdup(275, &r->prop_ptr, subst_token(r->prop_ptr, "dataset", my_itoa(track_dset))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "dataset", my_itoa(track_dset))); } /* do this here to update texts printing current dataset in graph @@ -1192,8 +1192,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 + var * b / delta; yy1 = gr->gy1 - var * a / delta; - my_strdup(276, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(277, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } else { @@ -1202,8 +1202,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 - delta * delta_threshold; xx2 = gr->gx2 - delta * delta_threshold; - my_strdup(278, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(279, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1219,8 +1219,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = delta * 0.2; yy2 = gr->gy2 - var * b / delta; yy1 = gr->gy1 + var * a / delta; - my_strdup(280, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(281, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); need_redraw = 1; } } else { @@ -1229,8 +1229,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int delta_threshold = 0.05; xx1 = gr->gx1 + delta * delta_threshold; xx2 = gr->gx2 + delta * delta_threshold; - my_strdup(282, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(283, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1242,8 +1242,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 + var * (1 - zoom_m); xx1 = gr->gx1 - var * zoom_m; - my_strdup(284, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(285, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1255,8 +1255,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int double var = 0.2 * gr->gw; xx2 = gr->gx2 - var * (1 - zoom_m); xx1 = gr->gx1 + var * zoom_m; - my_strdup(286, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(287, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1282,8 +1282,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int if(r->sel || (same_sim_type && !(r->flags & 2)) || i == xctx->graph_master) { /* xx1 and xx2 calculated for master graph above */ - my_strdup(288, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(289, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } } @@ -1304,8 +1304,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int clear_graphpan_at_end = 1; /* xx1 and xx2 calculated for master graph above */ - my_strdup(290, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(291, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); need_redraw = 1; } else if(i == xctx->graph_master) { clear_graphpan_at_end = 1; @@ -1328,8 +1328,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int } else { if(yy2 < yy1) { double tmp; tmp = yy1; yy1 = yy2; yy2 = tmp; } } - my_strdup(292, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); - my_strdup(293, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2))); } else { yy1 = DG_Y(xctx->my_double_save); yy2 = DG_Y(xctx->mousey_snap); @@ -1338,8 +1338,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int } else { if(yy2 < yy1) { double tmp; tmp = yy1; yy1 = yy2; yy2 = tmp; } } - my_strdup(294, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); - my_strdup(295, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2))); } need_redraw = 1; } else if(i == xctx->graph_master) { @@ -1982,9 +1982,9 @@ static int edit_polygon_point(int state) if(state & ShiftMask) { xctx->push_undo(); points++; - my_realloc(296, &p->x, sizeof(double) * points); - my_realloc(297, &p->y, sizeof(double) * points); - my_realloc(298, &p->selected_point, sizeof(unsigned short) * points); + my_realloc(_ALLOC_ID_, &p->x, sizeof(double) * points); + my_realloc(_ALLOC_ID_, &p->y, sizeof(double) * points); + my_realloc(_ALLOC_ID_, &p->selected_point, sizeof(unsigned short) * points); p->selected_point[i] = 0; for(j = points - 2; j > i; j--) { p->x[j + 1] = p->x[j]; @@ -2008,9 +2008,9 @@ static int edit_polygon_point(int state) p->y[j] = p->y[j + 1]; p->selected_point[j] = p->selected_point[j + 1]; } - my_realloc(299, &p->x, sizeof(double) * points); - my_realloc(300, &p->y, sizeof(double) * points); - my_realloc(301, &p->selected_point, sizeof(unsigned short) * points); + my_realloc(_ALLOC_ID_, &p->x, sizeof(double) * points); + my_realloc(_ALLOC_ID_, &p->y, sizeof(double) * points); + my_realloc(_ALLOC_ID_, &p->selected_point, sizeof(unsigned short) * points); p->points = points; p->sel = SELECTED; return 1; @@ -2368,12 +2368,12 @@ static int grabscreen(const char *win_path, int event, int mx, int my, KeySym ke dbg(1, "closure.size = %ld\n", closure.size); encoded_data = base64_encode((unsigned char *)closure.buffer, closure.size, &olength, 0); dbg(1, "olength = %ld\n", olength); - my_free(302, &closure.buffer); - my_mstrcat(303, &prop, "flags=image,unscaled\nalpha=0.8\nimage_data=", encoded_data, NULL); - my_free(304, &encoded_data); + my_free(_ALLOC_ID_, &closure.buffer); + my_mstrcat(_ALLOC_ID_, &prop, "flags=image,unscaled\nalpha=0.8\nimage_data=", encoded_data, NULL); + my_free(_ALLOC_ID_, &encoded_data); storeobject(-1, xctx->mousex_snap, xctx->mousey_snap, xctx->mousex_snap + grab_w, xctx->mousey_snap + grab_h, xRECT, GRIDLAYER, SELECTED, prop); - my_free(305, &prop); + my_free(_ALLOC_ID_, &prop); xctx->need_reb_sel_arr=1; rebuild_selected_array(); move_objects(START,0,0,0); @@ -2972,11 +2972,11 @@ static void handle_key_press(int event, KeySym key, int state, int rstate, int m if(!tool) { tool = tclgetintvar("sim(spicewave,default)"); my_snprintf(str, PATH_MAX + 100, "sim(spicewave,%d,name)", tool); - my_strdup(306, &tool_name, tclgetvar(str)); + my_strdup(_ALLOC_ID_, &tool_name, tclgetvar(str)); dbg(1,"callback(): tool_name=%s\n", tool_name); if(strstr(tool_name, "Gaw")) tool=GAW; else if(strstr(tool_name, "Bespice")) tool=BESPICE; - my_free(307, &tool_name); + my_free(_ALLOC_ID_, &tool_name); } } if(tool) { diff --git a/src/check.c b/src/check.c index eb569173..e0c5f9f6 100644 --- a/src/check.c +++ b/src/check.c @@ -217,12 +217,12 @@ void trim_wires(void) xctx->wire[j].sel = 0; } xctx->wire[xctx->wires].prop_ptr=NULL; - my_strdup(308, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[j].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[j].prop_ptr); xctx->wire[xctx->wires].bus = get_attr_val(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0)); xctx->wire[xctx->wires].node=NULL; - my_strdup(309, &xctx->wire[xctx->wires].node, xctx->wire[j].node); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[j].node); xctx->wire[j].x1 = x0; xctx->wire[j].y1 = y0; hash_wire(XINSERT, xctx->wires, 0); @@ -238,7 +238,7 @@ void trim_wires(void) } /* dbg(1, "trim_wires(): break: %g\n", timer(1)); */ /* reduce included wires */ - my_realloc(310, &wireflag, xctx->wires*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &wireflag, xctx->wires*sizeof(unsigned short)); memset(wireflag, 0, xctx->wires*sizeof(unsigned short)); for(i=0;iwires; ++i) { if(wireflag[i]) continue; @@ -281,8 +281,8 @@ void trim_wires(void) if(wireflag[i]) { ++j; /* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */ - my_free(311, &xctx->wire[i].prop_ptr); - my_free(312, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); continue; } if(j) { @@ -299,7 +299,7 @@ void trim_wires(void) /* after wire deletions full rehash is needed */ hash_wires(); - my_realloc(313, &wireflag, xctx->wires*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &wireflag, xctx->wires*sizeof(unsigned short)); memset(wireflag, 0, xctx->wires*sizeof(unsigned short)); /* dbg(1, "trim_wires(): hash_wires_2: %g\n", timer(1)); */ @@ -378,8 +378,8 @@ void trim_wires(void) if(wireflag[i]) { ++j; /* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */ - my_free(314, &xctx->wire[i].prop_ptr); - my_free(315, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); continue; } if(j) { @@ -401,7 +401,7 @@ void trim_wires(void) } } while(changed); dbg(1, "trim_wires(): doloops=%d changed=%d\n", doloops, changed); - my_free(316, &wireflag); + my_free(_ALLOC_ID_, &wireflag); update_conn_cues(WIRELAYER, 0, 0); } @@ -497,7 +497,7 @@ void break_wires_at_point(double x0, double y0, int align) xctx->wire[xctx->wires].y2=y0; xctx->wire[xctx->wires].sel=0; xctx->wire[xctx->wires].prop_ptr=NULL; - my_strdup(317, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); xctx->wire[xctx->wires].bus = get_attr_val(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0)); xctx->wire[xctx->wires].node=NULL; @@ -505,7 +505,7 @@ void break_wires_at_point(double x0, double y0, int align) dbg(1, "break_wires_at_pins(): hashing new wire %d: %g %g %g %g\n", xctx->wires, xctx->wire[xctx->wires].x1, xctx->wire[xctx->wires].y1, xctx->wire[xctx->wires].x2, xctx->wire[xctx->wires].y2); - my_strdup(318, &xctx->wire[xctx->wires].node, xctx->wire[i].node); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[i].node); xctx->need_reb_sel_arr=1; xctx->wires++; xctx->wire[i].x1 = x0; @@ -572,7 +572,7 @@ void break_wires_at_pins(int remove) xctx->wire[xctx->wires].y2=y0; xctx->wire[xctx->wires].sel=xctx->wire[i].sel; xctx->wire[xctx->wires].prop_ptr=NULL; - my_strdup(319, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); xctx->wire[xctx->wires].bus = get_attr_val(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus", 0)); xctx->wire[xctx->wires].node=NULL; @@ -580,7 +580,7 @@ void break_wires_at_pins(int remove) dbg(1, "break_wires_at_pins(): hashing new wire %d: %g %g %g %g\n", xctx->wires, xctx->wire[xctx->wires].x1, xctx->wire[xctx->wires].y1, xctx->wire[xctx->wires].x2, xctx->wire[xctx->wires].y2); - my_strdup(320, &xctx->wire[xctx->wires].node, xctx->wire[i].node); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[i].node); xctx->need_reb_sel_arr=1; xctx->wires++; } else { @@ -666,7 +666,7 @@ void break_wires_at_pins(int remove) xctx->wire[xctx->wires].sel=SELECTED; set_first_sel(WIRE, xctx->wires, 0); xctx->wire[xctx->wires].prop_ptr=NULL; - my_strdup(321, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); xctx->wire[xctx->wires].bus = get_attr_val(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0)); xctx->wire[xctx->wires].node=NULL; diff --git a/src/draw.c b/src/draw.c index 4e5b0abd..e4ce43b8 100644 --- a/src/draw.c +++ b/src/draw.c @@ -270,7 +270,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line); if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2, xctx->areay2,textx1,texty1,textx2,texty2)) { - my_free(322, &estr); + my_free(_ALLOC_ID_, &estr); return; } @@ -302,7 +302,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in dbg(1, "draw_string(): size * mooz=%g height=%g ascent=%g descent=%g\n", size * xctx->mooz, fext.height, fext.ascent, fext.descent); llength=0; - my_strdup2(323, &sss, estr); + my_strdup2(_ALLOC_ID_, &sss, estr); tt=ss=sss; for(;;) { c=*ss; @@ -323,8 +323,8 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in } ++ss; } - my_free(324, &sss); - my_free(325, &estr); + my_free(_ALLOC_ID_, &sss); + my_free(_ALLOC_ID_, &estr); } #else /* !HAS_CAIRO */ @@ -356,7 +356,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line); if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2, textx1,texty1,textx2,texty2)) { - my_free(326, &estr); + my_free(_ALLOC_ID_, &estr); return; } xscale*=tclgetdoublevar("nocairo_font_xscale") * cairo_font_scale; @@ -394,7 +394,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in ++pos; a += FONTWIDTH+FONTWHITESPACE; } - my_free(327, &estr); + my_free(_ALLOC_ID_, &estr); } } @@ -413,11 +413,11 @@ void draw_temp_string(GC gctext, int what, const char *str, short rot, short fli dbg(2, "draw_string(): string=%s\n",estr); if(!text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1, &textx1,&texty1,&textx2,&texty2, &tmp, &dtmp)) { - my_free(328, &estr); + my_free(_ALLOC_ID_, &estr); return; } drawtemprect(gctext,what, textx1,texty1,textx2,texty2); - my_free(329, &estr); + my_free(_ALLOC_ID_, &estr); } void get_sym_text_layer(int inst, int text_n, int *layer) @@ -602,16 +602,16 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, bus = get_attr_val(get_tok_value(polygon->prop_ptr, "bus", 0)) ? THICK : NOW; bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true"); dash = (disabled == 1) ? 3 : polygon->dash; - x = my_malloc(330, sizeof(double) * polygon->points); - y = my_malloc(331, sizeof(double) * polygon->points); + x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); + y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); for(k=0;kpoints; ++k) { ROTATION(rot, flip, 0.0, 0.0,polygon->x[k],polygon->y[k],x[k],y[k]); x[k]+= x0; y[k] += y0; } drawpolygon(c, bus, x, y, polygon->points, polygon->fill, dash, bezier); /* added fill */ - my_free(332, &x); - my_free(333, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } for(j=0;j< symptr->arcs[layer]; ++j) { @@ -731,18 +731,18 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, } #endif dbg(1, "draw_symbol(): drawing string: before translate(): text.txt_ptr=%s\n", text.txt_ptr); - my_strdup2(334, &txtptr, translate(n, text.txt_ptr)); + my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr)); /* do another round of substitutions if some @var are found, but if not found leave @var as is */ dbg(1, "draw_symbol(): drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr ? text.prop_ptr : ""); - my_strdup2(335, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr, + my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr, xctx->sym[xctx->inst[n].ptr].templ, NULL, NULL)); dbg(1, "draw_symbol(): after translate3: str=%s\n", txtptr); draw_string(textlayer, what, txtptr, (text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3, flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, xscale, yscale); - my_free(336, &txtptr); + my_free(_ALLOC_ID_, &txtptr); #if HAS_CAIRO!=1 drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, -1, -1); drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, NULL); @@ -852,16 +852,16 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true"); { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ int k; - double *x = my_malloc(337, sizeof(double) * polygon->points); - double *y = my_malloc(338, sizeof(double) * polygon->points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); for(k=0;kpoints; ++k) { ROTATION(rot, flip, 0.0, 0.0,polygon->x[k],polygon->y[k],x[k],y[k]); x[k] += x0; y[k] += y0; } drawtemppolygon(gc, NOW, x, y, polygon->points, bezier); - my_free(339, &x); - my_free(340, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } } @@ -903,15 +903,15 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot #if HAS_CAIRO==1 customfont = set_text_custom_font(&text); #endif - my_strdup2(341, &txtptr, translate(n, text.txt_ptr)); + my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr)); /* do another round of substitutions if some @var are found, but if not found leave @var as is */ - my_strdup2(342, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr, + my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr, xctx->sym[xctx->inst[n].ptr].templ, NULL, NULL)); dbg(1, "draw_temp_symbol(): after translate3: str=%s\n", txtptr); if(txtptr[0]) draw_temp_string(gc, what, txtptr, (text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3, flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, xscale, yscale); - my_free(343, &txtptr); + my_free(_ALLOC_ID_, &txtptr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -1847,10 +1847,10 @@ void drawbezier(Drawable w, GC gc, int c, double *x, double *y, int points, int double x0, x1, x2, y0, y1, y2; if(points == 0 && x == NULL && y == NULL) { /* cleanup */ - my_free(344, &p); + my_free(_ALLOC_ID_, &p); return; } - if(!p) p = my_malloc(345, psize * sizeof(XPoint)); + if(!p) p = my_malloc(_ALLOC_ID_, psize * sizeof(XPoint)); i = 0; for(b = 0; b < points - 2; b++) { if(points == 3) { /* 3 points: only one bezier */ @@ -1887,7 +1887,7 @@ void drawbezier(Drawable w, GC gc, int c, double *x, double *y, int points, int yp = (1 - t) * (1 - t) * y0 + 2 * (1 - t) * t * y1 + t * t * y2; if(i >= psize) { psize *= 2; - my_realloc(346, &p, psize * sizeof(XPoint)); + my_realloc(_ALLOC_ID_, &p, psize * sizeof(XPoint)); } p[i].x = (short)X_TO_SCREEN(xp); p[i].y = (short)Y_TO_SCREEN(yp); @@ -1922,7 +1922,7 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil return; } if(!xctx->only_probes && (x2-x1)<1.0 && (y2-y1)<1.0) return; - p = my_malloc(347, sizeof(XPoint) * points); + p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points); if(what) { for(i=0;igc[c], XLINEWIDTH(xctx->lw) ,LineSolid, LINECAP , LINEJOIN); } - my_free(348, &p); + my_free(_ALLOC_ID_, &p); } /* flags: bit 0: bezier @@ -2019,14 +2019,14 @@ void drawtemppolygon(GC gc, int what, double *x, double *y, int points, int flag if(bezier) { drawbezier(xctx->window, gc, 0, x, y, points, 0); } else { - p = my_malloc(349, sizeof(XPoint) * points); + p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points); for(i=0;iwindow, gc, p, points, CoordModeOrigin); - my_free(350, &p); + my_free(_ALLOC_ID_, &p); } } } @@ -2333,9 +2333,9 @@ static SPICE_DATA **get_bus_idx_array(const char *ntok, int *n_bits) *n_bits = count_items(ntok, ";,", "") - 1; dbg(1, "get_bus_idx_array(): ntok=%s\n", ntok); dbg(1, "get_bus_idx_array(): *n_bits=%d\n", *n_bits); - idx_arr = my_malloc(351, (*n_bits) * sizeof(SPICE_DATA *)); + idx_arr = my_malloc(_ALLOC_ID_, (*n_bits) * sizeof(SPICE_DATA *)); p = 0; - my_strdup2(352, &ntok_copy, ntok); + my_strdup2(_ALLOC_ID_, &ntok_copy, ntok); nptr = ntok_copy; my_strtok_r(nptr, ";,", "", 0, &saven); /*strip off bus name (1st field) */ while( (bit_name = my_strtok_r(NULL, ";, \n", "", 0, &saven)) ) { @@ -2349,7 +2349,7 @@ static SPICE_DATA **get_bus_idx_array(const char *ntok, int *n_bits) /* dbg(0, "get_bus_idx_array(): bit_name=%s, p=%d\n", bit_name, p); */ ++p; } - my_free(353, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); return idx_arr; } @@ -2394,12 +2394,12 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset) if(autoload == 0) autoload = 2; ptr = get_tok_value(r->prop_ptr,"rawfile", 0); if(!ptr[0]) { - if(raw && raw->rawfile) my_strdup2(354, &custom_rawfile, raw->rawfile); - else my_strdup2(355, &custom_rawfile, ""); + if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile); + else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); } else { - my_strdup2(356, &custom_rawfile, ptr); + my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); } - my_strdup2(357, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); + my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); if((i == xctx->graph_master) && custom_rawfile[0]) { extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0); } @@ -2410,13 +2410,13 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset) ptr = get_tok_value(xctx->rect[GRIDLAYER][xctx->graph_master].prop_ptr,"rawfile", 0); if(!ptr[0]) { - if(raw && raw->rawfile) my_strdup2(358, &custom_rawfile, raw->rawfile); - else my_strdup2(359, &custom_rawfile, ""); + if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile); + else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); } else { - my_strdup2(360, &custom_rawfile, ptr); + my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); } - my_strdup2(361, &sim_type, + my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(xctx->rect[GRIDLAYER][xctx->graph_master].prop_ptr,"sim_type", 0)); if(custom_rawfile[0]) { extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0); @@ -2447,12 +2447,12 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset) xx2 = mylog10(xx2); } dbg(1, "graph_fullxzoom(): xx1=%g, xx2=%g\n"); - my_strdup(362, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); - my_strdup(363, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2))); if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0); - my_free(364, &custom_rawfile); - my_free(365, &sim_type); + my_free(_ALLOC_ID_, &custom_rawfile); + my_free(_ALLOC_ID_, &sim_type); need_redraw = 1; if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */ @@ -2491,18 +2491,18 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) autoload = !strboolcmp(get_tok_value(r->prop_ptr,"autoload", 0), "true"); if(autoload == 0) autoload = 2; dbg(1, "graph_fullyzoom(): graph_dataset=%d\n", graph_dataset); - my_strdup2(366, &node, get_tok_value(r->prop_ptr,"node", 0)); - my_strdup2(367, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node", 0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); ptr = get_tok_value(r->prop_ptr,"rawfile", 0); if(!ptr[0]) { - if(xctx->raw && xctx->raw->rawfile) my_strdup2(368, &custom_rawfile, xctx->raw->rawfile); - else my_strdup2(369, &custom_rawfile, ""); + if(xctx->raw && xctx->raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, xctx->raw->rawfile); + else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); } else { - my_strdup2(370, &custom_rawfile, ptr); + my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); } - my_strdup2(371, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); + my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); save_extra_idx = xctx->extra_idx; nptr = node; @@ -2518,7 +2518,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0); } raw = xctx->raw; - my_strdup2(372, &nd, find_nth(ntok, "%", "\"", 0, 2)); + my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2)); /* if % is specified after node name, is the dataset number to plot in graph */ if(nd[0]) { int pos = 1; @@ -2527,25 +2527,25 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) char *node_rawfile = NULL; char *node_sim_type = NULL; tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos), "}", NULL); - my_strdup2(373, &node_rawfile, tclresult()); + my_strdup2(_ALLOC_ID_, &node_rawfile, tclresult()); tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos + 1), "}", NULL); - my_strdup2(374, &node_sim_type, tclresult()[0] ? tclresult() : + my_strdup2(_ALLOC_ID_, &node_sim_type, tclresult()[0] ? tclresult() : sim_type[0] ? sim_type : xctx->raw->sim_type); dbg(1, "node_rawfile=|%s| node_sim_type=|%s|\n", node_rawfile, node_sim_type); if(node_rawfile && node_rawfile[0]) { extra_rawfile(autoload, node_rawfile, node_sim_type, -1.0, -1.0); raw = xctx->raw; } - my_free(375, &node_rawfile); - my_free(376, &node_sim_type); + my_free(_ALLOC_ID_, &node_rawfile); + my_free(_ALLOC_ID_, &node_sim_type); } if(pos == 2) node_dataset = atoi(nd); else node_dataset = -1; dbg(1, "nd=|%s|, node_dataset = %d\n", nd, node_dataset); - my_strdup(377, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1)); + my_strdup(_ALLOC_ID_, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1)); } else { node_dataset = -1; - my_strdup(378, &ntok_copy, ntok); + my_strdup(_ALLOC_ID_, &ntok_copy, ntok); } /* transform multiple OP points into a dc sweep */ @@ -2556,14 +2556,14 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) raw->npoints[0] = raw->allpoints; } - my_free(379, &nd); + my_free(_ALLOC_ID_, &nd); dbg(1, "ntok=|%s|\nntok_copy=|%s|\nnode_dataset=%d\n", ntok, ntok_copy, node_dataset); tmp_ptr = find_nth(ntok_copy, ";", "\"", 4, 2); if(strstr(tmp_ptr, ",")) { tmp_ptr = find_nth(tmp_ptr, ",", "\"", 4, 1); /* also trim spaces */ - my_strdup2(380, &bus_msb, trim_chars(tmp_ptr, "\n ")); + my_strdup2(_ALLOC_ID_, &bus_msb, trim_chars(tmp_ptr, "\n ")); } dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : ""); stok = my_strtok_r(sptr, "\n\t ", "\"", 0, &saves); @@ -2577,9 +2577,9 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) if(!bus_msb) { char *express = NULL; if(strstr(ntok_copy, ";")) { - my_strdup2(381, &express, find_nth(ntok_copy, ";", "\"", 0, 2)); + my_strdup2(_ALLOC_ID_, &express, find_nth(ntok_copy, ";", "\"", 0, 2)); } else { - my_strdup2(382, &express, ntok_copy); + my_strdup2(_ALLOC_ID_, &express, ntok_copy); } if(strpbrk(express, " \n\t")) { /* we *need* to recalculate the expression column for any new expression @@ -2588,7 +2588,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) } else { v = get_raw_index(express, NULL); } - my_free(383, &express); + my_free(_ALLOC_ID_, &express); dbg(1, "graph_fullyzoom(): v=%d\n", v); } if(xctx->raw && v >= 0) { @@ -2637,7 +2637,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) sweepvar_wrap++; } /* for(dset...) */ } - if(bus_msb) my_free(384, &bus_msb); + if(bus_msb) my_free(_ALLOC_ID_, &bus_msb); if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */ raw->datasets = save_datasets; raw->npoints[0] = save_npoints; @@ -2652,18 +2652,18 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset) if(max == min) max += 0.01; min = floor_to_n_digits(min, 2); max = ceil_to_n_digits(max, 2); - my_free(385, &node); - my_free(386, &sweep); - my_free(387, &custom_rawfile); - my_free(388, &sim_type); - if(ntok_copy) my_free(389, &ntok_copy); - my_strdup(390, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(min))); - my_strdup(391, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(max))); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &sweep); + my_free(_ALLOC_ID_, &custom_rawfile); + my_free(_ALLOC_ID_, &sim_type); + if(ntok_copy) my_free(_ALLOC_ID_, &ntok_copy); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(min))); + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(max))); need_redraw = 1; } else { /* digital plot */ - my_strdup(392, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", get_tok_value(r->prop_ptr, "y1", 0) )); - my_strdup(393, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", + my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", get_tok_value(r->prop_ptr, "y2", 0) )); need_redraw = 1; } @@ -3337,18 +3337,18 @@ static void draw_graph_variables(int wcnt, int wave_color, int n_nodes, int swee char *alias_ptr = NULL; dbg(1, "ntok=%s\n", ntok); if(strstr(ntok, ";")) { - my_strdup2(394, &alias_ptr, find_nth(ntok, ";", "\"", 0, 1)); - my_strdup2(395, &ntok_ptr, find_nth(ntok, ";", "\"", 0, 2)); + my_strdup2(_ALLOC_ID_, &alias_ptr, find_nth(ntok, ";", "\"", 0, 1)); + my_strdup2(_ALLOC_ID_, &ntok_ptr, find_nth(ntok, ";", "\"", 0, 2)); } else { - my_strdup2(396, &alias_ptr, ntok); - my_strdup2(397, &ntok_ptr, ntok); + my_strdup2(_ALLOC_ID_, &alias_ptr, ntok); + my_strdup2(_ALLOC_ID_, &ntok_ptr, ntok); } if(gr->unity != 1.0) my_snprintf(tmpstr, S(tmpstr), "%s[%c]", alias_ptr, gr->unity_suffix); else my_snprintf(tmpstr, S(tmpstr), "%s", alias_ptr); - my_free(398, &alias_ptr); - my_free(399, &ntok_ptr); + my_free(_ALLOC_ID_, &alias_ptr); + my_free(_ALLOC_ID_, &ntok_ptr); } if(gr->digital) { double xt = gr->x1 - 15 * gr->txtsizelab; @@ -3486,8 +3486,8 @@ int embed_rawfile(const char *rawfile) xInstance *i = &xctx->inst[xctx->sel_array[0].n]; xctx->push_undo(); ptr = base64_from_file(rawfile, &len); - my_strdup2(400, &i->prop_ptr, subst_token(i->prop_ptr, "spice_data", ptr)); - my_free(401, &ptr); + my_strdup2(_ALLOC_ID_, &i->prop_ptr, subst_token(i->prop_ptr, "spice_data", ptr)); + my_free(_ALLOC_ID_, &ptr); set_modify(1); } return res; @@ -3512,9 +3512,9 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr) xRect *r = &xctx->rect[GRIDLAYER][i]; /* get plot data */ - my_strdup2(402, &node, get_tok_value(r->prop_ptr,"node", 0)); - my_strdup2(403, &color, get_tok_value(r->prop_ptr,"color", 0)); - my_strdup2(404, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node", 0)); + my_strdup2(_ALLOC_ID_, &color, get_tok_value(r->prop_ptr,"color", 0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); nptr = node; cptr = color; sptr = sweep; @@ -3552,11 +3552,11 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr) } else { if(gr->hilight_wave == wcnt) { gr->hilight_wave = -1; - my_strdup2(405, &r->prop_ptr, + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } else { gr->hilight_wave = wcnt; - my_strdup2(406, &r->prop_ptr, + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } } @@ -3579,11 +3579,11 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr) } else { if(gr->hilight_wave == wcnt) { gr->hilight_wave = -1; - my_strdup2(407, &r->prop_ptr, + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } else { gr->hilight_wave = wcnt; - my_strdup2(408, &r->prop_ptr, + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); } } @@ -3591,9 +3591,9 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr) } ++wcnt; } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */ - my_free(409, &node); - my_free(410, &color); - my_free(411, &sweep); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &color); + my_free(_ALLOC_ID_, &sweep); return ret; } @@ -3700,18 +3700,18 @@ int find_closest_wave(int i, Graph_ctx *gr) yval = G_Y(xctx->mousey); xval = G_X(xctx->mousex); /* get data to plot */ - my_strdup2(412, &node, get_tok_value(r->prop_ptr,"node", 0)); - my_strdup2(413, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node", 0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); ptr = get_tok_value(r->prop_ptr,"rawfile", 0); if(!ptr[0]) { - if(raw && raw->rawfile) my_strdup2(414, &custom_rawfile, raw->rawfile); - else my_strdup2(415, &custom_rawfile, ""); + if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile); + else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); } else { - my_strdup2(416, &custom_rawfile, ptr); + my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); } - my_strdup2(417, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); + my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); if(sch_waves_loaded()!= -1 && custom_rawfile[0]) { extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0); } @@ -3738,9 +3738,9 @@ int find_closest_wave(int i, Graph_ctx *gr) expression = 0; if(raw->values) { if(strstr(ntok, ";")) { - my_strdup2(418, &express, find_nth(ntok, ";", "\"", 0, 2)); + my_strdup2(_ALLOC_ID_, &express, find_nth(ntok, ";", "\"", 0, 2)); } else { - my_strdup2(419, &express, ntok); + my_strdup2(_ALLOC_ID_, &express, ntok); } if(strpbrk(express, " \n\t")) { expression = 1; @@ -3824,14 +3824,14 @@ int find_closest_wave(int i, Graph_ctx *gr) ++wcnt; } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */ dbg(0, "closest dataset=%d\n", closest_dataset); - if(express) my_free(420, &express); + if(express) my_free(_ALLOC_ID_, &express); if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0); - my_free(421, &custom_rawfile); - my_free(422, &sim_type); + my_free(_ALLOC_ID_, &custom_rawfile); + my_free(_ALLOC_ID_, &sim_type); - my_free(423, &node); - my_free(424, &sweep); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &sweep); return closest_dataset; } @@ -3919,18 +3919,18 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) /* graph box, gridlines and axes */ draw_graph_grid(gr, ct); /* get data to plot */ - my_strdup2(425, &node, get_tok_value(r->prop_ptr,"node", 0)); - my_strdup2(426, &color, get_tok_value(r->prop_ptr,"color", 0)); - my_strdup2(427, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); + my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node", 0)); + my_strdup2(_ALLOC_ID_, &color, get_tok_value(r->prop_ptr,"color", 0)); + my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep", 0)); ptr = get_tok_value(r->prop_ptr,"rawfile", 0); if(!ptr[0]) { - if(xctx->raw && xctx->raw->rawfile) my_strdup2(428, &custom_rawfile, xctx->raw->rawfile); - else my_strdup2(429, &custom_rawfile, ""); + if(xctx->raw && xctx->raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, xctx->raw->rawfile); + else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); } else { - my_strdup2(430, &custom_rawfile, ptr); + my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); } - my_strdup2(431, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); + my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type", 0)); dbg(1, "draw_graph(): graph %d: custom_rawfile=%s autoload=%d sim_type=%s\n", i, custom_rawfile, autoload, sim_type); save_extra_idx = xctx->extra_idx; @@ -3956,7 +3956,7 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) valid_rawfile = 0; } } - my_strdup2(432, &nd, find_nth(ntok, "%", "\"", 0, 2)); + my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2)); if(wcnt >= n_nodes) { dbg(0, "draw_graph(): WARNING: wcnt (wave #) >= n_nodes (counted # of waves)\n"); dbg(0, "draw_graph(): n_nodes=%d\n", n_nodes); @@ -3972,30 +3972,30 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) char *node_rawfile = NULL; char *node_sim_type = NULL; tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos), "}", NULL); - my_strdup2(433, &node_rawfile, tclresult()); + my_strdup2(_ALLOC_ID_, &node_rawfile, tclresult()); tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos + 1), "}", NULL); - my_strdup2(434, &node_sim_type, tclresult()[0] ? tclresult() : + my_strdup2(_ALLOC_ID_, &node_sim_type, tclresult()[0] ? tclresult() : sim_type[0] ? sim_type : xctx->raw->sim_type); dbg(1, "node_rawfile=|%s| node_sim_type=|%s|\n", node_rawfile, node_sim_type); if(node_rawfile && node_rawfile[0]) { if(extra_rawfile(autoload, node_rawfile, node_sim_type, -1.0, -1.0) == 0) { - my_free(435, &node_rawfile); - my_free(436, &node_sim_type); + my_free(_ALLOC_ID_, &node_rawfile); + my_free(_ALLOC_ID_, &node_sim_type); valid_rawfile = 0; } } - my_free(437, &node_rawfile); - my_free(438, &node_sim_type); + my_free(_ALLOC_ID_, &node_rawfile); + my_free(_ALLOC_ID_, &node_sim_type); } if(pos == 2) node_dataset = atoi(nd); else node_dataset = -1; dbg(1, "nd=|%s|, node_dataset = %d\n", nd, node_dataset); - my_strdup(439, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1)); + my_strdup(_ALLOC_ID_, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1)); } else { node_dataset = -1; - my_strdup(440, &ntok_copy, ntok); + my_strdup(_ALLOC_ID_, &ntok_copy, ntok); } - if(nd) my_free(441, &nd); + if(nd) my_free(_ALLOC_ID_, &nd); /* transform multiple OP points into a dc sweep */ if(xctx->raw && xctx->raw->sim_type && !strcmp(xctx->raw->sim_type, "op") && xctx->raw->datasets > 1 && xctx->raw->npoints[0] == 1) { @@ -4005,14 +4005,14 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) xctx->raw->npoints[0] = xctx->raw->allpoints; } - my_free(442, &nd); + my_free(_ALLOC_ID_, &nd); dbg(1, "ntok=|%s|\nntok_copy=|%s|\nnode_dataset=%d\n", ntok, ntok_copy, node_dataset); tmp_ptr = find_nth(ntok_copy, ";", "\"", 4, 2); if(strstr(tmp_ptr, ",")) { tmp_ptr = find_nth(tmp_ptr, ",", "\"", 4, 1); /* also trim spaces */ - my_strdup2(443, &bus_msb, trim_chars(tmp_ptr, "\n ")); + my_strdup2(_ALLOC_ID_, &bus_msb, trim_chars(tmp_ptr, "\n ")); } dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : ""); ctok = my_strtok_r(cptr, " ", "", 0, &savec); @@ -4034,9 +4034,9 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) expression = 0; if(!bus_msb) { if(strstr(ntok_copy, ";")) { - my_strdup2(444, &express, find_nth(ntok_copy, ";", "\"", 0, 2)); + my_strdup2(_ALLOC_ID_, &express, find_nth(ntok_copy, ";", "\"", 0, 2)); } else { - my_strdup2(445, &express, ntok_copy); + my_strdup2(_ALLOC_ID_, &express, ntok_copy); } dbg(1, "express=|%s|\n", express); if(strpbrk(express, " \n\t")) { @@ -4086,7 +4086,7 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) ofs_end = ofs + xctx->raw->npoints[dset]; first = -1; poly_npoints = 0; - my_realloc(446, &point, xctx->raw->npoints[dset] * sizeof(XPoint)); + my_realloc(_ALLOC_ID_, &point, xctx->raw->npoints[dset] * sizeof(XPoint)); /* Process "npoints" simulation items * p loop split repeated 2 timed (for x and y points) to preserve cache locality */ prev_x = 0; @@ -4204,11 +4204,11 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) show_node_measures(measure_p, measure_x, measure_prev_x, bus_msb, wave_color, idx, idx_arr, n_bits, n_nodes, ntok_copy, wcnt, gr, r, cursor1); - my_free(447, &point); - if(idx_arr) my_free(448, &idx_arr); + my_free(_ALLOC_ID_, &point); + if(idx_arr) my_free(_ALLOC_ID_, &idx_arr); } /* if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) */ ++wcnt; - if(bus_msb) my_free(449, &bus_msb); + if(bus_msb) my_free(_ALLOC_ID_, &bus_msb); if(sch_waves_loaded()!= -1 && save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */ xctx->raw->datasets = save_datasets; xctx->raw->npoints[0] = save_npoints; @@ -4219,14 +4219,14 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct) } } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */ - if(ntok_copy) my_free(450, &ntok_copy); - if(express) my_free(451, &express); + if(ntok_copy) my_free(_ALLOC_ID_, &ntok_copy); + if(express) my_free(_ALLOC_ID_, &express); /* if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0); */ - my_free(452, &custom_rawfile); - my_free(453, &sim_type); - my_free(454, &node); - my_free(455, &color); - my_free(456, &sweep); + my_free(_ALLOC_ID_, &custom_rawfile); + my_free(_ALLOC_ID_, &sim_type); + my_free(_ALLOC_ID_, &node); + my_free(_ALLOC_ID_, &color); + my_free(_ALLOC_ID_, &sweep); } /* if(flags & 8) */ /* * bbox(START, 0.0, 0.0, 0.0, 0.0); @@ -4334,7 +4334,7 @@ cairo_status_t png_writer(void *in_closure, const unsigned char *in_data, unsign png_to_byte_closure_t *closure = (png_to_byte_closure_t *) in_closure; if(!in_data) return CAIRO_STATUS_WRITE_ERROR; if(closure->pos + length > closure->size) { - my_realloc(457, &closure->buffer, closure->pos + length + 65536); + my_realloc(_ALLOC_ID_, &closure->buffer, closure->pos + length + 65536); closure->size = closure->pos + length + 65536; } memcpy(closure->buffer + closure->pos, in_data, length); @@ -4506,9 +4506,9 @@ int edit_image(int what, xRect *r) /* put base64 encoded data to rect image_data attribute */ encoded_data = base64_encode((unsigned char *)closure.buffer, closure.size, &olength, 0); - my_strdup2(458, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data)); - my_free(459, &closure.buffer); - my_free(460, &encoded_data); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data)); + my_free(_ALLOC_ID_, &closure.buffer); + my_free(_ALLOC_ID_, &encoded_data); } dbg(1, "size_x = %d, size_y = %d, stride = %d\n", size_x, size_y, stride); return 1; @@ -4543,7 +4543,7 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char * fd = my_fopen(filename, fopen_read_mode); if(fd) { size_t bytes_read; - filedata = my_malloc(461, filesize); + filedata = my_malloc(_ALLOC_ID_, filesize); if((bytes_read = fread(filedata, 1, filesize, fd)) < filesize) { filesize = bytes_read; dbg(0, "get_surface_from_file(): less bytes read than expected from %s, got %ld bytes\n", @@ -4562,7 +4562,7 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char * dbg(0, "get_surface_from_file():\n"); dbg(0, " A SVG file is specified but no 'filter' attribute to convert to png was given\n"); dbg(0, " May be no 'svg_to_png' variable was specified in xschemrc\n"); - my_free(462, &filedata); + my_free(_ALLOC_ID_, &filedata); return NULL; } } @@ -4571,7 +4571,7 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char * size_t filtered_img_size = 0; char *filtered_img_data = NULL; filter_data(filedata, filesize, &filtered_img_data, &filtered_img_size, filter); - if(!svg) my_free(463, &filedata); + if(!svg) my_free(_ALLOC_ID_, &filedata); closure.buffer = (unsigned char *)filtered_img_data; closure.size = filtered_img_size; closure.pos = 0; @@ -4600,7 +4600,7 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char * if(!surface || cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { if(jpg != 1) dbg(0, "get_surface_from_file(): failure creating image surface from %s\n", filename); if(surface) cairo_surface_destroy(surface); - my_free(464, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); *buffer = NULL; *size = 0; return NULL; @@ -4610,7 +4610,7 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char * * not the filtered content, This way we don't lose resolution */ *buffer = (unsigned char *)filedata; *size = filesize; - my_free(465, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); } else { *buffer = closure.buffer; *size = closure.size; @@ -4643,7 +4643,7 @@ static cairo_surface_t *get_surface_from_b64data(const char *attr, size_t attr_l else jpg = -1; /* some invalid data */ if(jpg == -1) { - my_free(466, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); return NULL; } @@ -4663,7 +4663,7 @@ static cairo_surface_t *get_surface_from_b64data(const char *attr, size_t attr_l char *filtered_img_data = NULL; int ret = filter_data((char *)closure.buffer, closure.size, &filtered_img_data, &filtered_img_size, filter); - my_free(467, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); closure.buffer = (unsigned char *)filtered_img_data; closure.size = filtered_img_size; closure.pos = 0; @@ -4671,7 +4671,7 @@ static cairo_surface_t *get_surface_from_b64data(const char *attr, size_t attr_l surface = cairo_image_surface_create_from_png_stream(png_reader, &closure); } else { surface = NULL; - if(closure.buffer) my_free(468, &closure.buffer); + if(closure.buffer) my_free(_ALLOC_ID_, &closure.buffer); return NULL;; } } @@ -4680,7 +4680,7 @@ static cairo_surface_t *get_surface_from_b64data(const char *attr, size_t attr_l if(surface) cairo_surface_destroy(surface); surface = NULL; } - my_free(469, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); return surface; } #endif /* HAS_CAIRO==1 */ @@ -4717,7 +4717,7 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2, set_rect_extraptr(1, r); /* create r->extraptr pointing to a xEmb_image struct */ emb_ptr = r->extraptr; my_strncpy(filename, get_tok_value(r->prop_ptr, "image", 0), S(filename)); - my_strdup(470, &filter, get_tok_value(r->prop_ptr, "filter", 0)); + my_strdup(_ALLOC_ID_, &filter, get_tok_value(r->prop_ptr, "filter", 0)); /******* read image from in-memory buffer ... *******/ if(emb_ptr && emb_ptr->image) { /* nothing to do, image is already created */ @@ -4725,7 +4725,7 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2, } else if( (attr = get_tok_value(r->prop_ptr, "image_data", 0))[0] && (attr_len = strlen(attr)) > 5) { emb_ptr->image = get_surface_from_b64data(attr, attr_len, filter); if(!emb_ptr->image) { - my_free(471, &filter); + my_free(_ALLOC_ID_, &filter); return 0; } /******* ... or read PNG from file (image attribute) *******/ @@ -4738,14 +4738,14 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2, /* if filename is a SVG file buffer will be the plain svg file content, not the filtered data */ emb_ptr->image = get_surface_from_file(filename, filter, &buffer, &size); if(!emb_ptr->image) { - my_free(472, &filter); + my_free(_ALLOC_ID_, &filter); return 0; } /* put base64 encoded data to rect image_data attribute */ encoded_data = base64_encode((unsigned char *)buffer, size, &olength, 0); - my_strdup2(473, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data)); - my_free(474, &encoded_data); - my_free(475, &buffer); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data)); + my_free(_ALLOC_ID_, &encoded_data); + my_free(_ALLOC_ID_, &buffer); } else { /* no emb_ptr->image and no "image_data" attribute */ return 0; } @@ -4814,7 +4814,7 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2, cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_save_ctx); } - my_free(476, &filter); + my_free(_ALLOC_ID_, &filter); #endif return 1; } @@ -4913,7 +4913,7 @@ void svg_embedded_graph(FILE *fd, int i, double rx1, double ry1, double rx2, dou closure.pos = 0; cairo_surface_write_to_png_stream(png_sfc, png_writer, &closure); ptr = base64_encode(closure.buffer, closure.pos, &olength, 1); - my_free(477, &closure.buffer); + my_free(_ALLOC_ID_, &closure.buffer); cairo_surface_destroy(png_sfc); xctx->draw_pixmap=1; xctx->draw_window=save_draw_window; @@ -4931,7 +4931,7 @@ void svg_embedded_graph(FILE *fd, int i, double rx1, double ry1, double rx2, dou "xlink:href=\"data:image/png;base64,%s\"/>\n", 0.0, 0.0, w, h, transform, ptr); } - my_free(478, &ptr); + my_free(_ALLOC_ID_, &ptr); #endif } diff --git a/src/editprop.c b/src/editprop.c index 26ffe0d3..45774052 100644 --- a/src/editprop.c +++ b/src/editprop.c @@ -154,7 +154,7 @@ char *my_fgets(FILE *fd, size_t *line_len) if(line_len) *line_len = 0; while(fgets(buf, SIZE, fd)) { - my_strcat(479, &s, buf); + my_strcat(_ALLOC_ID_, &s, buf); len = strlen(buf); if(line_len) *line_len += len; if(buf[len - 1] == '\n') break; @@ -242,7 +242,7 @@ size_t my_strdup(int id, char **dest, const char *src) /* empty source string -- dbg(3,"my_strdup(%d,): duplicated string %s\n", id, src); return len-1; } else if(*dest) { - my_free(480, dest); + my_free(_ALLOC_ID_, dest); dbg(3,"my_strdup(%d,): freed destination ptr\n", id); } @@ -255,7 +255,7 @@ void my_strndup(int id, char **dest, const char *src, size_t n) /* empty source { if(*dest!=NULL) { dbg(3," my_strndup: calling my_free\n"); - my_free(481, dest); + my_free(_ALLOC_ID_, dest); } if(src!=NULL && src[0]!='\0') { @@ -285,7 +285,7 @@ char *my_expand(const char *s, int tabstop) if(!s) { return NULL; } - my_strcat2(482, &t, ""); + my_strcat2(_ALLOC_ID_, &t, ""); while(*sptr) { if(*sptr == '\t') { int i; @@ -298,7 +298,7 @@ char *my_expand(const char *s, int tabstop) pad[1] = '\0'; spos++; } - my_strcat2(483, &t, pad); + my_strcat2(_ALLOC_ID_, &t, pad); if(*sptr == '\n') spos = 0; sptr++; } @@ -476,7 +476,7 @@ size_t my_strdup2(int id, char **dest, const char *src) /* 20150409 duplicates a dbg(3,"my_strdup2(%d,): duplicated string %s\n", id, src); return len-1; } else if(*dest) { - my_free(484, dest); + my_free(_ALLOC_ID_, dest); dbg(3,"my_strdup2(%d,): freed destination ptr\n", id); } return 0; @@ -849,11 +849,11 @@ void set_inst_prop(int i) ptr = (xctx->inst[i].ptr+ xctx->sym)->templ; dbg(1, "set_inst_prop(): i=%d, name=%s, prop_ptr = %s, template=%s\n", i, xctx->inst[i].name, xctx->inst[i].prop_ptr, ptr); - my_strdup(485, &xctx->inst[i].prop_ptr, ptr); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, ptr); if(get_tok_value(ptr, "name",0)[0]) { - my_strdup(486, &tmp, xctx->inst[i].prop_ptr); + my_strdup(_ALLOC_ID_, &tmp, xctx->inst[i].prop_ptr); new_prop_string(i, tmp, tclgetboolvar("disable_unique_names")); /* sets also inst[].instname */ - my_free(487, &tmp); + my_free(_ALLOC_ID_, &tmp); } } @@ -1014,7 +1014,7 @@ static int edit_rect_property(int x) fprintf(errfp, "edit_rect_property() : unknown parameter x=%d\n",x); return 0; } - my_strdup(488, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval",oldprop); } else { @@ -1038,7 +1038,7 @@ static int edit_rect_property(int x) if(oldprop && preserve == 1) { set_different_token(&xctx->rect[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop); } else { - my_strdup(489, &xctx->rect[c][n].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[c][n].prop_ptr, (char *) tclgetvar("retval")); } set_rect_flags(&xctx->rect[c][n]); /* set cached .flags bitmask from attributes */ @@ -1092,7 +1092,7 @@ static int edit_rect_property(int x) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); } } - my_free(490, &oldprop); + my_free(_ALLOC_ID_, &oldprop); return modified; } @@ -1102,7 +1102,7 @@ static int edit_line_property(void) const char *dash; int preserve, modified = 0; char *oldprop=NULL; - my_strdup(491, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -1124,7 +1124,7 @@ static int edit_line_property(void) if(oldprop && preserve == 1) { set_different_token(&xctx->line[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop); } else { - my_strdup(492, &xctx->line[c][n].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->line[c][n].prop_ptr, (char *) tclgetvar("retval")); } xctx->line[c][n].bus = get_attr_val(get_tok_value(xctx->line[c][n].prop_ptr,"bus",0)); @@ -1146,7 +1146,7 @@ static int edit_line_property(void) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); modified = 1; } - my_free(493, &oldprop); + my_free(_ALLOC_ID_, &oldprop); return modified; } @@ -1158,7 +1158,7 @@ static int edit_wire_property(void) char *oldprop=NULL; int bus; - my_strdup(494, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -1184,7 +1184,7 @@ static int edit_wire_property(void) if(oldprop && preserve == 1) { set_different_token(&xctx->wire[k].prop_ptr, (char *) tclgetvar("retval"), oldprop); } else { - my_strdup(495, &xctx->wire[k].prop_ptr,(char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->wire[k].prop_ptr,(char *) tclgetvar("retval")); } bus = get_attr_val(get_tok_value(xctx->wire[k].prop_ptr,"bus",0)); if(bus) { @@ -1210,7 +1210,7 @@ static int edit_wire_property(void) bbox(END , 0.0 , 0.0 , 0.0 , 0.0); modified = 1; } - my_free(496, &oldprop); + my_free(_ALLOC_ID_, &oldprop); return modified; } @@ -1223,7 +1223,7 @@ static int edit_arc_property(void) const char *dash, *fill_ptr; int preserve, modified = 0; - my_strdup(497, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -1246,7 +1246,7 @@ static int edit_arc_property(void) set_different_token(&xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop); } else { - my_strdup(498, &xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval")); } old_fill = xctx->arc[c][i].fill; fill_ptr = get_tok_value(xctx->arc[c][i].prop_ptr,"fill",0); @@ -1298,7 +1298,7 @@ static int edit_polygon_property(void) int preserve, modified = 0; dbg(1, "edit_property(): input property:\n"); - my_strdup(499, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); if(oldprop && oldprop[0]) { tclsetvar("retval", oldprop); } else { @@ -1322,7 +1322,7 @@ static int edit_polygon_property(void) if(oldprop && preserve == 1) { set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop); } else { - my_strdup(500, &xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval")); } old_fill = xctx->poly[c][i].fill; old_dash = xctx->poly[c][i].dash; @@ -1391,7 +1391,7 @@ static int edit_text_property(int x) } dbg(1, "edit_text_property(): entering\n"); sel = xctx->sel_array[0].n; - my_strdup(501, &oldprop, xctx->text[sel].prop_ptr); + my_strdup(_ALLOC_ID_, &oldprop, xctx->text[sel].prop_ptr); if(oldprop && oldprop[0]) tclsetvar("props", oldprop); else @@ -1446,7 +1446,7 @@ static int edit_text_property(int x) xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter, xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0, &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); - my_free(502, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -1455,7 +1455,7 @@ static int edit_text_property(int x) /* dbg(1, "edit_property(): text props=%s text=%s\n", tclgetvar("props"), tclgetvar("retval")); */ if(text_changed) { double cg; - my_free(503, &xctx->text[sel].floater_ptr); + my_free(_ALLOC_ID_, &xctx->text[sel].floater_ptr); cg = tclgetdoublevar("cadgrid"); c = xctx->rects[PINLAYER]; for(l=0;lrect[PINLAYER][l].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr, subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name", (char *) tclgetvar("retval")) ); else - my_strdup(505, &xctx->rect[PINLAYER][l].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr, subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name", (char *) tclgetvar("retval")) ); } } } - my_strdup2(506, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval")); + my_strdup2(_ALLOC_ID_, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval")); } if(props_changed) { if(oldprop && preserve) set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop); else - my_strdup(507, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props")); + my_strdup(_ALLOC_ID_, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props")); - my_free(508, &xctx->text[sel].floater_ptr); + my_free(_ALLOC_ID_, &xctx->text[sel].floater_ptr); set_text_flags(&xctx->text[sel]); } if(text_changed || props_changed) { @@ -1503,7 +1503,7 @@ static int edit_text_property(int x) } /* for(k=0;klastsel; ++k) */ draw(); } - my_free(509, &oldprop); + my_free(_ALLOC_ID_, &oldprop); return modified; } @@ -1523,9 +1523,9 @@ int drc_check(int i) end = i + 1; } for(j = start; j < end; j++) { - my_strdup(510, &drc, get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, "drc", 2)); + my_strdup(_ALLOC_ID_, &drc, get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, "drc", 2)); if(drc) { - my_strdup(511, &res, translate3(drc, 1, + my_strdup(_ALLOC_ID_, &res, translate3(drc, 1, xctx->inst[j].prop_ptr, xctx->sym[xctx->inst[j].ptr].templ, NULL, NULL)); dbg(1, "drc_check(): res = |%s|, drc=|%s|\n", res, drc); if(res) { @@ -1536,13 +1536,13 @@ int drc_check(int i) result = tcleval(replace_res); if(result && result[0]) { ret = 1; - my_mstrcat(512, &check_result, result, NULL); + my_mstrcat(_ALLOC_ID_, &check_result, result, NULL); } } } } - if(drc) my_free(513, &drc); - if(res) my_free(514, &res); + if(drc) my_free(_ALLOC_ID_, &drc); + if(res) my_free(_ALLOC_ID_, &res); if(check_result) { if(has_x) { /* tclvareval("alert_ {", check_result, "} {}", NULL); */ @@ -1551,7 +1551,7 @@ int drc_check(int i) } else { dbg(0, "%s\n", check_result); } - my_free(515, &check_result); + my_free(_ALLOC_ID_, &check_result); } return ret; } @@ -1576,19 +1576,19 @@ static int update_symbol(const char *result, int x, int selected_inst) *ii = selected_inst; if(!result) { dbg(1, "update_symbol(): edit symbol prop aborted\n"); - my_free(516, &xctx->old_prop); + my_free(_ALLOC_ID_, &xctx->old_prop); return 0; } /* create new_prop updated attribute string */ if(*netl_com && x==1) { - my_strdup(517, &new_prop, + my_strdup(_ALLOC_ID_, &new_prop, subst_token(xctx->old_prop, "value", (char *) tclgetvar("retval") ) ); dbg(1, "update_symbol(): new_prop=%s\n", new_prop); dbg(1, "update_symbol(): tcl retval==%s\n", tclgetvar("retval")); } else { - my_strdup(518, &new_prop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &new_prop, (char *) tclgetvar("retval")); dbg(1, "update_symbol(): new_prop=%s\n", new_prop); } my_strncpy(symbol, (char *) tclgetvar("symbol") , S(symbol)); @@ -1616,18 +1616,18 @@ static int update_symbol(const char *result, int x, int selected_inst) /* 20171220 calculate bbox before changes to correctly redraw areas */ /* must be recalculated as cairo text extents vary with zoom factor. */ symbol_bbox(*ii, &xctx->inst[*ii].x1, &xctx->inst[*ii].y1, &xctx->inst[*ii].x2, &xctx->inst[*ii].y2); - my_strdup2(519, &old_translated_sym, translate(*ii, xctx->inst[*ii].name)); + my_strdup2(_ALLOC_ID_, &old_translated_sym, translate(*ii, xctx->inst[*ii].name)); /* update property string from tcl dialog */ if(!no_change_props) { if(only_different) { char * ss=NULL; - my_strdup(520, &ss, xctx->inst[*ii].prop_ptr); + my_strdup(_ALLOC_ID_, &ss, xctx->inst[*ii].prop_ptr); if( set_different_token(&ss, new_prop, xctx->old_prop) ) { if(!pushed) { xctx->push_undo(); pushed=1;} - my_strdup(521, &xctx->inst[*ii].prop_ptr, ss); + my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, ss); } - my_free(522, &ss); + my_free(_ALLOC_ID_, &ss); } else { if(new_prop) { @@ -1636,11 +1636,11 @@ static int update_symbol(const char *result, int x, int selected_inst) xctx->inst[*ii].prop_ptr, new_prop); if(!pushed) { xctx->push_undo(); pushed=1;} dbg(1, "update_symbol(): *ii=%d, new_prop=%s\n", *ii, new_prop ? new_prop : ""); - my_strdup(523, &xctx->inst[*ii].prop_ptr, new_prop); + my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, new_prop); } } else { if(!pushed) { xctx->push_undo(); pushed=1;} - my_strdup(524, &xctx->inst[*ii].prop_ptr, ""); + my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, ""); } } } @@ -1649,7 +1649,7 @@ static int update_symbol(const char *result, int x, int selected_inst) * to use for inst name (from symbol template) */ prefix = 0; sym_number = -1; - my_strdup2(525, &translated_sym, translate(*ii, symbol)); + my_strdup2(_ALLOC_ID_, &translated_sym, translate(*ii, symbol)); dbg(1, "update_symbol: %s -- %s\n", translated_sym, old_translated_sym); if(changed_symbol || ( !strcmp(symbol, xctx->inst[*ii].name) && strcmp(translated_sym, old_translated_sym) ) ) { @@ -1665,37 +1665,37 @@ static int update_symbol(const char *result, int x, int selected_inst) delete_inst_node(*ii); /* 20180208 fix crashing bug: delete node info if changing symbol */ /* if number of pins is different we must delete these data *before* */ /* changing ysmbol, otherwise *ii might end up deleting non allocated data. */ - my_strdup2(526, &xctx->inst[*ii].name, rel_sym_path(symbol)); + my_strdup2(_ALLOC_ID_, &xctx->inst[*ii].name, rel_sym_path(symbol)); xctx->inst[*ii].ptr=sym_number; /* update instance to point to new symbol */ } - my_free(527, &translated_sym); - my_free(528, &old_translated_sym); + my_free(_ALLOC_ID_, &translated_sym); + my_free(_ALLOC_ID_, &old_translated_sym); /* if symbol changed ensure instance name (with new prefix char) is unique */ /* preserve backslashes in name ---------0---------------------------------->. */ - my_strdup(529, &name, get_tok_value(xctx->inst[*ii].prop_ptr, "name", 1)); + my_strdup(_ALLOC_ID_, &name, get_tok_value(xctx->inst[*ii].prop_ptr, "name", 1)); if(name && name[0] ) { char *old_name = NULL; dbg(1, "update_symbol(): prefix!='\\0', name=%s\n", name); /* change prefix if changing symbol type; */ if(prefix && old_prefix && old_prefix != prefix) { name[0]=(char)prefix; - my_strdup(530, &ptr, subst_token(xctx->inst[*ii].prop_ptr, "name", name) ); + my_strdup(_ALLOC_ID_, &ptr, subst_token(xctx->inst[*ii].prop_ptr, "name", name) ); } else { - my_strdup(531, &ptr, xctx->inst[*ii].prop_ptr); + my_strdup(_ALLOC_ID_, &ptr, xctx->inst[*ii].prop_ptr); } /* set unique name of current inst */ if(!pushed) { xctx->push_undo(); pushed=1;} if(!k) hash_names(-1, XINSERT); hash_names(*ii, XDELETE); dbg(1, "update_symbol(): delete %s\n", xctx->inst[*ii].instname); - my_strdup2(532, &old_name, xctx->inst[*ii].instname); + my_strdup2(_ALLOC_ID_, &old_name, xctx->inst[*ii].instname); new_prop_string(*ii, ptr, /* sets also inst[].instname */ tclgetboolvar("disable_unique_names")); /* set new prop_ptr */ hash_names(*ii, XINSERT); update_attached_floaters(old_name, *ii, 1); dbg(1, "update_symbol(): insert %s\n", xctx->inst[*ii].instname); - my_free(533, &old_name); + my_free(_ALLOC_ID_, &old_name); } set_inst_flags(&xctx->inst[*ii]); } /* end for(k=0;klastsel; ++k) */ @@ -1716,10 +1716,10 @@ static int update_symbol(const char *result, int x, int selected_inst) /* redraw symbol with new props */ set_modify(-2); /* reset floaters caches */ draw(); - my_free(534, &name); - my_free(535, &ptr); - my_free(536, &new_prop); - my_free(537, &xctx->old_prop); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &ptr); + my_free(_ALLOC_ID_, &new_prop); + my_free(_ALLOC_ID_, &xctx->old_prop); return modified; } @@ -1746,12 +1746,12 @@ static int edit_symbol_property(int x, int first_sel) else { tclsetvar("retval",""); } - my_strdup(538, &xctx->old_prop, xctx->inst[*ii].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->old_prop, xctx->inst[*ii].prop_ptr); tclsetvar("symbol",xctx->inst[*ii].name); if(x==0) { tcleval("edit_prop {Input property:}"); - my_strdup(539, &result, tclresult()); + my_strdup(_ALLOC_ID_, &result, tclresult()); } else { /* edit_vi_netlist_prop will replace \" with " before editing, @@ -1760,11 +1760,11 @@ static int edit_symbol_property(int x, int first_sel) if(*netl_com && x==1) tcleval("edit_vi_netlist_prop {Input property:}"); else if(x==1) tcleval("edit_vi_prop {Input property:}"); else if(x==2) tcleval("viewdata $::retval"); - my_strdup(540, &result, tclresult()); + my_strdup(_ALLOC_ID_, &result, tclresult()); } dbg(1, "edit_symbol_property(): before update_symbol, modified=%d\n", xctx->modified); modified = update_symbol(result, x, *ii); - my_free(541, &result); + my_free(_ALLOC_ID_, &result); dbg(1, "edit_symbol_property(): done update_symbol, modified=%d\n", modified); *ii=-1; return modified; @@ -1869,7 +1869,7 @@ char *str_replace(const char *str, const char *rep, const char *with, int escape int replacements = 0; if(s==NULL || rep == NULL || with == NULL || rep[0] == '\0') { - my_free(542, &result); + my_free(_ALLOC_ID_, &result); size = 0; return NULL; } @@ -1878,7 +1878,7 @@ char *str_replace(const char *str, const char *rep, const char *with, int escape dbg(1, "str_replace(): %s, %s, %s\n", s, rep, with); if( size == 0 ) { size = CADCHUNKALLOC; - my_realloc(543, &result, size); + my_realloc(_ALLOC_ID_, &result, size); } while(*s) { STR_ALLOC(&result, result_pos + with_len + 1, &size); @@ -1906,7 +1906,7 @@ char *str_chars_replace(const char *str, const char *replace_set, const char wit { char *res = NULL; char *s; - my_strdup(544, &res, str); + my_strdup(_ALLOC_ID_, &res, str); s = res; dbg(1, "*str_chars_replace(): %s\n", res); while( *s) { @@ -1973,9 +1973,9 @@ void edit_property(int x) dbg(1, "edit_property(): done executing edit_vi_prop, result=%s\n",tclresult()); dbg(1, "edit_property(): tctx::rcode=%s\n",tclgetvar("tctx::rcode") ); - my_strdup(545, &new_prop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &new_prop, (char *) tclgetvar("retval")); tclsetvar("retval", new_prop); - my_free(546, &new_prop); + my_free(_ALLOC_ID_, &new_prop); if(strcmp(tclgetvar("tctx::rcode"),"") ) @@ -1984,31 +1984,31 @@ void edit_property(int x) (!xctx->schsymbolprop || strcmp(xctx->schsymbolprop, tclgetvar("retval") ) ) ) { xctx->push_undo(); modified = 1; - my_strdup(547, &xctx->schsymbolprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_VERILOG_NETLIST && (!xctx->schverilogprop || strcmp(xctx->schverilogprop, tclgetvar("retval") ) ) ) { modified = 1; xctx->push_undo(); - my_strdup(548, &xctx->schverilogprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schverilogprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_SPICE_NETLIST && (!xctx->schprop || strcmp(xctx->schprop, tclgetvar("retval") ) ) ) { modified = 1; xctx->push_undo(); - my_strdup(549, &xctx->schprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_TEDAX_NETLIST && (!xctx->schtedaxprop || strcmp(xctx->schtedaxprop, tclgetvar("retval") ) ) ) { modified = 1; xctx->push_undo(); - my_strdup(550, &xctx->schtedaxprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, (char *) tclgetvar("retval")); } else if(xctx->netlist_type==CAD_VHDL_NETLIST && (!xctx->schvhdlprop || strcmp(xctx->schvhdlprop, tclgetvar("retval") ) ) ) { modified = 1; xctx->push_undo(); - my_strdup(551, &xctx->schvhdlprop, (char *) tclgetvar("retval")); + my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, (char *) tclgetvar("retval")); } } diff --git a/src/eval_expr.y b/src/eval_expr.y index 15a922af..55e54a6e 100644 --- a/src/eval_expr.y +++ b/src/eval_expr.y @@ -120,7 +120,7 @@ static void get_char(int c) dbg(dbglev, "get_char: %c |%s|\n", c, str); s[0] = (char)c; s[1] = '\0'; - my_mstrcat(562, &ret, s, NULL); + my_mstrcat(_ALLOC_ID_, &ret, s, NULL); strptr = str; } @@ -129,7 +129,7 @@ static void get_expr(double x) char xx[100]; dbg(dbglev,"get_expr(): x=%g\n", x); my_snprintf(xx, S(xx), "%.15g", x); - my_mstrcat(563, &ret, xx, NULL); + my_mstrcat(_ALLOC_ID_, &ret, xx, NULL); strptr = str; } @@ -167,10 +167,10 @@ static void kkerror(char *s) /* Called by kkparse on error */ { char *ss = NULL; dbg(dbglev, "error: |%s|\n\n |%s|\n", s, str ? str : ""); - my_strdup2(564, &ss, strptr); + my_strdup2(_ALLOC_ID_, &ss, strptr); remove_expr(ss); - my_mstrcat(565, &ret, ss, NULL); - my_free(566, &ss); + my_mstrcat(_ALLOC_ID_, &ret, ss, NULL); + my_free(_ALLOC_ID_, &ss); lex_state = 0; } @@ -185,8 +185,8 @@ static symrec *getsym(char *sym_name) symrec * putsym (char *sym_name) { symrec *ptr; - ptr = (symrec *) my_malloc(567, sizeof (symrec)); - ptr->name = (char *) my_malloc(568, strlen (sym_name) + 1); + ptr = (symrec *) my_malloc(_ALLOC_ID_, sizeof (symrec)); + ptr->name = (char *) my_malloc(_ALLOC_ID_, strlen (sym_name) + 1); strcpy (ptr->name,sym_name); ptr->next = (struct symrec *)sym_table; sym_table = ptr; @@ -211,8 +211,8 @@ void eval_expr_clear_table(void) while(ptr) { symrec *tmp = ptr; ptr = ptr->next; - my_free(569, &(tmp->name)); - my_free(570, &tmp); + my_free(_ALLOC_ID_, &(tmp->name)); + my_free(_ALLOC_ID_, &tmp); } } @@ -287,7 +287,7 @@ static int kklex() char *eval_expr(const char *s) { lex_state = 0; - if(ret) my_free(571, &ret); + if(ret) my_free(_ALLOC_ID_, &ret); strptr = str = s; kkparse(); return ret; diff --git a/src/expandlabel.y b/src/expandlabel.y index 51701994..1b4c639f 100644 --- a/src/expandlabel.y +++ b/src/expandlabel.y @@ -70,13 +70,13 @@ static char *expandlabel_strdup(char *src) char *ptr; if(src==NULL || src[0]=='\0') { ptr=NULL; - my_strdup(572, &ptr,""); + my_strdup(_ALLOC_ID_, &ptr,""); return ptr; } else { ptr=NULL; - my_strdup(573, &ptr,src); + my_strdup(_ALLOC_ID_, &ptr,src); dbg(3, "expandlabel_strdup(): duplicated %lu string %s\n",(unsigned long)ptr,src); return ptr; } @@ -90,7 +90,7 @@ static char *expandlabel_strcat(char *s1, char *s2) if(s1) l1=strlen(s1); if(s2) l2=strlen(s2); - res=my_malloc(574, l1+l2+1); /* 2 strings plus '\0' */ + res=my_malloc(_ALLOC_ID_, l1+l2+1); /* 2 strings plus '\0' */ if(s1) memcpy(res, s1, l1); if(s2) memcpy(res + l1 , s2, l2+1); else memcpy(res + l1 , "", 1); @@ -105,7 +105,7 @@ static char *expandlabel_strcat_char(char *s1, char c, char *s2) if(s1) l1=strlen(s1); if(s2) l2=strlen(s2); - res=my_malloc(575, l1+l2+2); /* 2 strings plus 'c' and '\0' */ + res=my_malloc(_ALLOC_ID_, l1+l2+2); /* 2 strings plus 'c' and '\0' */ if(s1) memcpy(res, s1, l1); res[l1] = c; if(s2) memcpy(res + l1 + 1, s2, l2+1); @@ -128,7 +128,7 @@ static char *expandlabel_strmult2(int n, char *s) if(n==0) return expandlabel_strdup(""); len=strlen(s); prev=s; - ss = str=my_malloc(576, (len+1)*n); + ss = str=my_malloc(_ALLOC_ID_, (len+1)*n); str[0]='\0'; for(pos=s;pos<=s+len;pos++) { if(*pos==',' || *pos=='\0') { @@ -162,7 +162,7 @@ static char *expandlabel_strmult(int n, char *s) if(n==0) return expandlabel_strdup(""); len=strlen(s); - str=pos=my_malloc(577, (len+1)*n); + str=pos=my_malloc(_ALLOC_ID_, (len+1)*n); for(i=1;i<=n;i++) { /* strcpy(pos,s); */ @@ -181,8 +181,8 @@ static char *expandlabel_strbus_suffix(char *s, int *n, char *suffix) int tmplen; char *res=NULL; char *tmp=NULL; - my_realloc(578, &res, n[0] * (strlen(s) + strlen(suffix) + 30)); - my_realloc(579, &tmp, strlen(s) + strlen(suffix) + 30); + my_realloc(_ALLOC_ID_, &res, n[0] * (strlen(s) + strlen(suffix) + 30)); + my_realloc(_ALLOC_ID_, &tmp, strlen(s) + strlen(suffix) + 30); l=0; for(i=1;iinst[i].y0; rot = xctx->inst[i].rot; flip = xctx->inst[i].flip; - my_strdup(623, &type, (xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type, (xctx->inst[i].ptr+ xctx->sym)->type); if(!type) continue; no_of_pin_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]; @@ -318,7 +318,7 @@ void xfind_closest_net_or_symbol_pin(double mx, double my, double *x, double *y) } *x = min_dist_x; *y = min_dist_y; - my_free(624, &type); + my_free(_ALLOC_ID_, &type); } #endif @@ -461,7 +461,7 @@ static void find_closest_text(double mx, double my, int override_lock) xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0, &xx1, &yy1, &xx2, &yy2, &tmp, &dtmp); - my_free(625, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); diff --git a/src/font.c b/src/font.c index b35a9a48..299bbda2 100644 --- a/src/font.c +++ b/src/font.c @@ -38,7 +38,7 @@ void compile_font(void) select_inside(0, code*FONTOFFSET-1,-FONTHEIGHT-1, code*FONTOFFSET+FONTWIDTH+1,FONTWHITESPACE + FONTDESCENT+1, 1); rebuild_selected_array(); - character[code] = my_calloc(626, xctx->lastsel*4+1, sizeof(double)); + character[code] = my_calloc(_ALLOC_ID_, xctx->lastsel*4+1, sizeof(double)); character[code][0] = (double)xctx->lastsel; dbg(2, "compile_font(): character[%d][]={%.16g",code,character[code][0]); for(i=0;ilastsel; ++i) @@ -60,6 +60,6 @@ void compile_font(void) clear_drawing(); unselect_all(1); xctx->currsch = 0; - my_free(627, &xctx->sch[xctx->currsch]); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); } diff --git a/src/hash_iterator.c b/src/hash_iterator.c index 4e3a9daa..a76b50e7 100644 --- a/src/hash_iterator.c +++ b/src/hash_iterator.c @@ -28,7 +28,7 @@ void init_inst_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, doub dbg(3, "init_inst_iterator(): instances=%d\n", xctx->instances); if(xctx->instances) { - my_realloc(628, &ctx->instflag, xctx->instances*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &ctx->instflag, xctx->instances*sizeof(unsigned short)); memset(ctx->instflag, 0, xctx->instances*sizeof(unsigned short)); } /* calculate square 4 1st corner of drawing area */ @@ -72,7 +72,7 @@ Instentry *inst_iterator_next(Iterator_ctx *ctx) ctx->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES; ctx->instanceptr = xctx->inst_spatial_table[ctx->tmpi][ctx->tmpj]; } else { - my_free(629, &ctx->instflag); + my_free(_ALLOC_ID_, &ctx->instflag); return NULL; } } @@ -83,7 +83,7 @@ void init_wire_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, doub ctx->wireflag = NULL; dbg(3, "init_wire_iterator(): wires=%d\n", xctx->wires); if(xctx->wires) { - my_realloc(630, &ctx->wireflag, xctx->wires*sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &ctx->wireflag, xctx->wires*sizeof(unsigned short)); memset(ctx->wireflag, 0, xctx->wires*sizeof(unsigned short)); } /* calculate square 4 1st corner of drawing area */ @@ -127,7 +127,7 @@ Wireentry *wire_iterator_next(Iterator_ctx *ctx) ctx->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES; ctx->wireptr = xctx->wire_spatial_table[ctx->tmpi][ctx->tmpj]; } else { - my_free(631, &ctx->wireflag); + my_free(_ALLOC_ID_, &ctx->wireflag); return NULL; } } @@ -139,7 +139,7 @@ void init_object_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, do ctx->objectflag = NULL; dbg(3, "init_object_iterator(): objects=%d\n", xctx->n_hash_objects); if(xctx->n_hash_objects) { - my_realloc(632, &ctx->objectflag, xctx->n_hash_objects * sizeof(unsigned short)); + my_realloc(_ALLOC_ID_, &ctx->objectflag, xctx->n_hash_objects * sizeof(unsigned short)); memset(ctx->objectflag, 0, xctx->n_hash_objects * sizeof(unsigned short)); } /* calculate square 4 1st corner of drawing area */ @@ -182,7 +182,7 @@ Objectentry *object_iterator_next(Iterator_ctx *ctx) ctx->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES; ctx->objectptr = xctx->object_spatial_table[ctx->tmpi][ctx->tmpj]; } else { - my_free(633, &ctx->objectflag); + my_free(_ALLOC_ID_, &ctx->objectflag); return NULL; } } diff --git a/src/hilight.c b/src/hilight.c index 8c19c434..bd388686 100644 --- a/src/hilight.c +++ b/src/hilight.c @@ -48,9 +48,9 @@ static void hilight_hash_free_entry(Hilight_hashentry *entry) Hilight_hashentry *tmp; while(entry) { tmp = entry->next; - my_free(634, &entry->token); - my_free(635, &entry->path); - my_free(636, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->path); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -89,11 +89,11 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int size_t lent = strlen(token) + 1; size_t lenp = strlen(xctx->sch_path[xctx->currsch]) + 1; if( what==XINSERT || what == XINSERT_NOREPLACE) { /* insert data */ - Hilight_hashentry *entry = (Hilight_hashentry *)my_malloc(637, sizeof( Hilight_hashentry )); + Hilight_hashentry *entry = (Hilight_hashentry *)my_malloc(_ALLOC_ID_, sizeof( Hilight_hashentry )); entry->next = NULL; - entry->token = my_malloc(638, lent); + entry->token = my_malloc(_ALLOC_ID_, lent); memcpy(entry->token, token, lent); - entry->path = my_malloc(639, lenp); + entry->path = my_malloc(_ALLOC_ID_, lenp); memcpy(entry->path, xctx->sch_path[xctx->currsch], lenp); entry->oldvalue = value-1000; /* no old value, set different value anyway*/ entry->value = value; @@ -109,9 +109,9 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int if(what==XDELETE) { /* remove token from the hash table ... */ Hilight_hashentry *saveptr; saveptr=(*preventry)->next; - my_free(640, &(*preventry)->token); - my_free(641, &(*preventry)->path); - my_free(642, &(*preventry)); + my_free(_ALLOC_ID_, &(*preventry)->token); + my_free(_ALLOC_ID_, &(*preventry)->path); + my_free(_ALLOC_ID_, &(*preventry)); *preventry=saveptr; } else if(what == XINSERT ) { (*preventry)->oldvalue =(*preventry)->value; @@ -134,13 +134,13 @@ Hilight_hashentry *inst_hilight_hash_lookup(int i, int value, int what) Hilight_hashentry *entry; if(IS_LABEL_SH_OR_PIN( (xctx->inst[i].ptr+xctx->sym)->type )) label = 1; dbg(1, "inst_hilight_hash_lookup: token=%s value=%d what=%d\n", token, value, what); - inst_tok = my_malloc(643, len); + inst_tok = my_malloc(_ALLOC_ID_, len); /* instance name uglyfication: add a space at beginning so it will never match a valid net name */ /* use 2 spaces for pins/labels to distinguish from other instances */ if(label) my_snprintf(inst_tok, len, " %s", token); else my_snprintf(inst_tok, len, " %s", token); entry = hilight_hash_lookup(inst_tok, value, what); - my_free(644, &inst_tok); + my_free(_ALLOC_ID_, &inst_tok); return entry; } @@ -163,7 +163,7 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha if(!ptr1) xctx->some_nets_added = 1; return ptr1; } - my_strdup(645, &string, expandlabel(token,&mult)); + my_strdup(_ALLOC_ID_, &string, expandlabel(token,&mult)); if(string==NULL) { return NULL; } @@ -187,7 +187,7 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha string_ptr++; } /* if something found return first pointer */ - my_free(646, &string); + my_free(_ALLOC_ID_, &string); return ptr2; } @@ -198,9 +198,9 @@ Hilight_hashentry *hier_hilight_hash_lookup(const char *token, int value, const char *oldpath = xctx->sch_path[xctx->currsch]; xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_path[xctx->currsch] = NULL; - my_strdup2(647, &xctx->sch_path[xctx->currsch], path); + my_strdup2(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], path); entry = bus_hilight_hash_lookup(token, value, what); - my_free(648, &xctx->sch_path[xctx->currsch]); + my_free(_ALLOC_ID_, &xctx->sch_path[xctx->currsch]); xctx->sch_path[xctx->currsch] = oldpath; xctx->sch_path_hash[xctx->currsch] = 0; return entry; @@ -228,11 +228,11 @@ void display_hilights(int what, char **str) dbg(1, "what=%d, instance=%d, token=%s\n", what, instance, ptr); if( ((what & 1) && !instance) || ((what & 2) && instance) ) { if(instance) ptr++; /* skip uglyfication space */ - if(!first) my_strcat(649, str, " "); - my_strcat(650, str,"{"); - my_strcat(651, str, entry->path+1); - my_strcat(652, str, ptr); - my_strcat(653, str,"}"); + if(!first) my_strcat(_ALLOC_ID_, str, " "); + my_strcat(_ALLOC_ID_, str,"{"); + my_strcat(_ALLOC_ID_, str, entry->path+1); + my_strcat(_ALLOC_ID_, str, ptr); + my_strcat(_ALLOC_ID_, str,"}"); first = 0; } skip: @@ -276,7 +276,7 @@ int hilight_graph_node(const char *node, int col) ++path_skip; } - my_strdup2(654, &n, node); + my_strdup2(_ALLOC_ID_, &n, node); nptr = n; dbg(1, "hilight_graph_node(): path_skip=%s, %s: %d\n", path_skip, node, col); @@ -293,12 +293,12 @@ int hilight_graph_node(const char *node, int col) path3 = nptr; nptr = ptr2 + 1; if(!strstr(path_skip, path3)) - my_mstrcat(655, &path2, path, path3, ".", NULL); + my_mstrcat(_ALLOC_ID_, &path2, path, path3, ".", NULL); else - my_strdup2(656, &path2, path); + my_strdup2(_ALLOC_ID_, &path2, path); } else { - my_strdup2(657, &path2, path); + my_strdup2(_ALLOC_ID_, &path2, path); } if(current) { nptr--; @@ -310,8 +310,8 @@ int hilight_graph_node(const char *node, int col) dbg(1, "hilight_graph_node(): propagate_hilights(), col=%d\n", col); propagate_hilights(1, 0, XINSERT_NOREPLACE); } - my_free(658, &n); - my_free(659, &path2); + my_free(_ALLOC_ID_, &n); + my_free(_ALLOC_ID_, &path2); return 1; } @@ -395,12 +395,12 @@ void create_plot_cmd(void) if(exists) { viewer = tclgetintvar("sim(spicewave,default)"); my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer); - my_strdup(660, &viewer_name, tclgetvar(tcl_str)); + my_strdup(_ALLOC_ID_, &viewer_name, tclgetvar(tcl_str)); dbg(1,"create_plot_cmd(): viewer_name=%s\n", viewer_name); if(strstr(viewer_name, "Gaw")) viewer=GAW; else if(strstr(viewer_name, "Bespice")) viewer=BESPICE; else if(strstr(viewer_name, "Ngspice")) viewer=NGSPICE; - my_free(661, &viewer_name); + my_free(_ALLOC_ID_, &viewer_name); } if(!exists || !viewer) return; my_snprintf(plotfile, S(plotfile), "%s/xplot", tclgetvar("netlist_dir")); @@ -435,24 +435,24 @@ void create_plot_cmd(void) fprintf(fd, "%s", str); fprintf(fd, "\n"); first = 1; - my_free(662, &str); + my_free(_ALLOC_ID_, &str); } fprintf(fd, "set color%d=rgb:%s\n", idx, color_str); if(first) { - my_strcat(663, &str, "plot "); + my_strcat(_ALLOC_ID_, &str, "plot "); first = 0; } - my_strcat(664, &str, "\""); - my_strcat(665, &str, (entry->path)+1); - my_strcat(666, &str, tok); - my_strcat(667, &str, "\" "); + my_strcat(_ALLOC_ID_, &str, "\""); + my_strcat(_ALLOC_ID_, &str, (entry->path)+1); + my_strcat(_ALLOC_ID_, &str, tok); + my_strcat(_ALLOC_ID_, &str, "\" "); } if(viewer == GAW) { char *t=NULL, *p=NULL; sprintf(color_str, "%02x%02x%02x", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); - my_strdup(668, &t, tok); - my_strdup2(669, &p, (entry->path)+1); + my_strdup(_ALLOC_ID_, &t, tok); + my_strdup2(_ALLOC_ID_, &p, (entry->path)+1); if(simtype == 0 ) { /* spice */ tclvareval("puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t), ") sel #", color_str, "}\nvwait gaw_fd\n", NULL); @@ -465,15 +465,15 @@ void create_plot_cmd(void) tclvareval("puts $gaw_fd {copyvar ", strtoupper(p), strtoupper(t), " sel #", color_str, "}\nvwait gaw_fd\n", NULL); } - my_free(670, &p); - my_free(671, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } if(viewer == BESPICE) { char *t=NULL, *p=NULL; sprintf(color_str, "#%02x%02x%02x", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); - my_strdup(672, &t, tok); - my_strdup2(673, &p, (entry->path)+1); + my_strdup(_ALLOC_ID_, &t, tok); + my_strdup2(_ALLOC_ID_, &p, (entry->path)+1); /* bespice command syntax : add_voltage_on_spice_node_to_plot
[] @@ -485,8 +485,8 @@ void create_plot_cmd(void) "{add_voltage_on_spice_node_to_plot * \"\" \"", p, t, "\" 0 ", color_str, "}", NULL); - my_free(674, &p); - my_free(675, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } entry = entry->next; @@ -495,7 +495,7 @@ void create_plot_cmd(void) if(viewer == NGSPICE) { fprintf(fd, "%s", str); fprintf(fd, "\nremcirc\n.endc\n"); - my_free(676, &str); + my_free(_ALLOC_ID_, &str); fclose(fd); } if(viewer == GAW) { @@ -535,16 +535,16 @@ void hilight_net_pin_mismatches(void) for(k=0; klastsel; ++k) { if(xctx->sel_array[k].type!=ELEMENT) continue; j = xctx->sel_array[k].n ; - my_strdup(677, &type,(xctx->inst[j].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type); if( type && IS_LABEL_SH_OR_PIN(type)) break; symbol = xctx->sym + xctx->inst[j].ptr; npin = symbol->rects[PINLAYER]; rct=symbol->rect[PINLAYER]; dbg(1, "hilight_net_pin_mismatches(): \n"); for(i=0;ihilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE); redraw_hilights(0); } @@ -589,12 +589,12 @@ void hilight_parent_pins(void) { char *p_n_s1, *p_n_s2; if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue; - my_strdup(685, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); + my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); dbg(1, "hilight_parent_pins(): net_node=%s\n", net_node); pin_name = get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][j].prop_ptr,"name",0); dbg(1, "pin_name=%s\n", pin_name); if(!pin_name[0]) continue; - my_strdup(686, &pin_node, expandlabel(pin_name, &mult)); + my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); dbg(1, "hilight_parent_pins(): pin_node=%s\n", pin_node); p_n_s1 = pin_node; @@ -625,8 +625,8 @@ void hilight_parent_pins(void) } } } - my_free(687, &pin_node); - my_free(688, &net_node); + my_free(_ALLOC_ID_, &pin_node); + my_free(_ALLOC_ID_, &net_node); } void hilight_child_pins(void) @@ -657,11 +657,11 @@ void hilight_child_pins(void) dbg(1, "hilight_child_pins(): inst_number=%d\n", inst_number); if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue; - my_strdup(689, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); + my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); dbg(1, "hilight_child_pins(): net_node=%s\n", net_node); pin_name = get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][j].prop_ptr,"name",0); if(!pin_name[0]) continue; - my_strdup(690, &pin_node, expandlabel(pin_name, &mult)); + my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node); p_n_s1 = pin_node; for(k = 1; k<=mult; ++k) { @@ -680,8 +680,8 @@ void hilight_child_pins(void) p_n_s1 = NULL; } /* for(k..) */ } - my_free(691, &pin_node); - my_free(692, &net_node); + my_free(_ALLOC_ID_, &pin_node); + my_free(_ALLOC_ID_, &net_node); } @@ -754,7 +754,7 @@ int search(const char *tok, const char *val, int sub, int sel, int match_case) if(regcomp(&re, val , cflags)) return TCL_ERROR; #else if(!match_case) { - my_strdup(693, ®exp_options, "-nocase"); + my_strdup(_ALLOC_ID_, ®exp_options, "-nocase"); } #endif dbg(1, "search():val=%s\n", val); @@ -771,7 +771,7 @@ int search(const char *tok, const char *val, int sub, int sel, int match_case) } else if(!strcmp(tok,"cell::propstring")) { has_token = (str = (xctx->inst[i].ptr+ xctx->sym)->prop_ptr) ? 1 : 0; } else if(!strncmp(tok,"cell::", 6)) { /* cell::xxx looks for xxx in global symbol attributes */ - my_strdup(694, &tmpname,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,tok+6,0)); + my_strdup(_ALLOC_ID_, &tmpname,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,tok+6,0)); has_token = xctx->tok_size; if(tmpname) { str = tmpname; @@ -1015,10 +1015,10 @@ int search(const char *tok, const char *val, int sub, int sel, int match_case) #ifdef __unix__ regfree(&re); #else - my_free(695, ®exp_options); + my_free(_ALLOC_ID_, ®exp_options); #endif xctx->draw_window = save_draw; - my_free(696, &tmpname); + my_free(_ALLOC_ID_, &tmpname); return found; } @@ -1049,10 +1049,10 @@ static void drill_hilight(int mode) if(xctx->inst[i].node && xctx->inst[i].node[j] && strstr(xctx->inst[i].node[j], "#net") == xctx->inst[i].node[j]) { - my_strdup2(697, &netname,xctx->inst[i].node[j]); + my_strdup2(_ALLOC_ID_, &netname,xctx->inst[i].node[j]); } else { /* mult here will be set to pin multiplicity */ - my_strdup2(698, &netname, net_name(i, j, &mult, 1, 0)); + my_strdup2(_ALLOC_ID_, &netname, net_name(i, j, &mult, 1, 0)); } /* mult here will be set to net multiplicity */ expandlabel(netname, &mult); @@ -1065,7 +1065,7 @@ static void drill_hilight(int mode) xctx->inst[i].color = entry->value; inst_hilight_hash_lookup(i, entry->value, XINSERT_NOREPLACE); } - my_strdup(699, &propagate_str, get_tok_value(rct[j].prop_ptr, "propag", 0)); + my_strdup(_ALLOC_ID_, &propagate_str, get_tok_value(rct[j].prop_ptr, "propag", 0)); if(propagate_str) { int n = 1; const char *propag; @@ -1083,9 +1083,9 @@ static void drill_hilight(int mode) if(xctx->inst[i].node && xctx->inst[i].node[propagate] && strstr(xctx->inst[i].node[propagate], "#net") == xctx->inst[i].node[propagate]) { - my_strdup2(700, &propagated_net,xctx->inst[i].node[propagate]); + my_strdup2(_ALLOC_ID_, &propagated_net,xctx->inst[i].node[propagate]); } else { - my_strdup2(701, &propagated_net, net_name(i, propagate, &mult2, 1, 0)); + my_strdup2(_ALLOC_ID_, &propagated_net, net_name(i, propagate, &mult2, 1, 0)); } netbitname = find_nth(propagated_net, ",", "", 0, k); dbg(1, "netbitname=%s\n", netbitname); @@ -1101,9 +1101,9 @@ static void drill_hilight(int mode) } /* for(i...) */ if(!found) break; } /* while(1) */ - my_free(702, &netname); - if(propagated_net) my_free(703, &propagated_net); - if(propagate_str) my_free(704, &propagate_str); + my_free(_ALLOC_ID_, &netname); + if(propagated_net) my_free(_ALLOC_ID_, &propagated_net); + if(propagate_str) my_free(_ALLOC_ID_, &propagate_str); } /* if fast is set you need to do a propagate_hilights() at the end to finalize the operation */ @@ -1145,9 +1145,9 @@ static void send_net_to_bespice(int simtype, const char *node) sprintf(color_str, "#%02x%02x%02x", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(705, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); for(k=1; k<=tok_mult; ++k) { - my_strdup(706, &t, find_nth(expanded_tok, ",", "", 0, k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); /* bespice command syntax : add_voltage_on_spice_node_to_plot
[] plot name is "*" => automatic @@ -1159,8 +1159,8 @@ static void send_net_to_bespice(int simtype, const char *node) p, t, "\" 0 ", color_str, "}", NULL); } - my_free(707, &p); - my_free(708, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } @@ -1184,7 +1184,7 @@ static void send_net_to_graph(char **s, int simtype, const char *node) int start_level; c = get_color(xctx->hilight_color); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(709, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; start_level = sch_waves_loaded(); if(path) { @@ -1197,20 +1197,20 @@ static void send_net_to_graph(char **s, int simtype, const char *node) } strtolower(path); for(k=1; k<=tok_mult; ++k) { - my_strdup(710, &t, find_nth(expanded_tok, ",", "", 0, k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); strtolower(t); if(simtype == 0 ) { /* ngspice */ dbg(1, "%s%s color=%d\n", path, t, c); my_snprintf(ss, S(ss), "%s%s %d ", path, t, c); - my_strcat(711, s, ss); + my_strcat(_ALLOC_ID_, s, ss); } else { /* Xyce */ my_snprintf(ss, S(ss), "%s%s %d", path, t, c); - my_strcat(712, s, ss); + my_strcat(_ALLOC_ID_, s, ss); } } - my_free(713, &p); - my_free(714, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } @@ -1235,11 +1235,11 @@ static void send_net_to_gaw(int simtype, const char *node) expanded_tok = expandlabel(tok, &tok_mult); tcleval("setup_tcp_gaw"); if(tclresult()[0] == '0') return; - my_strdup2(715, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; strtolower(path); for(k=1; k<=tok_mult; ++k) { - my_strdup(716, &t, find_nth(expanded_tok, ",", "", 0, k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); strtolower(t); if(simtype == 0 ) { /* ngspice */ tclvareval("puts $gaw_fd {copyvar v(", path, t, @@ -1249,8 +1249,8 @@ static void send_net_to_gaw(int simtype, const char *node) ") sel #", color_str, "}\nvwait gaw_fd\n", NULL); } } - my_free(717, &p); - my_free(718, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } } @@ -1271,9 +1271,9 @@ static void send_current_to_bespice(int simtype, const char *node) sprintf(color_str, "#%02x%02x%02x", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(719, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); for(k=1; k<=tok_mult; ++k) { - my_strdup(720, &t, find_nth(expanded_tok, ",", "", 0, k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); /* bespice command syntax : add_current_through_spice_device_to_plot
[] plot name is "*" => automatic @@ -1285,8 +1285,8 @@ static void send_current_to_bespice(int simtype, const char *node) p, t, "\" 0 ", color_str, "}", NULL); } - my_free(721, &p); - my_free(722, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } static void send_current_to_graph(char **s, int simtype, const char *node) @@ -1301,7 +1301,7 @@ static void send_current_to_graph(char **s, int simtype, const char *node) tok = node; c = get_color(xctx->hilight_color); expanded_tok = expandlabel(tok, &tok_mult); - my_strdup2(723, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; start_level = sch_waves_loaded(); if(path) { @@ -1315,22 +1315,22 @@ static void send_current_to_graph(char **s, int simtype, const char *node) strtolower(path); there_is_hierarchy = (strstr(path, ".") != NULL); for(k=1; k<=tok_mult; ++k) { - my_strdup(724, &t, find_nth(expanded_tok, ",", "", 0, k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); strtolower(t); if(!simtype) { /* ngspice */ my_snprintf(ss, S(ss), "i(%s%s%s) %d", there_is_hierarchy ? "v." : "", path, t, c); - my_strcat(725, s, ss); + my_strcat(_ALLOC_ID_, s, ss); } else { /* Xyce */ /* my_snprintf(ss, S(ss), "%s%s%s#branch %d", there_is_hierarchy ? "v." : "", path, (there_is_hierarchy ? t+1 : t) , c); */ my_snprintf(ss, S(ss), "i(%s%s) %d", path, t, c); - my_strcat(726, s, ss); + my_strcat(_ALLOC_ID_, s, ss); } } - my_free(727, &p); - my_free(728, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } static void send_current_to_gaw(int simtype, const char *node) @@ -1350,12 +1350,12 @@ static void send_current_to_gaw(int simtype, const char *node) expanded_tok = expandlabel(tok, &tok_mult); tcleval("setup_tcp_gaw"); if(tclresult()[0] == '0') return; - my_strdup2(729, &p, xctx->sch_path[xctx->currsch]+1); + my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); path = p; strtolower(path); there_is_hierarchy = (xctx->currsch > 0); for(k=1; k<=tok_mult; ++k) { - my_strdup(730, &t, find_nth(expanded_tok, ",", "", 0, k)); + my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); strtolower(t); if(!simtype) { /* spice */ tclvareval("puts $gaw_fd {copyvar i(", there_is_hierarchy ? "v." : "", path, t, @@ -1375,8 +1375,8 @@ static void send_current_to_gaw(int simtype, const char *node) " sel #", color_str, "}\nvwait gaw_fd\n", NULL); } } - my_free(731, &p); - my_free(732, &t); + my_free(_ALLOC_ID_, &p); + my_free(_ALLOC_ID_, &t); } /* hilight/clear pin/label instances attached to hilight nets, or instances with "highlight=true" @@ -1651,21 +1651,21 @@ static void create_simdata(void) int i, j; const char *str; free_simdata(); - my_realloc(733, &xctx->simdata, xctx->instances * sizeof(Simdata)); + my_realloc(_ALLOC_ID_, &xctx->simdata, xctx->instances * sizeof(Simdata)); xctx->simdata_ninst = xctx->instances; for(i = 0; i < xctx->instances; ++i) { xSymbol *symbol = xctx->inst[i].ptr + xctx->sym; int npin = symbol->rects[PINLAYER]; xctx->simdata[i].pin = NULL; - if(npin) my_realloc(734, &xctx->simdata[i].pin, npin * sizeof(Simdata_pin)); + if(npin) my_realloc(_ALLOC_ID_, &xctx->simdata[i].pin, npin * sizeof(Simdata_pin)); xctx->simdata[i].npin = npin; for(j = 0; j < npin; ++j) { char function[20]; xctx->simdata[i].pin[j].function=NULL; xctx->simdata[i].pin[j].go_to=NULL; my_snprintf(function, S(function), "function%d", j); - my_strdup(735, &xctx->simdata[i].pin[j].function, get_tok_value(symbol->prop_ptr, function, 0)); - my_strdup(736, &xctx->simdata[i].pin[j].go_to, + my_strdup(_ALLOC_ID_, &xctx->simdata[i].pin[j].function, get_tok_value(symbol->prop_ptr, function, 0)); + my_strdup(_ALLOC_ID_, &xctx->simdata[i].pin[j].go_to, get_tok_value(symbol->rect[PINLAYER][j].prop_ptr, "goto", 0)); str = get_tok_value(symbol->rect[PINLAYER][j].prop_ptr, "clock", 0); xctx->simdata[i].pin[j].clock = str[0] ? str[0] - '0' : -1; @@ -1681,12 +1681,12 @@ void free_simdata(void) for(i = 0; i < xctx->simdata_ninst; ++i) { /* can not use xctx->instances if a new sch is loaded */ int npin = xctx->simdata[i].npin; for(j = 0; j < npin; ++j) { - my_free(737, &xctx->simdata[i].pin[j].function); - my_free(738, &xctx->simdata[i].pin[j].go_to); + my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].function); + my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].go_to); } - if(npin) my_free(739, &xctx->simdata[i].pin); + if(npin) my_free(_ALLOC_ID_, &xctx->simdata[i].pin); } - my_free(740, &xctx->simdata); + my_free(_ALLOC_ID_, &xctx->simdata); } xctx->simdata_ninst = 0; } @@ -1811,7 +1811,7 @@ static void propagate_logic() if( tclresult()[0] == '1') break; ++iter; } /* while(1) */ - /* my_free(741, &propagated_net); */ + /* my_free(_ALLOC_ID_, &propagated_net); */ } void logic_set(int value, int num, const char *net_name) @@ -1951,7 +1951,7 @@ void hilight_net(int viewer) } if( viewer == XSCHEM_GRAPH && s) { tclvareval("graph_add_nodes_from_list {", s, "}", NULL); - my_free(742, &s); + my_free(_ALLOC_ID_, &s); } if(!incr_hi) incr_hilight_color(); if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE); @@ -2069,7 +2069,7 @@ char *resolved_net(const char *net) /* global node ? return as is */ if(net && record_global_node(3, NULL, net)) { - my_strdup(743, &rnet, net); + my_strdup(_ALLOC_ID_, &rnet, net); return rnet; } if(net) { @@ -2093,18 +2093,18 @@ char *resolved_net(const char *net) } } dbg(1, "path=%s\n", path); - my_strdup2(744, &exp_net, expandlabel(net, &mult)); + my_strdup2(_ALLOC_ID_, &exp_net, expandlabel(net, &mult)); n_s1 = exp_net; for(k = 0; k < mult; k++) { char *net_name = my_strtok_r(n_s1, ",", "", 0, &n_s2); level = xctx->currsch; n_s1 = NULL; - my_strdup2(745, &resolved_net, net_name); + my_strdup2(_ALLOC_ID_, &resolved_net, net_name); dbg(1, "resolved_net(): resolved_net=%s\n", resolved_net); if(xctx->currsch > 0) { /* check if net passed by attribute instead of by port */ const char *ptr = get_tok_value(xctx->hier_attr[xctx->currsch - 1].prop_ptr, resolved_net, 0); if(ptr && ptr[0]) { - my_strdup2(746, &resolved_net, ptr); + my_strdup2(_ALLOC_ID_, &resolved_net, ptr); level--; dbg(1, "lcc[%d].prop_ptr=%s\n", xctx->currsch - 1, xctx->hier_attr[xctx->currsch - 1].prop_ptr); dbg(1, "resolved_net(): resolved_net=%s\n", resolved_net); @@ -2113,13 +2113,13 @@ char *resolved_net(const char *net) while(level > start_level) { /* get net from parent nets attached to port if resolved_net is a port */ entry = str_hash_lookup(&xctx->portmap[level], resolved_net, NULL, XLOOKUP); if(entry) { - my_strdup2(747, &resolved_net, entry->value); + my_strdup2(_ALLOC_ID_, &resolved_net, entry->value); dbg(1, "resolved_net(): while loop: resolved_net=%s\n", resolved_net); } else break; level--; } - my_strdup2(748, &path2, path); + my_strdup2(_ALLOC_ID_, &path2, path); skip = start_level; path2_ptr = path2; if(level == start_level) path2_ptr[0] = '\0'; @@ -2134,15 +2134,15 @@ char *resolved_net(const char *net) dbg(1, "path2=%s level=%d start_level=%d\n", path2, level, start_level); if(record_global_node(3, NULL, resolved_net)) { - my_strdup2(749, &rnet, resolved_net); + my_strdup2(_ALLOC_ID_, &rnet, resolved_net); } else { - my_mstrcat(750, &rnet, path2, resolved_net, NULL); + my_mstrcat(_ALLOC_ID_, &rnet, path2, resolved_net, NULL); } - if(k < mult - 1) my_strcat(751, &rnet, ","); + if(k < mult - 1) my_strcat(_ALLOC_ID_, &rnet, ","); } - if(resolved_net) my_free(752, &resolved_net); - my_free(753, &path2); - my_free(754, &exp_net); + if(resolved_net) my_free(_ALLOC_ID_, &resolved_net); + my_free(_ALLOC_ID_, &path2); + my_free(_ALLOC_ID_, &exp_net); } dbg(1, "resolved_net(): got %s, return %s\n", net, rnet); return rnet; @@ -2263,14 +2263,14 @@ void print_hilight_net(int show) fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); return; } - my_strdup(755, &filetmp2, filename_ptr); + my_strdup(_ALLOC_ID_, &filetmp2, filename_ptr); fclose(fd); if(!(fd = open_tmpfile("hilight1_", "", &filename_ptr))) { fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); - my_free(756, &filetmp2); + my_free(_ALLOC_ID_, &filetmp2); return; } - my_strdup(757, &filetmp1, filename_ptr); + my_strdup(_ALLOC_ID_, &filetmp1, filename_ptr); my_snprintf(cmd, S(cmd), "awk -f \"%s/order_labels.awk\"", tclgetvar("XSCHEM_SHAREDIR")); my_snprintf(cmd2, S(cmd2), "%s %s > %s", cmd, filetmp1, filetmp2); my_snprintf(cmd3, S(cmd3), "awk -f \"%s/sort_labels.awk\" %s", tclgetvar("XSCHEM_SHAREDIR"), filetmp1); @@ -2343,8 +2343,8 @@ void print_hilight_net(int show) xctx->prep_hi_structs=0; xctx->prep_net_structs=0; - my_free(758, &filetmp1); - my_free(759, &filetmp2); + my_free(_ALLOC_ID_, &filetmp1); + my_free(_ALLOC_ID_, &filetmp2); } void list_hilights(int all) diff --git a/src/in_memory_undo.c b/src/in_memory_undo.c index 3b9e6234..313f54e9 100644 --- a/src/in_memory_undo.c +++ b/src/in_memory_undo.c @@ -28,9 +28,9 @@ static void free_undo_lines(int slot) for(c = 0;cuslot[slot].lines[c]; ++i) { - my_free(760, &xctx->uslot[slot].lptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr); } - my_free(761, &xctx->uslot[slot].lptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c]); xctx->uslot[slot].lines[c] = 0; } } @@ -41,9 +41,9 @@ static void free_undo_rects(int slot) for(c = 0;cuslot[slot].rects[c]; ++i) { - my_free(762, &xctx->uslot[slot].bptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr); } - my_free(763, &xctx->uslot[slot].bptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c]); xctx->uslot[slot].rects[c] = 0; } } @@ -54,12 +54,12 @@ static void free_undo_polygons(int slot) for(c = 0;cuslot[slot].polygons[c]; ++i) { - my_free(764, &xctx->uslot[slot].pptr[c][i].prop_ptr); - my_free(765, &xctx->uslot[slot].pptr[c][i].x); - my_free(766, &xctx->uslot[slot].pptr[c][i].y); - my_free(767, &xctx->uslot[slot].pptr[c][i].selected_point); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].x); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].y); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].selected_point); } - my_free(768, &xctx->uslot[slot].pptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c]); xctx->uslot[slot].polygons[c] = 0; } } @@ -70,9 +70,9 @@ static void free_undo_arcs(int slot) for(c = 0;cuslot[slot].arcs[c]; ++i) { - my_free(769, &xctx->uslot[slot].aptr[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr); } - my_free(770, &xctx->uslot[slot].aptr[c]); + my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c]); xctx->uslot[slot].arcs[c] = 0; } } @@ -82,9 +82,9 @@ static void free_undo_wires(int slot) int i; for(i = 0;iuslot[slot].wires; ++i) { - my_free(771, &xctx->uslot[slot].wptr[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr[i].prop_ptr); } - my_free(772, &xctx->uslot[slot].wptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr); xctx->uslot[slot].wires = 0; } @@ -93,13 +93,13 @@ static void free_undo_texts(int slot) int i; for(i = 0;iuslot[slot].texts; ++i) { - my_free(773, &xctx->uslot[slot].tptr[i].prop_ptr); - my_free(774, &xctx->uslot[slot].tptr[i].txt_ptr); - my_free(775, &xctx->uslot[slot].tptr[i].font); - my_free(776, &xctx->uslot[slot].tptr[i].floater_instname); - my_free(777, &xctx->uslot[slot].tptr[i].floater_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_instname); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_ptr); } - my_free(778, &xctx->uslot[slot].tptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr); xctx->uslot[slot].texts = 0; } @@ -108,12 +108,12 @@ static void free_undo_instances(int slot) int i; for(i = 0;iuslot[slot].instances; ++i) { - my_free(779, &xctx->uslot[slot].iptr[i].name); - my_free(780, &xctx->uslot[slot].iptr[i].prop_ptr); - my_free(781, &xctx->uslot[slot].iptr[i].instname); - my_free(782, &xctx->uslot[slot].iptr[i].lab); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].name); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].instname); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].lab); } - my_free(783, &xctx->uslot[slot].iptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr); xctx->uslot[slot].instances = 0; } @@ -125,77 +125,77 @@ static void free_undo_symbols(int slot) symbols = xctx->uslot[slot].symbols; for(i = 0;i < symbols; ++i) { sym = &xctx->uslot[slot].symptr[i]; - my_free(784, &sym->name); - my_free(785, &sym->prop_ptr); - my_free(786, &sym->type); - my_free(787, &sym->templ); - my_free(788, &sym->parent_prop_ptr); + my_free(_ALLOC_ID_, &sym->name); + my_free(_ALLOC_ID_, &sym->prop_ptr); + my_free(_ALLOC_ID_, &sym->type); + my_free(_ALLOC_ID_, &sym->templ); + my_free(_ALLOC_ID_, &sym->parent_prop_ptr); for(c = 0;cpolygons[c]; ++j) { if(sym->poly[c][j].prop_ptr != NULL) { - my_free(789, &sym->poly[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->poly[c][j].prop_ptr); } - my_free(790, &sym->poly[c][j].x); - my_free(791, &sym->poly[c][j].y); - my_free(792, &sym->poly[c][j].selected_point); + my_free(_ALLOC_ID_, &sym->poly[c][j].x); + my_free(_ALLOC_ID_, &sym->poly[c][j].y); + my_free(_ALLOC_ID_, &sym->poly[c][j].selected_point); } - my_free(793, &sym->poly[c]); + my_free(_ALLOC_ID_, &sym->poly[c]); sym->polygons[c] = 0; for(j = 0;jlines[c]; ++j) { if(sym->line[c][j].prop_ptr != NULL) { - my_free(794, &sym->line[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->line[c][j].prop_ptr); } } - my_free(795, &sym->line[c]); + my_free(_ALLOC_ID_, &sym->line[c]); sym->lines[c] = 0; for(j = 0;jarcs[c]; ++j) { if(sym->arc[c][j].prop_ptr != NULL) { - my_free(796, &sym->arc[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->arc[c][j].prop_ptr); } } - my_free(797, &sym->arc[c]); + my_free(_ALLOC_ID_, &sym->arc[c]); sym->arcs[c] = 0; for(j = 0;jrects[c]; ++j) { if(sym->rect[c][j].prop_ptr != NULL) { - my_free(798, &sym->rect[c][j].prop_ptr); + my_free(_ALLOC_ID_, &sym->rect[c][j].prop_ptr); } } - my_free(799, &sym->rect[c]); + my_free(_ALLOC_ID_, &sym->rect[c]); sym->rects[c] = 0; } for(j = 0;jtexts; ++j) { if(sym->text[j].prop_ptr != NULL) { - my_free(800, &sym->text[j].prop_ptr); + my_free(_ALLOC_ID_, &sym->text[j].prop_ptr); } if(sym->text[j].txt_ptr != NULL) { - my_free(801, &sym->text[j].txt_ptr); + my_free(_ALLOC_ID_, &sym->text[j].txt_ptr); } if(sym->text[j].font != NULL) { - my_free(802, &sym->text[j].font); + my_free(_ALLOC_ID_, &sym->text[j].font); } if(sym->text[j].floater_instname != NULL) { - my_free(803, &sym->text[j].floater_instname); + my_free(_ALLOC_ID_, &sym->text[j].floater_instname); } if(sym->text[j].floater_ptr != NULL) { - my_free(804, &sym->text[j].floater_ptr); + my_free(_ALLOC_ID_, &sym->text[j].floater_ptr); } } - my_free(805, &sym->text); + my_free(_ALLOC_ID_, &sym->text); sym->texts = 0; - my_free(806, &sym->line); - my_free(807, &sym->rect); - my_free(808, &sym->poly); - my_free(809, &sym->arc); - my_free(810, &sym->lines); - my_free(811, &sym->rects); - my_free(812, &sym->polygons); - my_free(813, &sym->arcs); + my_free(_ALLOC_ID_, &sym->line); + my_free(_ALLOC_ID_, &sym->rect); + my_free(_ALLOC_ID_, &sym->poly); + my_free(_ALLOC_ID_, &sym->arc); + my_free(_ALLOC_ID_, &sym->lines); + my_free(_ALLOC_ID_, &sym->rects); + my_free(_ALLOC_ID_, &sym->polygons); + my_free(_ALLOC_ID_, &sym->arcs); } - my_free(814, &xctx->uslot[slot].symptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].symptr); xctx->uslot[slot].symbols = 0; } @@ -206,14 +206,14 @@ static void mem_init_undo(void) dbg(1, "mem_init_undo(): undo_initialized = %d\n", xctx->mem_undo_initialized); if(!xctx->mem_undo_initialized) { for(slot = 0;slotuslot[slot].lines = my_calloc(815, cadlayers, sizeof(int)); - xctx->uslot[slot].rects = my_calloc(816, cadlayers, sizeof(int)); - xctx->uslot[slot].arcs = my_calloc(817, cadlayers, sizeof(int)); - xctx->uslot[slot].polygons = my_calloc(818, cadlayers, sizeof(int)); - xctx->uslot[slot].lptr = my_calloc(819, cadlayers, sizeof(xLine *)); - xctx->uslot[slot].bptr = my_calloc(820, cadlayers, sizeof(xRect *)); - xctx->uslot[slot].aptr = my_calloc(821, cadlayers, sizeof(xArc *)); - xctx->uslot[slot].pptr = my_calloc(822, cadlayers, sizeof(xPoly *)); + xctx->uslot[slot].lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].arcs = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].polygons = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->uslot[slot].lptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + xctx->uslot[slot].bptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + xctx->uslot[slot].aptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); + xctx->uslot[slot].pptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); } xctx->mem_undo_initialized = 1; } @@ -248,14 +248,14 @@ void mem_delete_undo(void) if(!xctx->mem_undo_initialized) return; mem_clear_undo(); for(slot = 0;slotuslot[slot].lines); - my_free(824, &xctx->uslot[slot].rects); - my_free(825, &xctx->uslot[slot].arcs); - my_free(826, &xctx->uslot[slot].polygons); - my_free(827, &xctx->uslot[slot].lptr); - my_free(828, &xctx->uslot[slot].bptr); - my_free(829, &xctx->uslot[slot].aptr); - my_free(830, &xctx->uslot[slot].pptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lines); + my_free(_ALLOC_ID_, &xctx->uslot[slot].rects); + my_free(_ALLOC_ID_, &xctx->uslot[slot].arcs); + my_free(_ALLOC_ID_, &xctx->uslot[slot].polygons); + my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr); + my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr); } xctx->mem_undo_initialized = 0; } @@ -268,11 +268,11 @@ void mem_push_undo(void) mem_init_undo(); slot = xctx->cur_undo_ptr%MAX_UNDO; - my_strdup(831, &xctx->uslot[slot].gptr, xctx->schvhdlprop); - my_strdup(832, &xctx->uslot[slot].vptr, xctx->schverilogprop); - my_strdup(833, &xctx->uslot[slot].sptr, xctx->schprop); - my_strdup(834, &xctx->uslot[slot].kptr, xctx->schsymbolprop); - my_strdup(835, &xctx->uslot[slot].eptr, xctx->schtedaxprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].gptr, xctx->schvhdlprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].vptr, xctx->schverilogprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].sptr, xctx->schprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].kptr, xctx->schsymbolprop); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].eptr, xctx->schtedaxprop); free_undo_lines(slot); free_undo_rects(slot); @@ -288,15 +288,15 @@ void mem_push_undo(void) memcpy(xctx->uslot[slot].arcs, xctx->arcs, sizeof(xctx->arcs[0]) * cadlayers); memcpy(xctx->uslot[slot].polygons, xctx->polygons, sizeof(xctx->polygons[0]) * cadlayers); for(c = 0;cuslot[slot].lptr[c] = my_calloc(836, xctx->lines[c], sizeof(xLine)); - xctx->uslot[slot].bptr[c] = my_calloc(837, xctx->rects[c], sizeof(xRect)); - xctx->uslot[slot].pptr[c] = my_calloc(838, xctx->polygons[c], sizeof(xPoly)); - xctx->uslot[slot].aptr[c] = my_calloc(839, xctx->arcs[c], sizeof(xArc)); + xctx->uslot[slot].lptr[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine)); + xctx->uslot[slot].bptr[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect)); + xctx->uslot[slot].pptr[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly)); + xctx->uslot[slot].aptr[c] = my_calloc(_ALLOC_ID_, xctx->arcs[c], sizeof(xArc)); } - xctx->uslot[slot].wptr = my_calloc(840, xctx->wires, sizeof(xWire)); - xctx->uslot[slot].tptr = my_calloc(841, xctx->texts, sizeof(xText)); - xctx->uslot[slot].iptr = my_calloc(842, xctx->instances, sizeof(xInstance)); - xctx->uslot[slot].symptr = my_calloc(843, xctx->symbols, sizeof(xSymbol)); + xctx->uslot[slot].wptr = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(xWire)); + xctx->uslot[slot].tptr = my_calloc(_ALLOC_ID_, xctx->texts, sizeof(xText)); + xctx->uslot[slot].iptr = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(xInstance)); + xctx->uslot[slot].symptr = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(xSymbol)); xctx->uslot[slot].texts = xctx->texts; xctx->uslot[slot].instances = xctx->instances; xctx->uslot[slot].symbols = xctx->symbols; @@ -307,34 +307,34 @@ void mem_push_undo(void) for(i = 0;ilines[c]; ++i) { xctx->uslot[slot].lptr[c][i] = xctx->line[c][i]; xctx->uslot[slot].lptr[c][i].prop_ptr = NULL; - my_strdup(844, &xctx->uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr); } /* rects */ for(i = 0;irects[c]; ++i) { xctx->uslot[slot].bptr[c][i] = xctx->rect[c][i]; xctx->uslot[slot].bptr[c][i].prop_ptr = NULL; xctx->uslot[slot].bptr[c][i].extraptr = NULL; - my_strdup(845, &xctx->uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr); } /* arcs */ for(i = 0;iarcs[c]; ++i) { xctx->uslot[slot].aptr[c][i] = xctx->arc[c][i]; xctx->uslot[slot].aptr[c][i].prop_ptr = NULL; - my_strdup(846, &xctx->uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr); } /*polygons */ for(i = 0;ipolygons[c]; ++i) { int points = xctx->poly[c][i].points; xctx->uslot[slot].pptr[c][i] = xctx->poly[c][i]; xctx->uslot[slot].pptr[c][i].prop_ptr = NULL; - xctx->uslot[slot].pptr[c][i].x = my_malloc(847, points * sizeof(double)); - xctx->uslot[slot].pptr[c][i].y = my_malloc(848, points * sizeof(double)); - xctx->uslot[slot].pptr[c][i].selected_point = my_malloc(849, points * sizeof(unsigned short)); + xctx->uslot[slot].pptr[c][i].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->uslot[slot].pptr[c][i].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->uslot[slot].pptr[c][i].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); memcpy(xctx->uslot[slot].pptr[c][i].x, xctx->poly[c][i].x, points * sizeof(double)); memcpy(xctx->uslot[slot].pptr[c][i].y, xctx->poly[c][i].y, points * sizeof(double)); memcpy(xctx->uslot[slot].pptr[c][i].selected_point, xctx->poly[c][i].selected_point, points * sizeof(unsigned short)); - my_strdup(850, &xctx->uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr); } } /* instances */ @@ -345,10 +345,10 @@ void mem_push_undo(void) xctx->uslot[slot].iptr[i].instname = NULL; xctx->uslot[slot].iptr[i].lab = NULL; xctx->uslot[slot].iptr[i].node = NULL; - my_strdup2(851, &xctx->uslot[slot].iptr[i].lab, xctx->inst[i].lab); - my_strdup2(852, &xctx->uslot[slot].iptr[i].instname, xctx->inst[i].instname); - my_strdup2(853, &xctx->uslot[slot].iptr[i].prop_ptr, xctx->inst[i].prop_ptr); - my_strdup2(854, &xctx->uslot[slot].iptr[i].name, xctx->inst[i].name); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].lab, xctx->inst[i].lab); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].instname, xctx->inst[i].instname); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].prop_ptr, xctx->inst[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].name, xctx->inst[i].name); } /* symbols */ @@ -363,11 +363,11 @@ void mem_push_undo(void) xctx->uslot[slot].tptr[i].font = NULL; xctx->uslot[slot].tptr[i].floater_instname = NULL; xctx->uslot[slot].tptr[i].floater_ptr = NULL; - my_strdup2(855, &xctx->uslot[slot].tptr[i].prop_ptr, xctx->text[i].prop_ptr); - my_strdup2(856, &xctx->uslot[slot].tptr[i].txt_ptr, xctx->text[i].txt_ptr); - my_strdup2(857, &xctx->uslot[slot].tptr[i].font, xctx->text[i].font); - my_strdup2(858, &xctx->uslot[slot].tptr[i].floater_instname, xctx->text[i].floater_instname); - my_strdup2(859, &xctx->uslot[slot].tptr[i].floater_ptr, xctx->text[i].floater_ptr); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr, xctx->text[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr, xctx->text[i].txt_ptr); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font, xctx->text[i].font); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_instname, xctx->text[i].floater_instname); + my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_ptr, xctx->text[i].floater_ptr); } /* wires */ @@ -375,7 +375,7 @@ void mem_push_undo(void) xctx->uslot[slot].wptr[i] = xctx->wire[i]; xctx->uslot[slot].wptr[i].prop_ptr = NULL; xctx->uslot[slot].wptr[i].node = NULL; - my_strdup(860, &xctx->uslot[slot].wptr[i].prop_ptr, xctx->wire[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->uslot[slot].wptr[i].prop_ptr, xctx->wire[i].prop_ptr); } @@ -419,63 +419,63 @@ void mem_pop_undo(int redo, int set_modify_status) slot = xctx->cur_undo_ptr%MAX_UNDO; clear_drawing(); unselect_all(1); - my_free(861, &xctx->wire); - my_free(862, &xctx->text); - my_free(863, &xctx->inst); + my_free(_ALLOC_ID_, &xctx->wire); + my_free(_ALLOC_ID_, &xctx->text); + my_free(_ALLOC_ID_, &xctx->inst); for(i = 0;irect[i]); - my_free(865, &xctx->line[i]); - my_free(866, &xctx->poly[i]); - my_free(867, &xctx->arc[i]); + my_free(_ALLOC_ID_, &xctx->rect[i]); + my_free(_ALLOC_ID_, &xctx->line[i]); + my_free(_ALLOC_ID_, &xctx->poly[i]); + my_free(_ALLOC_ID_, &xctx->arc[i]); } remove_symbols(); - my_free(868, &xctx->sym); + my_free(_ALLOC_ID_, &xctx->sym); - my_strdup(869, &xctx->schvhdlprop, xctx->uslot[slot].gptr); - my_strdup(870, &xctx->schverilogprop, xctx->uslot[slot].vptr); - my_strdup(871, &xctx->schprop, xctx->uslot[slot].sptr); - my_strdup(872, &xctx->schsymbolprop, xctx->uslot[slot].kptr); - my_strdup(873, &xctx->schtedaxprop, xctx->uslot[slot].eptr); + my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, xctx->uslot[slot].gptr); + my_strdup(_ALLOC_ID_, &xctx->schverilogprop, xctx->uslot[slot].vptr); + my_strdup(_ALLOC_ID_, &xctx->schprop, xctx->uslot[slot].sptr); + my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, xctx->uslot[slot].kptr); + my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, xctx->uslot[slot].eptr); for(c = 0;cmaxl[c] = xctx->lines[c] = xctx->uslot[slot].lines[c]; - xctx->line[c] = my_calloc(874, xctx->lines[c], sizeof(xLine)); + xctx->line[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine)); for(i = 0;ilines[c]; ++i) { xctx->line[c][i] = xctx->uslot[slot].lptr[c][i]; xctx->line[c][i].prop_ptr = NULL; - my_strdup(875, &xctx->line[c][i].prop_ptr, xctx->uslot[slot].lptr[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->line[c][i].prop_ptr, xctx->uslot[slot].lptr[c][i].prop_ptr); } /* rects */ xctx->maxr[c] = xctx->rects[c] = xctx->uslot[slot].rects[c]; - xctx->rect[c] = my_calloc(876, xctx->rects[c], sizeof(xRect)); + xctx->rect[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect)); for(i = 0;irects[c]; ++i) { xctx->rect[c][i] = xctx->uslot[slot].bptr[c][i]; xctx->rect[c][i].prop_ptr = NULL; xctx->rect[c][i].extraptr = NULL; - my_strdup(877, &xctx->rect[c][i].prop_ptr, xctx->uslot[slot].bptr[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr, xctx->uslot[slot].bptr[c][i].prop_ptr); } /* arcs */ xctx->maxa[c] = xctx->arcs[c] = xctx->uslot[slot].arcs[c]; - xctx->arc[c] = my_calloc(878, xctx->arcs[c], sizeof(xArc)); + xctx->arc[c] = my_calloc(_ALLOC_ID_, xctx->arcs[c], sizeof(xArc)); for(i = 0;iarcs[c]; ++i) { xctx->arc[c][i] = xctx->uslot[slot].aptr[c][i]; xctx->arc[c][i].prop_ptr = NULL; - my_strdup(879, &xctx->arc[c][i].prop_ptr, xctx->uslot[slot].aptr[c][i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, xctx->uslot[slot].aptr[c][i].prop_ptr); } /* polygons */ xctx->maxp[c] = xctx->polygons[c] = xctx->uslot[slot].polygons[c]; - xctx->poly[c] = my_calloc(880, xctx->polygons[c], sizeof(xPoly)); + xctx->poly[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly)); for(i = 0;ipolygons[c]; ++i) { int points = xctx->uslot[slot].pptr[c][i].points; xctx->poly[c][i] = xctx->uslot[slot].pptr[c][i]; xctx->poly[c][i].prop_ptr = NULL; - my_strdup(881, &xctx->poly[c][i].prop_ptr, xctx->uslot[slot].pptr[c][i].prop_ptr); - xctx->poly[c][i].x = my_malloc(882, points * sizeof(double)); - xctx->poly[c][i].y = my_malloc(883, points * sizeof(double)); - xctx->poly[c][i].selected_point = my_malloc(884, points * sizeof(unsigned short)); + my_strdup(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr, xctx->uslot[slot].pptr[c][i].prop_ptr); + xctx->poly[c][i].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->poly[c][i].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); + xctx->poly[c][i].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); memcpy(xctx->poly[c][i].x, xctx->uslot[slot].pptr[c][i].x, points * sizeof(double)); memcpy(xctx->poly[c][i].y, xctx->uslot[slot].pptr[c][i].y, points * sizeof(double)); memcpy(xctx->poly[c][i].selected_point, xctx->uslot[slot].pptr[c][i].selected_point, @@ -485,22 +485,22 @@ void mem_pop_undo(int redo, int set_modify_status) /* instances */ xctx->maxi = xctx->instances = xctx->uslot[slot].instances; - xctx->inst = my_calloc(885, xctx->instances, sizeof(xInstance)); + xctx->inst = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(xInstance)); for(i = 0;iinstances; ++i) { xctx->inst[i] = xctx->uslot[slot].iptr[i]; xctx->inst[i].prop_ptr = NULL; xctx->inst[i].name = NULL; xctx->inst[i].instname = NULL; xctx->inst[i].lab = NULL; - my_strdup2(886, &xctx->inst[i].prop_ptr, xctx->uslot[slot].iptr[i].prop_ptr); - my_strdup2(887, &xctx->inst[i].name, xctx->uslot[slot].iptr[i].name); - my_strdup2(888, &xctx->inst[i].instname, xctx->uslot[slot].iptr[i].instname); - my_strdup2(889, &xctx->inst[i].lab, xctx->uslot[slot].iptr[i].lab); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].prop_ptr, xctx->uslot[slot].iptr[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, xctx->uslot[slot].iptr[i].name); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, xctx->uslot[slot].iptr[i].instname); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].lab, xctx->uslot[slot].iptr[i].lab); } /* symbols */ xctx->maxs = xctx->symbols = xctx->uslot[slot].symbols; - xctx->sym = my_calloc(890, xctx->symbols, sizeof(xSymbol)); + xctx->sym = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(xSymbol)); for(i = 0;isymbols; ++i) { copy_symbol(&xctx->sym[i], &xctx->uslot[slot].symptr[i]); @@ -508,7 +508,7 @@ void mem_pop_undo(int redo, int set_modify_status) /* texts */ xctx->maxt = xctx->texts = xctx->uslot[slot].texts; - xctx->text = my_calloc(891, xctx->texts, sizeof(xText)); + xctx->text = my_calloc(_ALLOC_ID_, xctx->texts, sizeof(xText)); for(i = 0;itexts; ++i) { xctx->text[i] = xctx->uslot[slot].tptr[i]; xctx->text[i].txt_ptr = NULL; @@ -516,21 +516,21 @@ void mem_pop_undo(int redo, int set_modify_status) xctx->text[i].floater_instname = NULL; xctx->text[i].floater_ptr = NULL; xctx->text[i].prop_ptr = NULL; - my_strdup2(892, &xctx->text[i].prop_ptr, xctx->uslot[slot].tptr[i].prop_ptr); - my_strdup2(893, &xctx->text[i].txt_ptr, xctx->uslot[slot].tptr[i].txt_ptr); - my_strdup2(894, &xctx->text[i].font, xctx->uslot[slot].tptr[i].font); - my_strdup2(895, &xctx->text[i].floater_instname, xctx->uslot[slot].tptr[i].floater_instname); - my_strdup2(896, &xctx->text[i].floater_ptr, xctx->uslot[slot].tptr[i].floater_ptr); + my_strdup2(_ALLOC_ID_, &xctx->text[i].prop_ptr, xctx->uslot[slot].tptr[i].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->text[i].txt_ptr, xctx->uslot[slot].tptr[i].txt_ptr); + my_strdup2(_ALLOC_ID_, &xctx->text[i].font, xctx->uslot[slot].tptr[i].font); + my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_instname, xctx->uslot[slot].tptr[i].floater_instname); + my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_ptr, xctx->uslot[slot].tptr[i].floater_ptr); } /* wires */ xctx->maxw = xctx->wires = xctx->uslot[slot].wires; - xctx->wire = my_calloc(897, xctx->wires, sizeof(xWire)); + xctx->wire = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(xWire)); for(i = 0;iwires; ++i) { xctx->wire[i] = xctx->uslot[slot].wptr[i]; xctx->wire[i].prop_ptr = NULL; xctx->wire[i].node = NULL; - my_strdup(898, &xctx->wire[i].prop_ptr, xctx->uslot[slot].wptr[i].prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[i].prop_ptr, xctx->uslot[slot].wptr[i].prop_ptr); } /* unnecessary since in_memory_undo saves all symbols */ /* link_symbols_to_instances(-1); */ diff --git a/src/main.c b/src/main.c index 35595397..f3a5d07d 100644 --- a/src/main.c +++ b/src/main.c @@ -118,17 +118,17 @@ int main(int argc, char **argv) } #endif - my_strdup(899, &xschem_executable, argv[0]); + my_strdup(_ALLOC_ID_, &xschem_executable, argv[0]); if(debug_var>=1 && !has_x) fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n"); /* if cli_opt_detach is 1 no interactive command shell is created ... * using cli_opt_detach if no windowing exists (has_x == 0) is non sense so do nothing */ - cli_opt_argv = my_malloc(900, cli_opt_argc * sizeof(char *)); + cli_opt_argv = my_malloc(_ALLOC_ID_, cli_opt_argc * sizeof(char *)); for(i = 0; i < cli_opt_argc; ++i) { cli_opt_argv[i] = NULL; - my_strdup(901, &cli_opt_argv[i], argv[i]); + my_strdup(_ALLOC_ID_, &cli_opt_argv[i], argv[i]); } diff --git a/src/move.c b/src/move.c index 7483cc42..d7b97e54 100644 --- a/src/move.c +++ b/src/move.c @@ -32,7 +32,7 @@ void flip_rotate_ellipse(xRect *r, int rot, int flip) if(flip) { r->ellipse_a = 180 - r->ellipse_a - r->ellipse_b; my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b); - my_strdup2(902, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); } if(rot) { if(rot == 3) { @@ -44,7 +44,7 @@ void flip_rotate_ellipse(xRect *r, int rot, int flip) } r->ellipse_a %= 360; my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b); - my_strdup2(903, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); } } } @@ -133,8 +133,8 @@ void check_collapsing_objects() { if(xctx->wire[i].x1==xctx->wire[i].x2 && xctx->wire[i].y1 == xctx->wire[i].y2) { - my_free(904, &xctx->wire[i].prop_ptr); - my_free(905, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); found=1; ++j; continue; @@ -154,7 +154,7 @@ void check_collapsing_objects() { if(xctx->line[c][i].x1==xctx->line[c][i].x2 && xctx->line[c][i].y1 == xctx->line[c][i].y2) { - my_free(906, &xctx->line[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr); found=1; ++j; continue; @@ -173,7 +173,7 @@ void check_collapsing_objects() { if(xctx->rect[c][i].x1==xctx->rect[c][i].x2 || xctx->rect[c][i].y1 == xctx->rect[c][i].y2) { - my_free(907, &xctx->rect[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr); set_rect_extraptr(0, &xctx->rect[c][i]); found=1; ++j; @@ -334,8 +334,8 @@ void draw_selection(GC g, int interruptable) case POLYGON: { int bezier; - double *x = my_malloc(908, sizeof(double) *xctx->poly[c][n].points); - double *y = my_malloc(909, sizeof(double) *xctx->poly[c][n].points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); bezier = 2 + !strboolcmp(get_tok_value(xctx->poly[c][n].prop_ptr, "bezier", 0), "true"); if(xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].sel==SELECTED1) { for(k=0;kpoly[c][n].points; ++k) { @@ -356,8 +356,8 @@ void draw_selection(GC g, int interruptable) } drawtemppolygon(g, NOW, x, y, xctx->poly[c][n].points, bezier); } - my_free(910, &x); - my_free(911, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } break; @@ -543,21 +543,21 @@ void update_attached_floaters(const char *from_name, int inst, int sel) if(!attach[0]) return; new_attach = str_replace(attach, from_name, to_name, 1, 1); - my_strdup(912, &xctx->inst[inst].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->inst[inst].prop_ptr, subst_token(xctx->inst[inst].prop_ptr, "attach", new_attach) ); for(c = 0; c < cadlayers; c++) { for(i = 0; i < xctx->rects[c]; i++) { if(!sel || xctx->rect[c][i].sel == SELECTED) { if( !strcmp(from_name, get_tok_value(xctx->rect[c][i].prop_ptr, "name", 0))) { - my_strdup(913, &xctx->rect[c][i].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr, subst_token(xctx->rect[c][i].prop_ptr, "name", to_name) ); } if(c == GRIDLAYER) { const char *node = get_tok_value(xctx->rect[c][i].prop_ptr, "node", 2); if(node && node[0]) { const char *new_node = str_replace(node, from_name, to_name, 1, -1); - my_strdup(914, &xctx->rect[c][i].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr, subst_token(xctx->rect[c][i].prop_ptr, "node", new_node)); } } @@ -566,7 +566,7 @@ void update_attached_floaters(const char *from_name, int inst, int sel) for(i = 0; i < xctx->lines[c]; i++) { if((!sel || xctx->line[c][i].sel == SELECTED) && !strcmp(from_name, get_tok_value(xctx->line[c][i].prop_ptr, "name", 0))) { - my_strdup(915, &xctx->line[c][i].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->line[c][i].prop_ptr, subst_token(xctx->line[c][i].prop_ptr, "name", to_name) ); } } @@ -574,7 +574,7 @@ void update_attached_floaters(const char *from_name, int inst, int sel) for(i = 0; i < xctx->polygons[c]; i++) { if((!sel || xctx->poly[c][i].sel == SELECTED) && !strcmp(from_name, get_tok_value(xctx->poly[c][i].prop_ptr, "name", 0))) { - my_strdup(916, &xctx->poly[c][i].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr, subst_token(xctx->poly[c][i].prop_ptr, "name", to_name) ); } @@ -582,7 +582,7 @@ void update_attached_floaters(const char *from_name, int inst, int sel) for(i = 0; i < xctx->arcs[c]; i++) { if((!sel || xctx->arc[c][i].sel == SELECTED) && !strcmp(from_name, get_tok_value(xctx->arc[c][i].prop_ptr, "name", 0))) { - my_strdup(917, &xctx->arc[c][i].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, subst_token(xctx->arc[c][i].prop_ptr, "name", to_name) ); } } @@ -590,14 +590,14 @@ void update_attached_floaters(const char *from_name, int inst, int sel) for(i = 0; i < xctx->wires; i++) { if((!sel || xctx->wire[i].sel == SELECTED) && !strcmp(from_name, get_tok_value(xctx->wire[i].prop_ptr, "name", 0))) { - my_strdup(918, &xctx->wire[i].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->wire[i].prop_ptr, subst_token(xctx->wire[i].prop_ptr, "name", to_name) ); } } for(i = 0; i < xctx->texts; i++) { if((!sel || xctx->text[i].sel == SELECTED) && !strcmp(from_name, get_tok_value(xctx->text[i].prop_ptr, "name", 0))) { - my_strdup(919, &xctx->text[i].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->text[i].prop_ptr, subst_token(xctx->text[i].prop_ptr, "name", to_name) ); set_text_flags(&xctx->text[i]); } @@ -792,8 +792,8 @@ void copy_objects(int what) { xPoly *p = &xctx->poly[c][n]; double bx1 = 0.0, by1 = 0.0, bx2 = 0.0, by2 = 0.0; - double *x = my_malloc(920, sizeof(double) *p->points); - double *y = my_malloc(921, sizeof(double) *p->points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) *p->points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) *p->points); int j; for(j=0; jpoints; ++j) { if( p->sel==SELECTED || p->selected_point[j]) { @@ -816,8 +816,8 @@ void copy_objects(int what) xctx->sel_array[i].n=xctx->polygons[c]; store_poly(-1, x, y, p->points, c, p->sel, p->prop_ptr); p->sel=0; - my_free(922, &x); - my_free(923, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } break; case ARC: @@ -881,7 +881,7 @@ void copy_objects(int what) xctx->text[n].x0, xctx->text[n].y0, xctx->rx1,xctx->ry1); } xctx->text[xctx->texts].txt_ptr=NULL; - my_strdup2(924, &xctx->text[xctx->texts].txt_ptr,xctx->text[n].txt_ptr); + my_strdup2(_ALLOC_ID_, &xctx->text[xctx->texts].txt_ptr,xctx->text[n].txt_ptr); xctx->text[n].sel=0; dbg(2, "copy_objects(): current str=%s\n", xctx->text[xctx->texts].txt_ptr); @@ -896,9 +896,9 @@ void copy_objects(int what) xctx->text[xctx->texts].font=NULL; xctx->text[xctx->texts].floater_instname=NULL; xctx->text[xctx->texts].floater_ptr=NULL; - my_strdup2(925, &xctx->text[xctx->texts].prop_ptr, xctx->text[n].prop_ptr); - my_strdup2(926, &xctx->text[xctx->texts].floater_ptr, xctx->text[n].floater_ptr); - my_strdup2(927, &xctx->text[xctx->texts].floater_instname, xctx->text[n].floater_instname); + my_strdup2(_ALLOC_ID_, &xctx->text[xctx->texts].prop_ptr, xctx->text[n].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->text[xctx->texts].floater_ptr, xctx->text[n].floater_ptr); + my_strdup2(_ALLOC_ID_, &xctx->text[xctx->texts].floater_instname, xctx->text[n].floater_instname); set_text_flags(&xctx->text[xctx->texts]); xctx->text[xctx->texts].xscale=xctx->text[n].xscale; xctx->text[xctx->texts].yscale=xctx->text[n].yscale; @@ -914,7 +914,7 @@ void copy_objects(int what) xctx->text[l].hcenter, xctx->text[l].vcenter, xctx->text[l].x0, xctx->text[l].y0, &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpi, &dtmp); - my_free(928, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -952,9 +952,9 @@ void copy_objects(int what) xctx->inst[xctx->instances].lab=NULL; xctx->inst[xctx->instances].node=NULL; xctx->inst[xctx->instances].name=NULL; - my_strdup2(929, &xctx->inst[xctx->instances].name, xctx->inst[n].name); - my_strdup2(930, &xctx->inst[xctx->instances].prop_ptr, xctx->inst[n].prop_ptr); - my_strdup2(931, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab); + my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].name, xctx->inst[n].name); + my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].prop_ptr, xctx->inst[n].prop_ptr); + my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab); xctx->inst[n].sel=0; xctx->inst[xctx->instances].embed = xctx->inst[n].embed; xctx->inst[xctx->instances].flags = xctx->inst[n].flags; @@ -966,7 +966,7 @@ void copy_objects(int what) xctx->inst[xctx->instances].rot = (xctx->inst[xctx->instances].rot + ( (xctx->move_flip && (xctx->inst[xctx->instances].rot & 1) ) ? xctx->move_rot+2 : xctx->move_rot) ) & 0x3; xctx->inst[xctx->instances].flip = (xctx->move_flip? !xctx->inst[n].flip:xctx->inst[n].flip); - my_strdup2(932, &xctx->inst[xctx->instances].instname, xctx->inst[n].instname); + my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].instname, xctx->inst[n].instname); /* the newpropcnt argument is zero for the 1st call and used in */ /* new_prop_string() for cleaning some internal caches. */ if(!newpropcnt) hash_names(-1, XINSERT); @@ -1500,7 +1500,7 @@ void move_objects(int what, int merge, double dx, double dy) xctx->text[n].yscale, xctx->text[n].rot,xctx->text[n].flip, xctx->text[n].hcenter, xctx->text[n].vcenter, xctx->text[n].x0, xctx->text[n].y0, &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp); - my_free(933, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -1527,7 +1527,7 @@ void move_objects(int what, int merge, double dx, double dy) xctx->text[n].yscale, xctx->text[n].rot,xctx->text[n].flip, xctx->text[n].hcenter, xctx->text[n].vcenter, xctx->text[n].x0, xctx->text[n].y0, &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp); - my_free(934, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); diff --git a/src/netlist.c b/src/netlist.c index c2c749fa..29844dab 100644 --- a/src/netlist.c +++ b/src/netlist.c @@ -33,7 +33,7 @@ static void instdelete(int n, int x, int y) while(ptr) { if(ptr->n == n) { saveptr = ptr->next; - my_free(935, &ptr); + my_free(_ALLOC_ID_, &ptr); *prevptr = saveptr; return; } @@ -46,7 +46,7 @@ static void instinsert(int n, int x, int y) { Instentry *ptr, *newptr; ptr=xctx->inst_spatial_table[x][y]; - newptr=my_malloc(936, sizeof(Instentry)); + newptr=my_malloc(_ALLOC_ID_, sizeof(Instentry)); newptr->next=ptr; newptr->n=n; xctx->inst_spatial_table[x][y]=newptr; @@ -58,7 +58,7 @@ static Instentry *delinstentry(Instentry *t) Instentry *tmp; while( t ) { tmp = t->next; - my_free(937, &t); + my_free(_ALLOC_ID_, &t); t = tmp; } return NULL; @@ -140,7 +140,7 @@ static Objectentry *delobjectentry(Objectentry *t) Objectentry *tmp; while( t ) { tmp = t->next; - my_free(938, &t); + my_free(_ALLOC_ID_, &t); t = tmp; } return NULL; @@ -169,7 +169,7 @@ static void objectdelete(int type, int n, int c, int x, int y) while(ptr) { if(ptr->n == n && ptr->type == type && ptr->c == c ) { saveptr = ptr->next; - my_free(939, &ptr); + my_free(_ALLOC_ID_, &ptr); *prevptr = saveptr; return; } @@ -182,7 +182,7 @@ static void objectinsert(int type, int n, int c, int x, int y) { Objectentry *ptr, *newptr; ptr=xctx->object_spatial_table[x][y]; - newptr=my_malloc(940, sizeof(Instentry)); + newptr=my_malloc(_ALLOC_ID_, sizeof(Instentry)); newptr->next=ptr; newptr->type=type; newptr->n=n; @@ -243,7 +243,7 @@ void hash_object(int what, int type, int n, int c) xctx->text[n].hcenter, xctx->text[n].vcenter, xctx->text[n].x0, xctx->text[n].y0, &x1,&y1, &x2,&y2, &tmpi, &tmpd); - my_free(941, &estr); + my_free(_ALLOC_ID_, &estr); break; default: skip = 1; @@ -330,7 +330,7 @@ static void instpindelete(int n,int pin, int x, int y) while(ptr) { if(ptr->n == n && ptr->pin == pin) { saveptr = ptr->next; - my_free(942, &ptr); + my_free(_ALLOC_ID_, &ptr); *prevptr = saveptr; return; } @@ -345,7 +345,7 @@ static void instpininsert(int n,int pin, double x0, double y0, int x, int y) Instpinentry *ptr, *newptr; ptr=xctx->instpin_spatial_table[x][y]; - newptr=my_malloc(943, sizeof(Instpinentry)); + newptr=my_malloc(_ALLOC_ID_, sizeof(Instpinentry)); newptr->next=ptr; newptr->n=n; newptr->x0=x0; @@ -362,7 +362,7 @@ static Instpinentry *delinstpinentry(Instpinentry *t) while(t) { tmp = t->next; - my_free(944, &t); + my_free(_ALLOC_ID_, &t); t = tmp; } return NULL; @@ -387,7 +387,7 @@ static void wiredelete(int n, int x, int y) while(ptr) { if(ptr->n == n) { saveptr = ptr->next; - my_free(945, &ptr); + my_free(_ALLOC_ID_, &ptr); *prevptr = saveptr; return; } @@ -401,7 +401,7 @@ static void wireinsert(int n, int x, int y) Wireentry *ptr, *newptr; ptr=xctx->wire_spatial_table[x][y]; - newptr=my_malloc(946, sizeof(Wireentry)); + newptr=my_malloc(_ALLOC_ID_, sizeof(Wireentry)); newptr->next=ptr; newptr->n=n; xctx->wire_spatial_table[x][y]=newptr; @@ -414,7 +414,7 @@ static Wireentry *delwireentry(Wireentry *t) while( t ) { tmp = t->next; - my_free(947, &t); + my_free(_ALLOC_ID_, &t); t = tmp; } return NULL; @@ -617,11 +617,11 @@ void netlist_options(int i) /* fprintf(errfp, "netlist_options(): prop_ptr=%s\n", xctx->inst[i].prop_ptr); */ if(!strboolcmp(str, "true")) { tclsetintvar("lvs_netlist", 1); - my_strdup(948, &xctx->format, "lvs_format"); + my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format"); } else { tclsetintvar("lvs_netlist", 0); - my_strdup(949, &xctx->format, xctx->custom_format); + my_strdup(_ALLOC_ID_, &xctx->format, xctx->custom_format); } } @@ -711,10 +711,10 @@ int record_global_node(int what, FILE *fp, const char *node) if(what == 3) return 0; /* node is not a global */ if(xctx->max_globals >= xctx->size_globals) { xctx->size_globals+=CADCHUNKALLOC; - my_realloc(950, &xctx->globals, xctx->size_globals*sizeof(char *) ); + my_realloc(_ALLOC_ID_, &xctx->globals, xctx->size_globals*sizeof(char *) ); } xctx->globals[xctx->max_globals]=NULL; - my_strdup(951, &xctx->globals[xctx->max_globals], node); + my_strdup(_ALLOC_ID_, &xctx->globals[xctx->max_globals], node); xctx->max_globals++; } else if(what == 0) { for(i = 0;i < xctx->max_globals; ++i) { @@ -723,9 +723,9 @@ int record_global_node(int what, FILE *fp, const char *node) } } else if(what == 2) { for(i=0;imax_globals; ++i) { - my_free(952, &xctx->globals[i]); + my_free(_ALLOC_ID_, &xctx->globals[i]); } - my_free(953, &xctx->globals); + my_free(_ALLOC_ID_, &xctx->globals); xctx->size_globals = xctx->max_globals=0; } @@ -763,7 +763,7 @@ int get_unnamed_node(int what, int mult,int node) dbg(2, "get_unnamed_node(): what=%d mult=%d node=%d\n", what, mult, node); if(what==0) { /* initialize unnamed node data structures */ xctx->new_node=0; - my_free(954, &xctx->node_mult); + my_free(_ALLOC_ID_, &xctx->node_mult); xctx->node_mult_size=0; return 0; } @@ -777,7 +777,7 @@ int get_unnamed_node(int what, int mult,int node) if(xctx->new_node >= xctx->node_mult_size) { /* enlarge array and zero it */ int oldsize = xctx->node_mult_size; xctx->node_mult_size = xctx->new_node + CADCHUNKALLOC; - my_realloc(955, &xctx->node_mult, sizeof(xctx->node_mult[0]) * xctx->node_mult_size ); + my_realloc(_ALLOC_ID_, &xctx->node_mult, sizeof(xctx->node_mult[0]) * xctx->node_mult_size ); memset(xctx->node_mult + oldsize, 0, (xctx->node_mult_size - oldsize) * sizeof(xctx->node_mult[0])); } xctx->node_mult[xctx->new_node]=mult; @@ -813,7 +813,7 @@ static void name_generics() dbg(2, "name_generics(): naming generics from attached labels\n"); if(for_netlist) for (i=0;isym)->type); + my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type); if(type && !IS_LABEL_OR_PIN(type) ) { if((generic_rects = (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]) > 0) { rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER]; @@ -839,12 +839,12 @@ static void name_generics() if((inst[n].ptr+ xctx->sym)->type && inst[n].node[p] != NULL && !strcmp((inst[n].ptr+ xctx->sym)->type, "label")) { dbg(2, "name_generics(): naming generic %s\n", inst[n].node[p]); - my_strdup(957, &inst[i].node[j], get_tok_value(inst[n].prop_ptr,"value",0) ); + my_strdup(_ALLOC_ID_, &inst[i].node[j], get_tok_value(inst[n].prop_ptr,"value",0) ); if(!for_netlist) { - my_strdup(958, &sig_type,""); + my_strdup(_ALLOC_ID_, &sig_type,""); bus_node_hash_lookup(inst[n].node[p],"", XINSERT, 1, sig_type,"", "",""); } else { - my_strdup(959, &sig_type, + my_strdup(_ALLOC_ID_, &sig_type, get_tok_value(xctx->sym[inst[i].ptr].rect[GENERICLAYER][j-rects].prop_ptr, "sig_type", 0)); /* insert generic label in hash table as a port so it will not */ /* be declared as a signal in the vhdl netlist. this is a workaround */ @@ -860,7 +860,7 @@ static void name_generics() } /* end if( rects=...>0) */ } /* end if(type not a label nor pin)... */ } /* end for(i...) */ - if(type) my_free(960, &type); + if(type) my_free(_ALLOC_ID_, &type); } static int signal_short( const char *tag, const char *n1, const char *n2) @@ -893,7 +893,7 @@ static void set_inst_node(int i, int j, const char *node) if(!inst[i].node) return; dbg(1, "set_inst_node(): inst %s pin %d <-- %s\n", inst[i].instname, j, node); expandlabel(inst[i].instname, &inst_mult); - my_strdup(961, &inst[i].node[j], node); + my_strdup(_ALLOC_ID_, &inst[i].node[j], node); skip = skip_instance(i, 1, netlist_lvs_ignore); if(!for_netlist || skip) { bus_node_hash_lookup(inst[i].node[j],"", XINSERT, 0,"","","",""); @@ -979,8 +979,8 @@ static int wirecheck(int k) /* recursive routine */ touch(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, wire[k].x2, wire[k].y2); if( touches ) { if(!wire[n].node) { - my_strdup(962, &wire[n].node, wire[k].node); - my_strdup(963, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); + my_strdup(_ALLOC_ID_, &wire[n].node, wire[k].node); + my_strdup(_ALLOC_ID_, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); err |= name_attached_inst_to_net(n, tmpi, tmpj); err |= wirecheck(n); /* recursive check */ } else { @@ -1002,8 +1002,8 @@ static int name_attached_nets(double x0, double y0, int sqx, int sqy, const char int n = wptr->n; if(touch(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, x0,y0)) { if(!wire[n].node) { - my_strdup(964, &wire[n].node, node); - my_strdup(965, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); + my_strdup(_ALLOC_ID_, &wire[n].node, node); + my_strdup(_ALLOC_ID_, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); err |= wirecheck(n); } else { if(for_netlist>0) err |= signal_short("Net", wire[n].node, node); @@ -1104,8 +1104,8 @@ static int find_pass_through_symbols(int what, int ninst) int *symtable = NULL; if(what == 0 ) { /* initialize */ - pt_symbol = my_calloc(966, xctx->symbols, sizeof(int)); - symtable = my_calloc(967, xctx->symbols, sizeof(int)); + pt_symbol = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); + symtable = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); for(i = 0; i < instances; ++i) { k = inst[i].ptr; if( k < 0 || symtable[k] ) continue; @@ -1121,13 +1121,13 @@ static int find_pass_through_symbols(int what, int ninst) int_hash_free(&table); if(pt_symbol[k]) dbg(1, "duplicated pins: %s\n", xctx->sym[k].name); } - my_free(968, &symtable); + my_free(_ALLOC_ID_, &symtable); } else if(what ==1) { /* query */ k = inst[ninst].ptr; if(k >=0 && pt_symbol[k]) return 1; return 0; } else if(what ==2) { /* cleanup */ - my_free(969, &pt_symbol); + my_free(_ALLOC_ID_, &pt_symbol); } return -1; } @@ -1176,7 +1176,7 @@ static int instcheck(int n, int p) char *node_base_name = NULL; const char *tap; if(inst[n].node && inst[n].node[0] && inst[n].node[0][0] == '#') { - my_free(970, &inst[n].node[0]); /* bus tap forces net name on pin 0 (the tap) */ + my_free(_ALLOC_ID_, &inst[n].node[0]); /* bus tap forces net name on pin 0 (the tap) */ } /* delete any previously set unnamed net */ if(!inst[n].node[0]) { /* still unnamed */ /* tap = get_tok_value(inst[n].prop_ptr, "lab", 0); */ @@ -1196,12 +1196,12 @@ static int instcheck(int n, int p) } else { nptr = inst[n].node[p]; } - node_base_name = my_malloc(971, strlen(inst[n].node[p]) + 1); + node_base_name = my_malloc(_ALLOC_ID_, strlen(inst[n].node[p]) + 1); sscanf(nptr, "%[^[]", node_base_name); - my_strcat(972, &node_base_name, tap); + my_strcat(_ALLOC_ID_, &node_base_name, tap); } else { - my_strdup2(973, &node_base_name, tap); + my_strdup2(_ALLOC_ID_, &node_base_name, tap); } set_inst_node(n, 0, node_base_name); get_inst_pin_coord(n, 0, &x0, &y0); @@ -1212,7 +1212,7 @@ static int instcheck(int n, int p) if(for_netlist>0) err |= signal_short("Bus tap", inst[n].node[p], inst[n].node[0]); } dbg(1, "instcheck: bus tap node: p=%d, %s, tap=%s\n", p, inst[n].node[p], inst[n].node[0]); - my_free(974, &node_base_name); + my_free(_ALLOC_ID_, &node_base_name); } @@ -1220,7 +1220,7 @@ static int instcheck(int n, int p) else if(shorted_inst || find_pass_through_symbols(1, n)) { int k = inst[n].ptr; char *pin_name = NULL; - my_strdup(975, &pin_name, get_tok_value(xctx->sym[k].rect[PINLAYER][p].prop_ptr, "name", 0)); + my_strdup(_ALLOC_ID_, &pin_name, get_tok_value(xctx->sym[k].rect[PINLAYER][p].prop_ptr, "name", 0)); if(p >= rects) return 1; for(j = 0; j < rects; ++j) { const char *other_pin; @@ -1244,7 +1244,7 @@ static int instcheck(int n, int p) } } } - my_free(976, &pin_name); + my_free(_ALLOC_ID_, &pin_name); } return err; } @@ -1281,7 +1281,7 @@ static int name_nodes_of_pins_labels_and_propagate() for (i=0;isym)->type); + my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type); if(print_erc && (!inst[i].instname || !inst[i].instname[0]) && !get_tok_value(xctx->sym[inst[i].ptr].templ, "name", 0)[0] ) { @@ -1320,32 +1320,32 @@ static int name_nodes_of_pins_labels_and_propagate() } #endif port=0; - my_strdup2(978, &dir, ""); + my_strdup2(_ALLOC_ID_, &dir, ""); if(strcmp(type,"label")) { /* instance is a port (not a label) */ port=1; /* 20071204 only define a dir property if instance is not a label */ if(for_netlist) - my_strdup2(979, &dir, + my_strdup2(_ALLOC_ID_, &dir, get_tok_value(xctx->sym[inst[i].ptr].rect[PINLAYER][0].prop_ptr, "dir",0)); } else { /* handle global nodes (global=1 set as symbol property) 28032003 */ - my_strdup(980, &global_node,get_tok_value(inst[i].prop_ptr,"global",0)); + my_strdup(_ALLOC_ID_, &global_node,get_tok_value(inst[i].prop_ptr,"global",0)); if(!xctx->tok_size) { - my_strdup(981, &global_node,get_tok_value(xctx->sym[inst[i].ptr].prop_ptr,"global",0)); + my_strdup(_ALLOC_ID_, &global_node,get_tok_value(xctx->sym[inst[i].ptr].prop_ptr,"global",0)); } /*20071204 if instance is a label dont define a dir property for more precise erc checking */ } /* obtain ipin/opin/label signal type (default: std_logic) */ if(for_netlist) { - my_strdup(982, &sig_type,get_tok_value(inst[i].prop_ptr,"sig_type",0)); - my_strdup(983, &verilog_type,get_tok_value(inst[i].prop_ptr,"verilog_type",0)); - my_strdup(984, &value,get_tok_value(inst[i].prop_ptr,"value",0)); - my_strdup(985, &class,get_tok_value(inst[i].prop_ptr,"class",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(inst[i].prop_ptr,"sig_type",0)); + my_strdup(_ALLOC_ID_, &verilog_type,get_tok_value(inst[i].prop_ptr,"verilog_type",0)); + my_strdup(_ALLOC_ID_, &value,get_tok_value(inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &class,get_tok_value(inst[i].prop_ptr,"class",0)); } - my_strdup(986, &inst[i].node[0], inst[i].lab); + my_strdup(_ALLOC_ID_, &inst[i].node[0], inst[i].lab); if(!(inst[i].node[0])) { - my_strdup(987, &inst[i].node[0], get_tok_value(xctx->sym[inst[i].ptr].templ, "lab",0)); + my_strdup(_ALLOC_ID_, &inst[i].node[0], get_tok_value(xctx->sym[inst[i].ptr].templ, "lab",0)); dbg(1, "name_nodes_of_pins_labels_and_propagate(): no lab attr on instance, pick from symbol: %s\n", inst[i].node[0]); } @@ -1367,14 +1367,14 @@ static int name_nodes_of_pins_labels_and_propagate() err |= name_attached_inst(i, x0, y0, sqx, sqy, inst[i].node[0]); } /* if(type && ... */ } /* for(i=0;iwire[i].node, tmp_str); - my_strdup(996, &xctx->wire[i].prop_ptr, subst_token(xctx->wire[i].prop_ptr, "lab", tmp_str)); + my_strdup(_ALLOC_ID_, &xctx->wire[i].node, tmp_str); + my_strdup(_ALLOC_ID_, &xctx->wire[i].prop_ptr, subst_token(xctx->wire[i].prop_ptr, "lab", tmp_str)); /* insert unnamed wire name in hash table */ bus_node_hash_lookup(tmp_str, "", XINSERT, 0,"","","",""); err |= wirecheck(i); @@ -1495,7 +1495,7 @@ static int reset_node_data_and_rehash() (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]; if(rects > 0) { - inst[i].node = my_malloc(997, sizeof(char *) * rects); + inst[i].node = my_malloc(_ALLOC_ID_, sizeof(char *) * rects); for (j=0;j 0 ) { for(j=0;j< rects ; ++j) - my_free(998, &xctx->inst[i].node[j]); - my_free(999, &xctx->inst[i].node ); + my_free(_ALLOC_ID_, &xctx->inst[i].node[j]); + my_free(_ALLOC_ID_, &xctx->inst[i].node ); } } @@ -1573,7 +1573,7 @@ void delete_netlist_structs(void) } for(i=0;iwires; ++i) { - my_free(1000, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].node); } /* erase inst and wire topological hash tables */ del_inst_pin_table(); @@ -1776,21 +1776,21 @@ int sym_vs_sch_pins(int all) } symbol = match_symbol(name); - my_strdup(1001, &type, xctx->sym[symbol].type); + my_strdup(_ALLOC_ID_, &type, xctx->sym[symbol].type); if(type && IS_PIN(type)) { - my_strdup(1002, &lab, expandlabel(get_tok_value(tmp, "lab", 0), &mult)); + my_strdup(_ALLOC_ID_, &lab, expandlabel(get_tok_value(tmp, "lab", 0), &mult)); if(pin_cnt >= lab_array_size) { lab_array_size += CADCHUNKALLOC; - my_realloc(1003, &lab_array, lab_array_size * sizeof(char *)); + my_realloc(_ALLOC_ID_, &lab_array, lab_array_size * sizeof(char *)); } lab_array[pin_cnt] = NULL; - my_strdup(1004, &(lab_array[pin_cnt]), lab); + my_strdup(_ALLOC_ID_, &(lab_array[pin_cnt]), lab); pin_cnt++; pin_match = 0; for(j=0; j < rects; ++j) { - my_strdup(1005, &pin_name, + my_strdup(_ALLOC_ID_, &pin_name, expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult)); - my_strdup(1006, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0)); + my_strdup(_ALLOC_ID_, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0)); if( pin_name && !strcmp(pin_name, lab)) { @@ -1877,7 +1877,7 @@ int sym_vs_sch_pins(int all) } } for(j=0; j < rects; ++j) { - my_strdup(1007, &pin_name, + my_strdup(_ALLOC_ID_, &pin_name, expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult)); pin_match = 0; for(k=0; ksymbols > n_syms) remove_symbol(xctx->symbols - 1); diff --git a/src/node_hash.c b/src/node_hash.c index 3dfb4af3..4b44d98f 100644 --- a/src/node_hash.c +++ b/src/node_hash.c @@ -56,16 +56,16 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w { if( what==XINSERT ) /* insert data */ { - Node_hashentry *entry = (Node_hashentry *)my_malloc(1015, sizeof( Node_hashentry )); + Node_hashentry *entry = (Node_hashentry *)my_malloc(_ALLOC_ID_, sizeof( Node_hashentry )); entry->next = NULL; entry->token = entry->sig_type = entry->verilog_type = entry->value = entry->class = entry->orig_tok = NULL; - my_strdup(1016, &(entry->token),token); - if(sig_type &&sig_type[0]) my_strdup(1017, &(entry->sig_type), sig_type); - if(verilog_type &&verilog_type[0]) my_strdup(1018, &(entry->verilog_type), verilog_type); - if(class && class[0]) my_strdup(1019, &(entry->class), class); - if(orig_tok && orig_tok[0]) my_strdup(1020, &(entry->orig_tok), orig_tok); - if(value && value[0]) my_strdup(1021, &(entry->value), value); + my_strdup(_ALLOC_ID_, &(entry->token),token); + if(sig_type &&sig_type[0]) my_strdup(_ALLOC_ID_, &(entry->sig_type), sig_type); + if(verilog_type &&verilog_type[0]) my_strdup(_ALLOC_ID_, &(entry->verilog_type), verilog_type); + if(class && class[0]) my_strdup(_ALLOC_ID_, &(entry->class), class); + if(orig_tok && orig_tok[0]) my_strdup(_ALLOC_ID_, &(entry->orig_tok), orig_tok); + if(value && value[0]) my_strdup(_ALLOC_ID_, &(entry->value), value); entry->d.port=d.port; entry->d.in=d.in; entry->d.out=d.out; @@ -84,13 +84,13 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w if(what==XDELETE) /* remove token from the hash table ... */ { Node_hashentry *saveptr=(*preventry)->next, *entry = *preventry; - my_free(1022, &entry->token); - my_free(1023, &entry->verilog_type); - my_free(1024, &entry->sig_type); - my_free(1025, &entry->class); - my_free(1026, &entry->orig_tok); - my_free(1027, &entry->value); - my_free(1028, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->verilog_type); + my_free(_ALLOC_ID_, &entry->sig_type); + my_free(_ALLOC_ID_, &entry->class); + my_free(_ALLOC_ID_, &entry->orig_tok); + my_free(_ALLOC_ID_, &entry->value); + my_free(_ALLOC_ID_, &entry); *preventry=saveptr; return NULL; } @@ -102,11 +102,11 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w entry->d.out+=d.out; entry->d.inout+=d.inout; if(sig_type && sig_type[0] !='\0') - my_strdup(1029, &(entry->sig_type), sig_type); + my_strdup(_ALLOC_ID_, &(entry->sig_type), sig_type); if(verilog_type && verilog_type[0] !='\0') - my_strdup(1030, &(entry->verilog_type), verilog_type); + my_strdup(_ALLOC_ID_, &(entry->verilog_type), verilog_type); if(value && value[0] !='\0') - my_strdup(1031, &(entry->value), value); + my_strdup(_ALLOC_ID_, &(entry->value), value); dbg(3, "node_hash_lookup(): hashing %s : value=%s\n\n", entry->token, entry->value? entry->value:""); return entry; @@ -129,12 +129,12 @@ Node_hashentry *bus_node_hash_lookup(const char *token, const char *dir, int wha if(token==NULL || token[0] == 0) return NULL; if( token[0] == '#') { - my_strdup(1032, &string, token); + my_strdup(_ALLOC_ID_, &string, token); } else { dbg(3, "bus_node_hash_lookup(): expanding node: %s\n", token); - my_strdup(1033, &string, expandlabel(token,&mult)); + my_strdup(_ALLOC_ID_, &string, expandlabel(token,&mult)); dbg(3, "bus_node_hash_lookup(): done expanding node: %s\n", token); } if(string==NULL) return NULL; @@ -156,7 +156,7 @@ Node_hashentry *bus_node_hash_lookup(const char *token, const char *dir, int wha string_ptr++; } /* if something found return first pointer */ - my_free(1034, &string); + my_free(_ALLOC_ID_, &string); return ptr2; } @@ -166,13 +166,13 @@ static void node_hash_free_entry(Node_hashentry *entry) while(entry) { tmp = entry->next; - my_free(1035, &entry->token); - my_free(1036, &entry->verilog_type); - my_free(1037, &entry->sig_type); - my_free(1038, &entry->class); - my_free(1039, &entry->orig_tok); - my_free(1040, &entry->value); - my_free(1041, &entry); + my_free(_ALLOC_ID_, &entry->token); + my_free(_ALLOC_ID_, &entry->verilog_type); + my_free(_ALLOC_ID_, &entry->sig_type); + my_free(_ALLOC_ID_, &entry->class); + my_free(_ALLOC_ID_, &entry->orig_tok); + my_free(_ALLOC_ID_, &entry->value); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -277,9 +277,9 @@ void print_vhdl_signals(FILE *fd) dbg(2, "print_vhdl_signals(): node: %s mult: %d value=%s \n\n", ptr->token,mult, ptr->value?ptr->value:""); if( ptr->class && ptr->class[0] ) - my_strdup(1042, &class, ptr->class); + my_strdup(_ALLOC_ID_, &class, ptr->class); else - my_strdup(1043, &class, "signal"); + my_strdup(_ALLOC_ID_, &class, "signal"); if(mult>1) { for(j=mult-1;j>=0;j--) { fprintf(fd, "%s %s[%d] : ", class, ptr->token[0]=='#' ? ptr->token+1 : ptr->token,j); @@ -309,7 +309,7 @@ void print_vhdl_signals(FILE *fd) } } if(found) fprintf(fd, "\n" ); - my_free(1044, &class); + my_free(_ALLOC_ID_, &class); } @@ -378,25 +378,25 @@ void list_nets(char **result) prepare_netlist_structs(1); for(i = 0; i < xctx->instances; i++) { if(skip_instance(i, 0, netlist_lvs_ignore)) continue; - my_strdup(1045, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(type && xctx->inst[i].node && IS_PIN(type)) { - my_strdup2(1046, &pin_node, expandlabel(xctx->inst[i].lab, &mult)); + my_strdup2(_ALLOC_ID_, &pin_node, expandlabel(xctx->inst[i].lab, &mult)); p_n_s1 = pin_node; for(k = 1; k <= mult; ++k) { lab = my_strtok_r(p_n_s1, ",", "", 0, &p_n_s2); p_n_s1 = NULL; - my_mstrcat(1047, result, "{", lab, " ", type, "}\n", NULL); + my_mstrcat(_ALLOC_ID_, result, "{", lab, " ", type, "}\n", NULL); } } - if(pin_node) my_free(1048, &pin_node); + if(pin_node) my_free(_ALLOC_ID_, &pin_node); } - if(type) my_free(1049, &type); + if(type) my_free(_ALLOC_ID_, &type); for(i=0;inode_table[i]; while(ptr) { if(!ptr->d.port) { - my_mstrcat(1050, result, + my_mstrcat(_ALLOC_ID_, result, "{", ptr->token, " ", "net", "}\n", NULL); } ptr = ptr->next; diff --git a/src/options.c b/src/options.c index bc391fba..732cc3ed 100644 --- a/src/options.c +++ b/src/options.c @@ -74,11 +74,11 @@ static void check_opt(char *opt, char *optval, int type) } else if( (type == LONG && !strcmp("preinit", opt)) ) { dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); - if(optval) my_strdup(1051, &cli_opt_preinit_command, optval); + if(optval) my_strdup(_ALLOC_ID_, &cli_opt_preinit_command, optval); } else if( (type == LONG && !strcmp("tcl", opt)) ) { dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); - if(optval) my_strdup(1052, &cli_opt_tcl_command, optval); + if(optval) my_strdup(_ALLOC_ID_, &cli_opt_tcl_command, optval); } else if( (type == LONG && !strcmp("script", opt)) ) { dbg(1, "process_options(): passing tcl script file to interpreter: %s\n", optval); @@ -86,7 +86,7 @@ static void check_opt(char *opt, char *optval, int type) } else if( (type == LONG && !strcmp("command", opt)) ) { dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); - if(optval) my_strdup(1053, &cli_opt_tcl_post_command, optval); + if(optval) my_strdup(_ALLOC_ID_, &cli_opt_tcl_post_command, optval); } else if( (type == LONG && !strcmp("diff", opt)) ) { dbg(1, "process_options(): diff with: %s\n", optval); diff --git a/src/parselabel.l b/src/parselabel.l index 4129ecc9..3a217ec1 100644 --- a/src/parselabel.l +++ b/src/parselabel.l @@ -66,7 +66,7 @@ extern int yylex(); void clear_expandlabel_data(void) { - my_free(1054, &dest_string.str); + my_free(_ALLOC_ID_, &dest_string.str); } static void str_char_replace(char s[], char chr, char repl_chr) @@ -95,7 +95,7 @@ void parse(const char *s) const char *expandlabel(const char *s, int *m) { YY_BUFFER_STATE buf; - my_free(1055, &dest_string.str); /* 30102004 delete 'memory' of previous execution */ + my_free(_ALLOC_ID_, &dest_string.str); /* 30102004 delete 'memory' of previous execution */ if(!s) { *m = -1; @@ -104,7 +104,7 @@ const char *expandlabel(const char *s, int *m) if(parselabel_debug >= 3) fprintf(errfp, "expandlabel(): entering\n"); if(!strpbrk(s, "*,.:") || s[0] == '$') { /* shortcut: nothing to parse / expand */ *m = 1; - my_strdup2(1056, &dest_string.str, s); + my_strdup2(_ALLOC_ID_, &dest_string.str, s); if(xctx->netlist_type == CAD_SPICE_NETLIST && bus_char[0] && bus_char[1]) { str_char_replace(dest_string.str, '[', bus_char[0]); str_char_replace(dest_string.str, ']', bus_char[1]); @@ -119,13 +119,13 @@ const char *expandlabel(const char *s, int *m) size_t l; yyparse_error = -1; l = strlen(s)+400; - cmd = my_malloc(1057, l); + cmd = my_malloc(_ALLOC_ID_, l); fprintf(errfp, "syntax error in %s\n", s); my_snprintf(cmd, l, "tk_messageBox -icon error -type ok -parent [xschem get topwindow] " "-message {Syntax error in identifier expansion: %s\nschematic:\n%s}", s, xctx->sch[xctx->currsch]); if(has_x) tcleval(cmd); - my_free(1058, &cmd); + my_free(_ALLOC_ID_, &cmd); } if(parselabel_debug >= 3) @@ -138,7 +138,7 @@ const char *expandlabel(const char *s, int *m) } } else { *m=-1; - my_strdup2(1059, &dest_string.str, s); + my_strdup2(_ALLOC_ID_, &dest_string.str, s); } return dest_string.str; } @@ -203,7 +203,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* recognize characters after a bus label: AA[33:31]_xx --> _xx */ {IDX_ID_N} { yylval.ptr.str=NULL;/*19102004 */ - my_strdup(1060, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_TRAILER: |%s|\n", yytext); BEGIN(INITIAL); return B_TRAILER; @@ -243,14 +243,14 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* recognize AA[aa:bb:33] or AA[33:cc:dd] or AA[aa..bb..11] .... */ ({IDX_ID}{DDOT}{IDX_ID_N}{DDOT}{IDX_ID_N})|({IDX_ID_N}{DDOT}{IDX_ID}{DDOT}{IDX_ID_N})|({IDX_ID_N}{DDOT}{IDX_ID_N}{DDOT}{IDX_ID}) { yylval.ptr.str=NULL; - my_strdup(1061, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME3: |%s|\n", yytext); return B_NAME; } ({IDX_ID}{CLN}{IDX_ID_N}{CLN}{IDX_ID_N})|({IDX_ID_N}{CLN}{IDX_ID}{CLN}{IDX_ID_N})|({IDX_ID_N}{CLN}{IDX_ID_N}{CLN}{IDX_ID}) { yylval.ptr.str=NULL; - my_strdup(1062, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME2: |%s|\n", yytext); return B_NAME; } @@ -258,7 +258,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* recognize AA[width-1:0], AA[0:width-1], AA[width-1..4], AA[3..width+3], AA[aa:bb] AA[aa..bb] */ ({IDX_ID}{CLN}{IDX_ID_N})|({IDX_ID_N}{CLN}{IDX_ID})|({IDX_ID}{DDOT}{IDX_ID_N})|({IDX_ID_N}{DDOT}{IDX_ID}) { yylval.ptr.str=NULL; - my_strdup(1063, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME1: |%s|\n", yytext); return B_NAME; } @@ -268,7 +268,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z ^\*.* { yylval.ptr.str=NULL; /*19102004 */ if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_LINE: |%s|\n",yytext); - my_strdup(1064, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ BEGIN(INITIAL); return B_LINE; } @@ -282,7 +282,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* a number: if not a multiplier nor a node index return as a node name */ {INT} { yylval.ptr.str=NULL; - my_strdup(1065, &yylval.ptr.str, yytext); + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME4: |%s|\n", yytext); BEGIN(INITIAL); return B_NAME; @@ -301,7 +301,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z /* recognize the most esotheric identifiers */ {ID_NUM}|{ID_EXT_PARENTHESIS} { yylval.ptr.str=NULL;/*19102004 */ - my_strdup(1066, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ + my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME0: |%s|\n", yytext); BEGIN(INITIAL); return B_NAME; diff --git a/src/paste.c b/src/paste.c index b2c0b918..095d59ad 100644 --- a/src/paste.c +++ b/src/paste.c @@ -65,7 +65,7 @@ static void merge_wire(FILE *fd) } load_ascii_string( &ptr, fd); storeobject(-1, x1,y1,x2,y2,WIRE,0,SELECTED,ptr); - my_free(1067, &ptr); + my_free(_ALLOC_ID_, &ptr); select_wire(i, SELECTED, 1, 1); } @@ -201,17 +201,17 @@ static void merge_polygon(FILE *fd) ptr[i].y=NULL; ptr[i].selected_point=NULL; ptr[i].prop_ptr=NULL; - ptr[i].x = my_calloc(1068, points, sizeof(double)); - ptr[i].y = my_calloc(1069, points, sizeof(double)); - ptr[i].selected_point= my_calloc(1070, points, sizeof(unsigned short)); + ptr[i].x = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].y = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); ptr[i].points=points; ptr[i].sel=0; for(j=0;jinst[i].name, rel_sym_path(tmp)); - else my_strdup(1075, &xctx->inst[i].name,tmp); + if(tmp[0] == '/') my_strdup(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(tmp)); + else my_strdup(_ALLOC_ID_, &xctx->inst[i].name,tmp); #else - my_strdup(1076, &xctx->inst[i].name, rel_sym_path(tmp)); + my_strdup(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(tmp)); #endif - my_free(1077, &tmp); + my_free(_ALLOC_ID_, &tmp); if(fscanf(fd, "%lf %lf %hd %hd",&xctx->inst[i].x0, &xctx->inst[i].y0,&xctx->inst[i].rot, &xctx->inst[i].flip) < 4) { fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n"); read_line(fd, 0); @@ -302,14 +302,14 @@ static void merge_inst(int k,FILE *fd) xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */ xctx->inst[i].node=NULL; load_ascii_string(&prop_ptr,fd); - my_strdup(1078, &xctx->inst[i].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, prop_ptr); set_inst_flags(&xctx->inst[i]); if(!k) hash_names(-1, XINSERT); new_prop_string(i, prop_ptr, tclgetboolvar("disable_unique_names")); /* will also assign .instname */ /* the final tmp argument is zero for the 1st call and used in */ /* new_prop_string() for cleaning some internal caches. */ hash_names(i, XINSERT); - my_free(1079, &prop_ptr); + my_free(_ALLOC_ID_, &prop_ptr); xctx->instances++; } @@ -373,7 +373,7 @@ void merge_file(int selection_load, const char ext[]) cmd = get_generator_command(name); if(cmd) { fd = popen(cmd, "r"); - my_free(1080, &cmd); + my_free(_ALLOC_ID_, &cmd); } else fd = NULL; } else { fd=my_fopen(name, fopen_read_mode); @@ -457,7 +457,7 @@ void merge_file(int selection_load, const char ext[]) xctx->mousex_snap = 0.; xctx->mousey_snap = 0.; } - my_free(1081, &aux_ptr); + my_free(_ALLOC_ID_, &aux_ptr); link_symbols_to_instances(old); /* in case of paste/merge will set instances .sel to SELECTED */ if(generator) pclose(fd); else fclose(fd); diff --git a/src/psprint.c b/src/psprint.c index cd88be99..12303a6b 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -114,7 +114,7 @@ static int ps_embedded_image(xRect* r, double x1, double y1, double x2, double y quality_attr = get_tok_value(r->prop_ptr, "jpg_quality", 0); if(quality_attr[0]) quality = atoi(quality_attr); } - attr_len = my_strdup2(1082, &attr, get_tok_value(r->prop_ptr, "image_data", 0)); + attr_len = my_strdup2(_ALLOC_ID_, &attr, get_tok_value(r->prop_ptr, "image_data", 0)); filter = get_tok_value(r->prop_ptr, "filter", 0); buffer = base64_decode(attr, attr_len, &buffer_size); if(attr_len > 5) { @@ -132,8 +132,8 @@ static int ps_embedded_image(xRect* r, double x1, double y1, double x2, double y } emb_ptr = r->extraptr; if(jpg == -1 || !(emb_ptr && emb_ptr->image)) { - my_free(1083, &buffer); - my_free(1084, &attr); + my_free(_ALLOC_ID_, &buffer); + my_free(_ALLOC_ID_, &attr); return 0; } orig_sfc = emb_ptr->image; @@ -242,10 +242,10 @@ static int ps_embedded_image(xRect* r, double x1, double y1, double x2, double y fprintf(fd, "~>\n"); fprintf(fd, "grestore\n"); - my_free(1085, &ascii85EncodedJpeg); + my_free(_ALLOC_ID_, &ascii85EncodedJpeg); free(jpgData); - my_free(1086, &buffer); - my_free(1087, &attr); + my_free(_ALLOC_ID_, &buffer); + my_free(_ALLOC_ID_, &attr); #endif return 1; } @@ -397,7 +397,7 @@ static int ps_embedded_graph(int i, double rx1, double ry1, double rx2, double r fprintf(fd, "grestore\n"); - my_free(1088, &ascii85EncodedJpeg); + my_free(_ALLOC_ID_, &ascii85EncodedJpeg); #endif return 1; @@ -565,7 +565,7 @@ static void ps_drawpolygon(int c, int what, double *x, double *y, int points, static void ps_filledrect(int gc, double rectx1,double recty1,double rectx2,double recty2, int dash, int fill, int e_a, int e_b) { - double x1,y1,x2,y2, tmp; + double x1,y1,x2,y2; double psdash; x1=X_TO_PS(rectx1); @@ -748,7 +748,7 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2, xctx->areay2,textx1,texty1,textx2,texty2)) { - my_free(1089, &estr); + my_free(_ALLOC_ID_, &estr); return; } if(hcenter) { @@ -772,7 +772,7 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in if(rot == 3 && flip == 1 ) { x=textx1;} } llength=0; - my_strdup2(1090, &sss, estr); + my_strdup2(_ALLOC_ID_, &sss, estr); tt=ss=sss; for(;;) { c=*ss; @@ -790,8 +790,8 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in } ++ss; } - my_free(1091, &sss); - my_free(1092, &estr); + my_free(_ALLOC_ID_, &sss); + my_free(_ALLOC_ID_, &estr); } static void old_ps_draw_string(int gctext, const char *str, @@ -817,7 +817,7 @@ static void old_ps_draw_string(int gctext, const char *str, #endif if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) { - my_free(1093, &estr); + my_free(_ALLOC_ID_, &estr); return; } xscale*=tclgetdoublevar("nocairo_font_xscale") * cairo_font_scale; @@ -852,7 +852,7 @@ static void old_ps_draw_string(int gctext, const char *str, } ++pos; } - my_free(1094, &estr); + my_free(_ALLOC_ID_, &estr); } static void ps_drawgrid() @@ -1034,16 +1034,16 @@ static void ps_draw_symbol(int c, int n,int layer, int what, short tmp_flip, sho dash = (disabled == 1) ? 3 : polygon->dash; { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ int k; - double *x = my_malloc(1095, sizeof(double) * polygon->points); - double *y = my_malloc(1096, sizeof(double) * polygon->points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); for(k=0;kpoints; ++k) { ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); x[k]+= x0; y[k] += y0; } ps_drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, dash, bezier, bus); - my_free(1097, &x); - my_free(1098, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } } if(symptr->arcs[layer]) fprintf(fd, "NP\n"); /* newpath */ @@ -1235,7 +1235,7 @@ void create_ps(char **psfile, int what, int fullzoom, int eps) } /* setbuf(fd, NULL); */ /* To prevent buffer errors, still investigating cause. */ } - ps_colors=my_calloc(1099, cadlayers, sizeof(Ps_color)); + ps_colors=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Ps_color)); if(ps_colors==NULL){ fprintf(errfp, "create_ps(): calloc error\n"); return; @@ -1582,7 +1582,7 @@ void create_ps(char **psfile, int what, int fullzoom, int eps) fclose(fd); } tclsetboolvar("draw_grid", old_grid); - my_free(1100, &ps_colors); + my_free(_ALLOC_ID_, &ps_colors); /* restore original size and zoom factor */ diff --git a/src/save.c b/src/save.c index 8dcbc519..2c37cf7d 100644 --- a/src/save.c +++ b/src/save.c @@ -38,11 +38,11 @@ char **parse_cmd_string(const char *cmd, int *argc) char *cmd_ptr, *cmd_save; dbg(1, "parse_cmd_string(): cmd=|%s|\n", cmd ? cmd : ""); if(!cmd || !cmd[0]) { - if(cmd_copy) my_free(1101, &cmd_copy); + if(cmd_copy) my_free(_ALLOC_ID_, &cmd_copy); return NULL; } *argc = 0; - my_strdup2(1102, &cmd_copy, cmd); + my_strdup2(_ALLOC_ID_, &cmd_copy, cmd); cmd_ptr = cmd_copy; while( (argv[*argc] = my_strtok_r(cmd_ptr, " \t", "'\"", 0, &cmd_save)) ) { cmd_ptr = NULL; @@ -146,7 +146,7 @@ int filter_data(const char *din, const size_t ilen, close(p1[1]); if(!ret) { oalloc = bufsize + 1; /* add extra space for final '\0' */ - *dout = my_malloc(1103, oalloc); + *dout = my_malloc(_ALLOC_ID_, oalloc); *olen = 0; while( (n = read(p2[0], *dout + *olen, bufsize)) > 0) { *olen += n; @@ -155,14 +155,14 @@ int filter_data(const char *din, const size_t ilen, oalloc = *olen + bufsize + 1; /* add extra space for final '\0' */ oalloc = ((oalloc << 2) + oalloc) >> 2; /* size up 1.25x */ dbg(1, "filter_data() read %ld bytes, reallocate dout to %ld bytes, bufsize=%ld\n", n, oalloc, bufsize); - my_realloc(1104, dout, oalloc); + my_realloc(_ALLOC_ID_, dout, oalloc); } } if(*olen) (*dout)[*olen] = '\0'; /* so (if ascii) it can be used as a string */ } if(n < 0 || !*olen) { if(oalloc) { - my_free(1105, dout); + my_free(_ALLOC_ID_, dout); *olen = 0; } fprintf(stderr, "no data read\n"); @@ -210,7 +210,7 @@ char *base64_encode(const unsigned char *data, const size_t input_length, size_t *output_length = 4 * ((input_length + 2) / 3); alloc_length = (1 + (*output_length / 4096)) * 4096; - encoded_data = my_malloc(1106, alloc_length); + encoded_data = my_malloc(_ALLOC_ID_, alloc_length); if (encoded_data == NULL) return NULL; cnt = 0; @@ -222,7 +222,7 @@ char *base64_encode(const unsigned char *data, const size_t input_length, size_t if(j + 10 >= alloc_length) { dbg(1, "alloc-length=%ld, j=%d, output_length=%ld\n", alloc_length, j, *output_length); alloc_length += 4096; - my_realloc(1107, &encoded_data, alloc_length); + my_realloc(_ALLOC_ID_, &encoded_data, alloc_length); } if(brk && ( (cnt & 31) == 0) ) { *output_length += 1; @@ -269,7 +269,7 @@ unsigned char *base64_decode(const char *data, const size_t input_length, size_t padding = 0; if (data[input_length - 1] == '=') padding++; if (data[input_length - 2] == '=') padding++; - decoded_data = my_malloc(1108, *output_length); + decoded_data = my_malloc(_ALLOC_ID_, *output_length); if (decoded_data == NULL) return NULL; cnt = 0; for (i = 0, j = 0; i < input_length;) { @@ -312,12 +312,12 @@ unsigned char *ascii85_encode(const unsigned char *data, const size_t input_leng int padding = (4-(input_length % 4))%4; static unsigned int pow85[] = {1, 85, 7225, 614125, 52200625}; - unsigned char *paddedData = my_calloc(1109, input_length+padding, 1); + unsigned char *paddedData = my_calloc(_ALLOC_ID_, input_length+padding, 1); unsigned char *encoded_data; int i, idx = 0; memcpy( paddedData, data, input_length); *output_length = 5*(input_length+padding)/4; - encoded_data = my_malloc(1110, *output_length +1); + encoded_data = my_malloc(_ALLOC_ID_, *output_length +1); encoded_data[*output_length]=0; for (i = 0; i < input_length+padding; i+=4) { @@ -350,7 +350,7 @@ unsigned char *ascii85_encode(const unsigned char *data, const size_t input_leng encoded_data[idx]=b85_enc[encoded_data[idx]]; ++idx; } - my_free(1111, &paddedData); + my_free(_ALLOC_ID_, &paddedData); *output_length-=padding; encoded_data[*output_length]=0; return encoded_data; @@ -365,7 +365,7 @@ void transpose_matrix(double *a, int r, int c) int begin; /* holds start of cycle */ int i; double tmp; - char *done = my_calloc(1112, r, c); /* hash to mark moved elements */ + char *done = my_calloc(_ALLOC_ID_, r, c); /* hash to mark moved elements */ done[0] = done[size] = 1; /* first and last matrix elements are not moved. */ i = 1; @@ -382,7 +382,7 @@ void transpose_matrix(double *a, int r, int c) /* Get Next Move */ for (i = 1; i < size && done[i]; i++) ; } - my_free(1113, &done); + my_free(_ALLOC_ID_, &done); } static void skip_raw_ascii_points(int npoints, FILE *fd) @@ -487,7 +487,7 @@ static void read_raw_data_block(int binary, FILE *fd, Raw *raw, int ac) /* we store 4 variables (mag, phase, real and imag) but raw file has only real and imag */ if(ac) rawvars >>= 1; /* read buffer */ - tmp = my_calloc(1114, rawvars, (sizeof(double *) )); + tmp = my_calloc(_ALLOC_ID_, rawvars, (sizeof(double *) )); /* if sweep1 and sweep2 are given calculate actual npoints that will be loaded */ npoints = raw->npoints[raw->datasets]; @@ -515,9 +515,9 @@ static void read_raw_data_block(int binary, FILE *fd, Raw *raw, int ac) offset += raw->npoints[p]; } /* allocate storage for binary block, add one data column for custom data plots */ - if(!raw->values) raw->values = my_calloc(1115, raw->nvars + 1, sizeof(SPICE_DATA *)); + if(!raw->values) raw->values = my_calloc(_ALLOC_ID_, raw->nvars + 1, sizeof(SPICE_DATA *)); for(p = 0 ; p <= raw->nvars; p++) { - my_realloc(1116, + my_realloc(_ALLOC_ID_, &raw->values[p], (offset + npoints) * sizeof(SPICE_DATA)); } /* read binary block */ @@ -564,7 +564,7 @@ static void read_raw_data_block(int binary, FILE *fd, Raw *raw, int ac) p++; } raw->npoints[raw->datasets] = npoints; /* if sweeep1 and sweep2 are given less points are read */ - my_free(1117, &tmp); + my_free(_ALLOC_ID_, &tmp); } /* parse ascii raw header section: @@ -615,13 +615,13 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning else if(!my_strcasecmp(type, "sp")) type = "ac"; } while((line = my_fgets(fd, NULL))) { - my_strdup2(1118, &lowerline, line); + my_strdup2(_ALLOC_ID_, &lowerline, line); strtolower(lowerline); /* after this line comes the ascii or binary blob made of nvars * npoints * sizeof(double) bytes */ if(!strcmp(line, "Values:\n") || !strcmp(line, "Values:\r\n")) { if(sim_type) { - my_strdup(1119, &raw->sim_type, sim_type); + my_strdup(_ALLOC_ID_, &raw->sim_type, sim_type); done_header = 1; dbg(dbglev, "read_dataset(): read binary block, nvars=%d npoints=%d\n", nvars, npoints); read_raw_data_block(0, fd, raw, ac); @@ -640,7 +640,7 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning /* after this line comes the binary blob made of nvars * npoints * sizeof(double) bytes */ else if(!strcmp(line, "Binary:\n") || !strcmp(line, "Binary:\r\n")) { if(sim_type) { - my_strdup(1120, &raw->sim_type, sim_type); + my_strdup(_ALLOC_ID_, &raw->sim_type, sim_type); done_header = 1; dbg(dbglev, "read_dataset(): read binary block, nvars=%d npoints=%d\n", nvars, npoints); read_raw_data_block(1, fd, raw, ac); @@ -721,7 +721,7 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning goto read_dataset_done; } if(sim_type) { - my_realloc(1121, &raw->npoints, (raw->datasets+1) * sizeof(int)); + my_realloc(_ALLOC_ID_, &raw->npoints, (raw->datasets+1) * sizeof(int)); raw->npoints[raw->datasets] = npoints; /* multi-point OP is equivalent to a DC sweep. Change sim_type */ if(raw->npoints[raw->datasets] > 1 && !strcmp(sim_type, "op") ) { @@ -768,7 +768,7 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning goto read_dataset_done; } if(sim_type) { - my_realloc(1122, &raw->npoints, (raw->datasets+1) * sizeof(int)); + my_realloc(_ALLOC_ID_, &raw->npoints, (raw->datasets+1) * sizeof(int)); raw->npoints[raw->datasets] = npoints; /* multi-point OP is equivalent to a DC sweep. Change sim_type */ if(raw->npoints[raw->datasets] > 1 && !strcmp(sim_type, "op") ) { @@ -779,9 +779,9 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning if(sim_type && !done_header && variables) { char *ptr; /* get the list of lines with index and node name */ - if(!raw->names) raw->names = my_calloc(1123, raw->nvars, sizeof(char *)); - if(!raw->cursor_b_val) raw->cursor_b_val = my_calloc(1124, raw->nvars, sizeof(double)); - my_realloc(1125, &varname, strlen(line) + 1) ; + if(!raw->names) raw->names = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(char *)); + if(!raw->cursor_b_val) raw->cursor_b_val = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(double)); + my_realloc(_ALLOC_ID_, &varname, strlen(line) + 1) ; n = sscanf(line, "%d %s", &i, varname); /* read index and name of saved waveform */ if(n < 2) { dbg(0, "read_dataset(): WAARNING: malformed raw file, aborting\n"); @@ -798,31 +798,31 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning ++ptr; } if(ac || (sim_type && !strcmp(sim_type, "ac")) ) { /* AC */ - my_strcat(1126, &raw->names[i << 2], varname); + my_strcat(_ALLOC_ID_, &raw->names[i << 2], varname); int_hash_lookup(&raw->table, raw->names[i << 2], (i << 2), XINSERT_NOREPLACE); if(strstr(varname, "v(") == varname /* || strstr(varname, "i(") == varname */) { - my_mstrcat(1127, &raw->names[(i << 2) + 1], "ph(", varname + 2, NULL); + my_mstrcat(_ALLOC_ID_, &raw->names[(i << 2) + 1], "ph(", varname + 2, NULL); } else { - my_mstrcat(1128, &raw->names[(i << 2) + 1], "ph(", varname, ")", NULL); + my_mstrcat(_ALLOC_ID_, &raw->names[(i << 2) + 1], "ph(", varname, ")", NULL); } int_hash_lookup(&raw->table, raw->names[(i << 2) + 1], (i << 2) + 1, XINSERT_NOREPLACE); if(strstr(varname, "v(") == varname /* || strstr(varname, "i(") == varname */) { - my_mstrcat(1129, &raw->names[(i << 2) + 2], "re(", varname + 2, NULL); + my_mstrcat(_ALLOC_ID_, &raw->names[(i << 2) + 2], "re(", varname + 2, NULL); } else { - my_mstrcat(1130, &raw->names[(i << 2) + 2], "re(", varname, ")", NULL); + my_mstrcat(_ALLOC_ID_, &raw->names[(i << 2) + 2], "re(", varname, ")", NULL); } int_hash_lookup(&raw->table, raw->names[(i << 2) + 2], (i << 2) + 2, XINSERT_NOREPLACE); if(strstr(varname, "v(") == varname /* || strstr(varname, "i(") == varname */) { - my_mstrcat(1131, &raw->names[(i << 2) + 3], "im(", varname + 2, NULL); + my_mstrcat(_ALLOC_ID_, &raw->names[(i << 2) + 3], "im(", varname + 2, NULL); } else { - my_mstrcat(1132, &raw->names[(i << 2) + 3], "im(", varname, ")", NULL); + my_mstrcat(_ALLOC_ID_, &raw->names[(i << 2) + 3], "im(", varname, ")", NULL); } int_hash_lookup(&raw->table, raw->names[(i << 2) + 3], (i << 2) + 3, XINSERT_NOREPLACE); } else { - my_strcat(1133, &raw->names[i], varname); + my_strcat(_ALLOC_ID_, &raw->names[i], varname); int_hash_lookup(&raw->table, raw->names[i], i, XINSERT_NOREPLACE); } /* use hash table to store index number of variables */ @@ -832,7 +832,7 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning if(sim_type && !strncmp(line, "Variables:", 10)) { variables = 1 ; } - my_free(1134, &line); + my_free(_ALLOC_ID_, &line); } /* while((line = my_fgets(fd, NULL)) */ @@ -841,9 +841,9 @@ static int read_dataset(FILE *fd, Raw **rawptr, const char *type, int no_warning free_rawfile(rawptr, 0, no_warning); } read_dataset_done: - if(line) my_free(1135, &line); - if(lowerline) my_free(1136, &lowerline); - if(varname) my_free(1137, &varname); + if(line) my_free(_ALLOC_ID_, &line); + if(lowerline) my_free(_ALLOC_ID_, &lowerline); + if(varname) my_free(_ALLOC_ID_, &varname); if(exit_status == 1 && raw->datasets && raw->npoints) { dbg(dbglev, "raw file read: datasets=%d, last dataset points=%d, nvars=%d\n", raw->datasets, raw->npoints[raw->datasets-1], raw->nvars); @@ -869,24 +869,24 @@ void free_rawfile(Raw **rawptr, int dr, int no_warning) } if(raw->names) { for(i = 0 ; i < raw->nvars; ++i) { - my_free(1138, &raw->names[i]); + my_free(_ALLOC_ID_, &raw->names[i]); } - my_free(1139, &raw->names); - my_free(1140, &raw->cursor_b_val); + my_free(_ALLOC_ID_, &raw->names); + my_free(_ALLOC_ID_, &raw->cursor_b_val); } if(raw->values) { /* free also extra column for custom data plots */ for(i = 0 ; i <= raw->nvars; ++i) { - my_free(1141, &raw->values[i]); + my_free(_ALLOC_ID_, &raw->values[i]); } - my_free(1142, &raw->values); + my_free(_ALLOC_ID_, &raw->values); } - if(raw->sim_type) my_free(1143, &raw->sim_type); - if(raw->npoints) my_free(1144, &raw->npoints); - if(raw->rawfile) my_free(1145, &raw->rawfile); - if(raw->schname) my_free(1146, &raw->schname); + if(raw->sim_type) my_free(_ALLOC_ID_, &raw->sim_type); + if(raw->npoints) my_free(_ALLOC_ID_, &raw->npoints); + if(raw->rawfile) my_free(_ALLOC_ID_, &raw->rawfile); + if(raw->schname) my_free(_ALLOC_ID_, &raw->schname); if(raw->table.table) int_hash_free(&raw->table); - my_free(1147, rawptr); + my_free(_ALLOC_ID_, rawptr); if(has_x) { tclvareval("set tctx::", xctx->current_win_path, "_waves $simulate_bg", NULL); @@ -912,13 +912,13 @@ char *base64_from_file(const char *f, size_t *length) fd = my_fopen(f, fopen_read_mode); if(fd) { size_t bytes_read; - s = my_malloc(1148, len); + s = my_malloc(_ALLOC_ID_, len); if((bytes_read = fread(s, 1, len, fd)) < len) { dbg(0, "base64_from_file(): less bytes FROM %S, got %ld bytes\n", f, bytes_read); } fclose(fd); b64s = base64_encode(s, len, length, 1); - my_free(1149, &s); + my_free(_ALLOC_ID_, &s); } else { dbg(0, "base64_from_file(): failed to open file %s for reading\n", f); @@ -957,7 +957,7 @@ int raw_read_from_attr(Raw **rawptr, const char *type, double sweep1, double swe s = base64_decode(b64_spice_data, length, &decoded_length); fwrite(s, decoded_length, 1, fd); fclose(fd); - my_free(1150, &s); + my_free(_ALLOC_ID_, &s); res = raw_read(tmp_filename, rawptr, type, 0, sweep1, sweep2); unlink(tmp_filename); } else { @@ -977,15 +977,15 @@ int raw_add_vector(const char *varname, const char *expr, int sweep_idx) if(!int_hash_lookup(&raw->table, varname, 0, XLOOKUP)) { raw->nvars++; - my_realloc(1151, &raw->names, raw->nvars * sizeof(char *)); - my_realloc(1152, &raw->cursor_b_val, raw->nvars * sizeof(double)); + my_realloc(_ALLOC_ID_, &raw->names, raw->nvars * sizeof(char *)); + my_realloc(_ALLOC_ID_, &raw->cursor_b_val, raw->nvars * sizeof(double)); raw->cursor_b_val[raw->nvars - 1] = 0.0; raw->names[raw->nvars - 1] = NULL; - my_strdup2(1153, &raw->names[raw->nvars - 1], varname); + my_strdup2(_ALLOC_ID_, &raw->names[raw->nvars - 1], varname); int_hash_lookup(&raw->table, raw->names[raw->nvars - 1], raw->nvars - 1, XINSERT_NOREPLACE); - my_realloc(1154, &raw->values, (raw->nvars + 1) * sizeof(SPICE_DATA *)); + my_realloc(_ALLOC_ID_, &raw->values, (raw->nvars + 1) * sizeof(SPICE_DATA *)); raw->values[raw->nvars] = NULL; - my_realloc(1155, &raw->values[raw->nvars], raw->allpoints * sizeof(SPICE_DATA)); + my_realloc(_ALLOC_ID_, &raw->values[raw->nvars], raw->allpoints * sizeof(SPICE_DATA)); res = 1; } if(expr) { @@ -1016,7 +1016,7 @@ int raw_read(const char *f, Raw **rawptr, const char *type, int no_warning, doub dbg(1, "raw_read(): type=%s\n", type ? type : ""); fd = my_fopen(f, fopen_read_mode); if(fd) { - *rawptr = my_calloc(1156, 1, sizeof(Raw)); + *rawptr = my_calloc(_ALLOC_ID_, 1, sizeof(Raw)); raw = *rawptr; raw->level = -1; raw->annot_p = -1; @@ -1027,8 +1027,8 @@ int raw_read(const char *f, Raw **rawptr, const char *type, int no_warning, doub if((res = read_dataset(fd, rawptr, type, no_warning)) == 1) { int i; set_modify(-2); /* clear text floater caches */ - my_strdup2(1157, &raw->rawfile, f); - my_strdup2(1158, &raw->schname, xctx->sch[xctx->currsch]); + my_strdup2(_ALLOC_ID_, &raw->rawfile, f); + my_strdup2(_ALLOC_ID_, &raw->schname, xctx->sch[xctx->currsch]); raw->level = xctx->currsch; raw->allpoints = 0; for(i = 0; i < raw->datasets; ++i) { @@ -1084,7 +1084,7 @@ int raw_renamevar(const char *old_name, const char *new_name) if(n < 0) return ret; dbg(1, "n=%d, %s \n", n, entry->token); int_hash_lookup(&raw->table, entry->token, 0, XDELETE); - my_strdup2(1159, &raw->names[n], new_name); + my_strdup2(_ALLOC_ID_, &raw->names[n], new_name); int_hash_lookup(&raw->table, raw->names[n], n, XINSERT); /* update hash table */ ret = 1; return ret; @@ -1101,18 +1101,18 @@ int raw_deletevar(const char *name) if(n < 0) return ret; dbg(1, "n=%d, %s \n", n, entry->token); int_hash_lookup(&raw->table, entry->token, 0, XDELETE); - my_free(1160, &raw->names[n]); + my_free(_ALLOC_ID_, &raw->names[n]); for(i = n + 1; i < raw->nvars; i++) { int_hash_lookup(&raw->table, raw->names[i], i - 1, XINSERT); /* update hash table */ raw->names[i - 1] = raw->names[i]; } - my_free(1161, &raw->values[n]); + my_free(_ALLOC_ID_, &raw->values[n]); for(i = n + 1; i <= raw->nvars; i++) { raw->values[i - 1] = raw->values[i]; } raw->nvars--; - my_realloc(1162, &raw->names, sizeof(char *) * raw->nvars); - my_realloc(1163, &raw->values, sizeof(SPICE_DATA *) * raw->nvars + 1); + my_realloc(_ALLOC_ID_, &raw->names, sizeof(char *) * raw->nvars); + my_realloc(_ALLOC_ID_, &raw->values, sizeof(SPICE_DATA *) * raw->nvars + 1); ret = 1; return ret; } @@ -1148,7 +1148,7 @@ int new_rawfile(const char *name, const char *type, const char *sweepvar, if(i >= xctx->extra_raw_n) { /* file not already loaded: read it and switch to it */ double t; - xctx->raw = my_calloc(1164, 1, sizeof(Raw)); + xctx->raw = my_calloc(_ALLOC_ID_, 1, sizeof(Raw)); raw = xctx->raw; raw->level = -1; raw->sweep1 = -1.0; @@ -1157,21 +1157,21 @@ int new_rawfile(const char *name, const char *type, const char *sweepvar, raw->annot_sweep_idx = -1; int_hash_init(&raw->table, HASHSIZE); - my_strdup2(1165, &raw->rawfile, name); - my_strdup2(1166, &raw->schname, xctx->sch[xctx->currsch]); - my_strdup(1167, &raw->sim_type, type); + my_strdup2(_ALLOC_ID_, &raw->rawfile, name); + my_strdup2(_ALLOC_ID_, &raw->schname, xctx->sch[xctx->currsch]); + my_strdup(_ALLOC_ID_, &raw->sim_type, type); raw->level = xctx->currsch; - my_realloc(1168, &raw->npoints, 1 * sizeof(int)); /* for now assume only one dataset */ + my_realloc(_ALLOC_ID_, &raw->npoints, 1 * sizeof(int)); /* for now assume only one dataset */ raw->datasets = 1; raw->allpoints = number; raw->npoints[0] = number; raw->nvars = 1; - raw->values = my_calloc(1169, raw->nvars + 1, sizeof(SPICE_DATA *)); - raw->values[0] = my_calloc(1170, number, sizeof(SPICE_DATA)); - raw->values[1] = my_calloc(1171, number, sizeof(SPICE_DATA)); - raw->names = my_calloc(1172, raw->nvars, sizeof(char *)); - raw->cursor_b_val = my_calloc(1173, raw->nvars, sizeof(double)); - my_strdup2(1174, &raw->names[0], sweepvar); + raw->values = my_calloc(_ALLOC_ID_, raw->nvars + 1, sizeof(SPICE_DATA *)); + raw->values[0] = my_calloc(_ALLOC_ID_, number, sizeof(SPICE_DATA)); + raw->values[1] = my_calloc(_ALLOC_ID_, number, sizeof(SPICE_DATA)); + raw->names = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(char *)); + raw->cursor_b_val = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(double)); + my_strdup2(_ALLOC_ID_, &raw->names[0], sweepvar); int_hash_lookup(&raw->table, raw->names[0], 0, XINSERT_NOREPLACE); for(i = 0; i < number; i++) { @@ -1240,7 +1240,7 @@ int extra_rawfile(int what, const char *file, const char *type, double sweep1, d save = xctx->raw; xctx->raw = NULL; read_ret = table_read(f); - my_strdup(1175, &xctx->raw->sim_type, type); + my_strdup(_ALLOC_ID_, &xctx->raw->sim_type, type); if(read_ret) { xctx->extra_raw_arr[xctx->extra_raw_n] = xctx->raw; xctx->extra_prev_idx = xctx->extra_idx; @@ -1500,7 +1500,7 @@ int table_read(const char *f) dbg(0, "table_read(): must clear current data file before loading new\n"); return 0; } - xctx->raw = my_calloc(1176, 1, sizeof(Raw)); + xctx->raw = my_calloc(_ALLOC_ID_, 1, sizeof(Raw)); raw = xctx->raw; raw->level = -1; raw->annot_p = -1; @@ -1542,7 +1542,7 @@ int table_read(const char *f) } if(!raw->datasets || (prev_prev_empty == 1 && prev_empty == 1) ) { raw->datasets++; - my_realloc(1177, &raw->npoints, raw->datasets * sizeof(int)); + my_realloc(_ALLOC_ID_, &raw->npoints, raw->datasets * sizeof(int)); dataset_points = 0; } prev_prev_empty = prev_empty = 0; @@ -1556,9 +1556,9 @@ int table_read(const char *f) line_ptr = NULL; /* dbg(1,"%s ", line_tok); */ if(nline == 0) { /* header line */ - my_realloc(1178, &raw->names, (field + 1) * sizeof(char *)); + my_realloc(_ALLOC_ID_, &raw->names, (field + 1) * sizeof(char *)); raw->names[field] = NULL; - my_strcat(1179, &raw->names[field], line_tok); + my_strcat(_ALLOC_ID_, &raw->names[field], line_tok); int_hash_lookup(&raw->table, raw->names[field], field, XINSERT_NOREPLACE); raw->nvars = field + 1; } else { /* data line */ @@ -1580,19 +1580,19 @@ int table_read(const char *f) ++nline; if(nline == 1) { int f; - raw->values = my_calloc(1180, raw->nvars + 1, sizeof(SPICE_DATA *)); + raw->values = my_calloc(_ALLOC_ID_, raw->nvars + 1, sizeof(SPICE_DATA *)); for(f = 0; f <= raw->nvars; f++) { /* one extra column for wave expressions */ - my_realloc(1181, &raw->values[f], lines * sizeof(SPICE_DATA)); + my_realloc(_ALLOC_ID_, &raw->values[f], lines * sizeof(SPICE_DATA)); } } clear: - my_free(1182, &line); + my_free(_ALLOC_ID_, &line); } /* while(line ....) */ raw->allpoints = 0; if(res == 1) { int i; - my_strdup2(1183, &raw->rawfile, f); - my_strdup2(1184, &raw->schname, xctx->sch[xctx->currsch]); + my_strdup2(_ALLOC_ID_, &raw->rawfile, f); + my_strdup2(_ALLOC_ID_, &raw->schname, xctx->sch[xctx->currsch]); raw->level = xctx->currsch; raw->allpoints = 0; for(i = 0; i < raw->datasets; ++i) { @@ -1604,7 +1604,7 @@ int table_read(const char *f) } else { dbg(0, "table_read(): no useful data found\n"); } - raw->cursor_b_val = my_calloc(1185, raw->nvars, sizeof(double)); + raw->cursor_b_val = my_calloc(_ALLOC_ID_, raw->nvars, sizeof(double)); fclose(fd); return res; } @@ -1709,18 +1709,18 @@ static double ravg_store(int what , int i, int p, int last, double value) } else if(what == 1) { if(i >= imax) { int new_size = i + 4; - my_realloc(1186, &arr, sizeof(double *) * new_size); + my_realloc(_ALLOC_ID_, &arr, sizeof(double *) * new_size); for(j = imax; j < new_size; ++j) { - arr[j] = my_calloc(1187, last + 1, sizeof(double)); + arr[j] = my_calloc(_ALLOC_ID_, last + 1, sizeof(double)); } imax = new_size; } arr[i][p] = value; } else if(what == 0 && imax) { for(j = 0; j < imax; ++j) { - my_free(1188, &arr[j]); + my_free(_ALLOC_ID_, &arr[j]); } - my_free(1189, &arr); + my_free(_ALLOC_ID_, &arr); imax = 0; } return 0.0; @@ -1811,13 +1811,13 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c y = xctx->raw->values[yidx]; /* provided index */ } } - my_strdup2(1190, &ntok_copy, expr); + my_strdup2(_ALLOC_ID_, &ntok_copy, expr); ntok_ptr = ntok_copy; dbg(1, "plot_raw_custom_data(): expr=%s, first=%d, last=%d\n", expr, first, last); while( (n = my_strtok_r(ntok_ptr, " \t\n", "", 0, &ntok_save)) ) { if(stackptr1 >= STACKMAX -2) { dbg(0, "stack overflow in graph expression parsing. Interrupted\n"); - my_free(1191, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); return -1; } ntok_ptr = NULL; @@ -1900,7 +1900,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c idx = get_raw_index(n, NULL); if(idx == -1) { dbg(1, "plot_raw_custom_data(): no data found: %s\n", n); - my_free(1192, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); return -1; /* no data found in raw file */ } stack1[stackptr1].i = SPICE_NODE; @@ -1908,7 +1908,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr, c stackptr1++; } } /* while(n = my_strtok_r(...) */ - my_free(1193, &ntok_copy); + my_free(_ALLOC_ID_, &ntok_copy); for(p = first ; p <= last; p++) { stackptr2 = 0; for(i = 0; i < stackptr1; ++i) { @@ -2337,7 +2337,7 @@ void read_record(int firstchar, FILE *fp, int dbg_level) } } dbg(dbg_level, "END SKIP RECORD\n"); - my_free(1194, &str); + my_free(_ALLOC_ID_, &str); } /* skip line of text from file, stopping before '\n' or EOF */ @@ -2466,7 +2466,7 @@ void save_ascii_string(const char *ptr, FILE *fd, int newline) if(ptr == NULL) { if( fd == NULL) { /* used to clear static data */ - my_free(1195, &strbuf); + my_free(_ALLOC_ID_, &strbuf); strbuf_size = 0; return; } @@ -2475,11 +2475,11 @@ void save_ascii_string(const char *ptr, FILE *fd, int newline) return; } len = strlen(ptr) + CADCHUNKALLOC; - if(strbuf_size < len ) my_realloc(1196, &strbuf, (strbuf_size = len)); + if(strbuf_size < len ) my_realloc(_ALLOC_ID_, &strbuf, (strbuf_size = len)); strbuf[strbuf_pos++] = '{'; while( (c = *ptr++) ) { - if(strbuf_pos > strbuf_size - 6) my_realloc(1197, &strbuf, (strbuf_size += CADCHUNKALLOC)); + if(strbuf_pos > strbuf_size - 6) my_realloc(_ALLOC_ID_, &strbuf, (strbuf_size += CADCHUNKALLOC)); if( c=='\\' || c=='{' || c=='}') strbuf[strbuf_pos++] = '\\'; strbuf[strbuf_pos++] = (char)c; } @@ -2569,7 +2569,7 @@ static void save_inst(FILE *fd, int select_only) dbg(1, "save_inst(): saving instances\n"); inst=xctx->inst; oldversion = !strcmp(xctx->file_version, "1.0"); - embedded_saved = my_calloc(1198, xctx->symbols, sizeof(int)); + embedded_saved = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); for(i=0;iinstances; ++i) { int ptr = inst[i].ptr; @@ -2581,9 +2581,9 @@ static void save_inst(FILE *fd, int select_only) if(ptr >=0) xctx->sym[ptr].flags &=~EMBEDDED; fputs("C ", fd); if(oldversion) { - my_strdup2(1199, &tmp, add_ext(inst[i].name, ".sym")); + my_strdup2(_ALLOC_ID_, &tmp, add_ext(inst[i].name, ".sym")); save_ascii_string(tmp, fd, 0); - my_free(1200, &tmp); + my_free(_ALLOC_ID_, &tmp); } else { save_ascii_string(inst[i].name, fd, 0); } @@ -2597,7 +2597,7 @@ static void save_inst(FILE *fd, int select_only) xctx->sym[ptr].flags |= EMBEDDED; } } - my_free(1201, &embedded_saved); + my_free(_ALLOC_ID_, &embedded_saved); } static void save_wire(FILE *fd, int select_only) @@ -2709,7 +2709,7 @@ static void write_xschem_file(FILE *fd) size_t tmpstring_size; char *header_ptr = xctx->header_text ? xctx->header_text : ""; tmpstring_size = strlen(header_ptr) + 100; - tmpstring = my_malloc(1202, tmpstring_size); + tmpstring = my_malloc(_ALLOC_ID_, tmpstring_size); if(xctx->header_text && xctx->header_text[0]) { my_snprintf(tmpstring, tmpstring_size, "xschem version=%s file_version=%s\n%s", XSCHEM_VERSION, XSCHEM_FILE_VERSION, header_ptr); @@ -2719,7 +2719,7 @@ static void write_xschem_file(FILE *fd) } fprintf(fd, "v "); save_ascii_string(tmpstring, fd, 1); - my_free(1203, &tmpstring); + my_free(_ALLOC_ID_, &tmpstring); if(xctx->schvhdlprop && !xctx->schsymbolprop) { get_tok_value(xctx->schvhdlprop,"type",0); @@ -2827,13 +2827,13 @@ static void load_inst(int k, FILE *fd) xctx->inst[i].name=NULL; /* avoid as much as possible calls to rel_sym_path (slow) */ #ifdef __unix__ - if(name[0] == '/') my_strdup2(1204, &xctx->inst[i].name, rel_sym_path(name)); - else my_strdup2(1205, &xctx->inst[i].name, name); + if(name[0] == '/') my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(name)); + else my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, name); #else - if(isupper(name[0]) && name[1] == ':' && name[1] == '/') my_strdup2(1206, &xctx->inst[i].name, rel_sym_path(name)); - else my_strdup2(1207, &xctx->inst[i].name, name); + if(isupper(name[0]) && name[1] == ':' && name[1] == '/') my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(name)); + else my_strdup2(_ALLOC_ID_, &xctx->inst[i].name, name); #endif - my_free(1208, &tmp); + my_free(_ALLOC_ID_, &tmp); if(fscanf(fd, "%lf %lf %hd %hd", &xctx->inst[i].x0, &xctx->inst[i].y0, &xctx->inst[i].rot, &xctx->inst[i].flip) < 4) { fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n"); @@ -2847,14 +2847,14 @@ static void load_inst(int k, FILE *fd) xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */ xctx->inst[i].node=NULL; load_ascii_string(&prop_ptr,fd); - my_strdup(1209, &xctx->inst[i].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, prop_ptr); set_inst_flags(&xctx->inst[i]); dbg(2, "load_inst(): n=%d name=%s prop=%s\n", i, xctx->inst[i].name? xctx->inst[i].name:"", xctx->inst[i].prop_ptr? xctx->inst[i].prop_ptr:""); xctx->instances++; } - my_free(1210, &prop_ptr); + my_free(_ALLOC_ID_, &prop_ptr); } static void load_polygon(FILE *fd) @@ -2882,17 +2882,17 @@ static void load_polygon(FILE *fd) ptr[i].y=NULL; ptr[i].selected_point=NULL; ptr[i].prop_ptr=NULL; - ptr[i].x = my_calloc(1211, points, sizeof(double)); - ptr[i].y = my_calloc(1212, points, sizeof(double)); - ptr[i].selected_point= my_calloc(1213, points, sizeof(unsigned short)); + ptr[i].x = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].y = my_calloc(_ALLOC_ID_, points, sizeof(double)); + ptr[i].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); ptr[i].points=points; ptr[i].sel=0; for(j=0;jversion_string, "xschem")) && (ptr2 - xctx->version_string < 50)) { - my_strdup2(1217, &ptr, subst_token(xctx->version_string, "xschem", NULL)); + my_strdup2(_ALLOC_ID_, &ptr, subst_token(xctx->version_string, "xschem", NULL)); } - my_strdup2(1218, &ptr, subst_token(ptr, "version", NULL)); - my_strdup2(1219, &ptr, subst_token(ptr, "file_version", NULL)); + my_strdup2(_ALLOC_ID_, &ptr, subst_token(ptr, "version", NULL)); + my_strdup2(_ALLOC_ID_, &ptr, subst_token(ptr, "file_version", NULL)); ptr2 = ptr; while(*ptr2 == ' ' || *ptr2 =='\t') ptr2++; /* strip leading spaces */ if(*ptr2 == '\n') ptr2++; /* strip leading newline */ - my_strdup2(1220, &xctx->header_text, ptr2); - my_free(1221,&ptr); + my_strdup2(_ALLOC_ID_, &xctx->header_text, ptr2); + my_free(_ALLOC_ID_,&ptr); } dbg(1, "read_xschem_file(): file_version=%s\n", xctx->file_version); break; @@ -3137,7 +3137,7 @@ static void read_xschem_file(FILE *fd) break; case '[': found=0; - my_strdup(1222, &xctx->inst[xctx->instances-1].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->inst[xctx->instances-1].prop_ptr, subst_token(xctx->inst[xctx->instances-1].prop_ptr, "embed", "true")); if(xctx->inst[xctx->instances-1].name) { my_snprintf(name_embedded, S(name_embedded), "%s/.xschem_embedded_%d_%s", @@ -3153,7 +3153,7 @@ static void read_xschem_file(FILE *fd) /* if loading file coming back from embedded symbol delete temporary file */ /* symbol from this temp file has already been loaded in go_back() */ if(!xctx->x_strcmp(name_embedded, xctx->sym[i].name)) { - my_strdup2(1223, &xctx->sym[i].name, xctx->inst[xctx->instances-1].name); + my_strdup2(_ALLOC_ID_, &xctx->sym[i].name, xctx->inst[xctx->instances-1].name); xunlink(name_embedded); found=1;break; } @@ -3210,13 +3210,13 @@ void load_ascii_string(char **ptr, FILE *fd) for(;;) { - if(i+5>strlength) my_realloc(1224, &str,(strlength+=CADCHUNKALLOC)); + if(i+5>strlength) my_realloc(_ALLOC_ID_, &str,(strlength+=CADCHUNKALLOC)); c=fgetc(fd); if (c=='\r') continue; if(c==EOF) { fprintf(errfp, "EOF reached, malformed {...} string input, missing close brace\n"); - my_free(1225, ptr); - my_free(1226, &str); + my_free(_ALLOC_ID_, ptr); + my_free(_ALLOC_ID_, &str); return; } if(begin) { @@ -3236,9 +3236,9 @@ void load_ascii_string(char **ptr, FILE *fd) } else if(c=='{') begin=1; } dbg(2, "load_ascii_string(): string read=%s\n",str? str:""); - my_strdup(1227, ptr, str); + my_strdup(_ALLOC_ID_, ptr, str); dbg(2, "load_ascii_string(): loaded %s\n",*ptr? *ptr:""); - my_free(1228, &str); + my_free(_ALLOC_ID_, &str); } void make_symbol(void) @@ -3359,7 +3359,7 @@ Sch_pin_record *sort_schematic_pins(int *npins) (*npins)++; } } - pinnumber_list = my_malloc(1229, sizeof(Sch_pin_record) * *npins); + pinnumber_list = my_malloc(_ALLOC_ID_, sizeof(Sch_pin_record) * *npins); *npins = 0; for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; @@ -3404,11 +3404,11 @@ int save_schematic(const char *schname, int fast) /* 20171020 added return value dbg(1, "save_schematic(): sch[currsch]=%s\n", xctx->sch[xctx->currsch] ? xctx->sch[xctx->currsch] : ""); if(!xctx->sch[xctx->currsch]) { /* no current schematic name -> assign new name */ - my_strdup2(1230, &xctx->sch[xctx->currsch], schname); + my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname); set_modify(-1); /* set title to new filename */ } else if(strcmp(schname, xctx->sch[xctx->currsch])) { /* user asks to save to a different filename */ - my_strdup2(1231, &xctx->sch[xctx->currsch], schname); + my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], schname); set_modify(-1); /* set title to new filename */ } else { /* user asks to save to same filename */ @@ -3474,16 +3474,16 @@ void link_symbols_to_instances(int from) dbg(2, "link_symbols_to_instances(): inst=%d\n", i); dbg(2, "link_symbols_to_instances(): matching inst %d name=%s \n",i, xctx->inst[i].name); dbg(2, "link_symbols_to_instances(): -------\n"); - my_strdup2(1232, &name, tcl_hook2(translate(i, xctx->inst[i].name))); + my_strdup2(_ALLOC_ID_, &name, tcl_hook2(translate(i, xctx->inst[i].name))); xctx->inst[i].ptr = match_symbol(name); - my_free(1233, &name); + my_free(_ALLOC_ID_, &name); } for(i = from; i < xctx->instances; ++i) { type=xctx->sym[xctx->inst[i].ptr].type; cond= type && IS_LABEL_SH_OR_PIN(type); if(cond) { xctx->inst[i].flags |= PIN_OR_LABEL; /* label or pin */ - my_strdup2(1234, &xctx->inst[i].lab, get_tok_value(xctx->inst[i].prop_ptr,"lab",0)); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].lab, get_tok_value(xctx->inst[i].prop_ptr,"lab",0)); } else xctx->inst[i].flags &= ~PIN_OR_LABEL; /* ordinary symbol */ } @@ -3510,7 +3510,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler xctx->prep_net_structs=0; xctx->prep_hash_inst=0; xctx->prep_hash_wires=0; - my_strdup2(1235, &ffname, trim_chars(fname, " \t\n")); + my_strdup2(_ALLOC_ID_, &ffname, trim_chars(fname, " \t\n")); if(reset_undo) { xctx->clear_undo(); xctx->prev_set_modify = -1; /* will force set_modify(0) to set window title */ @@ -3522,7 +3522,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler tclvareval("is_xschem_file {", ffname, "}", NULL); if(!strcmp(tclresult(), "GENERATOR")) { size_t len = strlen(ffname); - if( ffname[len - 1] != ')') my_strcat(1236, &ffname, "()"); + if( ffname[len - 1] != ')') my_strcat(_ALLOC_ID_, &ffname, "()"); } if(is_generator(ffname)) generator = 1; my_strncpy(name, ffname, S(name)); @@ -3537,7 +3537,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler my_snprintf(msg, S(msg), "get_directory {%s}", ffname); my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname)); /* local file name */ - my_strdup2(1237, &xctx->sch[xctx->currsch], name); + my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], name); /* local relative reference */ my_strncpy(xctx->current_name, rel_sym_path(name), S(xctx->current_name)); /* local filename specified but coming (push, pop) from web object ... */ @@ -3552,7 +3552,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname)); } /* local file name */ - my_strdup2(1238, &xctx->sch[xctx->currsch], ffname); + my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], ffname); /* local relative reference */ my_strncpy(xctx->current_name, rel_sym_path(ffname), S(xctx->current_name)); } else { /* local file specified and not coming from web url */ @@ -3560,7 +3560,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler my_snprintf(msg, S(msg), "get_directory {%s}", ffname); my_strncpy(xctx->current_dirname, tcleval(msg), S(xctx->current_dirname)); /* local file name */ - my_strdup2(1239, &xctx->sch[xctx->currsch], ffname); + my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], ffname); /* local relative reference */ my_strncpy(xctx->current_name, rel_sym_path(ffname), S(xctx->current_name)); } @@ -3568,7 +3568,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler dbg(1, "load_schematic(): opening file for loading:%s, ffname=%s\n", name, ffname); dbg(1, "load_schematic(): sch[currsch]=%s\n", xctx->sch[xctx->currsch]); if(!name[0]) { - my_free(1240, &ffname); + my_free(_ALLOC_ID_, &ffname); return 0; /* empty filename */ } if(reset_undo) { @@ -3584,7 +3584,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler cmd = get_generator_command(ffname); if(cmd) { fd = popen(cmd, "r"); - my_free(1241, &cmd); + my_free(_ALLOC_ID_, &cmd); } else fd = NULL; } else fd=my_fopen(name,fopen_read_mode); @@ -3654,7 +3654,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler } else { my_strncpy(xctx->current_dirname, pwd_dir, S(xctx->current_dirname)); } - my_mstrcat(1242, &xctx->sch[xctx->currsch], xctx->current_dirname, "/", name, NULL); + my_mstrcat(_ALLOC_ID_, &xctx->sch[xctx->currsch], xctx->current_dirname, "/", name, NULL); if(reset_undo) set_modify(0); } check_collapsing_objects(); @@ -3668,7 +3668,7 @@ int load_schematic(int load_symbols, const char *fname, int reset_undo, int aler set_netlist_dir(2, NULL); drc_check(-1); } - my_free(1243, &ffname); + my_free(_ALLOC_ID_, &ffname); return ret; } @@ -3692,7 +3692,7 @@ void delete_undo(void) xunlink(diff_name); } rmdir(xctx->undo_dirname); - my_free(1244, &xctx->undo_dirname); + my_free(_ALLOC_ID_, &xctx->undo_dirname); xctx->undo_initialized = 0; } @@ -3701,7 +3701,7 @@ static void init_undo(void) { if(xctx->no_undo == 0 && !xctx->undo_initialized) { /* create undo directory */ - if( !my_strdup(1245, &xctx->undo_dirname, create_tmpdir("xschem_undo_") )) { + if( !my_strdup(_ALLOC_ID_, &xctx->undo_dirname, create_tmpdir("xschem_undo_") )) { dbg(0, "init_undo(): problems creating tmp undo dir, Undo will be disabled\n"); dbg(0, "init_undo(): Check permissions in %s\n", tclgetvar("XSCHEM_TMP_DIR")); xctx->no_undo = 1; /* disable undo */ @@ -3922,7 +3922,7 @@ static void get_sym_type(const char *symname, char **type, /* first look in already loaded symbols in xctx->sym[] array... */ for(i=0;isymbols; ++i) { if(xctx->x_strcmp(symname, xctx->sym[i].name) == 0) { - my_strdup2(1246, type, xctx->sym[i].type); + my_strdup2(_ALLOC_ID_, type, xctx->sym[i].type); found = 1; break; } @@ -3943,7 +3943,7 @@ static void get_sym_type(const char *symname, char **type, if(fd==NULL) { dbg(1, "get_sym_type(): Symbol not found: %s\n",name); - my_strdup2(1247, type, ""); + my_strdup2(_ALLOC_ID_, type, ""); } else { char *globalprop=NULL; int fscan_ret; @@ -3957,12 +3957,12 @@ static void get_sym_type(const char *symname, char **type, case 'G': load_ascii_string(&globalprop,fd); if(!found) { - my_strdup2(1248, type, get_tok_value(globalprop, "type", 0)); + my_strdup2(_ALLOC_ID_, type, get_tok_value(globalprop, "type", 0)); } break; case 'K': load_ascii_string(&globalprop,fd); - my_strdup2(1249, type, get_tok_value(globalprop, "type", 0)); + my_strdup2(_ALLOC_ID_, type, get_tok_value(globalprop, "type", 0)); if(type[0]) found = 1; break; case 'B': @@ -3991,8 +3991,8 @@ static void get_sym_type(const char *symname, char **type, } read_line(fd, 0); /* discard any remaining characters till (but not including) newline */ } - my_free(1250, &globalprop); - my_free(1251, &rect.prop_ptr); + my_free(_ALLOC_ID_, &globalprop); + my_free(_ALLOC_ID_, &rect.prop_ptr); if(!embed_fd) fclose(fd); } } @@ -4023,7 +4023,7 @@ static void align_sch_pins_with_sym(const char *name, int pos) name, symname); fail = 1; } - rect = (xRect *) my_malloc(1252, sizeof(xRect) * sym_n_pins); + rect = (xRect *) my_malloc(_ALLOC_ID_, sizeof(xRect) * sym_n_pins); dbg(1, "align_sch_pins_with_sym(): symbol: %s\n", symname); for(i=0; i < xctx->sym[pos].rects[PINLAYER]; ++i) { Int_hashentry *entry; @@ -4044,10 +4044,10 @@ static void align_sch_pins_with_sym(const char *name, int pos) xctx->sym[pos].rect[PINLAYER][i] = rect[i]; } } - my_free(1253, &rect); + my_free(_ALLOC_ID_, &rect); } int_hash_free(&pintable); - my_free(1254, &symtype); + my_free(_ALLOC_ID_, &symtype); } } @@ -4061,14 +4061,14 @@ static void add_pinlayer_boxes(int *lastr, xRect **bb, char *pin_label = NULL; i = lastr[PINLAYER]; - my_realloc(1255, &bb[PINLAYER], (i + 1) * sizeof(xRect)); + my_realloc(_ALLOC_ID_, &bb[PINLAYER], (i + 1) * sizeof(xRect)); bb[PINLAYER][i].x1 = i_x0 - 2.5; bb[PINLAYER][i].x2 = i_x0 + 2.5; bb[PINLAYER][i].y1 = i_y0 - 2.5; bb[PINLAYER][i].y2 = i_y0 + 2.5; RECTORDER(bb[PINLAYER][i].x1, bb[PINLAYER][i].y1, bb[PINLAYER][i].x2, bb[PINLAYER][i].y2); bb[PINLAYER][i].prop_ptr = NULL; label = get_tok_value(prop_ptr, "lab", 0); save = strlen(label)+30; - pin_label = my_malloc(1256, save); + pin_label = my_malloc(_ALLOC_ID_, save); pin_label[0] = '\0'; if (!strcmp(symtype, "ipin")) { my_snprintf(pin_label, save, "name=%s dir=in ", label); @@ -4077,7 +4077,7 @@ static void add_pinlayer_boxes(int *lastr, xRect **bb, } else if (!strcmp(symtype, "iopin")) { my_snprintf(pin_label, save, "name=%s dir=inout ", label); } - my_strdup(1257, &bb[PINLAYER][i].prop_ptr, pin_label); + my_strdup(_ALLOC_ID_, &bb[PINLAYER][i].prop_ptr, pin_label); bb[PINLAYER][i].flags = 0; bb[PINLAYER][i].extraptr = 0; bb[PINLAYER][i].dash = 0; @@ -4085,9 +4085,9 @@ static void add_pinlayer_boxes(int *lastr, xRect **bb, bb[PINLAYER][i].sel = 0; bb[PINLAYER][i].fill = 1; /* add to symbol pins remaining attributes from schematic pins, except name= and lab= */ - my_strdup(1258, &pin_label, get_sym_template(prop_ptr, "lab")); /* remove name=... and lab=... */ - my_strcat(1259, &bb[PINLAYER][i].prop_ptr, pin_label); - my_free(1260, &pin_label); + my_strdup(_ALLOC_ID_, &pin_label, get_sym_template(prop_ptr, "lab")); /* remove name=... and lab=... */ + my_strcat(_ALLOC_ID_, &bb[PINLAYER][i].prop_ptr, pin_label); + my_free(_ALLOC_ID_, &pin_label); lastr[PINLAYER]++; } @@ -4173,7 +4173,7 @@ static void calc_symbol_bbox(int pos) * estr = my_expand(get_text_floater(i), tclgetintvar("tabstop")); * text_bbox(estr, tt[i].xscale, tt[i].yscale, rot, flip, * tt[i].x0, tt[i].y0, &rx1,&ry1,&rx2,&ry2, &dtmp); -* my_free(1261, &estr); +* my_free(_ALLOC_ID_, &estr); * tmp.x1=rx1;tmp.y1=ry1;tmp.x2=rx2;tmp.y2=ry2; * updatebbox(count,&boundbox,&tmp); * } @@ -4230,15 +4230,15 @@ int load_sym_def(const char *name, FILE *embed_fd) short inst_rot, inst_flip; char *symname = NULL; char tag[1]; - int *lastl = my_malloc(1262, cadlayers * sizeof(lastl)); - int *lastr = my_malloc(1263, cadlayers * sizeof(int)); - int *lastp = my_malloc(1264, cadlayers * sizeof(int)); - int *lasta = my_malloc(1265, cadlayers * sizeof(int)); + int *lastl = my_malloc(_ALLOC_ID_, cadlayers * sizeof(lastl)); + int *lastr = my_malloc(_ALLOC_ID_, cadlayers * sizeof(int)); + int *lastp = my_malloc(_ALLOC_ID_, cadlayers * sizeof(int)); + int *lasta = my_malloc(_ALLOC_ID_, cadlayers * sizeof(int)); int lastt; - xLine tmpline, **ll = my_malloc(1266, cadlayers * sizeof(xLine *)); - xRect tmprect, **bb = my_malloc(1267, cadlayers * sizeof(xRect *)); - xPoly tmppoly, **pp = my_malloc(1268, cadlayers * sizeof(xPoly *)); - xArc tmparc, **aa = my_malloc(1269, cadlayers * sizeof(xArc *)); + xLine tmpline, **ll = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xLine *)); + xRect tmprect, **bb = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xRect *)); + xPoly tmppoly, **pp = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xPoly *)); + xArc tmparc, **aa = my_malloc(_ALLOC_ID_, cadlayers * sizeof(xArc *)); xText tmptext, *tt; int endfile; char *skip_line; @@ -4260,9 +4260,9 @@ int load_sym_def(const char *name, FILE *embed_fd) dbg(1, "l_s_d(): recursion_counter=%d, name=%s\n", recursion_counter, name); recursion_counter++; lcc=NULL; - my_realloc(1270, &lcc, (level + 1) * sizeof(Lcc)); + my_realloc(_ALLOC_ID_, &lcc, (level + 1) * sizeof(Lcc)); max_level = level + 1; - my_strdup2(1271, &transl_name, tcl_hook2(name)); + my_strdup2(_ALLOC_ID_, &transl_name, tcl_hook2(name)); dbg(1, "l_s_d(): transl_name=%s\n", transl_name); generator = is_generator(transl_name); if(generator) { @@ -4274,7 +4274,7 @@ int load_sym_def(const char *name, FILE *embed_fd) } else { lcc[level].fd = NULL; } - my_free(1272, &translated_cmd); + my_free(_ALLOC_ID_, &translated_cmd); } else if(!embed_fd) { /* regular symbol: open file */ if(!strcmp(xctx->file_version,"1.0")) { my_strncpy(sympath, abs_sym_path(transl_name, ".sym"), S(sympath)); @@ -4323,16 +4323,16 @@ int load_sym_def(const char *name, FILE *embed_fd) symbol[symbols].base_name=NULL; symbol[symbols].name=NULL; - symbol[symbols].line=my_calloc(1273, cadlayers, sizeof(xLine *)); - symbol[symbols].poly=my_calloc(1274, cadlayers, sizeof(xPoly *)); - symbol[symbols].arc=my_calloc(1275, cadlayers, sizeof(xArc *)); - symbol[symbols].rect=my_calloc(1276, cadlayers, sizeof(xRect *)); - symbol[symbols].lines=my_calloc(1277, cadlayers, sizeof(int)); - symbol[symbols].rects=my_calloc(1278, cadlayers, sizeof(int)); - symbol[symbols].arcs=my_calloc(1279, cadlayers, sizeof(int)); - symbol[symbols].polygons=my_calloc(1280, cadlayers, sizeof(int)); + symbol[symbols].line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + symbol[symbols].poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); + symbol[symbols].arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); + symbol[symbols].rect=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + symbol[symbols].lines=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + symbol[symbols].rects=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + symbol[symbols].arcs=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + symbol[symbols].polygons=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); - my_strdup2(1281, &symbol[symbols].name,transl_name); + my_strdup2(_ALLOC_ID_, &symbol[symbols].name,transl_name); /* read symbol from file */ while(1) { @@ -4342,8 +4342,8 @@ int load_sym_def(const char *name, FILE *embed_fd) dbg(1, "l_s_d(): fclose1, level=%d, fd=%p\n", level, lcc[level].fd); if(generator) pclose(lcc[level].fd); else fclose(lcc[level].fd); - my_free(1282, &lcc[level].prop_ptr); - my_free(1283, &lcc[level].symname); + my_free(_ALLOC_ID_, &lcc[level].prop_ptr); + my_free(_ALLOC_ID_, &lcc[level].symname); --level; continue; } else break; @@ -4412,12 +4412,12 @@ int load_sym_def(const char *name, FILE *embed_fd) load_ascii_string(&tmpline.prop_ptr, lcc[level].fd); if( !strboolcmp(get_tok_value(tmpline.prop_ptr, "symbol_ignore", 0), "true")) { - my_free(1284, &tmpline.prop_ptr); + my_free(_ALLOC_ID_, &tmpline.prop_ptr); continue; } i=lastl[c]; - my_realloc(1285, &ll[c],(i+1)*sizeof(xLine)); + my_realloc(_ALLOC_ID_, &ll[c],(i+1)*sizeof(xLine)); ll[c][i].x1 = tmpline.x1; ll[c][i].y1 = tmpline.y1; @@ -4456,9 +4456,9 @@ int load_sym_def(const char *name, FILE *embed_fd) continue; } - tmppoly.x = my_calloc(1286, poly_points, sizeof(double)); - tmppoly.y = my_calloc(1287, poly_points, sizeof(double)); - tmppoly.selected_point = my_calloc(1288, poly_points, sizeof(unsigned short)); + tmppoly.x = my_calloc(_ALLOC_ID_, poly_points, sizeof(double)); + tmppoly.y = my_calloc(_ALLOC_ID_, poly_points, sizeof(double)); + tmppoly.selected_point = my_calloc(_ALLOC_ID_, poly_points, sizeof(unsigned short)); tmppoly.points = poly_points; for(k=0;k0 && c == PINLAYER) c = 7; /* Don't care about pins inside SYM: set on different layer */ i=lastr[c]; - my_realloc(1297, &bb[c],(i+1)*sizeof(xRect)); + my_realloc(_ALLOC_ID_, &bb[c],(i+1)*sizeof(xRect)); bb[c][i].x1 = tmprect.x1; bb[c][i].y1 = tmprect.y1; @@ -4616,7 +4616,7 @@ int load_sym_def(const char *name, FILE *embed_fd) RECTORDER(bb[c][i].x1, bb[c][i].y1, bb[c][i].x2, bb[c][i].y2); /* don't load graphs of LCC schematic instances */ if(strstr(get_tok_value(bb[c][i].prop_ptr, "flags", 0), "graph")) { - my_free(1298, &bb[c][i].prop_ptr); + my_free(_ALLOC_ID_, &bb[c][i].prop_ptr); continue; } dbg(2, "l_s_d(): loaded rect: ptr=%lx\n", (unsigned long)bb[c]); @@ -4672,12 +4672,12 @@ int load_sym_def(const char *name, FILE *embed_fd) if(xctx->tok_size) is_floater = 1; /* get rid of floater texts in LCC symbols */ } if( !strboolcmp(get_tok_value(tmptext.prop_ptr, "symbol_ignore", 0), "true") || is_floater) { - my_free(1299, &tmptext.prop_ptr); - my_free(1300, &tmptext.txt_ptr); + my_free(_ALLOC_ID_, &tmptext.prop_ptr); + my_free(_ALLOC_ID_, &tmptext.txt_ptr); continue; } i=lastt; - my_realloc(1301, &tt,(i+1)*sizeof(xText)); + my_realloc(_ALLOC_ID_, &tt,(i+1)*sizeof(xText)); tt[i].font=NULL; tt[i].txt_ptr = tmptext.txt_ptr; tt[i].x0 = tmptext.x0; @@ -4694,7 +4694,7 @@ int load_sym_def(const char *name, FILE *embed_fd) const char* tmp = translate2(lcc, level, tt[i].txt_ptr); dbg(1, "l_s_d(): txt2: tt[i].txt_ptr=%s, i=%d\n", tt[i].txt_ptr, i); rot = lcc[level].rot; flip = lcc[level].flip; - my_strdup2(1302, &tt[i].txt_ptr, tmp); + my_strdup2(_ALLOC_ID_, &tt[i].txt_ptr, tmp); dbg(1, "l_s_d(): txt3: tt[i].txt_ptr=%s, i=%d\n", tt[i].txt_ptr, i); /* allow annotation inside LCC instances. */ if(!strcmp(tt[i].txt_ptr, "@spice_get_voltage")) { @@ -4706,16 +4706,16 @@ int load_sym_def(const char *name, FILE *embed_fd) int i; for(i = 1; i ) */ - my_realloc(1305, &tt[i].txt_ptr, new_size); + my_realloc(_ALLOC_ID_, &tt[i].txt_ptr, new_size); my_snprintf(tt[i].txt_ptr, new_size, "@spice_get_voltage(%s%s)", path ? path : "", lab); - my_free(1306, &path); + my_free(_ALLOC_ID_, &path); dbg(1, " --> tt[i].txt_ptr=%s\n", tt[i].txt_ptr); } /* @spice_get_current or @spice_get_current */ @@ -4729,18 +4729,18 @@ int load_sym_def(const char *name, FILE *embed_fd) int i; for(i = 1; i ) */ - my_realloc(1309, &txt_ptr, new_size); + my_realloc(_ALLOC_ID_, &txt_ptr, new_size); my_snprintf(txt_ptr, new_size, "%s(%s%s)", tt[i].txt_ptr, path ? path : "", dev); - my_free(1310, &tt[i].txt_ptr); + my_free(_ALLOC_ID_, &tt[i].txt_ptr); tt[i].txt_ptr = txt_ptr; - my_free(1311, &path); + my_free(_ALLOC_ID_, &path); dbg(1, "--> tt[i].txt_ptr=%s\n", tt[i].txt_ptr); } ROTATION(rot, flip, 0.0, 0.0, tt[i].x0, tt[i].y0, rx1, ry1); @@ -4752,7 +4752,7 @@ int load_sym_def(const char *name, FILE *embed_fd) if(level > 0 && symtype && !strcmp(symtype, "label")) { char lay[30]; my_snprintf(lay, S(lay), " layer=%d", WIRELAYER); - my_strcat(1312, &tt[i].prop_ptr, lay); + my_strcat(_ALLOC_ID_, &tt[i].prop_ptr, lay); } dbg(1, "l_s_d(): loaded text : t=%s p=%s\n", tt[i].txt_ptr, tt[i].prop_ptr ? tt[i].prop_ptr : ""); set_text_flags(&tt[i]); @@ -4770,12 +4770,12 @@ int load_sym_def(const char *name, FILE *embed_fd) load_ascii_string(&tmpline.prop_ptr, lcc[level].fd); if( !strboolcmp(get_tok_value(tmpline.prop_ptr, "symbol_ignore", 0), "true")) { - my_free(1313, &tmpline.prop_ptr); + my_free(_ALLOC_ID_, &tmpline.prop_ptr); continue; } i = lastl[WIRELAYER]; - my_realloc(1314, &ll[WIRELAYER],(i+1)*sizeof(xLine)); + my_realloc(_ALLOC_ID_, &ll[WIRELAYER],(i+1)*sizeof(xLine)); ll[WIRELAYER][i].x1 = tmpline.x1; ll[WIRELAYER][i].y1 = tmpline.y1; ll[WIRELAYER][i].x2 = tmpline.x2; @@ -4885,7 +4885,7 @@ int load_sym_def(const char *name, FILE *embed_fd) } if(fd_tmp) { if (level+1 >= max_level) { - my_realloc(1315, &lcc, (max_level + 1) * sizeof(Lcc)); + my_realloc(_ALLOC_ID_, &lcc, (max_level + 1) * sizeof(Lcc)); max_level++; } ++level; @@ -4912,8 +4912,8 @@ int load_sym_def(const char *name, FILE *embed_fd) lcc[level].x0 += lcc[(level-1)].x0; lcc[level].y0 += lcc[(level-1)].y0; } - my_strdup(1316, &lcc[level].prop_ptr, prop_ptr); - my_strdup(1317, &lcc[level].symname, symname); + my_strdup(_ALLOC_ID_, &lcc[level].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &lcc[level].symname, symname); dbg(1, "level incremented: level=%d, symname=%s, prop_ptr=%s sympath=%s\n", level, symname, prop_ptr, sympath); } @@ -4927,8 +4927,8 @@ int load_sym_def(const char *name, FILE *embed_fd) break; case ']': if(level) { - my_free(1318, &lcc[level].prop_ptr); - my_free(1319, &lcc[level].symname); + my_free(_ALLOC_ID_, &lcc[level].prop_ptr); + my_free(_ALLOC_ID_, &lcc[level].symname); --level; } else { endfile=1; @@ -4974,25 +4974,25 @@ int load_sym_def(const char *name, FILE *embed_fd) /* given a .sch file used as instance in LCC schematics, order its pin * as in corresponding .sym file if it exists */ align_sch_pins_with_sym(transl_name, symbols); - my_free(1320, &prop_ptr); - my_free(1321, &lastl); - my_free(1322, &lastr); - my_free(1323, &lastp); - my_free(1324, &lasta); - my_free(1325, &ll); - my_free(1326, &bb); - my_free(1327, &aa); - my_free(1328, &pp); - my_free(1329, &lcc); - my_free(1330, &aux_ptr); - my_free(1331, &symname); - my_free(1332, &symtype); + my_free(_ALLOC_ID_, &prop_ptr); + my_free(_ALLOC_ID_, &lastl); + my_free(_ALLOC_ID_, &lastr); + my_free(_ALLOC_ID_, &lastp); + my_free(_ALLOC_ID_, &lasta); + my_free(_ALLOC_ID_, &ll); + my_free(_ALLOC_ID_, &bb); + my_free(_ALLOC_ID_, &aa); + my_free(_ALLOC_ID_, &pp); + my_free(_ALLOC_ID_, &lcc); + my_free(_ALLOC_ID_, &aux_ptr); + my_free(_ALLOC_ID_, &symname); + my_free(_ALLOC_ID_, &symtype); recursion_counter--; sort_symbol_pins(xctx->sym[xctx->symbols].rect[PINLAYER], xctx->sym[xctx->symbols].rects[PINLAYER], xctx->sym[xctx->symbols].name); xctx->symbols++; - my_free(1333, &transl_name); + my_free(_ALLOC_ID_, &transl_name); return 1; } @@ -5052,20 +5052,20 @@ void create_sch_from_sym(void) char *sch = NULL; size_t ln; - my_strdup(1334, &pinname[0], tcleval("rel_sym_path [find_file_first ipin.sym]")); - my_strdup(1335, &pinname[1], tcleval("rel_sym_path [find_file_first opin.sym]")); - my_strdup(1336, &pinname[2], tcleval("rel_sym_path [find_file_first iopin.sym]")); - my_strdup(1337, &generic_pin, tcleval("rel_sym_path [find_file_first generic_pin.sym]")); + my_strdup(_ALLOC_ID_, &pinname[0], tcleval("rel_sym_path [find_file_first ipin.sym]")); + my_strdup(_ALLOC_ID_, &pinname[1], tcleval("rel_sym_path [find_file_first opin.sym]")); + my_strdup(_ALLOC_ID_, &pinname[2], tcleval("rel_sym_path [find_file_first iopin.sym]")); + my_strdup(_ALLOC_ID_, &generic_pin, tcleval("rel_sym_path [find_file_first generic_pin.sym]")); if(pinname[0] && pinname[1] && pinname[2] && generic_pin) { rebuild_selected_array(); if(xctx->lastsel > 1) return; if(xctx->lastsel==1 && xctx->sel_array[0].type==ELEMENT) { - my_strdup2(1338, &sch, + my_strdup2(_ALLOC_ID_, &sch, get_tok_value(xctx->sym[xctx->inst[xctx->sel_array[0].n].ptr].prop_ptr, "schematic", 0)); my_strncpy(schname, abs_sym_path(sch, ""), S(schname)); - my_free(1339, &sch); + my_free(_ALLOC_ID_, &sch); if(!schname[0]) { my_strncpy(schname, add_ext(abs_sym_path(tcl_hook2(xctx->inst[xctx->sel_array[0].n].name), ""), ".sch"), S(schname)); @@ -5097,13 +5097,13 @@ void create_sch_from_sym(void) rct = ptr->rect[GENERICLAYER]; ypos=0; for(i=0;ilastsel...) */ - my_free(1346, &dir); - my_free(1347, &prop); - my_free(1348, &sub2_prop); - my_free(1349, &str); + my_free(_ALLOC_ID_, &dir); + my_free(_ALLOC_ID_, &prop); + my_free(_ALLOC_ID_, &sub2_prop); + my_free(_ALLOC_ID_, &str); } else { fprintf(errfp, "create_sch_from_sym(): location of schematic pins not found\n"); tcleval("alert_ {create_sch_from_sym(): location of schematic pins not found} {}"); } - my_free(1350, &pinname[0]); - my_free(1351, &pinname[1]); - my_free(1352, &pinname[2]); - my_free(1353, &generic_pin); + my_free(_ALLOC_ID_, &pinname[0]); + my_free(_ALLOC_ID_, &pinname[1]); + my_free(_ALLOC_ID_, &pinname[2]); + my_free(_ALLOC_ID_, &generic_pin); } int descend_symbol(void) @@ -5189,20 +5189,20 @@ int descend_symbol(void) else return 0; /* build up current hierarchy path */ - my_strdup(1354, &str, xctx->inst[n].instname); - my_strdup(1355, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); - my_strcat(1356, &xctx->sch_path[xctx->currsch+1], str); - my_strcat(1357, &xctx->sch_path[xctx->currsch+1], "."); + my_strdup(_ALLOC_ID_, &str, xctx->inst[n].instname); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], str); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "."); if(xctx->portmap[xctx->currsch + 1].table) str_hash_free(&xctx->portmap[xctx->currsch + 1]); str_hash_init(&xctx->portmap[xctx->currsch + 1], HASHSIZE); xctx->sch_path_hash[xctx->currsch+1] = 0; - my_free(1358, &str); + my_free(_ALLOC_ID_, &str); /* store hierarchy of inst attributes and sym templates for hierarchic parameter substitution */ - my_strdup(1359, &xctx->hier_attr[xctx->currsch].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, xctx->inst[n].prop_ptr); - my_strdup(1360, &xctx->hier_attr[xctx->currsch].templ, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, xctx->sym[xctx->inst[n].ptr].templ); if(!xctx->inst[n].embed) @@ -5246,15 +5246,15 @@ int descend_symbol(void) /* ... we are in a schematic downloaded from web ... */ if(web_url) { /* symbols have already been downloaded while loading parent schematic: set local file path */ - my_mstrcat(1361, &sympath, xschem_web_dirname, "/", get_cell_w_ext(tcl_hook2(name), 0), NULL); - my_strdup(1362, ¤t_dirname_save, xctx->current_dirname); /* save http url */ + my_mstrcat(_ALLOC_ID_, &sympath, xschem_web_dirname, "/", get_cell_w_ext(tcl_hook2(name), 0), NULL); + my_strdup(_ALLOC_ID_, ¤t_dirname_save, xctx->current_dirname); /* save http url */ } if(!sympath || stat(sympath, &buf)) { /* not found */ dbg(1, "descend_symbol: not found: %s\n", sympath); if(is_generator(name)) { - my_strdup2(1363, &sympath, tcl_hook2(name)); + my_strdup2(_ALLOC_ID_, &sympath, tcl_hook2(name)); } else { - my_strdup2(1364, &sympath, abs_sym_path(tcl_hook2(name), "")); + my_strdup2(_ALLOC_ID_, &sympath, abs_sym_path(tcl_hook2(name), "")); } } dbg(1, "descend_symbol(): name=%s, sympath=%s, dirname=%s\n", name, sympath, xctx->current_dirname); @@ -5263,9 +5263,9 @@ int descend_symbol(void) if(web_url) { /* restore web url current_dirname that is reset by load_schematic with local path */ my_strncpy(xctx->current_dirname, current_dirname_save, S(xctx->current_dirname)); - my_free(1365, ¤t_dirname_save); + my_free(_ALLOC_ID_, ¤t_dirname_save); } - my_free(1366, &sympath); + my_free(_ALLOC_ID_, &sympath); } if(save_netlist_type != CAD_SYMBOL_ATTRS) xctx->save_netlist_type = save_netlist_type; xctx->loaded_symbol = 1; diff --git a/src/scheduler.c b/src/scheduler.c index e66eade7..68accbde 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -29,16 +29,16 @@ void statusmsg(char str[],int n) { if(!str) return; if(str[0]== '\0') { - my_free(1367, &xctx->infowindow_text); + my_free(_ALLOC_ID_, &xctx->infowindow_text); return; } else { if(n == 3) { - my_strdup(1368, &xctx->infowindow_text, str); + my_strdup(_ALLOC_ID_, &xctx->infowindow_text, str); } else if(n == 2) { if(xctx->infowindow_text && xctx->infowindow_text[0]) { - my_strcat(1369, &xctx->infowindow_text, "\n"); + my_strcat(_ALLOC_ID_, &xctx->infowindow_text, "\n"); } - my_strcat(1370, &xctx->infowindow_text, str); + my_strcat(_ALLOC_ID_, &xctx->infowindow_text, str); } } if(!has_x) return; @@ -200,7 +200,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg dir = argv[5]; if(!strcmp(dir, "inout") || !strcmp(dir, "out") ) flip = 1; if(!strcmp(dir, "inout")) linecol = 7; - my_mstrcat(1371, &prop, "name=", name, " dir=", dir, NULL); + my_mstrcat(_ALLOC_ID_, &prop, "name=", name, " dir=", dir, NULL); storeobject(-1, x - 2.5, y - 2.5, x + 2.5, y + 2.5, xRECT, PINLAYER, 0, prop); if(flip) { create_text(draw, x - 25, y - 5, 0, 1, name, NULL, 0.2, 0.2); @@ -221,7 +221,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } xctx->draw_window = save; } - my_free(1372, &prop); + my_free(_ALLOC_ID_, &prop); } else { unselect_all(1); storeobject(-1, x - 2.5, y - 2.5, x + 2.5, y + 2.5, xRECT, PINLAYER, SELECTED, "name=XXX\ndir=inout"); @@ -281,24 +281,24 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(tclresult()[0]) { char *str = NULL; - my_strdup2(1373, &f, tclresult()); - my_mstrcat(1374, &str, "flags=image,unscaled\nalpha=0.8\nimage=", f, "\n", NULL); + my_strdup2(_ALLOC_ID_, &f, tclresult()); + my_mstrcat(_ALLOC_ID_, &str, "flags=image,unscaled\nalpha=0.8\nimage=", f, "\n", NULL); if(strstr(f, ".svg") == f + strlen(f) - 4 ) { if(tcleval("info exists svg_to_png")[0] == '1') { - my_mstrcat(1375, &str, "filter=\"", tclgetvar("svg_to_png"), "\"\n", NULL); + my_mstrcat(_ALLOC_ID_, &str, "filter=\"", tclgetvar("svg_to_png"), "\"\n", NULL); } } storeobject(-1, xctx->mousex_snap-100, xctx->mousey_snap-100, xctx->mousex_snap+100, xctx->mousey_snap+100, xRECT, GRIDLAYER, SELECTED, str); - my_free(1376, &str); + my_free(_ALLOC_ID_, &str); xctx->need_reb_sel_arr=1; rebuild_selected_array(); move_objects(START,0,0,0); xctx->ui_state |= START_SYMPIN; } - if(f) my_free(1377, &f); + if(f) my_free(_ALLOC_ID_, &f); Tcl_ResetResult(interp); } @@ -360,7 +360,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(res == 1) { if(level >= 0) { xctx->raw->level = level; - my_strdup2(1378, &xctx->raw->schname, xctx->sch[level]); + my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[level]); } update_op(); draw(); @@ -507,15 +507,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } if(!stat(sympath, &buf)) { /* file exists */ if(xctx->time_last_modify < buf.st_mtime) { - my_mstrcat(1379, &res, "Warning: symbol ", sympath, " is newer than schematic\n", NULL); + my_mstrcat(_ALLOC_ID_, &res, "Warning: symbol ", sympath, " is newer than schematic\n", NULL); } } else { /* not found */ - my_mstrcat(1380, &res, "Warning: symbol ", sympath, " not found\n", NULL); + my_mstrcat(_ALLOC_ID_, &res, "Warning: symbol ", sympath, " not found\n", NULL); } - my_mstrcat(1381, &res, "symbol ", my_itoa(i), " : ", sympath, "\n", NULL); + my_mstrcat(_ALLOC_ID_, &res, "symbol ", my_itoa(i), " : ", sympath, "\n", NULL); } Tcl_SetResult(interp, res, TCL_VOLATILE); - my_free(1382, &res); + my_free(_ALLOC_ID_, &res); } /* check_unique_names [1|0] @@ -872,7 +872,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } display_hilights(what, &str); Tcl_SetResult(interp, str, TCL_VOLATILE); - my_free(1383, &str); + my_free(_ALLOC_ID_, &str); } /* draw_graph [n] [flags] @@ -1125,10 +1125,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg l = expandlabel(argv[2], &tmp); llen = strlen(l); dbg(1, "l=%s\n", l ? l : ""); - result = my_malloc(1384, llen + 30); + result = my_malloc(_ALLOC_ID_, llen + 30); my_snprintf(result, llen + 30, "%s %d", l, tmp); Tcl_SetResult(interp, result, TCL_VOLATILE); - my_free(1385, &result); + my_free(_ALLOC_ID_, &result); } } else { cmd_found = 0;} @@ -1824,11 +1824,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc > 4) { fqdev = get_fqdevice(argv[3], atoi(argv[4]), argv[2]); Tcl_SetResult(interp, fqdev, TCL_VOLATILE); - my_free(1386, &fqdev); + my_free(_ALLOC_ID_, &fqdev); } else if(argc > 2) { fqdev = get_fqdevice("", 0, argv[2]); Tcl_SetResult(interp, fqdev, TCL_VOLATILE); - my_free(1387, &fqdev); + my_free(_ALLOC_ID_, &fqdev); } } @@ -1934,7 +1934,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_SetResult(interp, (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr, TCL_VOLATILE); } else { tmp = 100 + strlen(argv[4]) + strlen(argv[5]); - subtok = my_malloc(1388,tmp); + subtok = my_malloc(_ALLOC_ID_,tmp); my_snprintf(subtok, tmp, "%s(%s)", argv[5], argv[4]); value = get_tok_value(xctx->inst[inst].prop_ptr,subtok,0); if(!value[0]) { @@ -1953,7 +1953,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } Tcl_SetResult(interp, (char *)value, TCL_VOLATILE); } - my_free(1389, &subtok); + my_free(_ALLOC_ID_, &subtok); } } /* xschem getprop symbol lm358.sym [type] */ @@ -2054,9 +2054,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc < 4) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;} if(argc == 5) t = atoi(argv[4]); else t = 0; - my_strdup(1390, &s, get_tok_value(argv[2], argv[3], t)); + my_strdup(_ALLOC_ID_, &s, get_tok_value(argv[2], argv[3], t)); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(1391, &s); + my_free(_ALLOC_ID_, &s); } /* get_tok_size @@ -2542,11 +2542,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg char *instname = xctx->inst[i].instname ? xctx->inst[i].instname : ""; char *type = (xctx->inst[i].ptr + xctx->sym)->type; type = type ? type : ""; - if(i > 0) my_mstrcat(1392, &s, "\n", NULL); - my_mstrcat(1393, &s, "{", instname, "} {", name, "} {", type, "}", NULL); + if(i > 0) my_mstrcat(_ALLOC_ID_, &s, "\n", NULL); + my_mstrcat(_ALLOC_ID_, &s, "{", instname, "} {", name, "} {", type, "}", NULL); } Tcl_SetResult(interp, (char *)s, TCL_VOLATILE); - my_free(1394, &s); + my_free(_ALLOC_ID_, &s); } /* instance_net inst pin * Return the name of the net attached to pin 'pin' of instance 'inst' @@ -2675,7 +2675,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg rct=symbol->rect[PINLAYER]; /* slotted devices: name= U1:2, pinnumber=2:5 */ slot = -1; - tmpstr = my_malloc(1395, sizeof(xctx->inst[i].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[i].instname)); if((ss=strchr(xctx->inst[i].instname, ':')) ) { sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { @@ -2694,7 +2694,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg get_inst_pin_coord(i, p, &pinx0, &piny0); my_snprintf(num, S(num), "{%s} %g %g", get_tok_value(rct[p].prop_ptr, "name", 0), pinx0, piny0); Tcl_SetResult(interp, num, TCL_VOLATILE); - my_free(1396, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } /* instance_pins inst @@ -2716,11 +2716,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg const char *pin; pin = get_tok_value(xctx->sym[xctx->inst[i].ptr].rect[PINLAYER][p].prop_ptr, "name",0); if(!pin[0]) pin = "--ERROR--"; - my_mstrcat(1397, &pins, "{", pin, "}", NULL); - if(p< no_of_pins-1) my_strcat(1398, &pins, " "); + my_mstrcat(_ALLOC_ID_, &pins, "{", pin, "}", NULL); + if(p< no_of_pins-1) my_strcat(_ALLOC_ID_, &pins, " "); } Tcl_SetResult(interp, pins, TCL_VOLATILE); - my_free(1399, &pins); + my_free(_ALLOC_ID_, &pins); } } @@ -2767,16 +2767,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(!pin[0]) pin = "--ERROR--"; if(xctx->inst[i].node[p] && !strcmp(xctx->inst[i].node[p], argv[2]) && !IS_LABEL_SH_OR_PIN( (xctx->inst[i].ptr+xctx->sym)->type )) { - my_mstrcat(1400, &pins, "{ {", xctx->inst[i].instname, "} {", pin, NULL); + my_mstrcat(_ALLOC_ID_, &pins, "{ {", xctx->inst[i].instname, "} {", pin, NULL); get_inst_pin_coord(i, p, &pinx0, &piny0); my_strncpy(xx, dtoa(pinx0), S(xx)); my_strncpy(yy, dtoa(piny0), S(yy)); - my_mstrcat(1401, &pins, "} {", xx, "} {", yy, "} } ", NULL); + my_mstrcat(_ALLOC_ID_, &pins, "} {", xx, "} {", yy, "} } ", NULL); } } } Tcl_SetResult(interp, pins ? pins : "", TCL_VOLATILE); - my_free(1402, &pins); + my_free(_ALLOC_ID_, &pins); } /* is_generator symbol @@ -2877,7 +2877,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_ResetResult(interp); hier_psprint(&res, 2); Tcl_SetResult(interp, res, TCL_VOLATILE); - my_free(1403, &res); + my_free(_ALLOC_ID_, &res); } /* list_hilights [sep | all | all_nets | all_inst] @@ -2909,7 +2909,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} list_nets(&result); Tcl_SetResult(interp, result, TCL_VOLATILE); - my_free(1404, &result); + my_free(_ALLOC_ID_, &result); } /* list_tokens str with_quotes @@ -3023,7 +3023,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg dbg(1, "xschem load: f=%s, ret=%d\n", f, ret); if(undo_reset) { tclvareval("update_recent_file {", f, "}", NULL); - my_strdup(1405, &xctx->sch_path[xctx->currsch], "."); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], "."); if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]); str_hash_init(&xctx->portmap[xctx->currsch], HASHSIZE); xctx->sch_path_hash[xctx->currsch] = 0; @@ -3362,14 +3362,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(argc > 5) { char *strcopy = NULL, *strptr = NULL, *saveptr = NULL, *tok; - my_strdup(1406, &strcopy, argv[2]); + my_strdup(_ALLOC_ID_, &strcopy, argv[2]); strptr = strcopy; while( (tok = my_strtok_r(strptr, argv[3], argv[4], atoi(argv[5]), &saveptr)) ) { strptr = NULL; Tcl_AppendResult(interp, "{", tok, "}\n", NULL); } - my_free(1407, &strptr); + my_free(_ALLOC_ID_, &strptr); } } @@ -3426,7 +3426,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int done_netlist = 0; if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} yyparse_error = 0; - my_strdup(1408, &saveshow, tclgetvar("show_infowindow_after_netlist")); + my_strdup(_ALLOC_ID_, &saveshow, tclgetvar("show_infowindow_after_netlist")); my_strncpy(savedir, tclgetvar("netlist_dir"), S(savedir)); for(i = 2; i < argc; i++) { @@ -3504,7 +3504,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE); } } - my_free(1409, &saveshow); + my_free(_ALLOC_ID_, &saveshow); } /* new_process [f] @@ -4671,9 +4671,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg xctx->prep_net_structs=0; xctx->prep_hi_structs=0; } - my_strdup(1410, &sym, tcl_hook2(symbol)); + my_strdup(_ALLOC_ID_, &sym, tcl_hook2(symbol)); sym_number=match_symbol(sym); - my_free(1411, &sym); + my_free(_ALLOC_ID_, &sym); if(sym_number>=0) { prefix=(get_tok_value(xctx->sym[sym_number].templ , "name",0))[0]; /* get new symbol prefix */ @@ -4682,23 +4682,23 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg delete_inst_node(inst); /* 20180208 fix crashing bug: delete node info if changing symbol */ /* if number of pins is different we must delete these data *before* */ /* changing ysmbol, otherwise i might end up deleting non allocated data. */ - my_strdup2(1412, &xctx->inst[inst].name, rel_sym_path(symbol)); + my_strdup2(_ALLOC_ID_, &xctx->inst[inst].name, rel_sym_path(symbol)); xctx->inst[inst].ptr=sym_number; - my_strdup(1413, &name, xctx->inst[inst].instname); + my_strdup(_ALLOC_ID_, &name, xctx->inst[inst].instname); if(name && name[0] ) { /* 20110325 only modify prefix if prefix not NUL */ if(prefix) name[0]=(char)prefix; /* change prefix if changing symbol type; */ - my_strdup(1414, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) ); + my_strdup(_ALLOC_ID_, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) ); if(!fast) hash_names(-1, XINSERT); hash_names(inst, XDELETE); new_prop_string(inst, ptr, /* sets also inst[].instname */ tclgetboolvar("disable_unique_names")); /* set new prop_ptr */ hash_names(inst, XINSERT); set_inst_flags(&xctx->inst[inst]); - my_free(1415, &ptr); + my_free(_ALLOC_ID_, &ptr); } - my_free(1416, &name); + my_free(_ALLOC_ID_, &name); set_modify(1); /* draw(); */ Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE); @@ -4742,21 +4742,21 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg hash_names(inst, XDELETE); set_inst_prop(inst); - my_strdup2(1417, &translated_sym, translate(inst, xctx->inst[inst].name)); + my_strdup2(_ALLOC_ID_, &translated_sym, translate(inst, xctx->inst[inst].name)); sym_number=match_symbol(translated_sym); if(sym_number > 0) { delete_inst_node(inst); xctx->inst[inst].ptr=sym_number; } - if(subst) my_free(1418, &subst); + if(subst) my_free(_ALLOC_ID_, &subst); set_inst_flags(&xctx->inst[inst]); hash_names(inst, XINSERT); /* new symbol bbox after prop changes (may change due to text length) */ symbol_bbox(inst, &xctx->inst[inst].x1, &xctx->inst[inst].y1, &xctx->inst[inst].x2, &xctx->inst[inst].y2); set_modify(-2); /* reset floaters caches */ draw(); - my_free(1419, &translated_sym); + my_free(_ALLOC_ID_, &translated_sym); Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE); } @@ -4776,7 +4776,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_SetResult(interp, "xschem reset_symbol: instance not found", TCL_STATIC); return TCL_ERROR; } else { - my_strdup(1420, &xctx->inst[inst].name, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->inst[inst].name, argv[3]); } Tcl_ResetResult(interp); } @@ -4823,7 +4823,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } rn = resolved_net(net); Tcl_AppendResult(interp, rn, NULL); - my_free(1421, &rn); + my_free(_ALLOC_ID_, &rn); } /* rotate [x0 y0] @@ -5267,7 +5267,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(exists) { viewer = atoi(tclgetvar("sim(spicewave,default)")); my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer); - my_strdup(1422, &viewer_name, tclgetvar(tcl_str)); + my_strdup(_ALLOC_ID_, &viewer_name, tclgetvar(tcl_str)); dbg(1, "send_to_viewer: viewer_name=%s\n", viewer_name); if(strstr(viewer_name, "Gaw")) viewer=GAW; else if(strstr(viewer_name, "Bespice")) viewer=BESPICE; @@ -5275,7 +5275,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg hilight_net(viewer); redraw_hilights(0); } - my_free(1423, &viewer_name); + my_free(_ALLOC_ID_, &viewer_name); } Tcl_ResetResult(interp); } @@ -5346,13 +5346,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } else if(!strcmp(argv[2], "format")) { /* set name of custom format attribute used for netlisting */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - my_strdup(1424, &xctx->custom_format, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->custom_format, argv[3]); } else if(!strcmp(argv[2], "header_text")) { /* set header metadata (used for license info) */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx->header_text || strcmp(xctx->header_text, argv[3])) { set_modify(1); xctx->push_undo(); - my_strdup2(1425, &xctx->header_text, argv[3]); + my_strdup2(_ALLOC_ID_, &xctx->header_text, argv[3]); } } else if(!strcmp(argv[2], "hide_symbols")) { /* set to 0,1,2 for various hiding level of symbols */ @@ -5368,7 +5368,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg else if(!strcmp(argv[2], "infowindow_text")) { /* ERC messages */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - my_strdup(1426, &xctx->infowindow_text, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->infowindow_text, argv[3]); } else if(!strcmp(argv[2], "intuitive_interface")) { /* ERC messages */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} @@ -5418,7 +5418,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(n >= 0 && n <= xctx->currsch) { xctx->raw->level = atoi(argv[3]); - my_strdup2(1427, &xctx->raw->schname, xctx->sch[xctx->raw->level]); + my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[xctx->raw->level]); Tcl_SetResult(interp, my_itoa(n), TCL_VOLATILE); } else { Tcl_SetResult(interp, "-1", TCL_VOLATILE); @@ -5440,23 +5440,23 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } else if(!strcmp(argv[2], "schsymbolprop")) { /* set global symbol attribute string */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - my_strdup(1428, &xctx->schsymbolprop, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, argv[3]); } else if(!strcmp(argv[2], "schprop")) { /* set schematic global spice attribute string */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - my_strdup(1429, &xctx->schprop, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->schprop, argv[3]); } else if(!strcmp(argv[2], "schverilogprop")) { /* set schematic global verilog attribute string */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - my_strdup(1430, &xctx->schverilogprop, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->schverilogprop, argv[3]); } else if(!strcmp(argv[2], "schvhdlprop")) { /* set schematic global vhdl attribute string */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - my_strdup(1431, &xctx->schvhdlprop, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, argv[3]); } else if(!strcmp(argv[2], "schtedaxprop")) { /* set schematic global tedax attribute string */ if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} - my_strdup(1432, &xctx->schtedaxprop, argv[3]); + my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, argv[3]); } else if(!strcmp(argv[2], "text_svg")) { /* set to 1 to use svg elements */ text_svg=atoi(argv[3]); @@ -5490,10 +5490,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg char *s = NULL; if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(argc < 5) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;} - my_strdup(1433, &s, argv[2]); + my_strdup(_ALLOC_ID_, &s, argv[2]); set_different_token(&s, argv[3], argv[4]); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(1434, &s); + my_free(_ALLOC_ID_, &s); } /* set_modify [n] @@ -5598,20 +5598,20 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(fast == 0) { hash_names(-1, XINSERT); } - my_strdup2(1435, &old_name, xctx->inst[inst].instname); + my_strdup2(_ALLOC_ID_, &old_name, xctx->inst[inst].instname); } if(argc > 5) { if(!strcmp(argv[4], "allprops")) { hash_names(-1, XINSERT); - my_strdup2(1436, &subst, argv[5]); + my_strdup2(_ALLOC_ID_, &subst, argv[5]); } else { - my_strdup2(1437, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5])); + my_strdup2(_ALLOC_ID_, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5])); } } else if(argc > 4) {/* assume argc == 5 , delete attribute */ - my_strdup2(1438, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], NULL)); + my_strdup2(_ALLOC_ID_, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], NULL)); } else if(argc > 3) { /* clear all instance prop_str */ - my_free(1439, &subst); + my_free(_ALLOC_ID_, &subst); } hash_names(inst, XDELETE); @@ -5619,15 +5619,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(old_name) { update_attached_floaters(old_name, inst, 0); } - my_strdup2(1440, &translated_sym, translate(inst, xctx->inst[inst].name)); + my_strdup2(_ALLOC_ID_, &translated_sym, translate(inst, xctx->inst[inst].name)); sym_number=match_symbol(translated_sym); if(sym_number > 0) { delete_inst_node(inst); xctx->inst[inst].ptr=sym_number; } - if(subst) my_free(1441, &subst); - if(old_name) my_free(1442, &old_name); + if(subst) my_free(_ALLOC_ID_, &subst); + if(old_name) my_free(_ALLOC_ID_, &old_name); set_inst_flags(&xctx->inst[inst]); hash_names(inst, XINSERT); if(!fast) { @@ -5636,7 +5636,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg set_modify(-2); /* reset floaters caches */ draw(); } - my_free(1443, &translated_sym); + my_free(_ALLOC_ID_, &translated_sym); Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE); } } else if(argc > 2 && !strcmp(argv[2], "symbol")) { @@ -5656,9 +5656,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg } sym = &xctx->sym[i]; if(argc > 5) - my_strdup2(1444, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], argv[5])); + my_strdup2(_ALLOC_ID_, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], argv[5])); else - my_strdup2(1445, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], NULL)); /* delete attr */ + my_strdup2(_ALLOC_ID_, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], NULL)); /* delete attr */ } else if(argc > 5 && !strcmp(argv[2], "rect")) { /* 0 1 2 3 4 5 6 @@ -5697,14 +5697,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(strcmp(argv[6], get_tok_value(r->prop_ptr, argv[5], 0))) { change_done = 1; if(fast == 3 || fast == 0) xctx->push_undo(); - my_strdup2(1446, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6])); + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6])); } } else { get_tok_value(r->prop_ptr, argv[5], 0); if(xctx->tok_size) { change_done = 1; if(fast == 3 || fast == 0) xctx->push_undo(); - my_strdup2(1447, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */ + my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */ } } if(change_done) set_modify(1); @@ -5751,7 +5751,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg t->yscale, t->rot, t->flip, t->hcenter, t->vcenter, t->x0, t->y0, &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); - my_free(1448, &estr); + my_free(_ALLOC_ID_, &estr); bbox(ADD, xx1, yy1, xx2, yy2); } /* verify if there is some difference */ @@ -5759,19 +5759,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(strcmp(argv[5], t->txt_ptr)) { change_done = 1; if(fast == 3 || fast == 0) xctx->push_undo(); - my_strdup2(1449, &t->txt_ptr, argv[5]); + my_strdup2(_ALLOC_ID_, &t->txt_ptr, argv[5]); } } else if(strcmp(argv[5], get_tok_value(t->prop_ptr, argv[4], 0))) { change_done = 1; if(fast == 3 || fast == 0) xctx->push_undo(); - my_strdup2(1450, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], argv[5])); + my_strdup2(_ALLOC_ID_, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], argv[5])); } } else if(argc > 4) { get_tok_value(t->prop_ptr, argv[4], 0); if(xctx->tok_size) { change_done = 1; if(fast == 3 || fast == 0) xctx->push_undo(); - my_strdup2(1451, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], NULL)); /* delete attr */ + my_strdup2(_ALLOC_ID_, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], NULL)); /* delete attr */ } } if(change_done) { @@ -5783,7 +5783,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg t->yscale, t->rot, t->flip, t->hcenter, t->vcenter, t->x0, t->y0, &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); - my_free(1452, &estr); + my_free(_ALLOC_ID_, &estr); if(!fast) bbox(ADD, xx1, yy1, xx2, yy2); } if(!fast) { @@ -5845,9 +5845,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg char *s=NULL; if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(argc < 5) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;} - my_strdup(1453, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "") ? argv[4] : NULL)); + my_strdup(_ALLOC_ID_, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "") ? argv[4] : NULL)); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(1454, &s); + my_free(_ALLOC_ID_, &s); } /* symbol_base_name n * Return the base_name field of a symbol with name or number `n` @@ -6113,7 +6113,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg dbg(0, "%s\n----\n", s); Tcl_SetResult(interp, t, TCL_VOLATILE); - my_free(1455, &t); + my_free(_ALLOC_ID_, &t); } } @@ -6213,10 +6213,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg Tcl_SetResult(interp, "xschem translate: instance not found", TCL_STATIC); return TCL_ERROR; } - my_strdup2(1456, &s, translate(i, argv[3])); + my_strdup2(_ALLOC_ID_, &s, translate(i, argv[3])); Tcl_ResetResult(interp); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(1457, &s); + my_free(_ALLOC_ID_, &s); } } @@ -6232,16 +6232,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int eat_escapes = 0; if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(argc > 3) eat_escapes = atoi(argv[3]); - if(argc > 6) my_strdup2(1458, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], argv[6], NULL)); - else if(argc > 5) my_strdup2(1459, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], NULL, NULL)); - else if(argc > 4) my_strdup2(1460, &s, translate3(argv[2], eat_escapes, argv[4], NULL, NULL, NULL)); + if(argc > 6) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], argv[6], NULL)); + else if(argc > 5) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], NULL, NULL)); + else if(argc > 4) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], NULL, NULL, NULL)); else { Tcl_SetResult(interp, "xschem translate3: missing arguments", TCL_STATIC); return TCL_ERROR; } Tcl_ResetResult(interp); Tcl_SetResult(interp, s, TCL_VOLATILE); - my_free(1461, &s); + my_free(_ALLOC_ID_, &s); } /* trim_chars str sep @@ -6364,7 +6364,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} for(i = 0; i < xctx->texts; i++) if(xctx->text[i].flags & TEXT_FLOATER) { - my_free(1462, &xctx->text[i].floater_ptr); /* clear floater cached value */ + my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); /* clear floater cached value */ } for(i = 0; i < xctx->instances; ++i) { symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2); @@ -6427,10 +6427,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg int n = atoi(argv[2]); if(n > 0 && n < xctx->wires) { xWire * const wire = xctx->wire; - my_mstrcat(1463, &r, dtoa(wire[n].x1), " ", NULL); - my_mstrcat(1464, &r, dtoa(wire[n].y1), " ", NULL); - my_mstrcat(1465, &r, dtoa(wire[n].x2), " ", NULL); - my_mstrcat(1466, &r, dtoa(wire[n].y2), NULL); + my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].x1), " ", NULL); + my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].y1), " ", NULL); + my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].x2), " ", NULL); + my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].y2), NULL); Tcl_SetResult(interp, r, TCL_VOLATILE); } } @@ -6737,9 +6737,9 @@ int tclvareval(const char *script, ...) va_list args; va_start(args, script); - size = my_strcat(1467, &str, script); + size = my_strcat(_ALLOC_ID_, &str, script); while( (p = va_arg(args, const char *)) ) { - size = my_strcat(1468, &str, p); + size = my_strcat(_ALLOC_ID_, &str, p); dbg(2, "tclvareval(): p=%s, str=%s, size=%d\n", p, str, size); } dbg(2, "tclvareval(): script=%s, str=%s, size=%d\n", script, str ? str : "", size); @@ -6749,6 +6749,6 @@ int tclvareval(const char *script, ...) dbg(0, "tclvareval(): error executing %s: %s\n", str, tclresult()); Tcl_ResetResult(interp); } - my_free(1469, &str); + my_free(_ALLOC_ID_, &str); return return_code; } diff --git a/src/select.c b/src/select.c index f723c774..e509d952 100644 --- a/src/select.c +++ b/src/select.c @@ -175,7 +175,7 @@ int select_dangling_nets(void) char *type; double x0, y0, x1, y1, x2, y2; - table = my_calloc(1470, xctx->wires, sizeof(int)); + table = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(int)); hash_instances(); hash_wires(); @@ -315,7 +315,7 @@ int select_dangling_nets(void) xctx->need_reb_sel_arr = 1; rebuild_selected_array(); draw_selection(xctx->gc[SELLAYER], 0); - my_free(1471, &table); + my_free(_ALLOC_ID_, &table); return ret; } @@ -374,7 +374,7 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2) x0+text_x0,y0+text_y0, &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); dbg(1, "symbol bbox: text bbox: %s, %g %g %g %g\n", tmp_txt, xx1, yy1, xx2, yy2); dbg(1, "symbol bbox: text bbox: zoom=%g, lw=%g\n", xctx->zoom, xctx->lw); - my_free(1472, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -404,7 +404,7 @@ static void del_rect_line_arc_poly() { if(c == GRIDLAYER) xctx->graph_lastsel = -1; /* invalidate last selected graph */ ++j; - my_free(1473, &xctx->rect[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr); set_rect_extraptr(0, &xctx->rect[c][i]); deleted = 1; continue; @@ -422,7 +422,7 @@ static void del_rect_line_arc_poly() { ++j; deleted = 1; - my_free(1474, &xctx->line[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr); continue; } if(j) @@ -445,7 +445,7 @@ static void del_rect_line_arc_poly() else arc_bbox(xctx->arc[c][i].x, xctx->arc[c][i].y, xctx->arc[c][i].r, xctx->arc[c][i].a, xctx->arc[c][i].b, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2); - my_free(1475, &xctx->arc[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr); deleted = 1; continue; } @@ -470,10 +470,10 @@ static void del_rect_line_arc_poly() if(k==0 || xctx->poly[c][i].y[k] > y2) y2 = xctx->poly[c][i].y[k]; } ++j; - my_free(1476, &xctx->poly[c][i].prop_ptr); - my_free(1477, &xctx->poly[c][i].x); - my_free(1478, &xctx->poly[c][i].y); - my_free(1479, &xctx->poly[c][i].selected_point); + my_free(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->poly[c][i].x); + my_free(_ALLOC_ID_, &xctx->poly[c][i].y); + my_free(_ALLOC_ID_, &xctx->poly[c][i].selected_point); /*fprintf(errfp, "bbox: %.16g %.16g %.16g %.16g\n", x1, y1, x2, y2); */ deleted = 1; continue; @@ -499,8 +499,8 @@ int delete_wires(int selected_flag) if(xctx->wire[i].sel == selected_flag) { ++j; /* hash_wire(XDELETE, i, 0); */ /* can not be done since wire deletions change wire idexes in array */ - my_free(1480, &xctx->wire[i].prop_ptr); - my_free(1481, &xctx->wire[i].node); + my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->wire[i].node); deleted = 1; continue; @@ -546,11 +546,11 @@ void delete(int to_push_undo) cairo_restore(xctx->cairo_ctx); } #endif - my_free(1482, &xctx->text[i].prop_ptr); - my_free(1483, &xctx->text[i].font); - my_free(1484, &xctx->text[i].floater_instname); - my_free(1485, &xctx->text[i].floater_ptr); - my_free(1486, &xctx->text[i].txt_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].font); + my_free(_ALLOC_ID_, &xctx->text[i].floater_instname); + my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); + my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr); deleted = 1; ++j; continue; @@ -572,12 +572,12 @@ void delete(int to_push_undo) deleted = 1; if(xctx->inst[i].prop_ptr != NULL) { - my_free(1487, &xctx->inst[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); } delete_inst_node(i); - my_free(1488, &xctx->inst[i].name); - my_free(1489, &xctx->inst[i].instname); - my_free(1490, &xctx->inst[i].lab); + my_free(_ALLOC_ID_, &xctx->inst[i].name); + my_free(_ALLOC_ID_, &xctx->inst[i].instname); + my_free(_ALLOC_ID_, &xctx->inst[i].lab); ++j; continue; } @@ -947,7 +947,7 @@ static int select_attached_floaters(int inst, const char *name) char *attach = NULL; char *att_save, *att_ptr; if(!name || !name[0]) return found; - my_strdup2(1491, &attach, name); + my_strdup2(_ALLOC_ID_, &attach, name); att_ptr = attach; while( (name = my_strtok_r(att_ptr, " \n", "\"", 0, &att_save)) ) { att_ptr = NULL; @@ -997,7 +997,7 @@ static int select_attached_floaters(int inst, const char *name) } } } - my_free(1492, &attach); + my_free(_ALLOC_ID_, &attach); return found; } @@ -1424,7 +1424,7 @@ void select_inside(int stretch, double x1,double y1, double x2, double y2, int s xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0, &xx1,&yy1, &xx2,&yy2, &tmpint, &dtmp); - my_free(1493, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -1634,7 +1634,7 @@ void select_touch(double x1,double y1, double x2, double y2, int sel) /*added un xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].x0, xctx->text[i].y0, &xx1,&yy1, &xx2,&yy2, &tmpint, &dtmp); - my_free(1494, &estr); + my_free(_ALLOC_ID_, &estr); #if HAS_CAIRO==1 if(customfont) { cairo_restore(xctx->cairo_ctx); @@ -1757,9 +1757,9 @@ int floaters_from_selected_inst() set_modify(1); first = 0; } - my_strdup2(1495, &xctx->inst[i].prop_ptr, + my_strdup2(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, "hide_texts", "true")); - my_strdup2(1496, &xctx->inst[i].prop_ptr, + my_strdup2(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, "attach", xctx->inst[i].instname)); set_inst_flags(&xctx->inst[i]); for(t = 0; t < sym->texts; t++) { diff --git a/src/spice_netlist.c b/src/spice_netlist.c index c3c0ce4f..26fba797 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -61,10 +61,10 @@ void hier_psprint(char **res, int what) /* netlister driver */ zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); if(what & 1) ps_draw(2, 1, 0); /* page */ if(what & 2) { /* print cellname */ - my_strcat(1497, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); - my_strcat(1498, res, " {"); - my_strcat(1499, res, xctx->sch[xctx->currsch]); - my_strcat(1500, res, "}\n"); + my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); + my_strcat(_ALLOC_ID_, res, " {"); + my_strcat(_ALLOC_ID_, res, xctx->sch[xctx->currsch]); + my_strcat(_ALLOC_ID_, res, "}\n"); } dbg(1,"--> %s\n", get_cell(xctx->sch[xctx->currsch], 0) ); unselect_all(1); @@ -72,8 +72,8 @@ void hier_psprint(char **res, int what) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(1501, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); - my_strcat(1502, &xctx->sch_path[xctx->currsch+1], "->netlisting"); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; subckt_name=NULL; @@ -83,13 +83,13 @@ void hier_psprint(char **res, int what) /* netlister driver */ int flag; /* for printing we process also symbols that have *_ignore attribute */ if(!xctx->sym[i].type || !xctx->sym[i].name || !xctx->sym[i].name[0]) continue; /* can not descend into */ - my_strdup2(1503, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); if(what & 1) flag = check_lib(2, abs_path); /* noprint_libs */ else flag = check_lib(4, abs_path); /* nolist_libs */ if(flag && (!strcmp(xctx->sym[i].type, "subcircuit") || !strcmp(xctx->sym[i].type, "primitive"))) { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(1504, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); get_sch_from_sym(filename, xctx->sym + i, -1, 0); if (str_hash_lookup(&subckt_table, subckt_name, "", XINSERT_NOREPLACE)==NULL) { @@ -109,10 +109,10 @@ void hier_psprint(char **res, int what) /* netlister driver */ zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); if(what & 1) ps_draw(2, 1, 0); /* page */ if(what & 2) { /* print cellname */ - my_strcat(1505, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); - my_strcat(1506, res, " {"); - my_strcat(1507, res, xctx->sch[xctx->currsch]); - my_strcat(1508, res, "}\n"); + my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); + my_strcat(_ALLOC_ID_, res, " {"); + my_strcat(_ALLOC_ID_, res, xctx->sch[xctx->currsch]); + my_strcat(_ALLOC_ID_, res, "}\n"); } dbg(1,"--> %s\n", get_cell(xctx->sch[xctx->currsch], 0) ); } @@ -122,10 +122,10 @@ void hier_psprint(char **res, int what) /* netlister driver */ } /* can not free additional syms since load_schematic() above may have loaded additional syms */ /* get_additional_symbols(0); */ - my_free(1509, &abs_path); + my_free(_ALLOC_ID_, &abs_path); str_hash_free(&subckt_table); - my_free(1510, &subckt_name); - my_free(1511, &xctx->sch[xctx->currsch]); + my_free(_ALLOC_ID_, &subckt_name); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); xctx->currsch--; unselect_all(1); remove_symbols(); @@ -147,10 +147,10 @@ static char *model_name(const char *m) char *ptr; int n; size_t l = strlen(m) + 1; - my_strdup(1512, &m_lower, m); + my_strdup(_ALLOC_ID_, &m_lower, m); strtolower(m_lower); - my_realloc(1513, &modelname, l); - my_realloc(1514, &model_name_result, l); + my_realloc(_ALLOC_ID_, &modelname, l); + my_realloc(_ALLOC_ID_, &model_name_result, l); if((ptr = strstr(m_lower, ".subckt"))) { n = sscanf(ptr, ".subckt %s %s", model_name_result, modelname); } else if((ptr = strstr(m_lower, ".model"))) { @@ -161,10 +161,10 @@ static char *model_name(const char *m) if(n<2) my_strncpy(model_name_result, m_lower, l); else { /* build a hash key value with no spaces to make device_model attributes with different spaces equivalent*/ - my_strcat(1515, &model_name_result, modelname); + my_strcat(_ALLOC_ID_, &model_name_result, modelname); } - my_free(1516, &modelname); - my_free(1517, &m_lower); + my_free(_ALLOC_ID_, &modelname); + my_free(_ALLOC_ID_, &m_lower); return model_name_result; } @@ -176,8 +176,8 @@ static int spice_netlist(FILE *fd, int spice_stop ) int lvs_netlist = tclgetboolvar("lvs_netlist"); int top_sub = lvs_netlist || tclgetboolvar("top_is_subckt"); int lvs_ignore = tclgetboolvar("lvs_ignore"); - if(lvs_netlist) my_strdup(1518, &xctx->format, "lvs_format"); - else my_strdup(1519, &xctx->format, xctx->custom_format); + if(lvs_netlist) my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format"); + else my_strdup(_ALLOC_ID_, &xctx->format, xctx->custom_format); if(!spice_stop) { dbg(1, "spice_netlist(): invoke prepare_netlist_structs for %s\n", xctx->current_name); xctx->prep_net_structs = 0; @@ -225,21 +225,21 @@ static int spice_netlist(FILE *fd, int spice_stop ) fprintf(fd, "**** end_element\n"); } /* hash device_model attribute if any */ - my_strdup2(1520, &val, get_tok_value(xctx->inst[i].prop_ptr, "device_model", 2)); + my_strdup2(_ALLOC_ID_, &val, get_tok_value(xctx->inst[i].prop_ptr, "device_model", 2)); m = val; if(strchr(val, '@')) m = translate(i, val); else m = tcl_hook2(m); if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT); else { - my_strdup2(1521, &val, + my_strdup2(_ALLOC_ID_, &val, get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr, "device_model", 2)); m = val; if(strchr(val, '@')) m = translate(i, val); else m = tcl_hook2(m); if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT); } - my_free(1522, &model_name_result); - my_free(1523, &val); + my_free(_ALLOC_ID_, &model_name_result); + my_free(_ALLOC_ID_, &val); } } } @@ -282,8 +282,8 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ int top_sub = lvs_netlist || tclgetboolvar("top_is_subckt"); int lvs_ignore = tclgetboolvar("lvs_ignore"); - if(lvs_netlist) my_strdup(1524, &xctx->format, "lvs_format"); - else my_strdup(1525, &xctx->format, xctx->custom_format); + if(lvs_netlist) my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format"); + else my_strdup(_ALLOC_ID_, &xctx->format, xctx->custom_format); exit_code = 0; /* reset exit code */ split_f = tclgetboolvar("split_files"); dbg(1, "global_spice_netlist(): invoking push_undo()\n"); @@ -322,10 +322,10 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ { if(skip_instance(i, 1, lvs_ignore)) continue; type = (xctx->inst[i].ptr+ xctx->sym)->type; - my_strdup(1526, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0)); if( type && !strcmp(type,"netlist_commands") ) { if(!place) { - my_strdup(1527, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); } if(place && !strcmp(place, "header" )) { if(first == 0) fprintf(fd,"**** begin user header code\n"); @@ -352,7 +352,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ pinnumber_list = sort_schematic_pins(&npins); /* sort pins according to sim_pinnumber attr */ /* print top subckt ipin/opins */ - my_strdup2(1528, &top_symbol_name, abs_sym_path(add_ext(xctx->current_name, ".sym"), "")); + my_strdup2(_ALLOC_ID_, &top_symbol_name, abs_sym_path(add_ext(xctx->current_name, ".sym"), "")); if(!stat(top_symbol_name, &buf)) { /* if top level has a symbol use the symbol for pin ordering */ dbg(1, "found top level symbol %s\n", top_symbol_name); load_sym_def(top_symbol_name, NULL); @@ -368,7 +368,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ } remove_symbol(xctx->symbols - 1); } - my_free(1529, &top_symbol_name); + my_free(_ALLOC_ID_, &top_symbol_name); if(found_top_symbol != 3) { for(i=0;i" ); } } - my_free(1530, &pinnumber_list); + my_free(_ALLOC_ID_, &pinnumber_list); fprintf(fd,"\n"); err |= spice_netlist(fd, 0); @@ -388,10 +388,10 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ { if(skip_instance(i, 1, lvs_ignore)) continue; type = (xctx->inst[i].ptr+ xctx->sym)->type; - my_strdup(1531, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0)); if( type && !strcmp(type,"netlist_commands") ) { if(!place) { - my_strdup(1532, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); } if(!place || (strcmp(place, "end") && strcmp(place, "header")) ) { if(first == 0) fprintf(fd,"**** begin user architecture code\n"); @@ -435,7 +435,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ /* warning if two symbols perfectly overlapped */ err |= warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(1533, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances; ++i) stored_flags[i] = xctx->inst[i].color; if(global) @@ -444,7 +444,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ int web_url = is_from_web(xctx->current_dirname); char *current_dirname_save = NULL; - my_strdup2(1534, ¤t_dirname_save, xctx->current_dirname); + my_strdup2(_ALLOC_ID_, ¤t_dirname_save, xctx->current_dirname); unselect_all(1); /* ensure all unused symbols purged before descending hierarchy */ if(!tclgetboolvar("keep_symbols")) remove_symbols(); @@ -452,8 +452,8 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ dbg(1, "global_spice_netlist(): invoking pop_undo(2, 0)\n"); xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(1535, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); - my_strcat(1536, &xctx->sch_path[xctx->currsch+1], "->netlisting"); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; subckt_name=NULL; @@ -469,12 +469,12 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ * to resolve subschematic instances with model=@modp in format string, * modp will be first looked up in instance prop_ptr string, and if not found * in parent symbol template string */ - my_strdup(1537, &xctx->hier_attr[xctx->currsch - 1].templ, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].templ, tcl_hook2(xctx->sym[i].templ)); /* only additional symbols (created with instance schematic=... attr) will have this attribute */ - my_strdup(1538, &xctx->hier_attr[xctx->currsch - 1].prop_ptr, + my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].prop_ptr, tcl_hook2(xctx->sym[i].parent_prop_ptr)); - my_strdup(1539, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { if(!web_url) { @@ -482,7 +482,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); } /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(1540, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); dbg(1, "global_spice_netlist(): subckt_name=%s\n", subckt_name); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { @@ -501,14 +501,14 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ } } if(xctx->hier_attr[xctx->currsch - 1].templ) - my_free(1541, &xctx->hier_attr[xctx->currsch - 1].templ); + my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].templ); if(xctx->hier_attr[xctx->currsch - 1].prop_ptr) - my_free(1542, &xctx->hier_attr[xctx->currsch - 1].prop_ptr); - my_free(1543, &abs_path); + my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].prop_ptr); + my_free(_ALLOC_ID_, &abs_path); /* get_additional_symbols(0); */ - my_free(1544, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); /*clear_drawing(); */ - my_free(1545, &xctx->sch[xctx->currsch]); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); xctx->currsch--; unselect_all(1); dbg(1, "global_spice_netlist(): invoking pop_undo(0, 0)\n"); @@ -527,13 +527,13 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ dbg(1, "spice_netlist(): invoke prepare_netlist_structs for %s\n", xctx->current_name); err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */ if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; - my_free(1546, ¤t_dirname_save); + my_free(_ALLOC_ID_, ¤t_dirname_save); } /* restore hilight flags from errors found analyzing top level before descending hierarchy */ for(i=0;iinstances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(1547, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); /* print globals nodes found in netlist 28032003 */ if(!split_f) { @@ -548,14 +548,14 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ { if(skip_instance(i, 1, lvs_ignore)) continue; type = (xctx->inst[i].ptr+ xctx->sym)->type; - my_strdup(1548, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr,"place",0)); if( type && !strcmp(type,"netlist_commands") ) { if(place && !strcmp(place, "end" )) { if(first == 0) fprintf(fd,"**** begin user architecture code\n"); ++first; print_spice_element(fd, i) ; } else { - my_strdup(1549, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); + my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); if(place && !strcmp(place, "end" )) { if(first == 0) fprintf(fd,"**** begin user architecture code\n"); ++first; @@ -599,7 +599,7 @@ int global_spice_netlist(int global, int alert) /* netlister driver */ } if(!debug_var) xunlink(netl_filename); } - my_free(1550, &place); + my_free(_ALLOC_ID_, &place); xctx->netlist_count = 0; tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */ exit_code = err ? 10 : 0; @@ -638,7 +638,7 @@ int spice_block_netlist(FILE *fd, int i, int alert) if(!strcmp(default_schematic, "ignore")) { return err; } - my_strdup(1551, &name, tcl_hook2(xctx->sym[i].name)); + my_strdup(_ALLOC_ID_, &name, tcl_hook2(xctx->sym[i].name)); dbg(1, "spice_block_netlist(): filename=%s\n", filename); if(split_f) { @@ -656,15 +656,15 @@ int spice_block_netlist(FILE *fd, int i, int alert) fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n", name,xctx->sym[i].rects[PINLAYER] ); if(xctx->sym[i].base_name) fprintf(fd, "** sym_path: %s\n", abs_sym_path(xctx->sym[i].base_name, "")); else fprintf(fd, "** sym_path: %s\n", sanitized_abs_sym_path(name, "")); - my_strdup(1552, &sym_def, get_tok_value(xctx->sym[i].prop_ptr,"spice_sym_def",0)); + my_strdup(_ALLOC_ID_, &sym_def, get_tok_value(xctx->sym[i].prop_ptr,"spice_sym_def",0)); if(sym_def) { char *symname_attr = NULL; const char *translated_sym_def; - my_mstrcat(1553, &symname_attr, "symname=", get_cell(name, 0), NULL); + my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(name, 0), NULL); translated_sym_def = translate3(sym_def, 1, xctx->sym[i].templ, symname_attr, NULL, NULL); - my_free(1554, &symname_attr); + my_free(_ALLOC_ID_, &symname_attr); fprintf(fd, "%s\n", translated_sym_def); - my_free(1555, &sym_def); + my_free(_ALLOC_ID_, &sym_def); } else { const char *s = get_cell(sanitize(name), 0); fprintf(fd, "** sch_path: %s\n", sanitized_abs_sym_path(filename, "")); @@ -674,7 +674,7 @@ int spice_block_netlist(FILE *fd, int i, int alert) fprintf(fd, ".subckt %s ", s); print_spice_subckt_nodes(fd, i); - my_strdup(1556, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); /* this is now done in print_spice_subckt_nodes */ /* * fprintf(fd, "%s ", extra ? extra : "" ); @@ -682,7 +682,7 @@ int spice_block_netlist(FILE *fd, int i, int alert) /* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */ fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra)); - my_free(1557, &extra); + my_free(_ALLOC_ID_, &extra); fprintf(fd, "\n"); spice_stop ? load_schematic(0,filename, 0, alert) : load_schematic(1,filename, 0, alert); @@ -713,7 +713,7 @@ int spice_block_netlist(FILE *fd, int i, int alert) } err: xctx->netlist_count++; - my_free(1558, &name); + my_free(_ALLOC_ID_, &name); return err; } @@ -748,12 +748,12 @@ Str_hashentry *str_hash_lookup(Str_hashtable *hashtable, const char *token, cons { if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ { - Str_hashentry *entry = (Str_hashentry *)my_malloc(1559, sizeof( Str_hashentry )); + Str_hashentry *entry = (Str_hashentry *)my_malloc(_ALLOC_ID_, sizeof( Str_hashentry )); entry->next=NULL; entry->token=NULL; entry->value=NULL; - my_strdup2(1560, &entry->token, token); - my_strdup2(1561, &entry->value, value); + my_strdup2(_ALLOC_ID_, &entry->token, token); + my_strdup2(_ALLOC_ID_, &entry->value, value); entry->hash=hashcode; *preventry=entry; } @@ -765,13 +765,13 @@ Str_hashentry *str_hash_lookup(Str_hashtable *hashtable, const char *token, cons { Str_hashentry *saveptr; saveptr=(*preventry)->next; - my_free(1562, &(*preventry)->token); - my_free(1563, &(*preventry)->value); - my_free(1564, &(*preventry)); + my_free(_ALLOC_ID_, &(*preventry)->token); + my_free(_ALLOC_ID_, &(*preventry)->value); + my_free(_ALLOC_ID_, &(*preventry)); *preventry=saveptr; } else if(value && what == XINSERT ) { - my_strdup2(1565, &(*preventry)->value, value); + my_strdup2(_ALLOC_ID_, &(*preventry)->value, value); } return (*preventry); /* found matching entry, return the address */ } @@ -785,7 +785,7 @@ void str_hash_init(Str_hashtable *hashtable, int size) dbg(0, "str_hash_init(): Warning hash table not empty, possible data leak\n"); } hashtable->size = size; - hashtable->table = my_calloc(1566, size, sizeof(Str_hashentry *)); + hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Str_hashentry *)); } static void str_hash_free_entry(Str_hashentry *entry) @@ -793,9 +793,9 @@ static void str_hash_free_entry(Str_hashentry *entry) Str_hashentry *tmp; while( entry ) { tmp = entry -> next; - my_free(1567, &(entry->token)); - my_free(1568, &(entry->value)); - my_free(1569, &entry); + my_free(_ALLOC_ID_, &(entry->token)); + my_free(_ALLOC_ID_, &(entry->value)); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -811,7 +811,7 @@ void str_hash_free(Str_hashtable *hashtable) str_hash_free_entry( table[i] ); table[i] = NULL; } - if(hashtable->table) my_free(1570, &(hashtable->table)); + if(hashtable->table) my_free(_ALLOC_ID_, &(hashtable->table)); hashtable->size = 0; } } @@ -846,10 +846,10 @@ Int_hashentry *int_hash_lookup(Int_hashtable *hashtable, const char *token, cons { if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ { - Int_hashentry *entry = (Int_hashentry *)my_malloc(1571, sizeof( Int_hashentry )); + Int_hashentry *entry = (Int_hashentry *)my_malloc(_ALLOC_ID_, sizeof( Int_hashentry )); entry->next=NULL; entry->token=NULL; - my_strdup2(1572, &entry->token, token); + my_strdup2(_ALLOC_ID_, &entry->token, token); entry->value = value; entry->hash=hashcode; *preventry=entry; @@ -862,8 +862,8 @@ Int_hashentry *int_hash_lookup(Int_hashtable *hashtable, const char *token, cons { Int_hashentry *saveptr; saveptr=(*preventry)->next; - my_free(1573, &(*preventry)->token); - my_free(1574, &(*preventry)); + my_free(_ALLOC_ID_, &(*preventry)->token); + my_free(_ALLOC_ID_, &(*preventry)); *preventry=saveptr; } else if(what == XINSERT ) { @@ -881,7 +881,7 @@ void int_hash_init(Int_hashtable *hashtable, int size) dbg(0, "int_hash_init(): Warning hash table not empty, possible data leak\n"); } hashtable->size = size; - hashtable->table = my_calloc(1575, size, sizeof(Int_hashentry *)); + hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Int_hashentry *)); } static void int_hash_free_entry(Int_hashentry *entry) @@ -889,8 +889,8 @@ static void int_hash_free_entry(Int_hashentry *entry) Int_hashentry *tmp; while( entry ) { tmp = entry -> next; - my_free(1576, &(entry->token)); - my_free(1577, &entry); + my_free(_ALLOC_ID_, &(entry->token)); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -906,7 +906,7 @@ void int_hash_free(Int_hashtable *hashtable) int_hash_free_entry( table[i] ); table[i] = NULL; } - my_free(1578, &(hashtable->table)); + my_free(_ALLOC_ID_, &(hashtable->table)); hashtable->size = 0; } } @@ -943,10 +943,10 @@ Ptr_hashentry *ptr_hash_lookup(Ptr_hashtable *hashtable, const char *token, void { if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ { - Ptr_hashentry *entry = (Ptr_hashentry *)my_malloc(1579, sizeof( Ptr_hashentry )); + Ptr_hashentry *entry = (Ptr_hashentry *)my_malloc(_ALLOC_ID_, sizeof( Ptr_hashentry )); entry->next=NULL; entry->token=NULL; - my_strdup2(1580, &entry->token, token); + my_strdup2(_ALLOC_ID_, &entry->token, token); entry->value = value; entry->hash=hashcode; *preventry=entry; @@ -959,8 +959,8 @@ Ptr_hashentry *ptr_hash_lookup(Ptr_hashtable *hashtable, const char *token, void { Ptr_hashentry *saveptr; saveptr=(*preventry)->next; - my_free(1581, &(*preventry)->token); - my_free(1582, &(*preventry)); + my_free(_ALLOC_ID_, &(*preventry)->token); + my_free(_ALLOC_ID_, &(*preventry)); *preventry=saveptr; } else if(what == XINSERT ) { @@ -978,7 +978,7 @@ void ptr_hash_init(Ptr_hashtable *hashtable, int size) dbg(0, "ptr_hash_init(): Warning hash table not empty, possible data leak\n"); } hashtable->size = size; - hashtable->table = my_calloc(1583, size, sizeof(Ptr_hashentry *)); + hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Ptr_hashentry *)); } static void ptr_hash_free_entry(Ptr_hashentry *entry) @@ -986,8 +986,8 @@ static void ptr_hash_free_entry(Ptr_hashentry *entry) Ptr_hashentry *tmp; while( entry ) { tmp = entry -> next; - my_free(1584, &(entry->token)); - my_free(1585, &entry); + my_free(_ALLOC_ID_, &(entry->token)); + my_free(_ALLOC_ID_, &entry); entry = tmp; } } @@ -1003,7 +1003,7 @@ void ptr_hash_free(Ptr_hashtable *hashtable) ptr_hash_free_entry( table[i] ); table[i] = NULL; } - my_free(1586, &(hashtable->table)); + my_free(_ALLOC_ID_, &(hashtable->table)); hashtable->size = 0; } } diff --git a/src/store.c b/src/store.c index f5465e09..5fbb1c66 100644 --- a/src/store.c +++ b/src/store.c @@ -28,7 +28,7 @@ void check_wire_storage(void) if(xctx->wires >= xctx->maxw) { xctx->maxw=(1+xctx->wires / CADMAXWIRES)*CADMAXWIRES; - my_realloc(1587, &xctx->wire, sizeof(xWire)*xctx->maxw); + my_realloc(_ALLOC_ID_, &xctx->wire, sizeof(xWire)*xctx->maxw); } } @@ -37,7 +37,7 @@ void check_selected_storage(void) if(xctx->lastsel >= xctx->maxsel) { xctx->maxsel=(1+xctx->lastsel / MAXGROUP) * MAXGROUP; - my_realloc(1588, &xctx->sel_array, sizeof(Selected)*xctx->maxsel); + my_realloc(_ALLOC_ID_, &xctx->sel_array, sizeof(Selected)*xctx->maxsel); } } @@ -46,7 +46,7 @@ void check_text_storage(void) if(xctx->texts >= xctx->maxt) { xctx->maxt=(1 + xctx->texts / CADMAXTEXT) * CADMAXTEXT; - my_realloc(1589, &xctx->text, sizeof(xText)*xctx->maxt); + my_realloc(_ALLOC_ID_, &xctx->text, sizeof(xText)*xctx->maxt); } } @@ -57,7 +57,7 @@ void check_symbol_storage(void) dbg(1, "check_symbol_storage(): more than maxs, %s\n", xctx->sch[xctx->currsch] ); xctx->maxs=(1 + xctx->symbols / ELEMDEF) * ELEMDEF; - my_realloc(1590, &xctx->sym, sizeof(xSymbol)*xctx->maxs); + my_realloc(_ALLOC_ID_, &xctx->sym, sizeof(xSymbol)*xctx->maxs); } } @@ -71,7 +71,7 @@ void check_inst_storage(void) int i, old = xctx->maxi; xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST; - my_realloc(1591, &xctx->inst, sizeof(xInstance)*xctx->maxi); + my_realloc(_ALLOC_ID_, &xctx->inst, sizeof(xInstance)*xctx->maxi); #ifdef ZERO_REALLOC memset(xctx->inst + xctx->instances, 0, sizeof(xInstance) * (xctx->maxi - xctx->instances)); #endif @@ -86,7 +86,7 @@ void check_arc_storage(int c) if(xctx->arcs[c] >= xctx->maxa[c]) { xctx->maxa[c]=(1 + xctx->arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(1592, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]); + my_realloc(_ALLOC_ID_, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]); #ifdef ZERO_REALLOC memset(xctx->arc[c] + xctx->arcs[c], 0, sizeof(xArc) * (xctx->maxa[c] - xctx->arcs[c])); #endif @@ -98,7 +98,7 @@ void check_box_storage(int c) if(xctx->rects[c] >= xctx->maxr[c]) { xctx->maxr[c]=(1 + xctx->rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(1593, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]); + my_realloc(_ALLOC_ID_, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]); #ifdef ZERO_REALLOC memset(xctx->rect[c] + xctx->rects[c], 0, sizeof(xRect) * (xctx->maxr[c] - xctx->rects[c])); #endif @@ -110,7 +110,7 @@ void check_line_storage(int c) if(xctx->lines[c] >= xctx->maxl[c]) { xctx->maxl[c]=(1 + xctx->lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(1594, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]); + my_realloc(_ALLOC_ID_, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]); #ifdef ZERO_REALLOC memset(xctx->line[c] + xctx->lines[c], 0, sizeof(xLine) * (xctx->maxl[c] - xctx->lines[c])); #endif @@ -122,7 +122,7 @@ void check_polygon_storage(int c) if(xctx->polygons[c] >= xctx->maxp[c]) { xctx->maxp[c]=(1 + xctx->polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS; - my_realloc(1595, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]); + my_realloc(_ALLOC_ID_, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]); #ifdef ZERO_REALLOC memset(xctx->poly[c] + xctx->polygons[c], 0, sizeof(xPoly) * (xctx->maxp[c] - xctx->polygons[c])); #endif @@ -150,7 +150,7 @@ void store_arc(int pos, double x, double y, double r, double a, double b, xctx->arc[rectc][n].a = a; xctx->arc[rectc][n].b = b; xctx->arc[rectc][n].prop_ptr = NULL; - my_strdup(1596, &xctx->arc[rectc][n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->arc[rectc][n].prop_ptr, prop_ptr); xctx->arc[rectc][n].sel = sel; if(sel == SELECTED) set_first_sel(ARC, n, rectc); @@ -192,10 +192,10 @@ void store_poly(int pos, double *x, double *y, int points, unsigned int rectc, xctx->poly[rectc][n].y=NULL; xctx->poly[rectc][n].selected_point=NULL; xctx->poly[rectc][n].prop_ptr=NULL; - xctx->poly[rectc][n].x= my_calloc(1597, points, sizeof(double)); - xctx->poly[rectc][n].y= my_calloc(1598, points, sizeof(double)); - xctx->poly[rectc][n].selected_point= my_calloc(1599, points, sizeof(unsigned short)); - my_strdup(1600, &xctx->poly[rectc][n].prop_ptr, prop_ptr); + xctx->poly[rectc][n].x= my_calloc(_ALLOC_ID_, points, sizeof(double)); + xctx->poly[rectc][n].y= my_calloc(_ALLOC_ID_, points, sizeof(double)); + xctx->poly[rectc][n].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); + my_strdup(_ALLOC_ID_, &xctx->poly[rectc][n].prop_ptr, prop_ptr); for(j=0;jpoly[rectc][n].x[j] = x[j]; xctx->poly[rectc][n].y[j] = y[j]; @@ -247,7 +247,7 @@ int storeobject(int pos, double x1,double y1,double x2,double y2, xctx->line[rectc][n].y1=y1; xctx->line[rectc][n].y2=y2; xctx->line[rectc][n].prop_ptr=NULL; - my_strdup(1601, &xctx->line[rectc][n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->line[rectc][n].prop_ptr, prop_ptr); xctx->line[rectc][n].sel=sel; if(sel == SELECTED) set_first_sel(LINE, n, rectc); xctx->line[rectc][n].bus = 0; @@ -281,7 +281,7 @@ int storeobject(int pos, double x1,double y1,double x2,double y2, xctx->rect[rectc][n].y2=y2; xctx->rect[rectc][n].prop_ptr=NULL; xctx->rect[rectc][n].extraptr=NULL; - my_strdup(1602, &xctx->rect[rectc][n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->rect[rectc][n].prop_ptr, prop_ptr); xctx->rect[rectc][n].sel=sel; if(sel == SELECTED) set_first_sel(xRECT, n, rectc); @@ -341,7 +341,7 @@ int storeobject(int pos, double x1,double y1,double x2,double y2, xctx->wire[n].node=NULL; xctx->wire[n].end1=0; xctx->wire[n].end2=0; - my_strdup(1603, &xctx->wire[n].prop_ptr, prop_ptr); + my_strdup(_ALLOC_ID_, &xctx->wire[n].prop_ptr, prop_ptr); xctx->wire[n].bus = 0; if(prop_ptr) { xctx->wire[n].bus = get_attr_val(get_tok_value(prop_ptr,"bus",0)); diff --git a/src/svgdraw.c b/src/svgdraw.c index 858501cb..ad394a40 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -376,7 +376,7 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x,y, &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line); if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) { - my_free(1604, &estr); + my_free(_ALLOC_ID_, &estr); return; } if(hcenter) { @@ -400,7 +400,7 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i if(rot == 3 && flip == 1 ) { x=textx1;} } llength=0; - my_strdup2(1605, &sss, estr); + my_strdup2(_ALLOC_ID_, &sss, estr); tt=ss=sss; for(;;) { c=*ss; @@ -418,8 +418,8 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i } ++ss; } - my_free(1606, &sss); - my_free(1607, &estr); + my_free(_ALLOC_ID_, &sss); + my_free(_ALLOC_ID_, &estr); } @@ -445,7 +445,7 @@ static void old_svg_draw_string(int layer, const char *str, &rx1,&ry1,&rx2,&ry2, &no_of_lines, &longest_line); #endif if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) { - my_free(1608, &estr); + my_free(_ALLOC_ID_, &estr); return; } xscale*=tclgetdoublevar("nocairo_font_xscale") * cairo_font_scale; @@ -478,7 +478,7 @@ static void old_svg_draw_string(int layer, const char *str, } ++pos; } - my_free(1609, &estr); + my_free(_ALLOC_ID_, &estr); } @@ -544,7 +544,7 @@ static int svg_embedded_image(xRect *r, double rx1, double ry1, double rx2, doub alpha_str = get_tok_value(r->prop_ptr, "alpha", 0); if(alpha_str[0]) alpha = atof(alpha_str); - attr_len = my_strdup2(1610, &attr, get_tok_value(r->prop_ptr, "image_data", 0)); + attr_len = my_strdup2(_ALLOC_ID_, &attr, get_tok_value(r->prop_ptr, "image_data", 0)); buffer = base64_decode(attr, attr_len, &buffer_size); filter = get_tok_value(r->prop_ptr, "filter", 0); if(attr_len > 5) { @@ -562,8 +562,8 @@ static int svg_embedded_image(xRect *r, double rx1, double ry1, double rx2, doub jpg = -1; } if(jpg == -1) { - my_free(1611, &buffer); - my_free(1612, &attr); + my_free(_ALLOC_ID_, &buffer); + my_free(_ALLOC_ID_, &attr); return 0; } @@ -604,8 +604,8 @@ static int svg_embedded_image(xRect *r, double rx1, double ry1, double rx2, doub "xlink:href=\"data:image/svg+xml;base64,%s\"/>\n", 0.0, 0.0, w, h, transform, opacity, attr); } - my_free(1613, &buffer); - my_free(1614, &attr); + my_free(_ALLOC_ID_, &buffer); + my_free(_ALLOC_ID_, &attr); return 1; } @@ -716,16 +716,16 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot, dash = (disabled == 1) ? 3 : polygon->dash; { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ int k; - double *x = my_malloc(1615, sizeof(double) * polygon->points); - double *y = my_malloc(1616, sizeof(double) * polygon->points); + double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); + double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); for(k=0;kpoints; ++k) { ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); x[k]+= x0; y[k] += y0; } svg_drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, dash, bezier, bus); - my_free(1617, &x); - my_free(1618, &y); + my_free(_ALLOC_ID_, &x); + my_free(_ALLOC_ID_, &y); } } for(j=0;j< symptr->arcs[layer]; ++j) { @@ -918,7 +918,7 @@ void svg_draw(void) else return; } svg_restore_lw(); - svg_colors=my_calloc(1619, cadlayers, sizeof(Svg_color)); + svg_colors=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Svg_color)); if(svg_colors==NULL){ fprintf(errfp, "svg_draw(): calloc error\n"); return; @@ -945,7 +945,7 @@ void svg_draw(void) } my_strncpy(xctx->plotfile,"", S(xctx->plotfile)); - unused_layer = my_calloc(1620, cadlayers, sizeof(int)); + unused_layer = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); #if 0 * /* Determine used layers. Disabled since we want hilight colors */ * for(c=0;c\n"); fclose(fd); tclsetboolvar("draw_grid", old_grid); - my_free(1621, &svg_colors); - my_free(1622, &unused_layer); + my_free(_ALLOC_ID_, &svg_colors); + my_free(_ALLOC_ID_, &unused_layer); Tcl_SetResult(interp,"",TCL_STATIC); } diff --git a/src/tedax_netlist.c b/src/tedax_netlist.c index 2593b555..e023ba10 100644 --- a/src/tedax_netlist.c +++ b/src/tedax_netlist.c @@ -37,7 +37,7 @@ static int tedax_netlist(FILE *fd, int tedax_stop ) for(i=0;iinstances; ++i) /* print first ipin/opin defs ... */ { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(1623, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && IS_PIN(type) ) { print_tedax_element(fd, i) ; /* this is the element line */ } @@ -45,7 +45,7 @@ static int tedax_netlist(FILE *fd, int tedax_stop ) for(i=0;iinstances; ++i) /* ... then print other lines */ { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(1624, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(!strcmp(type,"noconn")) continue; if( type && !IS_LABEL_OR_PIN(type) ) { /* already done in global_tedax_netlist */ @@ -63,7 +63,7 @@ static int tedax_netlist(FILE *fd, int tedax_stop ) } } } - my_free(1625, &type); + my_free(_ALLOC_ID_, &type); } if(!tedax_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ return err; @@ -97,7 +97,7 @@ static int tedax_block_netlist(FILE *fd, int i, int alert) fprintf(fd, "begin netlist v1 %s\n",get_cell(sanitize(xctx->sym[i].name), 0)); print_tedax_subckt(fd, i); - my_strdup(1626, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); /* this is now done in print_spice_subckt */ /* * fprintf(fd, "%s ", extra ? extra : "" ); @@ -105,7 +105,7 @@ static int tedax_block_netlist(FILE *fd, int i, int alert) /* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */ fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra)); - my_free(1627, &extra); + my_free(_ALLOC_ID_, &extra); fprintf(fd, "\n"); load_schematic(1,filename, 0, alert); get_additional_symbols(1); @@ -190,7 +190,7 @@ int global_tedax_netlist(int global, int alert) /* netlister driver */ /* warning if two symbols perfectly overlapped */ err |= warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(1628, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances; ++i) stored_flags[i] = xctx->inst[i].color; if(global) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */ @@ -205,8 +205,8 @@ int global_tedax_netlist(int global, int alert) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(1629, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); - my_strcat(1630, &xctx->sch_path[xctx->currsch+1], "->netlisting"); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; subckt_name=NULL; @@ -217,7 +217,7 @@ int global_tedax_netlist(int global, int alert) /* netlister driver */ if(xctx->sym[i].flags & (TEDAX_IGNORE | TEDAX_SHORT)) continue; if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue; if(!xctx->sym[i].type) continue; - my_strdup2(1631, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { if(!web_url) { @@ -225,7 +225,7 @@ int global_tedax_netlist(int global, int alert) /* netlister driver */ my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); } /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(1632, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { /* do not insert symbols with default_schematic attribute set to ignore in hash since these symbols @@ -236,13 +236,13 @@ int global_tedax_netlist(int global, int alert) /* netlister driver */ } } } - my_free(1633, &abs_path); + my_free(_ALLOC_ID_, &abs_path); /* can not free additional syms since *_block_netlist() may have loaded additional syms */ /* get_additional_symbols(0); */ str_hash_free(&subckt_table); - my_free(1634, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); /*clear_drawing(); */ - my_free(1635, &xctx->sch[xctx->currsch]); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); xctx->currsch--; unselect_all(1); /* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */ @@ -260,14 +260,14 @@ int global_tedax_netlist(int global, int alert) /* netlister driver */ err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */ if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; - my_free(1636, ¤t_dirname_save); + my_free(_ALLOC_ID_, ¤t_dirname_save); } /* restore hilight flags from errors found analyzing top level before descending hierarchy */ for(i=0;iinstances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(1637, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); /* print globals nodes found in netlist 28032003 */ record_global_node(0,fd,NULL); diff --git a/src/token.c b/src/token.c index 47f0d39a..5ee01b62 100644 --- a/src/token.c +++ b/src/token.c @@ -63,17 +63,17 @@ const char *tcl_hook2(const char *cmd) char *unescaped_res; if(cmd == NULL) { - my_free(1638, &result); + my_free(_ALLOC_ID_, &result); return empty; } if(strstr(cmd, "tcleval(") == cmd) { unescaped_res = str_replace(cmd, "\\}", "}", 0, -1); tclvareval("tclpropeval2 {", unescaped_res, "}" , NULL); - my_strdup2(1639, &result, tclresult()); + my_strdup2(_ALLOC_ID_, &result, tclresult()); /* dbg(0, "tcl_hook2: return: %s\n", result);*/ } else { /* dbg(0, "tcl_hook2: return: %s\n", cmd); */ - my_strdup2(1640, &result, cmd); + my_strdup2(_ALLOC_ID_, &result, cmd); } return result; } @@ -87,12 +87,12 @@ int is_generator(const char *name) if(!name) { if(re) { regfree(re); - my_free(1641, &re); + my_free(_ALLOC_ID_, &re); } return 0; } if(!re) { - re = my_malloc(1642, sizeof(regex_t)); + re = my_malloc(_ALLOC_ID_, sizeof(regex_t)); regcomp(re, "^[^ \t()]+\\([^()]*\\)[ \t]*$", REG_NOSUB | REG_EXTENDED); } if(!regexec(re, name, 0 , NULL, 0) ) res = 1; @@ -118,17 +118,17 @@ const char *sanitize(const char *name) static char *empty=""; if(!is_generator(name)) { - my_strdup2(1643, &s, name); + my_strdup2(_ALLOC_ID_, &s, name); return s; } if(name == NULL) { - my_free(1644, &s); + my_free(_ALLOC_ID_, &s); return empty; } dbg(1, "sanitize(): name=%s\n", name); tclvareval("regsub -all { *[.(),] *} {", name, "} _", NULL); tclvareval("regsub {_$} {", tclresult(), "} {}", NULL); - my_strdup2(1645, &s, tclresult()); + my_strdup2(_ALLOC_ID_, &s, tclresult()); dbg(1, "sanitize(): s=%s\n", s); return s; } @@ -156,18 +156,18 @@ char *get_generator_command(const char *str) goto end; } #ifdef __unix__ - /* my_strdup(1646, &gen_cmd, cmd_filename); */ + /* my_strdup(_ALLOC_ID_, &gen_cmd, cmd_filename); */ /* add quotes to protect spaces in cmd path */ - my_mstrcat(1647, &gen_cmd, "\"", cmd_filename, "\"", NULL); + my_mstrcat(_ALLOC_ID_, &gen_cmd, "\"", cmd_filename, "\"", NULL); *spc_idx = ' '; - my_strcat(1648, &gen_cmd, spc_idx); + my_strcat(_ALLOC_ID_, &gen_cmd, spc_idx); #else /* tclsh "cmd_filename" a b c */ /* command tclsh is needed so new TCL windows will NOT open */ /* quotes are needed for filename if filename has spaces */ *spc_idx = ' '; int len = 8 + strlen(cmd_filename) + strlen(spc_idx) + 1; /*8="tclsh "+ "\""*2*/ - gen_cmd = my_malloc(1649, len * sizeof(char)); + gen_cmd = my_malloc(_ALLOC_ID_, len * sizeof(char)); my_snprintf(gen_cmd, len, "tclsh \"%s\"%s", cmd_filename, spc_idx); #endif dbg(1, "get_generator_command(): cmd_filename=%s\n", cmd_filename); @@ -175,7 +175,7 @@ char *get_generator_command(const char *str) dbg(1, "get_generator_command(): is_generator=%d\n", is_generator(str)); end: - my_free(1650, &cmd); + my_free(_ALLOC_ID_, &cmd); return gen_cmd; } @@ -221,8 +221,8 @@ int set_different_token(char **s,const char *new, const char *old) if(new==NULL) return 0; sizeval = sizetok = CADCHUNKALLOC; - my_realloc(1651, &token, sizetok); - my_realloc(1652, &value, sizeval); + my_realloc(_ALLOC_ID_, &token, sizetok); + my_realloc(_ALLOC_ID_, &value, sizeval); /* parse new string and add / change attributes that are missing / different from old */ while(1) { @@ -250,7 +250,7 @@ int set_different_token(char **s,const char *new, const char *old) value_pos=0; if(strcmp(value, get_tok_value(old,token,1))) { mod=1; - my_strdup(1653, s, subst_token(*s, token, value) ); + my_strdup(_ALLOC_ID_, s, subst_token(*s, token, value) ); } state=TOK_BEGIN; } @@ -285,7 +285,7 @@ int set_different_token(char **s,const char *new, const char *old) get_tok_value(new,token,1); if(xctx->tok_size == 0 ) { mod=1; - my_strdup(1654, s, subst_token(*s, token, NULL) ); + my_strdup(_ALLOC_ID_, s, subst_token(*s, token, NULL) ); } } else if(state==TOK_END) { value[value_pos]='\0'; @@ -295,8 +295,8 @@ int set_different_token(char **s,const char *new, const char *old) escape = (c=='\\' && !escape); if(c=='\0') break; } - my_free(1655, &token); - my_free(1656, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &value); return mod; } @@ -315,12 +315,12 @@ const char *list_tokens(const char *s, int with_quotes) int escape=0; if(s==NULL) { - my_free(1657, &token); + my_free(_ALLOC_ID_, &token); sizetok = 0; return ""; } sizetok = CADCHUNKALLOC; - my_realloc(1658, &token, sizetok); + my_realloc(_ALLOC_ID_, &token, sizetok); token[0] = '\0'; while(1) { c=*s++; @@ -401,10 +401,10 @@ static void get_pin_and_attr(const char *token, char **pin_num_or_name, char **p if(*p == ':' && !bracket) { /* 01234567890123456 * @#A[3:0]:net_name */ - *pin_num_or_name = my_malloc(1659, p - token - 1); + *pin_num_or_name = my_malloc(_ALLOC_ID_, p - token - 1); memcpy(*pin_num_or_name, token + 2, p - token - 2); (*pin_num_or_name)[p - token - 2] = '\0'; - my_strdup2(1660, pin_attr, p + 1); + my_strdup2(_ALLOC_ID_, pin_attr, p + 1); done = 1; break; } @@ -412,8 +412,8 @@ static void get_pin_and_attr(const char *token, char **pin_num_or_name, char **p p++; } if(!done) { - my_strdup2(1661, pin_num_or_name, token + 2); - my_strdup2(1662, pin_attr, ""); + my_strdup2(_ALLOC_ID_, pin_num_or_name, token + 2); + my_strdup2(_ALLOC_ID_, pin_attr, ""); } dbg(1, "get_pin_and_attr(): token=%s, name=%s, attr=%s\n", token, *pin_num_or_name ? *pin_num_or_name : "", @@ -452,9 +452,9 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) if(s==NULL) { if(tok == NULL) { - my_free(1663, &result); - my_free(1664, &token); - my_free(1665, &translated_tok); + my_free(_ALLOC_ID_, &result); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &translated_tok); size = sizetok = 0; dbg(2, "get_tok_value(): clear static data\n"); } @@ -464,8 +464,8 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) /* dbg(0, "get_tok_value(): looking for <%s> in <%.30s>\n",tok,s); */ if( size == 0 ) { sizetok = size = CADCHUNKALLOC; - my_realloc(1666, &result, size); - my_realloc(1667, &token, sizetok); + my_realloc(_ALLOC_ID_, &result, size); + my_realloc(_ALLOC_ID_, &token, sizetok); } while(1) { c=*s++; @@ -478,11 +478,11 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) /* don't use STR_ALLOC() for efficiency reasons */ if(value_pos>=size) { size+=CADCHUNKALLOC; - my_realloc(1668, &result,size); + my_realloc(_ALLOC_ID_, &result,size); } if(token_pos>=sizetok) { sizetok+=CADCHUNKALLOC; - my_realloc(1669, &token,sizetok); + my_realloc(_ALLOC_ID_, &token,sizetok); } if(c=='"') { if(!escape) quote=!quote; @@ -515,7 +515,7 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) if(with_quotes & 2) { return result; } else { - my_strdup2(1670, &translated_tok, tcl_hook2(result)); + my_strdup2(_ALLOC_ID_, &translated_tok, tcl_hook2(result)); return translated_tok; } } @@ -555,15 +555,15 @@ const char *get_sym_template(char *s,char *extra) dbg(1, "get_sym_template(): s=%s, extra=%s\n", s ? s : "", extra ? extra : ""); if(s==NULL) { - my_free(1671, &result); + my_free(_ALLOC_ID_, &result); return ""; } l = strlen(s); STR_ALLOC(&result, l+1, &sizeres); result[0] = '\0'; sizetok = sizeval = CADCHUNKALLOC; - my_realloc(1672, &value,sizeval); - my_realloc(1673, &token,sizetok); + my_realloc(_ALLOC_ID_, &value,sizeval); + my_realloc(_ALLOC_ID_, &token,sizetok); while(1) { c=*s++; space=SPACE(c) ; @@ -615,8 +615,8 @@ const char *get_sym_template(char *s,char *extra) break; } } - my_free(1674, &value); - my_free(1675, &token); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); dbg(1, "get_sym_template(): result=|%s|\n", result); return result; } @@ -640,20 +640,20 @@ static char *get_pin_attr_from_inst(int inst, int pin, const char *attr) size_t tok_val_len; tok_val_len = strlen(str); attr_size = strlen(attr); - my_strdup(1676, &pinname, str); - pname =my_malloc(1677, tok_val_len + attr_size + 30); + my_strdup(_ALLOC_ID_, &pinname, str); + pname =my_malloc(_ALLOC_ID_, tok_val_len + attr_size + 30); my_snprintf(pname, tok_val_len + attr_size + 30, "%s(%s)", attr, pinname); - my_free(1678, &pinname); + my_free(_ALLOC_ID_, &pinname); str = get_tok_value(xctx->inst[inst].prop_ptr, pname, 0); - my_free(1679, &pname); - if(xctx->tok_size) my_strdup2(1680, &pin_attr_value, str); + my_free(_ALLOC_ID_, &pname); + if(xctx->tok_size) my_strdup2(_ALLOC_ID_, &pin_attr_value, str); else { - pnumber = my_malloc(1681, attr_size + 100); + pnumber = my_malloc(_ALLOC_ID_, attr_size + 100); my_snprintf(pnumber, attr_size + 100, "%s(%d)", attr, pin); str = get_tok_value(xctx->inst[inst].prop_ptr, pnumber, 0); dbg(1, "get_pin_attr_from_inst(): pnumber=%s\n", pnumber); - my_free(1682, &pnumber); - if(xctx->tok_size) my_strdup2(1683, &pin_attr_value, str); + my_free(_ALLOC_ID_, &pnumber); + if(xctx->tok_size) my_strdup2(_ALLOC_ID_, &pin_attr_value, str); } } return pin_attr_value; @@ -664,11 +664,11 @@ int get_last_used_index(const char *old_basename, const char *brkt) int retval = 1; Int_hashentry *entry; size_t size = strlen(old_basename) + strlen(brkt)+40; - char *refname = my_malloc(1684, size); + char *refname = my_malloc(_ALLOC_ID_, size); my_snprintf(refname, size, "_@%s@%s", old_basename, brkt); entry = int_hash_lookup(&xctx->inst_name_table, refname, 0, XLOOKUP); if(entry) retval = entry->value; - my_free(1685, &refname); + my_free(_ALLOC_ID_, &refname); return retval; } @@ -695,7 +695,7 @@ void hash_names(int inst, int action) start, stop, xctx->inst[inst].instname? xctx->inst[inst].instname : ""); for(i = start; i < stop; ++i) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { - my_strdup(1686, &upinst, expandlabel(xctx->inst[i].instname, &xmult)); + my_strdup(_ALLOC_ID_, &upinst, expandlabel(xctx->inst[i].instname, &xmult)); strtoupper(upinst); upinst_ptr = upinst; @@ -707,7 +707,7 @@ void hash_names(int inst, int action) } } } - if(upinst) my_free(1687, &upinst); + if(upinst) my_free(_ALLOC_ID_, &upinst); } /* return -1 if name is not used, else return first instance number with same name found @@ -724,7 +724,7 @@ static int name_is_used(char *name, const char *old_basename, const char *brkt, char *upinst = NULL; char *upinst_ptr, *upinst_state, *single_name; Int_hashentry *entry; - my_strdup(1688, &upinst, expandlabel(name, &xmult)); + my_strdup(_ALLOC_ID_, &upinst, expandlabel(name, &xmult)); strtoupper(upinst); upinst_ptr = upinst; while( (single_name = my_strtok_r(upinst_ptr, ",", "", 0, &upinst_state)) ) { @@ -735,15 +735,15 @@ static int name_is_used(char *name, const char *old_basename, const char *brkt, break; } } - my_free(1689, &upinst); + my_free(_ALLOC_ID_, &upinst); dbg(1, "name_is_used(%s): return inst %d\n", name, used); if(q != -1 && used == -1) { size_t size = strlen(old_basename) + strlen(brkt)+40; - char *refname = my_malloc(1690, size); + char *refname = my_malloc(_ALLOC_ID_, size); my_snprintf(refname, size, "_@%s@%s", old_basename, brkt); int_hash_lookup(&xctx->inst_name_table, refname, q, XINSERT); - my_free(1691, &refname); + my_free(_ALLOC_ID_, &refname); } return used; } @@ -768,31 +768,31 @@ void new_prop_string(int i, const char *old_prop, int dis_uniq_names) dbg(1, "new_prop_string(): i=%d, old_prop=%s\n", i, old_prop); if(old_prop==NULL) { - my_free(1692, &xctx->inst[i].prop_ptr); + my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); return; } - old_name_len = my_strdup(1693, &old_name,get_tok_value(old_prop,"name",0) ); /* added old_name_len */ + old_name_len = my_strdup(_ALLOC_ID_, &old_name,get_tok_value(old_prop,"name",0) ); /* added old_name_len */ if(old_name==NULL) { - my_strdup(1694, &xctx->inst[i].prop_ptr, old_prop); /* changed to copy old props if no name */ - my_strdup2(1695, &xctx->inst[i].instname, ""); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, old_prop); /* changed to copy old props if no name */ + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, ""); return; } /* don't change old_prop if name does not conflict. */ /* if no hash_names() is done and inst_table uninitialized --> use old_prop */ is_used = name_is_used(old_name, "", "", -1); if(dis_uniq_names || is_used == -1 || is_used == i) { - my_strdup(1696, &xctx->inst[i].prop_ptr, old_prop); - my_strdup2(1697, &xctx->inst[i].instname, old_name); - my_free(1698, &old_name); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, old_prop); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, old_name); + my_free(_ALLOC_ID_, &old_name); return; } /* old_name is not unique. Find another unique name */ - old_name_base = my_malloc(1699, old_name_len+1); + old_name_base = my_malloc(_ALLOC_ID_, old_name_len+1); n = sscanf(old_name, "%[^[0-9]",old_name_base); if(!n) old_name_base[0] = '\0'; /* there is no basename (like in "[3:0]" or "12"), set to empty string */ brkt=find_bracket(old_name); /* if no bracket found will point to end of string ('\0') */ - my_realloc(1700, &new_name, old_name_len + 40); + my_realloc(_ALLOC_ID_, &new_name, old_name_len + 40); qq = get_last_used_index(old_name_base, brkt); /* */ @@ -801,18 +801,18 @@ void new_prop_string(int i, const char *old_prop, int dis_uniq_names) is_used = name_is_used(new_name, old_name_base, brkt, q); if(is_used == -1 ) break; } - my_free(1701, &old_name_base); + my_free(_ALLOC_ID_, &old_name_base); dbg(1, "new_prop_string(): new_name=%s\n", new_name); new_prop = subst_token(old_prop, "name", new_name); dbg(1, "new_prop_string(): old_prop=|%s|\n", old_prop); dbg(1, "new_prop_string(): new_prop=|%s|\n", new_prop); if(strcmp(new_prop, old_prop) ) { - my_strdup(1702, &xctx->inst[i].prop_ptr, new_prop); - my_strdup2(1703, &xctx->inst[i].instname, new_name); + my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, new_prop); + my_strdup2(_ALLOC_ID_, &xctx->inst[i].instname, new_name); } - my_free(1704, &old_name); - my_free(1705, &new_name); - my_free(1706, &up_new_name); + my_free(_ALLOC_ID_, &old_name); + my_free(_ALLOC_ID_, &new_name); + my_free(_ALLOC_ID_, &up_new_name); } void check_unique_names(int rename) @@ -861,13 +861,13 @@ void check_unique_names(int rename) /* rename duplicates */ if(rename) for(i=0;iinstances; ++i) { if( (xctx->inst[i].color != -10000)) { - my_strdup(1707, &tmp, xctx->inst[i].prop_ptr); + my_strdup(_ALLOC_ID_, &tmp, xctx->inst[i].prop_ptr); newpropcnt++; new_prop_string(i, tmp, 0); hash_names(i, XINSERT); symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2); bbox(ADD, xctx->inst[i].x1, xctx->inst[i].y1, xctx->inst[i].x2, xctx->inst[i].y2); - my_free(1708, &tmp); + my_free(_ALLOC_ID_, &tmp); } } /* for(i...) */ if(modified) set_modify(1); @@ -935,25 +935,25 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 char *fmt_attr = NULL; char *result = NULL; - my_strdup(1709, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(1710, &name, xctx->inst[inst].instname); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_strdup(_ALLOC_ID_, &name, xctx->inst[inst].instname); fmt_attr = xctx->format ? xctx->format : "vhdl_format"; - if(!name) my_strdup(1711, &name, get_tok_value(template, "name", 0)); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(1712, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); /* get netlist format rule from symbol */ if(!xctx->tok_size) - my_strdup(1713, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2)); /* allow format string override in instance */ if(xctx->tok_size && strcmp(fmt_attr, "vhdl_format")) - my_strdup(1714, &format, get_tok_value(xctx->inst[inst].prop_ptr, "vhdl_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "vhdl_format", 2)); /* get netlist format rule from symbol */ if(!xctx->tok_size && strcmp(fmt_attr, "vhdl_format")) - my_strdup(1715, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "vhdl_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "vhdl_format", 2)); if((name==NULL) || (format==NULL) ) { - my_free(1716, &template); - my_free(1717, &name); - my_free(1718, &format); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &format); return; /*do no netlist unwanted insts(no format) */ } no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; @@ -999,55 +999,55 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 if(!xctx->tok_size) value=get_tok_value(template, token+1, 0); if(!xctx->tok_size && token[0] =='%') { - my_mstrcat(1719, &result, token + 1, NULL); + my_mstrcat(_ALLOC_ID_, &result, token + 1, NULL); } else if(value && value[0]!='\0') { /* instance names (name) and node labels (lab) go thru the expandlabel function. */ /*if something else must be parsed, put an if here! */ if(!(strcmp(token+1,"name"))) { if( (lab=expandlabel(value, &tmp)) != NULL) - my_mstrcat(1720, &result, "----name(", lab, ")", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----name(", lab, ")", NULL); else - my_mstrcat(1721, &result, value, NULL); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); } else if(!(strcmp(token+1,"lab"))) { if( (lab=expandlabel(value, &tmp)) != NULL) - my_mstrcat(1722, &result, "----pin(", lab, ")", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", lab, ")", NULL); else - my_mstrcat(1723, &result, value, NULL); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); } - else my_mstrcat(1724, &result, value, NULL); + else my_mstrcat(_ALLOC_ID_, &result, value, NULL); } else if(strcmp(token,"@symref")==0) { const char *s = get_sym_name(inst, 9999, 1, 0); - my_mstrcat(1725, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if(strcmp(token,"@symname")==0) /* of course symname must not be present */ /* in hash table */ { const char *s = sanitize(translate(inst, get_sym_name(inst, 0, 0, 0))); - my_mstrcat(1726, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if (strcmp(token,"@symname_ext")==0) { const char *s = sanitize(translate(inst, get_sym_name(inst, 0, 1, 0))); - my_mstrcat(1727, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if(strcmp(token,"@schname_ext")==0) /* of course schname must not be present */ /* in hash table */ { - my_mstrcat(1728, &result, xctx->current_name, NULL); + my_mstrcat(_ALLOC_ID_, &result, xctx->current_name, NULL); } else if(strcmp(token,"@schname")==0) { - my_mstrcat(1729, &result, get_cell(xctx->current_name, 0), NULL); + my_mstrcat(_ALLOC_ID_, &result, get_cell(xctx->current_name, 0), NULL); } else if(strcmp(token,"@topschname")==0) /* of course topschname must not be present in attributes */ { const char *topsch; topsch = get_trailing_path(xctx->sch[0], 0, 1); - my_mstrcat(1730, &result, topsch, NULL); + my_mstrcat(_ALLOC_ID_, &result, topsch, NULL); } else if(strcmp(token,"@pinlist")==0) /* of course pinlist must not be present */ /* in hash table. print multiplicity */ @@ -1061,9 +1061,9 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 if(strboolcmp(get_tok_value(prop,"vhdl_ignore",0), "true")) { const char *name = get_tok_value(prop,"name",0); if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) { - if(!first) my_mstrcat(1731, &result, " , ", NULL); + if(!first) my_mstrcat(_ALLOC_ID_, &result, " , ", NULL); str_ptr = net_name(inst,i, &multip, 0, 1); - my_mstrcat(1732, &result, "----pin(", str_ptr, ") ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", str_ptr, ") ", NULL); first = 0; } } @@ -1076,7 +1076,7 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 if(!strcmp( get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"name",0), token+2)) { if(strboolcmp(get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) { str_ptr = net_name(inst,i, &multip, 0, 1); - my_mstrcat(1733, &result, "----pin(", str_ptr, ") ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", str_ptr, ") ", NULL); } break; } @@ -1101,24 +1101,24 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 pin_attr_value = get_pin_attr_from_inst(inst, n, pin_attr); /* get pin_attr from instance pin attribute string */ if(!pin_attr_value) { - my_strdup(1734, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0)); } } /* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */ if(!pin_attr_value && is_net_name) { prepare_netlist_structs(0); - my_strdup(1735, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, xctx->inst[inst].node && xctx->inst[inst].node[n] ? xctx->inst[inst].node[n] : "?"); } - if(!pin_attr_value ) my_strdup(1736, &pin_attr_value, "--UNDEF--"); + if(!pin_attr_value ) my_strdup(_ALLOC_ID_, &pin_attr_value, "--UNDEF--"); value = pin_attr_value; /* recognize slotted devices: instname = "U3:3", value = "a:b:c:d" --> value = "c" */ if(value[0] && !strcmp(pin_attr, "pinnumber") ) { char *ss; int slot; char *tmpstr = NULL; - tmpstr = my_malloc(1737, sizeof(xctx->inst[inst].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname)); if( (ss=strchr(xctx->inst[inst].instname, ':')) ) { sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { @@ -1126,10 +1126,10 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 if(strstr(value,":")) value = find_nth(value, ":", "", 0, slot); } } - my_free(1738, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } - my_mstrcat(1739, &result, value, NULL); - my_free(1740, &pin_attr_value); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); + my_free(_ALLOC_ID_, &pin_attr_value); } else if(n>=0 && n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]) { const char *si; @@ -1137,11 +1137,11 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 si = get_tok_value(prop, "verilog_ignore",0); if(strboolcmp(si, "true")) { str_ptr = net_name(inst,n, &multip, 0, 1); - my_mstrcat(1741, &result, "----pin(", str_ptr, ") ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", str_ptr, ") ", NULL); } } - my_free(1742, &pin_attr); - my_free(1743, &pin_num_or_name); + my_free(_ALLOC_ID_, &pin_attr); + my_free(_ALLOC_ID_, &pin_num_or_name); } else if(!strncmp(token,"@tcleval", 8)) { @@ -1149,19 +1149,19 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 size_t s; char *tclcmd=NULL; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(1744, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); tcleval(tclcmd); - my_mstrcat(1745, &result, tclresult(), NULL); - my_free(1746, &tclcmd); + my_mstrcat(_ALLOC_ID_, &result, tclresult(), NULL); + my_free(_ALLOC_ID_, &tclcmd); } if(c!='%' && c!='@' && c!='\0' ) { char str[2]; str[0] = (unsigned char) c; str[1] = (unsigned char)'\0'; - my_mstrcat(1747, &result, str, NULL); + my_mstrcat(_ALLOC_ID_, &result, str, NULL); } if(c == '@' || c == '%') s--; state=TOK_BEGIN; @@ -1170,7 +1170,7 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 char str[2]; str[0] = (unsigned char) c; str[1] = (unsigned char)'\0'; - my_mstrcat(1748, &result, str, NULL); + my_mstrcat(_ALLOC_ID_, &result, str, NULL); } if(c=='\0') @@ -1187,20 +1187,20 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 if(strchr(result, '@')) { /* netlist_commands often have @ characters due to ngspice syntax. Do not translate */ if(strcmp(xctx->sym[xctx->inst[inst].ptr].type, "netlist_commands")) { - my_strdup2(1749, &result, + my_strdup2(_ALLOC_ID_, &result, translate3(result, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, NULL, NULL)); /* can not put template in above translate3: -----------------------^^^^ * if instance has VHI=VHI, format string has VHI=@VHI, and symbol template has VHI=3 * we do not want token @VHI to resolve to 3, but stop at VHI as specified in instance */ if(strchr(result, '@')) { - my_strdup2(1750, &result, + my_strdup2(_ALLOC_ID_, &result, translate3(result, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, template, NULL)); } } } - my_strdup2(1751, &result, tcl_hook2(result)); /* tcl evaluation if tcleval(....) */ + my_strdup2(_ALLOC_ID_, &result, tcl_hook2(result)); /* tcl evaluation if tcleval(....) */ if(strstr(result, "expr(")) { - my_strdup2(1752, &result, eval_expr(result)); + my_strdup2(_ALLOC_ID_, &result, eval_expr(result)); } dbg(1, "print_vhdl_primitive(): after translate3() result=%s\n", result); } @@ -1210,11 +1210,11 @@ static void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 200 break ; } } /* while(1) */ - my_free(1753, &result); - my_free(1754, &template); - my_free(1755, &format); - my_free(1756, &name); - my_free(1757, &token); + my_free(_ALLOC_ID_, &result); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); } const char *subst_token(const char *s, const char *tok, const char *new_val) @@ -1237,34 +1237,34 @@ const char *subst_token(const char *s, const char *tok, const char *new_val) size_t new_val_len; if(s==NULL && tok == NULL){ - my_free(1758, &result); + my_free(_ALLOC_ID_, &result); return ""; } if((tok == NULL || tok[0]=='\0') && s ){ - my_strdup2(1759, &result, s); + my_strdup2(_ALLOC_ID_, &result, s); return result; } if( (!s || s[0] == '\0') && tok && new_val) { - my_strdup2(1760, &result, tok); - my_mstrcat(1761, &result, "=", new_val, NULL); + my_strdup2(_ALLOC_ID_, &result, tok); + my_mstrcat(_ALLOC_ID_, &result, "=", new_val, NULL); return result; } /* quote new_val if it contains newlines and not "name" token */ if(new_val) { new_val_len = strlen(new_val); if(strcmp(tok, "name") && !is_quoted(new_val) && strpbrk(new_val, ";\n \t")) { - new_val_copy = my_malloc(1762, new_val_len+3); + new_val_copy = my_malloc(_ALLOC_ID_, new_val_len+3); my_snprintf(new_val_copy, new_val_len+3, "\"%s\"", new_val); } - else my_strdup(1763, &new_val_copy, new_val); /* new_val_copy is NULL if new_val empty */ + else my_strdup(_ALLOC_ID_, &new_val_copy, new_val); /* new_val_copy is NULL if new_val empty */ } else new_val_copy = NULL; /* if new_val is NULL or empty new_val_copy will be NULL */ dbg(1, "subst_token(): %s, %s, %s\n", s ? s : "", tok ? tok : "", new_val ? new_val : ""); sizetok = size = CADCHUNKALLOC; - my_realloc(1764, &result, size); - my_realloc(1765, &token, sizetok); + my_realloc(_ALLOC_ID_, &result, size); + my_realloc(_ALLOC_ID_, &token, sizetok); result[0] = '\0'; while( s ) { c=*s++; @@ -1392,8 +1392,8 @@ const char *subst_token(const char *s, const char *tok, const char *new_val) } } dbg(2, "subst_token(): returning: %s\n",result); - my_free(1766, &token); - my_free(1767, &new_val_copy); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &new_val_copy); return result; } @@ -1504,13 +1504,13 @@ void print_vhdl_element(FILE *fd, int inst) print_vhdl_primitive(fd, inst); return; } - my_strdup(1768, &name,xctx->inst[inst].instname); - if(!name) my_strdup(1769, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); if(name==NULL) { - my_free(1770, &name); + my_free(_ALLOC_ID_, &name); return; } - my_strdup(1771, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; no_of_generics= (xctx->inst[inst].ptr + xctx->sym)->rects[GENERICLAYER]; @@ -1529,7 +1529,7 @@ void print_vhdl_element(FILE *fd, int inst) tmp=0; /* 20080213 use generic_type property to decide if some properties are strings, see later */ - my_strdup(1772, &generic_type, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"generic_type", 0)); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"generic_type", 0)); while(1) { @@ -1595,10 +1595,10 @@ void print_vhdl_element(FILE *fd, int inst) for(i=0;iinst[inst].node || !xctx->inst[inst].node[no_of_pins+i]) continue; - my_strdup(1773, &generic_type, + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[GENERICLAYER][i].prop_ptr,"type",0)); - my_strdup(1774, &generic_value, xctx->inst[inst].node[no_of_pins+i] ); - /*my_strdup(1775, &generic_value, get_tok_value( */ + my_strdup(_ALLOC_ID_, &generic_value, xctx->inst[inst].node[no_of_pins+i] ); + /*my_strdup(_ALLOC_ID_, &generic_value, get_tok_value( */ /* (xctx->inst[inst].ptr + xctx->sym)->rect[GENERICLAYER][i].prop_ptr,"value") ); */ str_ptr = get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[GENERICLAYER][i].prop_ptr,"name",0); @@ -1637,12 +1637,12 @@ void print_vhdl_element(FILE *fd, int inst) int_hash_free(&table); fprintf(fd, "\n);\n\n"); dbg(2, "print_vhdl_element(): ------- end ------ \n"); - my_free(1776, &name); - my_free(1777, &generic_value); - my_free(1778, &generic_type); - my_free(1779, &template); - my_free(1780, &value); - my_free(1781, &token); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &generic_value); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); } void print_generic(FILE *fd, char *ent_or_comp, int symbol) @@ -1659,12 +1659,12 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) int escape=0; int token_number=0; - my_strdup(1782, &template, xctx->sym[symbol].templ); + my_strdup(_ALLOC_ID_, &template, xctx->sym[symbol].templ); if( !template || !(template[0]) ) { - my_free(1783, &template); + my_free(_ALLOC_ID_, &template); return; } - my_strdup(1784, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); dbg(2, "print_generic(): symbol=%d template=%s \n", symbol, template); fprintf(fd, "%s %s ",ent_or_comp, get_cell(sanitize(xctx->sym[symbol].name), 0)); @@ -1708,7 +1708,7 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) token_number++; value[value_pos]='\0'; value_pos=0; - my_strdup(1785, &type, get_tok_value(generic_type,token,0)); + my_strdup(_ALLOC_ID_, &type, get_tok_value(generic_type,token,0)); if(value[0] != '\0') /* token has a value */ { @@ -1735,9 +1735,9 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) for(i=0;isym[symbol].rects[GENERICLAYER]; ++i) { - my_strdup(1786, &generic_type, + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"generic_type",0)); - my_strdup(1787, &generic_value, + my_strdup(_ALLOC_ID_, &generic_value, get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"value", 0) ); str_tmp = get_tok_value(xctx->sym[symbol].rect[GENERICLAYER][i].prop_ptr,"name",0); if(!tmp) fprintf(fd, "generic (\n"); @@ -1749,12 +1749,12 @@ void print_generic(FILE *fd, char *ent_or_comp, int symbol) tmp=1; } if(tmp) fprintf(fd, "\n);\n"); - my_free(1788, &template); - my_free(1789, &value); - my_free(1790, &token); - my_free(1791, &type); - my_free(1792, &generic_type); - my_free(1793, &generic_value); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &type); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &generic_value); } @@ -1769,13 +1769,13 @@ void print_verilog_param(FILE *fd, int symbol) int token_number=0; char *extra = NULL; - my_strdup(1794, &template, xctx->sym[symbol].templ); /* 20150409 20171103 */ + my_strdup(_ALLOC_ID_, &template, xctx->sym[symbol].templ); /* 20150409 20171103 */ if( !template || !(template[0]) ) { - my_free(1795, &template); + my_free(_ALLOC_ID_, &template); return; } - my_strdup(1796, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); - my_strdup(1797, &extra, get_tok_value(xctx->sym[symbol].prop_ptr,"extra",0) ); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[symbol].prop_ptr,"generic_type",0)); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[symbol].prop_ptr,"extra",0) ); dbg(2, "print_verilog_param(): symbol=%d template=%s \n", symbol, template); s=template; @@ -1837,11 +1837,11 @@ void print_verilog_param(FILE *fd, int symbol) break ; } } - my_free(1798, &template); - my_free(1799, &generic_type); - my_free(1800, &value); - my_free(1801, &token); - my_free(1802, &extra); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &extra); } @@ -1877,9 +1877,9 @@ static int has_included_subcircuit(int inst, int symbol, char **result) int ret = 0; - my_strdup2(1803, &spice_sym_def, get_tok_value(xctx->inst[inst].prop_ptr, "spice_sym_def", 2)); + my_strdup2(_ALLOC_ID_, &spice_sym_def, get_tok_value(xctx->inst[inst].prop_ptr, "spice_sym_def", 2)); if(!spice_sym_def[0]) { - my_strdup2(1804, &spice_sym_def, get_tok_value(xctx->sym[symbol].prop_ptr, "spice_sym_def", 0)); + my_strdup2(_ALLOC_ID_, &spice_sym_def, get_tok_value(xctx->sym[symbol].prop_ptr, "spice_sym_def", 0)); } if(xctx->tok_size) { @@ -1892,15 +1892,15 @@ static int has_included_subcircuit(int inst, int symbol, char **result) Str_hashentry *entry; Str_hashtable table = {NULL, 0}; - my_strdup2(1805, &symname, get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 0)); + my_strdup2(_ALLOC_ID_, &symname, get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 0)); if(!symname[0]) { - my_strdup2(1806, &symname, get_tok_value(xctx->sym[symbol].prop_ptr, "schematic", 0)); + my_strdup2(_ALLOC_ID_, &symname, get_tok_value(xctx->sym[symbol].prop_ptr, "schematic", 0)); } if(!symname[0]) { - my_strdup2(1807, &symname, xctx->sym[symbol].name); + my_strdup2(_ALLOC_ID_, &symname, xctx->sym[symbol].name); } - my_mstrcat(1808, &symname_attr, "symname=", get_cell(symname, 0), NULL); - my_mstrcat(1809, &symname_attr, " symref=", get_sym_name(inst, 9999, 1, 1), NULL); + my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(symname, 0), NULL); + my_mstrcat(_ALLOC_ID_, &symname_attr, " symref=", get_sym_name(inst, 9999, 1, 1), NULL); translated_sym_def = translate3(spice_sym_def, 1, xctx->inst[inst].prop_ptr, xctx->sym[symbol].templ, symname_attr, NULL); @@ -1918,10 +1918,10 @@ static int has_included_subcircuit(int inst, int symbol, char **result) int pin_mult, net_mult; char *pin_expanded_ptr, *pin_expanded = NULL; char *net_expanded_ptr, *net_expanded = NULL; - my_strdup2(1810, &pin_expanded, expandlabel(name, &pin_mult)); + my_strdup2(_ALLOC_ID_, &pin_expanded, expandlabel(name, &pin_mult)); exp_no_of_pins += pin_mult; strtolower(pin_expanded); - my_strdup2(1811, &net_expanded, net_name(inst, i, &net_mult, 0, 1)); + my_strdup2(_ALLOC_ID_, &net_expanded, net_name(inst, i, &net_mult, 0, 1)); net_expanded_ptr = net_expanded; pin_expanded_ptr = pin_expanded; while((pin = my_strtok_r(pin_expanded_ptr, ",", "", 0, &pin_save))) { @@ -1931,8 +1931,8 @@ static int has_included_subcircuit(int inst, int symbol, char **result) pin_expanded_ptr = NULL; net_expanded_ptr = NULL; } - my_free(1812, &pin_expanded); - my_free(1813, &net_expanded); + my_free(_ALLOC_ID_, &pin_expanded); + my_free(_ALLOC_ID_, &net_expanded); } } dbg(1, "exp_no_of_pins=%d\n", exp_no_of_pins); @@ -1941,7 +1941,7 @@ static int has_included_subcircuit(int inst, int symbol, char **result) tclvareval("has_included_subcircuit {", get_cell(symname, 0), "} {", translated_sym_def, "} ", my_itoa(exp_no_of_pins), NULL); - my_free(1814, &symname_attr); + my_free(_ALLOC_ID_, &symname_attr); if(tclresult()[0]) { /* a valid spice_sym_def netlist was found */ char *subckt_pin, *pin_save; char *subckt_pinlist_ptr; @@ -1950,7 +1950,7 @@ static int has_included_subcircuit(int inst, int symbol, char **result) int symbol_pins = 0; int instance_pins = 0; - my_strdup2(1815, &subckt_pinlist, tclresult()); + my_strdup2(_ALLOC_ID_, &subckt_pinlist, tclresult()); dbg(1, "included subcircuit: pinlist=%s\n", subckt_pinlist); @@ -1964,7 +1964,7 @@ static int has_included_subcircuit(int inst, int symbol, char **result) net = entry->value; symbol_pins++; dbg(1, "subckt_pin=%s, net=%s\n", subckt_pin, net); - my_mstrcat(1816, &tmp_result, "?1 ", net, " ", NULL); + my_mstrcat(_ALLOC_ID_, &tmp_result, "?1 ", net, " ", NULL); } subckt_pinlist_ptr = NULL; } @@ -1972,7 +1972,7 @@ static int has_included_subcircuit(int inst, int symbol, char **result) /* check if they match */ if(instance_pins == symbol_pins) { ret = 1; - my_mstrcat(1817, result, tmp_result, NULL); + my_mstrcat(_ALLOC_ID_, result, tmp_result, NULL); } else { dbg(0, "has_included_subcircuit(): %s symbol and .subckt pins do not match. Discard port order\n", symname); @@ -1980,13 +1980,13 @@ static int has_included_subcircuit(int inst, int symbol, char **result) tclvareval("alert_ {has_included_subcircuit(): ", symname, " symbol and .subckt pins do not match. Discard .subckt port order}", NULL); } - if(tmp_result) my_free(1818, &tmp_result); - my_free(1819, &subckt_pinlist); + if(tmp_result) my_free(_ALLOC_ID_, &tmp_result); + my_free(_ALLOC_ID_, &subckt_pinlist); } - my_free(1820, &symname); + my_free(_ALLOC_ID_, &symname); str_hash_free(&table); } - my_free(1821, &spice_sym_def); + my_free(_ALLOC_ID_, &spice_sym_def); return ret; } @@ -2005,13 +2005,13 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) const char *tclres, *fmt_attr = NULL; fmt_attr = xctx->format ? xctx->format : "format"; - my_strdup(1822, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, fmt_attr, 2)); if(!xctx->tok_size && strcmp(fmt_attr, "format") ) - my_strdup(1823, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, "format", 2)); + my_strdup(_ALLOC_ID_, &format1, get_tok_value(xctx->sym[symbol].prop_ptr, "format", 2)); dbg(1, "print_spice_subckt(): format1=%s\n", format1); /* can not do this, since @symname is used as a token later in format parser */ - /* my_strdup(1824, &format1, + /* my_strdup(_ALLOC_ID_, &format1, * str_replace(format1, "@symname", get_cell(xctx->sym[symbol].name, 0), '\\', -1)); */ if(format1 && strstr(format1, "tcleval(") == format1) { @@ -2019,12 +2019,12 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) if(!strcmp(tclres, "?\n")) { char *ptr = strrchr(format1 + 8, ')'); *ptr = '\0'; - my_strdup(1825, &format, format1 + 8); - } else my_strdup(1826, &format, tclres); + my_strdup(_ALLOC_ID_, &format, format1 + 8); + } else my_strdup(_ALLOC_ID_, &format, tclres); } else { - my_strdup(1827, &format, format1); + my_strdup(_ALLOC_ID_, &format, format1); } - if(format1) my_free(1828, &format1); + if(format1) my_free(_ALLOC_ID_, &format1); dbg(1, "print_spice_subckt(): format=%s\n", format); if( format==NULL ) { return; /* no format */ @@ -2080,7 +2080,7 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) { str_ptr= expandlabel(name, &multip); /* fprintf(fd, "%s ", str_ptr); */ - my_mstrcat(1829, &result, str_ptr, " ", NULL); + my_mstrcat(_ALLOC_ID_, &result, str_ptr, " ", NULL); } } } @@ -2094,7 +2094,7 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) } if(isym[symbol].rect[PINLAYER][pin_number].prop_ptr,"spice_ignore",0), "true")) { str_ptr = get_tok_value(xctx->sym[symbol].rect[PINLAYER][pin_number].prop_ptr,"name",0); /* fprintf(fd, "%s ", expandlabel(str_ptr, &multip)); */ - my_mstrcat(1831, &result, expandlabel(str_ptr, &multip), " ", NULL); + my_mstrcat(_ALLOC_ID_, &result, expandlabel(str_ptr, &multip), " ", NULL); } } - my_free(1832, &pin_attr); - my_free(1833, &pin_num_or_name); + my_free(_ALLOC_ID_, &pin_attr); + my_free(_ALLOC_ID_, &pin_num_or_name); } /* this will print the other @parameters, usually "extra" nodes so they will be in the order @@ -2121,7 +2121,7 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) /* if token not followed by white space it is not an extra node */ if( ( (space || c == '%' || c == '@') && !escape ) ) { /* fprintf(fd, "%s ", token + 1); */ - my_mstrcat(1834, &result, token + 1, " ", NULL); + my_mstrcat(_ALLOC_ID_, &result, token + 1, " ", NULL); } } /* if(c!='%' && c!='@' && c!='\0' ) fputc(c,fd); */ @@ -2134,17 +2134,17 @@ void print_spice_subckt_nodes(FILE *fd, int symbol) } if(c=='\0') { - my_mstrcat(1835, &result, "\n", NULL); + my_mstrcat(_ALLOC_ID_, &result, "\n", NULL); break ; } } if(result) { fprintf(fd, "%s", result); - my_free(1836, &result); + my_free(_ALLOC_ID_, &result); } - my_free(1837, &format1); - my_free(1838, &format); - my_free(1839, &token); + my_free(_ALLOC_ID_, &format1); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &token); } int print_spice_element(FILE *fd, int inst) @@ -2166,30 +2166,30 @@ int print_spice_element(FILE *fd, int inst) const char *fmt_attr = NULL; size = CADCHUNKALLOC; - my_realloc(1840, &result, size); + my_realloc(_ALLOC_ID_, &result, size); result[0] = '\0'; - my_strdup(1841, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(1842, &name,xctx->inst[inst].instname); - if (!name) my_strdup(1843, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if (!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); fmt_attr = xctx->format ? xctx->format : "format"; /* allow format string override in instance */ - my_strdup(1844, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); /* get netlist format rule from symbol */ if(!xctx->tok_size) - my_strdup(1845, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2)); /* allow format string override in instance */ if(!xctx->tok_size && strcmp(fmt_attr, "format") ) - my_strdup(1846, &format, get_tok_value(xctx->inst[inst].prop_ptr, "format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "format", 2)); /* get netlist format rule from symbol */ if(!xctx->tok_size && strcmp(fmt_attr, "format")) - my_strdup(1847, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "format", 2)); if ((name==NULL) || (format==NULL)) { - my_free(1848, &template); - my_free(1849, &format); - my_free(1850, &name); - my_free(1851, &result); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &result); return 0; /* do no netlist unwanted insts(no format) */ } no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; @@ -2232,27 +2232,27 @@ int print_spice_element(FILE *fd, int inst) if(strcmp(token,"@symref")==0) { const char *s = get_sym_name(inst, 9999, 1, 0); - my_mstrcat(1852, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if (strcmp(token,"@symname")==0) /* of course symname must not be present in attributes */ { const char *s = sanitize(translate(inst, get_sym_name(inst, 0, 0, 0))); - my_mstrcat(1853, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if (strcmp(token,"@symname_ext")==0) /* of course symname_ext must not be present in attributes */ { const char *s = sanitize(translate(inst, get_sym_name(inst, 0, 1, 0))); - my_mstrcat(1854, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if(strcmp(token,"@topschname")==0) /* of course topschname must not be present in attributes */ { const char *topsch; topsch = get_trailing_path(xctx->sch[0], 0, 1); - my_mstrcat(1855, &result, topsch, NULL); + my_mstrcat(_ALLOC_ID_, &result, topsch, NULL); } else if(strcmp(token,"@schname_ext")==0) /* of course schname must not be present in attributes */ { - my_mstrcat(1856, &result, xctx->current_name, NULL); + my_mstrcat(_ALLOC_ID_, &result, xctx->current_name, NULL); } else if(strcmp(token,"@savecurrent")==0) { @@ -2261,13 +2261,13 @@ int print_spice_element(FILE *fd, int inst) const char *sc = get_tok_value(xctx->inst[inst].prop_ptr, "savecurrent", 0); if(!sc[0]) sc = get_tok_value(template, "savecurrent", 0); if(!strboolcmp(sc , "true")) { - my_mstrcat(1857, &result, "\n.save I( ?1 ", instname, " )", NULL); + my_mstrcat(_ALLOC_ID_, &result, "\n.save I( ?1 ", instname, " )", NULL); } } else if(strcmp(token,"@schname")==0) /* of course schname must not be present in attributes */ { const char *schname = get_cell(xctx->current_name, 0); - my_mstrcat(1858, &result, schname, NULL); + my_mstrcat(_ALLOC_ID_, &result, schname, NULL); } else if(strcmp(token,"@pinlist")==0) /* of course pinlist must not be present in attributes */ /* print multiplicity */ @@ -2284,7 +2284,7 @@ int print_spice_element(FILE *fd, int inst) if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) { str_ptr = net_name(inst, i, &multip, 0, 1); - my_mstrcat(1859, &result, "?", my_itoa(multip), " ", str_ptr, " ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "?", my_itoa(multip), " ", str_ptr, " ", NULL); } } } @@ -2298,7 +2298,7 @@ int print_spice_element(FILE *fd, int inst) if(strboolcmp(get_tok_value(prop,"spice_ignore",0), "true")) { str_ptr = net_name(inst,i, &multip, 0, 1); - my_mstrcat(1860, &result, "?", my_itoa(multip), " ", str_ptr, " ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "?", my_itoa(multip), " ", str_ptr, " ", NULL); } break; } @@ -2322,24 +2322,24 @@ int print_spice_element(FILE *fd, int inst) pin_attr_value = get_pin_attr_from_inst(inst, n, pin_attr); /* get pin_attr from instance pin attribute string */ if(!pin_attr_value) { - my_strdup(1861, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0)); } } /* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */ if(!pin_attr_value && is_net_name) { prepare_netlist_structs(0); - my_strdup(1862, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, xctx->inst[inst].node && xctx->inst[inst].node[n] ? xctx->inst[inst].node[n] : "?"); } - if(!pin_attr_value ) my_strdup(1863, &pin_attr_value, "--UNDEF--"); + if(!pin_attr_value ) my_strdup(_ALLOC_ID_, &pin_attr_value, "--UNDEF--"); value = pin_attr_value; /* recognize slotted devices: instname = "U3:3", value = "a:b:c:d" --> value = "c" */ if(value[0] && !strcmp(pin_attr, "pinnumber") ) { char *ss; int slot; char *tmpstr = NULL; - tmpstr = my_malloc(1864, sizeof(xctx->inst[inst].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname)); if( (ss=strchr(xctx->inst[inst].instname, ':')) ) { sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { @@ -2347,10 +2347,10 @@ int print_spice_element(FILE *fd, int inst) if(strstr(value,":")) value = find_nth(value, ":", "", 0, slot); } } - my_free(1865, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } - my_mstrcat(1866, &result, value, NULL); - my_free(1867, &pin_attr_value); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); + my_free(_ALLOC_ID_, &pin_attr_value); } else if(n>=0 && n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]) { const char *si; @@ -2359,25 +2359,25 @@ int print_spice_element(FILE *fd, int inst) if(strboolcmp(si, "true")) { str_ptr = net_name(inst,n, &multip, 0, 1); - my_mstrcat(1868, &result, "?", my_itoa(multip), " ", str_ptr, " ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "?", my_itoa(multip), " ", str_ptr, " ", NULL); } } - my_free(1869, &pin_attr); - my_free(1870, &pin_num_or_name); + my_free(_ALLOC_ID_, &pin_attr); + my_free(_ALLOC_ID_, &pin_num_or_name); } else if (!strncmp(token,"@tcleval", 8)) { size_t s; char *tclcmd=NULL; const char *res; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(1871, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); dbg(1, "print_spice_element(): tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); res = tcleval(tclcmd); - my_mstrcat(1872, &result, res, NULL); - my_free(1873, &tclcmd); + my_mstrcat(_ALLOC_ID_, &result, res, NULL); + my_free(_ALLOC_ID_, &tclcmd); } /* if spiceprefix==0 and token == @spiceprefix then set empty value */ else if (!tclgetboolvar("spiceprefix") && !strcmp(token, "@spiceprefix")) { @@ -2414,36 +2414,36 @@ int print_spice_element(FILE *fd, int inst) * ..." * model=nfet_01v8 */ - my_strdup2(1874, &val, + my_strdup2(_ALLOC_ID_, &val, translate3(token, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, NULL, NULL)); /* can not put template in above translate3: ---------------------------^^^^ * if instance has VHI=VHI, format string has VHI=@VHI, and symbol template has VHI=3 * we do not want token @VHI to resolve to 3, but stop at VHI as specified in instance */ if(strchr(val, '@')) { - my_strdup2(1875, &val, + my_strdup2(_ALLOC_ID_, &val, translate3(val, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, template, NULL)); } /* nmos instance format string: @model --> @modeln */ dbg(1, "print_spice_element(): 1st round: val: |%s|\n", val); if(strchr(val, '@')) { if(parent_prop_ptr) { - my_strdup2(1876, &val, + my_strdup2(_ALLOC_ID_, &val, translate3(val, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, parent_templ, NULL)); /* instance based passgate.sym placement, nmos instance format string: @modeln --> pippon */ /* ad="expr('int((@nf + 1)/2) * @W / @nf * 0.29')" --> ad="expr('int((1 + 1)/2) * W_N / 1 * 0.29')" */ if(strchr(val, '@')) { - my_strdup2(1877, &val, + my_strdup2(_ALLOC_ID_, &val, translate3(val, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, parent_templ, NULL)); /* ad="expr('int((1 + 1)/2) * W_N / 1 * 0.29')" --> ad="expr('int((1 + 1)/2) * 5 / 1 * 0.29')" */ } } else { - my_strdup2(1878, &val, + my_strdup2(_ALLOC_ID_, &val, translate3(val, 0, xctx->inst[inst].prop_ptr, NULL, NULL, NULL)); dbg(1, "print_spice_element(): 2nd round: val: |%s|\n", val); /* normal passgate.sym placement, nmos instance format string: ad="expr('int((@nf + 1)/2) * @W / @nf * 0.29')" --> ad="expr('int((1 + 1)/2) * W_N/ 1 * 0.29')" */ if(strchr(val, '@')) { - my_strdup2(1879, &val, + my_strdup2(_ALLOC_ID_, &val, translate3(val, 0, xctx->inst[inst].prop_ptr, parent_templ, NULL, NULL)); dbg(1, "print_spice_element(): 3nd round: val: |%s|\n", val); /* normal passgate.sym placement, nmos instance format string: @@ -2459,7 +2459,7 @@ int print_spice_element(FILE *fd, int inst) tok_val_len = strlen(value); /* @spiceprefix needs a special tag for postprocessing */ if(!strcmp(token, "@spiceprefix") && value[0]) { - my_realloc(1880, &spiceprefixtag, tok_val_len+22); + my_realloc(_ALLOC_ID_, &spiceprefixtag, tok_val_len+22); my_snprintf(spiceprefixtag, tok_val_len+22, "**** spice_prefix %s\n", value); value = spiceprefixtag; } @@ -2469,7 +2469,7 @@ int print_spice_element(FILE *fd, int inst) } /* token=%xxxx and xxxx is not defined in prop_ptr or template: return xxxx */ if(!token_exists && token[0] =='%') { - my_mstrcat(1881, &result, token + 1, NULL); + my_mstrcat(_ALLOC_ID_, &result, token + 1, NULL); } /* And finally set the value of token into result string */ else if (value && value[0]!='\0') { @@ -2477,9 +2477,9 @@ int print_spice_element(FILE *fd, int inst) /*if something else must be parsed, put an if here! */ if (!(strcmp(token+1,"name") && strcmp(token+1,"lab")) /* expand name/labels */ && ((lab = expandlabel(value, &itmp)) != NULL)) { - my_mstrcat(1882, &result, lab, NULL); + my_mstrcat(_ALLOC_ID_, &result, lab, NULL); } else { - my_mstrcat(1883, &result, value, NULL); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); } } } /* else */ @@ -2489,26 +2489,26 @@ int print_spice_element(FILE *fd, int inst) char str[2]; str[0] = (unsigned char) c; str[1] = '\0'; - my_mstrcat(1884, &result, str, NULL); + my_mstrcat(_ALLOC_ID_, &result, str, NULL); } /* ... unless it is the start of another token, so push back to input string */ if(c == '@' || c == '%' ) s--; state=TOK_BEGIN; - my_free(1885, &val); + my_free(_ALLOC_ID_, &val); } /* else if (state==TOK_SEP) */ else if(state==TOK_BEGIN && c!='\0') { char str[2]; str[0] = (unsigned char) c; str[1] = '\0'; - my_mstrcat(1886, &result, str, NULL); + my_mstrcat(_ALLOC_ID_, &result, str, NULL); } if(c=='\0') { char str[2]; str[0] = '\n'; str[1] = '\0'; - my_mstrcat(1887, &result, str, NULL); + my_mstrcat(_ALLOC_ID_, &result, str, NULL); break; } } /* while(1) */ @@ -2517,20 +2517,20 @@ int print_spice_element(FILE *fd, int inst) /* if result is like: 'tcleval(some_string)' pass it thru tcl evaluation so expressions * can be calculated */ if(result) { - my_strdup(1888, &result, tcl_hook2(result)); + my_strdup(_ALLOC_ID_, &result, tcl_hook2(result)); } if(strstr(result, "expr(")) { - my_strdup2(1889, &result, eval_expr(result)); + my_strdup2(_ALLOC_ID_, &result, eval_expr(result)); } if(result) fprintf(fd, "%s", result); dbg(1, "print_spice_element(): returning |%s|\n", result); - my_free(1890, &template); - my_free(1891, &format); - my_free(1892, &name); - my_free(1893, &token); - my_free(1894, &result); - if(spiceprefixtag) my_free(1895, &spiceprefixtag); - /* my_free(1896, &translatedvalue); */ + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &result); + if(spiceprefixtag) my_free(_ALLOC_ID_, &spiceprefixtag); + /* my_free(_ALLOC_ID_, &translatedvalue); */ return 1; } @@ -2555,24 +2555,24 @@ void print_tedax_element(FILE *fd, int inst) int no_of_pins=0; int subcircuit = 0; - my_strdup(1897, &extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"extra",0)); - my_strdup(1898, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",0)); - if(!extra_pinnumber) my_strdup(1899, &extra_pinnumber, + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"extra",0)); + my_strdup(_ALLOC_ID_, &extra_pinnumber, get_tok_value(xctx->inst[inst].prop_ptr,"extra_pinnumber",0)); + if(!extra_pinnumber) my_strdup(_ALLOC_ID_, &extra_pinnumber, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"extra_pinnumber",0)); - my_strdup(1900, &template, + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(1901, &numslots, get_tok_value(xctx->inst[inst].prop_ptr,"numslots",0)); - if(!numslots) my_strdup(1902, &numslots, get_tok_value(template,"numslots",0)); - if(!numslots) my_strdup(1903, &numslots, "1"); + my_strdup(_ALLOC_ID_, &numslots, get_tok_value(xctx->inst[inst].prop_ptr,"numslots",0)); + if(!numslots) my_strdup(_ALLOC_ID_, &numslots, get_tok_value(template,"numslots",0)); + if(!numslots) my_strdup(_ALLOC_ID_, &numslots, "1"); - my_strdup(1904, &name,xctx->inst[inst].instname); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); /* my_strdup(xxx, &name,get_tok_value(xctx->inst[inst].prop_ptr,"name",0)); */ - if(!name) my_strdup(1905, &name, get_tok_value(template, "name", 0)); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); /* allow format string override in instance */ - my_strdup(1906, &format, get_tok_value(xctx->inst[inst].prop_ptr,"tedax_format",2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr,"tedax_format",2)); if(!format || !format[0]) - my_strdup(1907, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"tedax_format",2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"tedax_format",2)); no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; if( !format && !strcmp((xctx->inst[inst].ptr + xctx->sym)->type, "subcircuit") ) { @@ -2590,15 +2590,15 @@ void print_tedax_element(FILE *fd, int inst) sanitize(translate(inst, get_sym_name(inst, 0, 0, 0))), xctx->inst[inst].instname); int_hash_init(&table, 37); for(i=0;isym[xctx->inst[inst].ptr].rect[PINLAYER][i].prop_ptr,"name",0)); - my_strdup2(1910, &pin, expandlabel(pinname, &pin_mult)); + my_strdup2(_ALLOC_ID_, &pin, expandlabel(pinname, &pin_mult)); if(!int_hash_lookup(&table, pinname, 1, XINSERT_NOREPLACE)) { dbg(1, "#net=%s pinname=%s pin=%s net_mult=%d pin_mult=%d\n", net, pinname, pin, net_mult, pin_mult); for(n = 0; n < net_mult; ++n) { - my_strdup(1911, &netbit, find_nth(net, ",", "", 0, n+1)); - my_strdup(1912, &pinbit, find_nth(pin, ",", "", 0, n+1)); + my_strdup(_ALLOC_ID_, &netbit, find_nth(net, ",", "", 0, n+1)); + my_strdup(_ALLOC_ID_, &pinbit, find_nth(pin, ",", "", 0, n+1)); fprintf(fd, "__map__ %s -> %s\n", pinbit ? pinbit : "__UNCONNECTED_PIN__", netbit ? netbit : "__UNCONNECTED_PIN__"); @@ -2606,21 +2606,21 @@ void print_tedax_element(FILE *fd, int inst) } } int_hash_free(&table); - my_free(1913, &net); - my_free(1914, &pin); - my_free(1915, &pinname); - my_free(1916, &pinbit); - my_free(1917, &netbit); + my_free(_ALLOC_ID_, &net); + my_free(_ALLOC_ID_, &pin); + my_free(_ALLOC_ID_, &pinname); + my_free(_ALLOC_ID_, &pinbit); + my_free(_ALLOC_ID_, &netbit); fprintf(fd, "\n"); } if(name==NULL || !format || !format[0]) { - my_free(1918, &extra); - my_free(1919, &extra_pinnumber); - my_free(1920, &template); - my_free(1921, &numslots); - my_free(1922, &format); - my_free(1923, &name); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &extra_pinnumber); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &numslots); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); return; } @@ -2630,10 +2630,10 @@ void print_tedax_element(FILE *fd, int inst) char *pinnumber; pinnumber = get_pin_attr_from_inst(inst, i, "pinnumber"); if(!pinnumber) { - my_strdup2(1924, &pinnumber, + my_strdup2(_ALLOC_ID_, &pinnumber, get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][i].prop_ptr,"pinnumber",0)); } - if(!xctx->tok_size) my_strdup(1925, &pinnumber, "--UNDEF--"); + if(!xctx->tok_size) my_strdup(_ALLOC_ID_, &pinnumber, "--UNDEF--"); tmp = net_name(inst,i, &multip, 0, 1); if(tmp && !strstr(tmp, "__UNCONNECTED_PIN__")) { fprintf(fd, "conn %s %s %s %s %d\n", @@ -2643,7 +2643,7 @@ void print_tedax_element(FILE *fd, int inst) pinnumber, i+1); } - my_free(1926, &pinnumber); + my_free(_ALLOC_ID_, &pinnumber); } if(extra){ @@ -2798,24 +2798,24 @@ void print_tedax_element(FILE *fd, int inst) pin_attr_value = get_pin_attr_from_inst(inst, n, pin_attr); /* get pin_attr from instance pin attribute string */ if(!pin_attr_value) { - my_strdup(1927, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0)); } } /* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */ if(!pin_attr_value && is_net_name) { prepare_netlist_structs(0); - my_strdup(1928, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, xctx->inst[inst].node && xctx->inst[inst].node[n] ? xctx->inst[inst].node[n] : "?"); } - if(!pin_attr_value ) my_strdup(1929, &pin_attr_value, "--UNDEF--"); + if(!pin_attr_value ) my_strdup(_ALLOC_ID_, &pin_attr_value, "--UNDEF--"); value = pin_attr_value; /* recognize slotted devices: instname = "U3:3", value = "a:b:c:d" --> value = "c" */ if(value[0] && !strcmp(pin_attr, "pinnumber")) { char *ss; int slot; char *tmpstr = NULL; - tmpstr = my_malloc(1930, sizeof(xctx->inst[inst].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname)); if( (ss=strchr(xctx->inst[inst].instname, ':')) ) { sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { @@ -2823,10 +2823,10 @@ void print_tedax_element(FILE *fd, int inst) if(strstr(value,":")) value = find_nth(value, ":", "", 0, slot); } } - my_free(1931, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } fprintf(fd, "%s", value); - my_free(1932, &pin_attr_value); + my_free(_ALLOC_ID_, &pin_attr_value); } else if(n>=0 && n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]) { const char *si; @@ -2837,20 +2837,20 @@ void print_tedax_element(FILE *fd, int inst) fprintf(fd, "%s", str_ptr); } } - my_free(1933, &pin_attr); - my_free(1934, &pin_num_or_name); + my_free(_ALLOC_ID_, &pin_attr); + my_free(_ALLOC_ID_, &pin_num_or_name); } else if(!strncmp(token,"@tcleval", 8)) { /* char tclcmd[strlen(token)+100] ; */ size_t s; char *tclcmd=NULL; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(1935, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); tcleval(tclcmd); fprintf(fd, "%s", tclresult()); - my_free(1936, &tclcmd); + my_free(_ALLOC_ID_, &tclcmd); /* fprintf(errfp, "%s\n", tclcmd); */ } /* /20171029 */ @@ -2868,13 +2868,13 @@ void print_tedax_element(FILE *fd, int inst) } } /* if(format) */ if(!subcircuit) fprintf(fd,"end_inst\n"); - my_free(1937, &extra); - my_free(1938, &extra_pinnumber); - my_free(1939, &template); - my_free(1940, &numslots); - my_free(1941, &format); - my_free(1942, &name); - my_free(1943, &token); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &extra_pinnumber); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &numslots); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); } /* print verilog element if verilog_format is specified */ @@ -2894,28 +2894,28 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level const char *fmt_attr = NULL; char *result = NULL; - my_strdup(1944, &template, + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); - my_strdup(1945, &name,xctx->inst[inst].instname); - if(!name) my_strdup(1946, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); fmt_attr = xctx->format ? xctx->format : "verilog_format"; /* allow format string override in instance */ - my_strdup(1947, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, fmt_attr, 2)); /* get netlist format rule from symbol */ if(!xctx->tok_size) - my_strdup(1948, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, fmt_attr, 2)); /* allow format string override in instance */ if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format") ) - my_strdup(1949, &format, get_tok_value(xctx->inst[inst].prop_ptr, "verilog_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->inst[inst].prop_ptr, "verilog_format", 2)); /* get netlist format rule from symbol */ if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format")) - my_strdup(1950, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilog_format", 2)); + my_strdup(_ALLOC_ID_, &format, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilog_format", 2)); if((name==NULL) || (format==NULL) ) { - my_free(1951, &template); - my_free(1952, &name); - my_free(1953, &format); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &format); return; /*do no netlist unwanted insts(no format) */ } no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; @@ -2960,56 +2960,56 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level if(!xctx->tok_size) value=get_tok_value(template, token+1, 0); if(!xctx->tok_size && token[0] =='%') { - my_mstrcat(1954, &result, token + 1, NULL); + my_mstrcat(_ALLOC_ID_, &result, token + 1, NULL); } else if(value && value[0]!='\0') { /* instance names (name) and node labels (lab) go thru the expandlabel function. */ /*if something else must be parsed, put an if here! */ if(!(strcmp(token+1,"name"))) { if( (lab=expandlabel(value, &tmp)) != NULL) - my_mstrcat(1955, &result, "----name(", lab, ")", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----name(", lab, ")", NULL); else - my_mstrcat(1956, &result, value, NULL); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); } else if(!(strcmp(token+1,"lab"))) { if( (lab=expandlabel(value, &tmp)) != NULL) - my_mstrcat(1957, &result, "----pin(", lab, ")", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", lab, ")", NULL); else - my_mstrcat(1958, &result, value, NULL); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); } - else my_mstrcat(1959, &result, value, NULL); + else my_mstrcat(_ALLOC_ID_, &result, value, NULL); } else if(strcmp(token,"@symref")==0) { const char *s = get_sym_name(inst, 9999, 1, 0); - my_mstrcat(1960, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if(strcmp(token,"@symname")==0) /* of course symname must not be present */ /* in hash table */ { const char *s = sanitize(translate(inst, get_sym_name(inst, 0, 0, 0))); - my_mstrcat(1961, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if (strcmp(token,"@symname_ext")==0) { const char *s = sanitize(translate(inst, get_sym_name(inst, 0, 1, 0))); - my_mstrcat(1962, &result, s, NULL); + my_mstrcat(_ALLOC_ID_, &result, s, NULL); } else if(strcmp(token,"@schname_ext")==0) /* of course schname must not be present */ /* in hash table */ { - my_mstrcat(1963, &result, xctx->current_name, NULL); + my_mstrcat(_ALLOC_ID_, &result, xctx->current_name, NULL); } else if(strcmp(token,"@schname")==0) /* of course schname must not be present */ /* in hash table */ { - my_mstrcat(1964, &result, get_cell(xctx->current_name, 0), NULL); + my_mstrcat(_ALLOC_ID_, &result, get_cell(xctx->current_name, 0), NULL); } else if(strcmp(token,"@topschname")==0) /* of course topschname must not be present in attributes */ { const char *topsch; topsch = get_trailing_path(xctx->sch[0], 0, 1); - my_mstrcat(1965, &result, topsch, NULL); + my_mstrcat(_ALLOC_ID_, &result, topsch, NULL); } else if(strcmp(token,"@pinlist")==0) /* of course pinlist must not be present */ /* in hash table. print multiplicity */ @@ -3021,9 +3021,9 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level if(strboolcmp(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"verilog_ignore",0), "true")) { const char *name = get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0); if(!int_hash_lookup(&table, name, 1, XINSERT_NOREPLACE)) { - if(!first) my_mstrcat(1966, &result, " , ", NULL); + if(!first) my_mstrcat(_ALLOC_ID_, &result, " , ", NULL); str_ptr = net_name(inst,i, &multip, 0, 1); - my_mstrcat(1967, &result, "----pin(", str_ptr, ") ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", str_ptr, ") ", NULL); first = 0; } } @@ -3035,7 +3035,7 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level char *prop = (xctx->inst[inst].ptr + xctx->sym)->rect[PINLAYER][i].prop_ptr; if(!strcmp( get_tok_value(prop,"name",0), token+2)) { str_ptr = net_name(inst,i, &multip, 0, 1); - my_mstrcat(1968, &result, "----pin(", str_ptr, ") ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", str_ptr, ") ", NULL); break; } } @@ -3059,24 +3059,24 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level pin_attr_value = get_pin_attr_from_inst(inst, n, pin_attr); /* get pin_attr from instance pin attribute string */ if(!pin_attr_value) { - my_strdup(1969, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0)); } } /* @#n:net_name attribute (n = pin number or name) will translate to net name attached to pin */ if(!pin_attr_value && is_net_name) { prepare_netlist_structs(0); - my_strdup(1970, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, xctx->inst[inst].node && xctx->inst[inst].node[n] ? xctx->inst[inst].node[n] : "?"); } - if(!pin_attr_value ) my_strdup(1971, &pin_attr_value, "--UNDEF--"); + if(!pin_attr_value ) my_strdup(_ALLOC_ID_, &pin_attr_value, "--UNDEF--"); value = pin_attr_value; /* recognize slotted devices: instname = "U3:3", value = "a:b:c:d" --> value = "c" */ if(value[0] && !strcmp(pin_attr, "pinnumber") ) { char *ss; int slot; char *tmpstr = NULL; - tmpstr = my_malloc(1972, sizeof(xctx->inst[inst].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname)); if( (ss=strchr(xctx->inst[inst].instname, ':')) ) { sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { @@ -3084,10 +3084,10 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level if(strstr(value,":")) value = find_nth(value, ":", "", 0, slot); } } - my_free(1973, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } - my_mstrcat(1974, &result, value, NULL); - my_free(1975, &pin_attr_value); + my_mstrcat(_ALLOC_ID_, &result, value, NULL); + my_free(_ALLOC_ID_, &pin_attr_value); } else if(n>=0 && n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]) { const char *si; @@ -3095,11 +3095,11 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level si = get_tok_value(prop, "verilog_ignore",0); if(strboolcmp(si, "true")) { str_ptr = net_name(inst,n, &multip, 0, 1); - my_mstrcat(1976, &result, "----pin(", str_ptr, ") ", NULL); + my_mstrcat(_ALLOC_ID_, &result, "----pin(", str_ptr, ") ", NULL); } } - my_free(1977, &pin_attr); - my_free(1978, &pin_num_or_name); + my_free(_ALLOC_ID_, &pin_attr); + my_free(_ALLOC_ID_, &pin_num_or_name); } else if(!strncmp(token,"@tcleval", 8)) { @@ -3107,18 +3107,18 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level size_t s; char *tclcmd=NULL; s = token_pos + strlen(name) + strlen(xctx->inst[inst].name) + 100; - tclcmd = my_malloc(1979, s); + tclcmd = my_malloc(_ALLOC_ID_, s); Tcl_ResetResult(interp); my_snprintf(tclcmd, s, "tclpropeval {%s} {%s} {%s}", token, name, xctx->inst[inst].name); tcleval(tclcmd); - my_mstrcat(1980, &result, tclresult(), NULL); - my_free(1981, &tclcmd); + my_mstrcat(_ALLOC_ID_, &result, tclresult(), NULL); + my_free(_ALLOC_ID_, &tclcmd); } if(c!='%' && c!='@' && c!='\0') { char str[2]; str[0] = (unsigned char) c; str[1] = '\0'; - my_mstrcat(1982, &result, str, NULL); + my_mstrcat(_ALLOC_ID_, &result, str, NULL); } if(c == '@' || c == '%') s--; state=TOK_BEGIN; @@ -3127,7 +3127,7 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level char str[2]; str[0] = (unsigned char) c; str[1] = '\0'; - my_mstrcat(1983, &result, str, NULL); + my_mstrcat(_ALLOC_ID_, &result, str, NULL); } if(c=='\0') { @@ -3144,20 +3144,20 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level if(strchr(result, '@')) { /* netlist_commands often have @ characters due to ngspice syntax. Do not translate */ if(strcmp(xctx->sym[xctx->inst[inst].ptr].type, "netlist_commands")) { - my_strdup2(1984, &result, + my_strdup2(_ALLOC_ID_, &result, translate3(result, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, NULL, NULL)); /* can not put template in above translate3: -----------------------^^^^ * if instance has VHI=VHI, format string has VHI=@VHI, and symbol template has VHI=3 * we do not want token @VHI to resolve to 3, but stop at VHI as specified in instance */ if(strchr(result, '@')) { - my_strdup2(1985, &result, + my_strdup2(_ALLOC_ID_, &result, translate3(result, 0, xctx->inst[inst].prop_ptr, parent_prop_ptr, template, NULL)); } } } - my_strdup2(1986, &result, tcl_hook2(result)); /* tcl evaluation if tcleval(....) */ + my_strdup2(_ALLOC_ID_, &result, tcl_hook2(result)); /* tcl evaluation if tcleval(....) */ if(strstr(result, "expr(")) { - my_strdup2(1987, &result, eval_expr(result)); + my_strdup2(_ALLOC_ID_, &result, eval_expr(result)); } dbg(1, "print_verilog_primitive(): after translate3() result=%s\n", result); } @@ -3167,11 +3167,11 @@ static void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level break ; } } /* while(1) */ - my_free(1988, &result); - my_free(1989, &template); - my_free(1990, &format); - my_free(1991, &name); - my_free(1992, &token); + my_free(_ALLOC_ID_, &result); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &format); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &token); } /* verilog module instantiation: @@ -3226,35 +3226,35 @@ void print_verilog_element(FILE *fd, int inst) return; } - my_strdup(1993, &name,xctx->inst[inst].instname); - if(!name) my_strdup(1994, &name, get_tok_value(template, "name", 0)); + my_strdup(_ALLOC_ID_, &name,xctx->inst[inst].instname); + if(!name) my_strdup(_ALLOC_ID_, &name, get_tok_value(template, "name", 0)); if(name==NULL) { - my_free(1995, &name); + my_free(_ALLOC_ID_, &name); return; } /* verilog_extra is the list of additional nodes passed as attributes */ - my_strdup(1996, &v_extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilog_extra", 0)); + my_strdup(_ALLOC_ID_, &v_extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilog_extra", 0)); /* extra is the list of attributes NOT to consider as instance parameters */ - my_strdup(1997, &extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "extra", 0)); - my_strdup(1998, &verilogprefix, + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "extra", 0)); + my_strdup(_ALLOC_ID_, &verilogprefix, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr, "verilogprefix", 0)); if(verilogprefix) { - my_strdup(1999, &symname, verilogprefix); - my_strcat(2000, &symname, get_sym_name(inst, 0, 0, 0)); + my_strdup(_ALLOC_ID_, &symname, verilogprefix); + my_strcat(_ALLOC_ID_, &symname, get_sym_name(inst, 0, 0, 0)); } else { - my_strdup(2001, &symname, get_sym_name(inst, 0, 0, 0)); + my_strdup(_ALLOC_ID_, &symname, get_sym_name(inst, 0, 0, 0)); } - my_free(2002, &verilogprefix); - my_strdup(2003, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); + my_free(_ALLOC_ID_, &verilogprefix); + my_strdup(_ALLOC_ID_, &template, (xctx->inst[inst].ptr + xctx->sym)->templ); no_of_pins= (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]; /* 20080915 use generic_type property to decide if some properties are strings, see later */ - my_strdup(2004, &generic_type, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"generic_type",0)); + my_strdup(_ALLOC_ID_, &generic_type, get_tok_value(xctx->sym[xctx->inst[inst].ptr].prop_ptr,"generic_type",0)); s=xctx->inst[inst].prop_ptr; /* print instance subckt */ dbg(2, "print_verilog_element(): printing inst name & subcircuit name\n"); fprintf(fd, "%s\n", sanitize(symname)); - my_free(2005, &symname); + my_free(_ALLOC_ID_, &symname); /* -------- print generics passed as properties */ tmp=0; while(1) @@ -3366,13 +3366,13 @@ void print_verilog_element(FILE *fd, int inst) fprintf(fd, "\n);\n\n"); dbg(2, "print_verilog_element(): ------- end ------ \n"); - my_free(2006, &name); - my_free(2007, &generic_type); - my_free(2008, &template); - my_free(2009, &value); - my_free(2010, &token); - my_free(2011, &extra); - my_free(2012, &v_extra); + my_free(_ALLOC_ID_, &name); + my_free(_ALLOC_ID_, &generic_type); + my_free(_ALLOC_ID_, &template); + my_free(_ALLOC_ID_, &value); + my_free(_ALLOC_ID_, &token); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &v_extra); } @@ -3396,14 +3396,14 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int } if(xctx->inst[i].node && xctx->inst[i].node[j] == NULL) { - my_strdup(2013, &pinname, get_tok_value( sym->rect[PINLAYER][j].prop_ptr,"name",0)); + my_strdup(_ALLOC_ID_, &pinname, get_tok_value( sym->rect[PINLAYER][j].prop_ptr,"name",0)); /* before reporting unconnected pin try to locate duplicated pin and use it if found */ for(k = 0; k < no_of_pins; ++k) { const char *duplicated_pinname; if(k == j) continue; duplicated_pinname = get_tok_value( sym->rect[PINLAYER][k].prop_ptr,"name",0); if(!strcmp(duplicated_pinname , pinname)) { - my_strdup(2014, &pinname, duplicated_pinname); + my_strdup(_ALLOC_ID_, &pinname, duplicated_pinname); j = k; break; } @@ -3413,7 +3413,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int if(xctx->inst[i].node && xctx->inst[i].node[j] == NULL) { expandlabel(pinname, multip); - if(pinname) my_free(2015, &pinname); + if(pinname) my_free(_ALLOC_ID_, &pinname); if(erc) { my_snprintf(errstr, S(errstr), "Warning: unconnected pin, Inst idx: %d, Pin idx: %d Inst:%s\n", i, j, xctx->inst[i].instname ) ; @@ -3430,7 +3430,7 @@ const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int return expandlabel(unconn, &tmp); } else { /* xctx->inst[i].node[j] not NULL */ - if(pinname) my_free(2016, &pinname); + if(pinname) my_free(_ALLOC_ID_, &pinname); if((xctx->inst[i].node[j])[0] == '#') /* unnamed net */ { /* get unnamed node multiplicity ( minimum multip found in circuit) */ @@ -3493,7 +3493,7 @@ char *trim_chars(const char *str, const char *sep) char *last; if(str == NULL) { - my_free(2017, &result); + my_free(_ALLOC_ID_, &result); result_size = 0; return NULL; } @@ -3501,7 +3501,7 @@ char *trim_chars(const char *str, const char *sep) /* allocate storage for result */ if(len > result_size) { result_size = len + CADCHUNKALLOC; - my_realloc(2018, &result, result_size); + my_realloc(_ALLOC_ID_, &result, result_size); } memcpy(result, str, len); if(*str == '\0')return result; @@ -3539,7 +3539,7 @@ char *find_nth(const char *str, const char *sep, const char *quote, int keep_quo /* clean up static data */ if(!str) { - my_free(2019, &result); + my_free(_ALLOC_ID_, &result); result_size = 0; return NULL; } @@ -3547,7 +3547,7 @@ char *find_nth(const char *str, const char *sep, const char *quote, int keep_quo len = strlen(str) + 1; if(len > result_size) { result_size = len + CADCHUNKALLOC; - my_realloc(2020, &result, result_size); + my_realloc(_ALLOC_ID_, &result, result_size); } result_pos = 0; @@ -3603,7 +3603,7 @@ static char *get_pin_attr(const char *token, int inst, int engineering) pin_attr_value = get_pin_attr_from_inst(inst, n, pin_attr); /* get pin_attr from instance pin attribute string */ if(!pin_attr_value) { - my_strdup(2021, &pin_attr_value, + my_strdup(_ALLOC_ID_, &pin_attr_value, get_tok_value(xctx->sym[xctx->inst[inst].ptr].rect[PINLAYER][n].prop_ptr, pin_attr, 0)); } } @@ -3611,7 +3611,7 @@ static char *get_pin_attr(const char *token, int inst, int engineering) * if 'net_name=true' attribute is set in instance or symbol */ if(!pin_attr_value && is_net_name) { prepare_netlist_structs(0); - my_strdup2(2022, &pin_attr_value, + my_strdup2(_ALLOC_ID_, &pin_attr_value, xctx->inst[inst].node && xctx->inst[inst].node[n] ? xctx->inst[inst].node[n] : ""); } else if(!pin_attr_value && !is_net_name && !strcmp(pin_attr, "spice_get_voltage")) @@ -3628,15 +3628,15 @@ static char *get_pin_attr(const char *token, int inst, int engineering) const char *valstr; if(path) { prepare_netlist_structs(0); - my_strdup2(2023, &net, net_name(inst, n, &multip, 0, 0)); + my_strdup2(_ALLOC_ID_, &net, net_name(inst, n, &multip, 0, 0)); if(multip == 1 && net && net[0]) { char *rn; dbg(1, "get_pin_attr() spice_get_voltage: inst=%d\n", inst); dbg(1, " net=%s\n", net); rn = resolved_net(net); if(rn) { - my_strdup2(2024, &fqnet, rn); - if(rn) my_free(2025, &rn); + my_strdup2(_ALLOC_ID_, &fqnet, rn); + if(rn) my_free(_ALLOC_ID_, &rn); strtolower(fqnet); dbg(1, "get_pin_attr() @spice_get_voltage: fqnet=%s start_level=%d\n", fqnet, start_level); idx = get_raw_index(fqnet, NULL); @@ -3649,12 +3649,12 @@ static char *get_pin_attr(const char *token, int inst, int engineering) } else { valstr = engineering? dtoa_eng(val) : dtoa(val); } - my_strdup2(2026, &pin_attr_value, valstr); + my_strdup2(_ALLOC_ID_, &pin_attr_value, valstr); dbg(1, "inst %d, net=%s, fqnet=%s idx=%d valstr=%s\n", inst, net, fqnet, idx, valstr); - if(fqnet) my_free(2027, &fqnet); + if(fqnet) my_free(_ALLOC_ID_, &fqnet); } } - if(net) my_free(2028, &net); + if(net) my_free(_ALLOC_ID_, &net); } } } @@ -3667,28 +3667,28 @@ static char *get_pin_attr(const char *token, int inst, int engineering) if(xctx->inst[inst].node && xctx->inst[inst].node[n]) { rn = resolved_net(xctx->inst[inst].node[n]); } - my_strdup2(2029, &pin_attr_value, rn ? rn : ""); - if(rn) my_free(2030, &rn); + my_strdup2(_ALLOC_ID_, &pin_attr_value, rn ? rn : ""); + if(rn) my_free(_ALLOC_ID_, &rn); } - if(!pin_attr_value ) my_strdup2(2031, &pin_attr_value, ""); - my_strdup2(2032, &value, pin_attr_value); + if(!pin_attr_value ) my_strdup2(_ALLOC_ID_, &pin_attr_value, ""); + my_strdup2(_ALLOC_ID_, &value, pin_attr_value); /* recognize slotted devices: instname = "U3:3", value = "a:b:c:d" --> value = "c" */ if(pin_attr_value[0] && !strcmp(pin_attr, "pinnumber") ) { char *ss; int slot; char *tmpstr = NULL; if( xctx->inst[inst].instname && (ss=strchr(xctx->inst[inst].instname, ':')) ) { - tmpstr = my_malloc(2033, sizeof(xctx->inst[inst].instname)); + tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[inst].instname)); sscanf(ss+1, "%s", tmpstr); if(isonlydigit(tmpstr)) { slot = atoi(tmpstr); - if(strstr(value,":")) my_strdup2(2034, &value, find_nth(value, ":", "", 0, slot)); + if(strstr(value,":")) my_strdup2(_ALLOC_ID_, &value, find_nth(value, ":", "", 0, slot)); } - my_free(2035, &tmpstr); + my_free(_ALLOC_ID_, &tmpstr); } } - my_free(2036, &pin_attr_value); + my_free(_ALLOC_ID_, &pin_attr_value); } /* just @#pin was given */ else if(n>=0 && n < (xctx->inst[inst].ptr + xctx->sym)->rects[PINLAYER]) { @@ -3700,11 +3700,11 @@ static char *get_pin_attr(const char *token, int inst, int engineering) tmp = strlen(str_ptr) +100 ; /* always make room for some extra chars * so 1-char writes to result do not need reallocs */ - value = my_malloc(2037, tmp); + value = my_malloc(_ALLOC_ID_, tmp); my_snprintf(value, tmp, "?%d %s ", multip, str_ptr); } - my_free(2038, &pin_attr); - my_free(2039, &pin_num_or_name); + my_free(_ALLOC_ID_, &pin_attr); + my_free(_ALLOC_ID_, &pin_num_or_name); dbg(1, "get_pin_attr(): returning value=%s\n", value); return value; } @@ -3746,7 +3746,7 @@ const char *spice_get_node(const char *token) const char *s; dbg(1, "token=%s\n", token); - node = my_malloc(2040, strlen(token) + 1); + node = my_malloc(_ALLOC_ID_, strlen(token) + 1); n = sscanf(pos, "%*[^ ] %[^ ]%c", node, &sp); len = strlen(node); dbg(1, "node=%s, n=%d, sp=|%c|\n", node, n, sp); @@ -3764,7 +3764,7 @@ const char *spice_get_node(const char *token) valstr = dtoa_eng(val); } dbg(1, "valstr=%s\n", valstr); - my_strdup2(2041, &token2, str_replace(token, "@spice_get_node ", "", 0, 1)); + my_strdup2(_ALLOC_ID_, &token2, str_replace(token, "@spice_get_node ", "", 0, 1)); dbg(1, "token2=%s\n", token2); if(n == 2 && sp == ' ') { node[len] = ' '; @@ -3772,8 +3772,8 @@ const char *spice_get_node(const char *token) } s = str_replace(token2, node, valstr, 0, 1); dbg(1, "s=%s\n", s); - my_free(2042, &token2); - my_free(2043, &node); + my_free(_ALLOC_ID_, &token2); + my_free(_ALLOC_ID_, &node); return s; } else { return token; @@ -3813,11 +3813,11 @@ char *get_fqdevice(const char *param, int modelparam, const char *instname) if(*path == '.') skip++; ++path; } - my_strdup2(2044, &dev, instname); + my_strdup2(_ALLOC_ID_, &dev, instname); strtolower(dev); prefix=dev[0]; len = strlen(path) + strlen(dev) + 40; /* some extra chars for i(..) wrapper */ - fqdev = my_malloc(2045, len); + fqdev = my_malloc(_ALLOC_ID_, len); if(!sim_is_xyce) { int vsource = (prefix == 'v') || (prefix == 'e'); if(path[0]) { @@ -3866,7 +3866,7 @@ char *get_fqdevice(const char *param, int modelparam, const char *instname) } - my_free(2046, &dev); + my_free(_ALLOC_ID_, &dev); return fqdev; } @@ -3905,12 +3905,12 @@ const char *translate(int inst, const char* s) char *instname = NULL; if(!s && inst == -1) { - if(result) my_free(2047, &result); + if(result) my_free(_ALLOC_ID_, &result); #ifdef __unix__ if(get_sp_cur) { regfree(get_sp_cur); /* get_sp_cur = NULL; */ - my_free(2048, &get_sp_cur); + my_free(_ALLOC_ID_, &get_sp_cur); } #endif } @@ -3921,7 +3921,7 @@ const char *translate(int inst, const char* s) #ifdef __unix__ if(!get_sp_cur) { - get_sp_cur = my_malloc(2049, sizeof(regex_t)); + get_sp_cur = my_malloc(_ALLOC_ID_, sizeof(regex_t)); /* @spice_get_current_(...) or @spice_get_modelparam_(...) */ /* @spice_get_current(...) or @spice_get_modelparam(...) */ /* @spice_get_modelvoltage(...) or @spice_get_modelvoltage_(...) */ @@ -3943,7 +3943,7 @@ const char *translate(int inst, const char* s) level = xctx->currsch; lcc = xctx->hier_attr; size=CADCHUNKALLOC; - my_realloc(2050, &result,size); + my_realloc(_ALLOC_ID_, &result,size); result[0]='\0'; dbg(1, "translate(): substituting props in <%s>, instance <%s>\n", s ? s : "" , instname); @@ -4036,7 +4036,7 @@ const char *translate(int inst, const char* s) STR_ALLOC(&result, tmp + result_pos, &size); memcpy(result+result_pos, value, tmp+1); result_pos+=tmp; - my_free(2051, &value); + my_free(_ALLOC_ID_, &value); } } else if(inst >= 0 && strcmp(token,"@sch_last_modified")==0 && xctx->inst[inst].ptr >= 0) { @@ -4110,10 +4110,10 @@ const char *translate(int inst, const char* s) if(path) { prepare_netlist_structs(0); if(xctx->inst[inst].lab) { - my_strdup2(2052, &net, expandlabel(xctx->inst[inst].lab, &multip)); + my_strdup2(_ALLOC_ID_, &net, expandlabel(xctx->inst[inst].lab, &multip)); } if(net == NULL || net[0] == '\0') { - my_strdup2(2053, &net, net_name(inst, 0, &multip, 0, 0)); + my_strdup2(_ALLOC_ID_, &net, net_name(inst, 0, &multip, 0, 0)); } if(multip == 1 && net && net[0]) { char *rn; @@ -4121,8 +4121,8 @@ const char *translate(int inst, const char* s) dbg(1, " net=%s\n", net); rn = resolved_net(net); if(rn) { - my_strdup2(2054, &fqnet, rn); - if(rn) my_free(2055, &rn); + my_strdup2(_ALLOC_ID_, &fqnet, rn); + if(rn) my_free(_ALLOC_ID_, &rn); strtolower(fqnet); dbg(1, "translate() @spice_get_voltage: fqnet=%s start_level=%d\n", fqnet, start_level); idx = get_raw_index(fqnet, NULL); @@ -4147,10 +4147,10 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "inst %d, net=%s, fqnet=%s idx=%d valstr=%s\n", inst, net, fqnet, idx, valstr); - if(fqnet) my_free(2056, &fqnet); + if(fqnet) my_free(_ALLOC_ID_, &fqnet); } } - if(net) my_free(2057, &net); + if(net) my_free(_ALLOC_ID_, &net); } } } @@ -4202,13 +4202,13 @@ const char *translate(int inst, const char* s) if(*path == '.') skip++; ++path; } - net = my_malloc(2058, tmp); + net = my_malloc(_ALLOC_ID_, tmp); n = sscanf(token + 19, "%[^)]", net); expandlabel(net, &multip); if(n == 1 && multip == 1) { len = strlen(path) + strlen(instname) + strlen(net) + 2; dbg(1, "net=%s\n", net); - fqnet = my_malloc(2059, len); + fqnet = my_malloc(_ALLOC_ID_, len); global_net = strrchr(net, '.'); @@ -4248,9 +4248,9 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "instname %s, net=%s, fqnet=%s idx=%d valstr=%s\n", instname, net, fqnet, idx, valstr); - my_free(2060, &fqnet); + my_free(_ALLOC_ID_, &fqnet); } - my_free(2061, &net); + my_free(_ALLOC_ID_, &net); } } } @@ -4284,16 +4284,16 @@ const char *translate(int inst, const char* s) if(*path == '.') skip++; ++path; } - dev = my_malloc(2062, tmp); + dev = my_malloc(_ALLOC_ID_, tmp); dbg(1, "%s\n", token); if(!strncmp(token, "@spice_get_current(", 19)) { n = sscanf(token + 19, "%[^)]", dev); } else { - param = my_malloc(2063, tmp); + param = my_malloc(_ALLOC_ID_, tmp); n = sscanf(token, "@spice_get_current_%[^(](%[^)]", param, dev); dbg(1, "token=%s, param=%s, dev=%s\n", token, param, dev); if(n < 2) { - my_free(2064, ¶m); + my_free(_ALLOC_ID_, ¶m); n = sscanf(token, "@spice_get_current[^(](%[^)]", dev); } } @@ -4302,7 +4302,7 @@ const char *translate(int inst, const char* s) len = strlen(path) + strlen(instname) + strlen(dev) + 21; /* some extra chars for i(..) wrapper */ dbg(1, "dev=%s\n", dev); - fqdev = my_malloc(2065, len); + fqdev = my_malloc(_ALLOC_ID_, len); if(!sim_is_xyce) { int prefix, vsource; char *prefix_ptr = strrchr(dev, '.'); /* last '.' in dev */ @@ -4347,10 +4347,10 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "instname %s, dev=%s, fqdev=%s idx=%d valstr=%s\n", instname, dev, fqdev, idx, valstr); - my_free(2066, &fqdev); + my_free(_ALLOC_ID_, &fqdev); } /* if(n == 1) */ - if(param) my_free(2067, ¶m); - my_free(2068, &dev); + if(param) my_free(_ALLOC_ID_, ¶m); + my_free(_ALLOC_ID_, &dev); } /* if(path) */ } /* if((start_level = sch_waves_loaded()) >= 0 && xctx->raw->annot_p>=0) */ } @@ -4381,13 +4381,13 @@ const char *translate(int inst, const char* s) net1 = net_name(inst, 0, &multip, 0, 0); len = strlen(path) + strlen(net1) + 1; dbg(1, "net1=%s\n", net1); - fqnet1 = my_malloc(2069, len); + fqnet1 = my_malloc(_ALLOC_ID_, len); my_snprintf(fqnet1, len, "%s%s", path, net1); strtolower(fqnet1); net2 = net_name(inst, 1, &multip, 0, 0); len = strlen(path) + strlen(net2) + 1; dbg(1, "net2=%s\n", net2); - fqnet2 = my_malloc(2070, len); + fqnet2 = my_malloc(_ALLOC_ID_, len); my_snprintf(fqnet2, len, "%s%s", path, net2); strtolower(fqnet2); dbg(1, "translate(): fqnet1=%s start_level=%d\n", fqnet1, start_level); @@ -4414,8 +4414,8 @@ const char *translate(int inst, const char* s) } dbg(1, "inst %d, fqnet1=%s fqnet2=%s idx1=%d idx2=%d, val1=%g val2=%g valstr=%s\n", inst, fqnet1, fqnet2, idx1, idx2, val1, val2, valstr); - my_free(2071, &fqnet1); - my_free(2072, &fqnet2); + my_free(_ALLOC_ID_, &fqnet1); + my_free(_ALLOC_ID_, &fqnet2); } } } @@ -4451,7 +4451,7 @@ const char *translate(int inst, const char* s) strcmp(token, "@spice_get_modelparam") && strcmp(token, "@spice_get_modelvoltage")) { int n = 0; - param = my_malloc(2073, strlen(token) + 1); + param = my_malloc(_ALLOC_ID_, strlen(token) + 1); n = sscanf(token, "@spice_get_current_%s", param); if(n == 0) { n = sscanf(token, "@spice_get_modelparam_%s", param); @@ -4462,7 +4462,7 @@ const char *translate(int inst, const char* s) modelparam = 2; } if(n == 0) { - my_free(2074, ¶m); + my_free(_ALLOC_ID_, ¶m); error = 1; } } @@ -4470,12 +4470,12 @@ const char *translate(int inst, const char* s) char *iprefix = modelparam == 0 ? "i(" : modelparam == 1 ? "" : "v("; char *ipostfix = modelparam == 1 ? "" : ")"; int prefix; - my_strdup2(2075, &dev, instname); + my_strdup2(_ALLOC_ID_, &dev, instname); strtolower(dev); prefix=dev[0]; len = strlen(path) + strlen(dev) + 40; /* some extra chars for i(..) wrapper */ dbg(1, "token=%s, dev=%s param=%s\n", token, dev, param ? param : ""); - fqdev = my_malloc(2076, len); + fqdev = my_malloc(_ALLOC_ID_, len); if(!sim_is_xyce) { int vsource = (prefix == 'v') || (prefix == 'e'); if(path[0]) { @@ -4508,7 +4508,7 @@ const char *translate(int inst, const char* s) } else { my_snprintf(fqdev, len, "i(%s%s)", path, dev); } - if(param) my_free(2077, ¶m); + if(param) my_free(_ALLOC_ID_, ¶m); dbg(1, "fqdev=%s\n", fqdev); strtolower(fqdev); idx = get_raw_index(fqdev, NULL); @@ -4544,8 +4544,8 @@ const char *translate(int inst, const char* s) result_pos += len; } dbg(1, "instname %s, dev=%s, fqdev=%s idx=%d valstr=%s\n", instname, dev, fqdev, idx, valstr); - my_free(2078, &fqdev); - my_free(2079, &dev); + my_free(_ALLOC_ID_, &fqdev); + my_free(_ALLOC_ID_, &dev); } /* if(!error) */ } /* if(path) */ } /* (live && (start_level = sch_waves_loaded()) >= 0 && xctx->raw->annot_p>=0) */ @@ -4608,7 +4608,7 @@ const char *translate(int inst, const char* s) } } else { int i = level; - my_strdup2(2080, &value1, value); + my_strdup2(_ALLOC_ID_, &value1, value); /* recursive substitution of value using parent level prop_ptr attributes */ while(i > 0) { char *v = value1; @@ -4617,12 +4617,12 @@ const char *translate(int inst, const char* s) tok = get_tok_value(lcc[i-1].prop_ptr, v, 0); if(xctx->tok_size && tok[0]) { dbg(1, "tok=%s\n", tok); - my_strdup2(2081, &value1, tok); + my_strdup2(_ALLOC_ID_, &value1, tok); } else { tok = get_tok_value(lcc[i-1].templ, v, 0); if(xctx->tok_size && tok[0]) { dbg(1, "from parent template: tok=%s\n", tok); - my_strdup2(2082, &value1, tok); + my_strdup2(_ALLOC_ID_, &value1, tok); } } dbg(1, "2 translate(): lcc[%d].prop_ptr=%s, value1=%s\n", i-1, lcc[i-1].prop_ptr, value1); @@ -4632,7 +4632,7 @@ const char *translate(int inst, const char* s) STR_ALLOC(&result, tmp + result_pos, &size); memcpy(result+result_pos, value1, tmp+1); result_pos+=tmp; - my_free(2083, &value1); + my_free(_ALLOC_ID_, &value1); } } token_pos = 0; @@ -4648,15 +4648,15 @@ const char *translate(int inst, const char* s) } } /* while(1) */ dbg(2, "translate(): returning %s\n", result); - my_free(2084, &token); + my_free(_ALLOC_ID_, &token); /* resolve spice_get_node patterns. * if result is like: 'tcleval(some_string)' pass it thru tcl evaluation so expressions * can be calculated */ - my_strdup2(2085, &result, spice_get_node(tcl_hook2(result))); + my_strdup2(_ALLOC_ID_, &result, spice_get_node(tcl_hook2(result))); if(strstr(result, "expr(")) { dbg(1, "translate(): expr():%s\n", result); - my_strdup2(2086, &result, eval_expr( + my_strdup2(_ALLOC_ID_, &result, eval_expr( translate3(result, 1, xctx->inst[inst].prop_ptr, xctx->sym[xctx->inst[inst].ptr].templ, NULL, NULL))); } @@ -4674,11 +4674,11 @@ const char *translate2(Lcc *lcc, int level, char* s) char *token = NULL, *value = NULL; if(!s) { - my_free(2087, &result); + my_free(_ALLOC_ID_, &result); return empty; } size = CADCHUNKALLOC; - my_realloc(2088, &result, size); + my_realloc(_ALLOC_ID_, &result, size); result[0] = '\0'; dbg(1, "translate2(): s=%s, level=%d\n", s, level); while (1) { @@ -4704,16 +4704,16 @@ const char *translate2(Lcc *lcc, int level, char* s) dbg(1, "translate2(): lcc[%d].prop_ptr=%s token=%s\n", level, lcc[level].prop_ptr, token); /* if spiceprefix==0 and token == @spiceprefix then set empty value */ if(!tclgetboolvar("spiceprefix") && !strcmp(token, "@spiceprefix")) { - if(value) my_free(2089, &value); + if(value) my_free(_ALLOC_ID_, &value); xctx->tok_size = 0; } else if(token[0] == '@' && (token[1] == '@' || token[1] == '#')) { /* get rid of pin attribute info */ - if(value) my_free(2090, &value); + if(value) my_free(_ALLOC_ID_, &value); xctx->tok_size = 0; } else { - my_strdup2(2091, &value, get_tok_value(lcc[level].prop_ptr, token + 1, 0)); + my_strdup2(_ALLOC_ID_, &value, get_tok_value(lcc[level].prop_ptr, token + 1, 0)); /* propagate %xxx tokens to upper levels if no value found */ if(!value[0] && token[0] == '%') { - my_strdup2(2092, &value, token + 1); + my_strdup2(_ALLOC_ID_, &value, token + 1); xctx->tok_size = 1; /* just to tell %xxx token was found */ } dbg(1, "translate2(): lcc[%d].prop_ptr=%s value=%s\n", level, lcc[level].prop_ptr, value); @@ -4725,7 +4725,7 @@ const char *translate2(Lcc *lcc, int level, char* s) const char *upperval = get_tok_value(lcc[i-1].prop_ptr, value, 0); dbg(1, "translate2(): lcc[%d].prop_ptr=%s upperval=%s\n", i-1, lcc[i-1].prop_ptr, upperval); if(xctx->tok_size && upperval[0]) { - my_strdup2(2093, &value, upperval); + my_strdup2(_ALLOC_ID_, &value, upperval); } else { break; } @@ -4749,21 +4749,21 @@ const char *translate2(Lcc *lcc, int level, char* s) } else if(strcmp(token,"@path")==0) { char *path = NULL; - my_strdup2(2094, &path, "@path@name\\."); + my_strdup2(_ALLOC_ID_, &path, "@path@name\\."); if(level > 1) { /* add parent LCC instance names (X1, Xinv etc) */ int i; for(i = 1; i tok_size = 0; dbg(1, "---\ntranslate3():\n s=%s\n s1=%s\n s2=%s\n s3=%s\n s4=%s\n---\n", s, s1, s2, s3, s4); - my_strdup2(2102, &result, ""); + my_strdup2(_ALLOC_ID_, &result, ""); sptr[1] = s1; sptr[2] = s2; sptr[3] = s3; sptr[4] = s4; while(1) { c=*s; @@ -4869,22 +4869,22 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, else if( sptr[i]) { char *v = NULL; const char *newval; - my_strdup2(2103, &v, value); + my_strdup2(_ALLOC_ID_, &v, value); newval = get_tok_value(sptr[i], v, 0); if(xctx->tok_size) { value = newval; } - my_free(2104, &v); + my_free(_ALLOC_ID_, &v); } } if(!found_value) { /* above lines did not find a value for token */ if((eat_escapes & 2) == 0) { /* no definition found -> keep token */ - my_strcat(2105, &result, token); + my_strcat(_ALLOC_ID_, &result, token); } } else { - my_strcat(2106, &result, value); + my_strcat(_ALLOC_ID_, &result, value); } token_pos = 0; if(c == '@' || c == '%') s--; /* these token separators are also identifiers for next token: push them back */ @@ -4892,7 +4892,7 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, char ch[2]; ch[0] = (char)c; ch[1] = '\0'; - my_strcat(2107, &result, ch); + my_strcat(_ALLOC_ID_, &result, ch); } state=TOK_BEGIN; } /* else if(state==TOK_SEP) */ @@ -4900,19 +4900,19 @@ const char *translate3(const char *s, int eat_escapes, const char *s1, char ch[2]; ch[0] = (char)c; ch[1] = '\0'; - my_strcat(2108, &result, ch); + my_strcat(_ALLOC_ID_, &result, ch); } if(c=='\0') { break; } } /* while(1) */ dbg(2, "translate3(): returning %s\n", result); - my_free(2109, &token); + my_free(_ALLOC_ID_, &token); /* if result is like: 'tcleval(some_string)' pass it thru tcl evaluation so expressions * can be calculated */ dbg(1, "translate3(): result=|%s|\n", result); - my_strdup2(2110, &translated_tok, tcl_hook2(result)); + my_strdup2(_ALLOC_ID_, &translated_tok, tcl_hook2(result)); xctx->tok_size = found_value; return translated_tok; } diff --git a/src/verilog_netlist.c b/src/verilog_netlist.c index aa9c7447..630acc58 100644 --- a/src/verilog_netlist.c +++ b/src/verilog_netlist.c @@ -47,7 +47,7 @@ static int verilog_netlist(FILE *fd , int verilog_stop) { if(skip_instance(i, 1, lvs_ignore)) continue; dbg(2, "verilog_netlist(): into the netlisting loop\n"); - my_strdup(2111, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && ( !IS_LABEL_SH_OR_PIN(type) && strcmp(type,"netlist_commands")&& @@ -68,7 +68,7 @@ static int verilog_netlist(FILE *fd , int verilog_stop) } } } - my_free(2112, &type); + my_free(_ALLOC_ID_, &type); } dbg(1, "verilog_netlist(): end\n"); if(!verilog_stop && !xctx->netlist_count) redraw_hilights(0); /*draw_hilight_net(1); */ @@ -132,14 +132,14 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2113, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) ) { str_tmp = get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr , fmt_attr, 2); if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format")) str_tmp = get_tok_value(xctx->sym[xctx->inst[i].ptr].prop_ptr, "verilog_format", 2); - my_strdup(2114, &tmp_string, str_tmp); + my_strdup(_ALLOC_ID_, &tmp_string, str_tmp); fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : ""); } } @@ -162,7 +162,7 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2115, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"opin"))==0) { if(tmp) fprintf(fd, " ,\n"); @@ -176,7 +176,7 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2116, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"iopin"))==0) { if(tmp) fprintf(fd, " ,\n"); @@ -190,7 +190,7 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2117, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"ipin"))==0) { if(tmp) fprintf(fd, " ,\n"); @@ -218,12 +218,12 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2118, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"opin"))==0) { - my_strdup(2119, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); - my_strdup(2120, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(2121, &sig_type,"wire"); /* 20070720 changed reg to wire */ + my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); /* 20070720 changed reg to wire */ str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : ""); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : ""); @@ -237,12 +237,12 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2122, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"iopin"))==0) { - my_strdup(2123, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); - my_strdup(2124, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(2125, &sig_type,"wire"); + my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : ""); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : ""); @@ -256,12 +256,12 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2126, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"ipin"))==0) { - my_strdup(2127, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); - my_strdup(2128, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(2129, &sig_type,"wire"); + my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"verilog_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; fprintf(fd, " input %s ;\n", str_tmp ? str_tmp : ""); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : ""); @@ -278,7 +278,7 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2130, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); } @@ -307,7 +307,7 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ /* warning if two symbols perfectly overlapped */ err |= warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(2131, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances; ++i) stored_flags[i] = xctx->inst[i].color; if(global) @@ -322,8 +322,8 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(2132, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); - my_strcat(2133, &xctx->sch_path[xctx->currsch+1], "->netlisting"); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; @@ -335,14 +335,14 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ if(xctx->sym[i].flags & (VERILOG_IGNORE | VERILOG_SHORT)) continue; if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue; if(!xctx->sym[i].type) continue; - my_strdup2(2134, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { if(!web_url) { tclvareval("get_directory [list ", xctx->sch[xctx->currsch - 1], "]", NULL); my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); } /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(2135, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { /* do not insert symbols with default_schematic attribute set to ignore in hash since these symbols @@ -358,12 +358,12 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ } } } - my_free(2136, &abs_path); + my_free(_ALLOC_ID_, &abs_path); /* can not free additional syms since *_block_netlist() may have loaded additional syms */ /* get_additional_symbols(0); */ str_hash_free(&subckt_table); - my_free(2137, &subckt_name); - my_free(2138, &xctx->sch[xctx->currsch]); + my_free(_ALLOC_ID_, &subckt_name); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); xctx->currsch--; unselect_all(1); /* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */ @@ -380,14 +380,14 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name)); err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */ if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; - my_free(2139, ¤t_dirname_save); + my_free(_ALLOC_ID_, ¤t_dirname_save); } /* restore hilight flags from errors found analyzing top level before descending hierarchy */ for(i=0;iinstances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(2140, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); dbg(1, "global_verilog_netlist(): starting awk on netlist!\n"); if(!split_f) { @@ -402,10 +402,10 @@ int global_verilog_netlist(int global, int alert) /* netlister driver */ } if(debug_var == 0 ) xunlink(netl_filename); } - my_free(2141, &sig_type); - my_free(2142, &port_value); - my_free(2143, &tmp_string); - my_free(2144, &type); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &port_value); + my_free(_ALLOC_ID_, &tmp_string); + my_free(_ALLOC_ID_, &type); xctx->netlist_count = 0; tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */ exit_code = err ? 10 : 0; @@ -446,7 +446,7 @@ int verilog_block_netlist(FILE *fd, int i, int alert) if(!strcmp(default_schematic, "ignore")) { return err; } - my_strdup(2145, &name, tcl_hook2(xctx->sym[i].name)); + my_strdup(_ALLOC_ID_, &name, tcl_hook2(xctx->sym[i].name)); if(split_f) { my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", @@ -471,8 +471,8 @@ int verilog_block_netlist(FILE *fd, int i, int alert) } else { Int_hashtable table = {NULL, 0}; int_hash_init(&table, 37); - my_strdup(2146, &extra, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); - my_strdup(2147, &extra2, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); + my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); + my_strdup(_ALLOC_ID_, &extra2, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); fprintf(fd, "// sch_path: %s\n", sanitized_abs_sym_path(filename, "")); verilog_stop? load_schematic(0,filename, 0, alert) : load_schematic(1,filename, 0, alert); get_additional_symbols(1); @@ -481,32 +481,32 @@ int verilog_block_netlist(FILE *fd, int i, int alert) for(j=0;jinstances; ++j) { if(skip_instance(j, 1, lvs_ignore)) continue; - my_strdup(2148, &type,(xctx->inst[j].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type); if( type && ( strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) ) { str_tmp = get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, fmt_attr, 2); if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format")) str_tmp = get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, "verilog_format", 2); - my_strdup(2149, &tmp_string, str_tmp); + my_strdup(_ALLOC_ID_, &tmp_string, str_tmp); fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : ""); } } - my_strdup(2150, &verilogprefix, + my_strdup(_ALLOC_ID_, &verilogprefix, get_tok_value(xctx->sym[i].prop_ptr, "verilogprefix", 0)); if(verilogprefix) { - my_strdup(2151, &symname, verilogprefix); - my_strcat(2152, &symname, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &symname, verilogprefix); + my_strcat(_ALLOC_ID_, &symname, get_cell(xctx->sym[i].name, 0)); } else { - my_strdup(2153, &symname, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &symname, get_cell(xctx->sym[i].name, 0)); } - my_free(2154, &verilogprefix); + my_free(_ALLOC_ID_, &verilogprefix); fprintf(fd, "module %s (\n", sanitize(symname)); - my_free(2155, &symname); + my_free(_ALLOC_ID_, &symname); /*print_generic(fd, "entity", i); */ dbg(1, "verilog_block_netlist(): entity ports\n"); @@ -545,15 +545,15 @@ int verilog_block_netlist(FILE *fd, int i, int alert) for(j=0;jsym[i].rects[PINLAYER]; ++j) { if(strboolcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) { - my_strdup(2156, &sig_type,get_tok_value( + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value( xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0)); - my_strdup(2157, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); - my_strdup(2158, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); if(strcmp(dir_tmp,"in")){ - if(!sig_type || sig_type[0]=='\0') my_strdup(2159, &sig_type,"wire"); /* 20070720 changed reg to wire */ + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); /* 20070720 changed reg to wire */ } else { - if(!sig_type || sig_type[0]=='\0') my_strdup(2160, &sig_type,"wire"); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); } str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { @@ -570,7 +570,7 @@ int verilog_block_netlist(FILE *fd, int i, int alert) if(extra2) { char *verilog_extra_dir = NULL; const char *dir; - my_strdup2(2161, &verilog_extra_dir, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra_dir", 0)); + my_strdup2(_ALLOC_ID_, &verilog_extra_dir, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra_dir", 0)); saveptr1 = NULL; for(extra_ptr = extra2; ; extra_ptr=NULL) { extra_token=my_strtok_r(extra_ptr, " ", "", 0, &saveptr1); @@ -583,7 +583,7 @@ int verilog_block_netlist(FILE *fd, int i, int alert) } fprintf(fd, " wire %s ;\n", extra_token); } - my_free(2162, &verilog_extra_dir); + my_free(_ALLOC_ID_, &verilog_extra_dir); } dbg(1, "verilog_block_netlist(): netlisting %s\n", get_cell( xctx->sch[xctx->currsch], 0)); err |= verilog_netlist(fd, verilog_stop); @@ -593,7 +593,7 @@ int verilog_block_netlist(FILE *fd, int i, int alert) if(xctx->netlist_count && !strboolcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; - my_strdup(2163, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); } @@ -604,13 +604,13 @@ int verilog_block_netlist(FILE *fd, int i, int alert) } fprintf(fd,"---- end user architecture code\n"); fprintf(fd, "endmodule\n"); - my_free(2164, &dir_tmp); - my_free(2165, &sig_type); - my_free(2166, &port_value); - my_free(2167, &type); - my_free(2168, &tmp_string); - my_free(2169, &extra); - my_free(2170, &extra2); + my_free(_ALLOC_ID_, &dir_tmp); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &port_value); + my_free(_ALLOC_ID_, &type); + my_free(_ALLOC_ID_, &tmp_string); + my_free(_ALLOC_ID_, &extra); + my_free(_ALLOC_ID_, &extra2); } /* if(!sym_def[0]) */ if(split_f) { int save; @@ -626,7 +626,7 @@ int verilog_block_netlist(FILE *fd, int i, int alert) } err: xctx->netlist_count++; - my_free(2171, &name); + my_free(_ALLOC_ID_, &name); return err; } diff --git a/src/vhdl_netlist.c b/src/vhdl_netlist.c index 52b09b49..c7d218c4 100644 --- a/src/vhdl_netlist.c +++ b/src/vhdl_netlist.c @@ -56,7 +56,7 @@ static int vhdl_netlist(FILE *fd , int vhdl_stop) for(l=0;linstances; ++l) { if(skip_instance(l, 1, lvs_ignore)) continue; - my_strdup(2172, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if( type && (strcmp(type,"attributes"))==0) { if(xctx->inst[l].prop_ptr) fprintf(fd, "\n%s\n", xctx->inst[l].prop_ptr); @@ -72,7 +72,7 @@ static int vhdl_netlist(FILE *fd , int vhdl_stop) { /* dont print elements with vhdl_ignore=true set in symbol */ if(skip_instance(i, 1, lvs_ignore)) continue; dbg(2, "vhdl_netlist(): into the netlisting loop\n"); - my_strdup(2173, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && ( !IS_LABEL_SH_OR_PIN(type) && strcmp(type,"generic")&& @@ -95,7 +95,7 @@ static int vhdl_netlist(FILE *fd , int vhdl_stop) } } } - if(type) my_free(2174, &type); + if(type) my_free(_ALLOC_ID_, &type); dbg(1, "vhdl_netlist(): end\n"); if(!vhdl_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ return err; @@ -156,7 +156,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2175, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"package"))==0) { if(xctx->inst[i].prop_ptr) { /* */ @@ -171,7 +171,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2176, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"use"))==0) { if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr); @@ -236,9 +236,9 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2177, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(2178, &sig_type,"std_logic"); - my_strdup(2179, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"opin"))==0) { str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; @@ -253,9 +253,9 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2180, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(2181, &sig_type,"std_logic"); - my_strdup(2182, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"iopin"))==0) { str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; @@ -270,9 +270,9 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2183, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); - if(!sig_type || sig_type[0]=='\0') my_strdup(2184, &sig_type,"std_logic"); - my_strdup(2185, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"ipin"))==0) { str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; @@ -288,7 +288,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2186, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if( type && (strcmp(type,"port_attributes"))==0) { if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr); @@ -311,7 +311,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ if(lvs_ignore && (xctx->sym[j].flags & LVS_IGNORE)) continue; if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 && strcmp(xctx->sym[j].type,"subcircuit")!=0)) continue; - my_strdup(2187, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[j].name), "")); + my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[j].name), "")); if(( strcmp(xctx->sym[j].type,"subcircuit")==0 || strcmp(xctx->sym[j].type,"primitive")==0 @@ -319,7 +319,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ ) { /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(2188, &subckt_name, get_cell(xctx->sym[j].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[j].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { Int_hashtable table = {NULL, 0}; str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); @@ -332,12 +332,12 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;isym[j].rects[PINLAYER]; ++i) { if(strboolcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) { - my_strdup(2189, &sig_type, + my_strdup(_ALLOC_ID_, &sig_type, get_tok_value( xctx->sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0)); - my_strdup(2190, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"value", 0) ); - if(!sig_type || sig_type[0]=='\0') my_strdup(2191, &sig_type,"std_logic"); - my_strdup(2192, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) ); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { if(!tmp) fprintf(fd, "port (\n"); @@ -347,7 +347,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ fprintf(fd," := %s", port_value); tmp=1; } - my_free(2193, &dir_tmp); + my_free(_ALLOC_ID_, &dir_tmp); } } int_hash_free(&table); @@ -355,11 +355,11 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ fprintf(fd, "end component ;\n\n"); } } - my_free(2194, &abs_path); + my_free(_ALLOC_ID_, &abs_path); } get_additional_symbols(0); str_hash_free(&subckt_table); - my_free(2195, &subckt_name); + my_free(_ALLOC_ID_, &subckt_name); dbg(1, "global_vhdl_netlist(): netlisting top level\n"); err |= vhdl_netlist(fd, 0); @@ -367,7 +367,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ for(i=0;iinstances; ++i) { if(skip_instance(i, 1, lvs_ignore)) continue; - my_strdup(2196, &type,(xctx->inst[i].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); } @@ -395,7 +395,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ /* warning if two symbols perfectly overlapped */ err |= warning_overlapped_symbols(0); /* preserve current level instance flags before descending hierarchy for netlisting, restore later */ - stored_flags = my_calloc(2197, xctx->instances, sizeof(unsigned int)); + stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); for(i=0;iinstances; ++i) stored_flags[i] = xctx->inst[i].color; if(global) @@ -411,8 +411,8 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ /* reload data without popping undo stack, this populates embedded symbols if any */ xctx->pop_undo(2, 0); /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ - my_strdup(2198, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); - my_strcat(2199, &xctx->sch_path[xctx->currsch+1], "->netlisting"); + my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); + my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->currsch++; @@ -424,7 +424,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ if(xctx->sym[i].flags & (VHDL_IGNORE | VHDL_SHORT)) continue; if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue; if(!xctx->sym[i].type) continue; - my_strdup(2200, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) { if(!web_url) { @@ -432,7 +432,7 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); } /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ - my_strdup(2201, &subckt_name, get_cell(xctx->sym[i].name, 0)); + my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { /* do not insert symbols with default_schematic attribute set to ignore in hash since these symbols @@ -448,12 +448,12 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ } } } - my_free(2202, &abs_path); + my_free(_ALLOC_ID_, &abs_path); /* can not free additional syms since *_block_netlist() may have loaded additional syms */ /* get_additional_symbols(0); */ str_hash_free(&subckt_table); - my_free(2203, &subckt_name); - my_free(2204, &xctx->sch[xctx->currsch]); + my_free(_ALLOC_ID_, &subckt_name); + my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); xctx->currsch--; unselect_all(1); /* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */ @@ -470,14 +470,14 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name)); err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */ if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; - my_free(2205, ¤t_dirname_save); + my_free(_ALLOC_ID_, ¤t_dirname_save); } /* restore hilight flags from errors found analyzing top level before descending hierarchy */ for(i=0;iinstances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; propagate_hilights(1, 0, XINSERT_NOREPLACE); draw_hilight_net(1); - my_free(2206, &stored_flags); + my_free(_ALLOC_ID_, &stored_flags); dbg(1, "global_vhdl_netlist(): starting awk on netlist!\n"); if(!split_f) { fclose(fd); @@ -491,9 +491,9 @@ int global_vhdl_netlist(int global, int alert) /* netlister driver */ } if(!debug_var) xunlink(netl_filename); } - my_free(2207, &sig_type); - my_free(2208, &type); - my_free(2209, &port_value); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &type); + my_free(_ALLOC_ID_, &port_value); xctx->netlist_count = 0; tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */ exit_code = err ? 10 : 0; @@ -588,12 +588,12 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) for(j=0;jsym[i].rects[PINLAYER]; ++j) { if(strboolcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) { - my_strdup(2210, &sig_type, + my_strdup(_ALLOC_ID_, &sig_type, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0)); - my_strdup(2211, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); - if(!sig_type || sig_type[0]=='\0') my_strdup(2212, &sig_type,"std_logic"); - my_strdup(2213, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { if(tmp) fprintf(fd, " ;\n"); @@ -604,7 +604,7 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) fprintf(fd," := %s", port_value); tmp=1; } - my_free(2214, &dir_tmp); + my_free(_ALLOC_ID_, &dir_tmp); } } int_hash_free(&table); @@ -614,7 +614,7 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) for(l=0;linstances; ++l) { if(skip_instance(l, 1, lvs_ignore)) continue; - my_strdup(2215, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if( type && (strcmp(type,"port_attributes"))==0) { if(xctx->inst[l].prop_ptr) fprintf(fd, "%s\n", xctx->inst[l].prop_ptr); @@ -643,7 +643,7 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 && strcmp(xctx->sym[j].type,"subcircuit")!=0)) continue; - my_strdup2(2216, &abs_path, abs_sym_path(xctx->sym[i].name, "")); + my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); if(( strcmp(xctx->sym[j].type,"subcircuit")==0 || strcmp(xctx->sym[j].type,"primitive")==0) && check_lib(1, abs_path) ) { @@ -667,19 +667,19 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) for(k=0;ksym[j].rects[PINLAYER]; ++k) { if(strboolcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) { - my_strdup(2217, &sig_type, + my_strdup(_ALLOC_ID_, &sig_type, get_tok_value( xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0)); - my_strdup(2218, &port_value, + my_strdup(_ALLOC_ID_, &port_value, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value", 0) ); - if(!sig_type || sig_type[0]=='\0') my_strdup(2219, &sig_type,"std_logic"); - my_strdup(2220, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) ); + if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); + my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) ); str_tmp = get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"name",0); if(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) { if(!tmp) fprintf(fd, "port (\n"); if(tmp) fprintf(fd, " ;\n"); fprintf(fd," %s : %s %s",str_tmp, dir_tmp ? dir_tmp : "", sig_type); - my_free(2221, &dir_tmp); + my_free(_ALLOC_ID_, &dir_tmp); if(port_value &&port_value[0]) fprintf(fd," := %s", port_value); tmp=1; } @@ -692,7 +692,7 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) } /* for(j...) */ get_additional_symbols(0); } /* if(!vhdl_stop) */ - my_free(2222, &abs_path); + my_free(_ALLOC_ID_, &abs_path); dbg(1, "vhdl_block_netlist(): netlisting %s\n", get_cell( xctx->sch[xctx->currsch], 0)); err |= vhdl_netlist(fd, vhdl_stop); fprintf(fd,"//// begin user architecture code\n"); @@ -702,7 +702,7 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) if(xctx->netlist_count && !strboolcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; - my_strdup(2223, &type,(xctx->inst[l].ptr+ xctx->sym)->type); + my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); if(type && !strcmp(type,"netlist_commands")) { fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); } @@ -710,9 +710,9 @@ int vhdl_block_netlist(FILE *fd, int i, int alert) if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop); fprintf(fd, "end arch_%s ;\n\n", get_cell(sanitize(xctx->sym[i].name), 0) ); - my_free(2224, &sig_type); - my_free(2225, &port_value); - my_free(2226, &type); + my_free(_ALLOC_ID_, &sig_type); + my_free(_ALLOC_ID_, &port_value); + my_free(_ALLOC_ID_, &type); } /* if(!sym_def[0]) */ if(split_f) { int save; diff --git a/src/xinit.c b/src/xinit.c index 52a280a2..39cae4e4 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -321,7 +321,7 @@ static void init_color_array(double dim, double dim_bg) if(g>0xff) g=0xff; if(b>0xff) b=0xff; my_snprintf(s, S(s), "#%02x%02x%02x", r, g, b); - my_strdup(2227, &xctx->color_array[i], s); + my_strdup(_ALLOC_ID_, &xctx->color_array[i], s); } } @@ -375,55 +375,55 @@ static void free_xschem_data() xctx->delete_undo(); free_simdata(); - my_free(2228, &xctx->node_table); - my_free(2229, &xctx->hilight_table); + my_free(_ALLOC_ID_, &xctx->node_table); + my_free(_ALLOC_ID_, &xctx->hilight_table); - my_free(2230, &xctx->wire); - my_free(2231, &xctx->text); - my_free(2232, &xctx->inst); + my_free(_ALLOC_ID_, &xctx->wire); + my_free(_ALLOC_ID_, &xctx->text); + my_free(_ALLOC_ID_, &xctx->inst); for(i=0;irect[i]); - my_free(2234, &xctx->line[i]); - my_free(2235, &xctx->poly[i]); - my_free(2236, &xctx->arc[i]); + my_free(_ALLOC_ID_, &xctx->rect[i]); + my_free(_ALLOC_ID_, &xctx->line[i]); + my_free(_ALLOC_ID_, &xctx->poly[i]); + my_free(_ALLOC_ID_, &xctx->arc[i]); } - my_free(2237, &xctx->sym); - my_free(2238, &xctx->rect); - my_free(2239, &xctx->line); - my_free(2240, &xctx->poly); - my_free(2241, &xctx->arc); - my_free(2242, &xctx->rects); - my_free(2243, &xctx->polygons); - my_free(2244, &xctx->arcs); - my_free(2245, &xctx->lines); - my_free(2246, &xctx->maxr); - my_free(2247, &xctx->maxp); - my_free(2248, &xctx->maxa); - my_free(2249, &xctx->maxl); - my_free(2250, &xctx->sel_array); + my_free(_ALLOC_ID_, &xctx->sym); + my_free(_ALLOC_ID_, &xctx->rect); + my_free(_ALLOC_ID_, &xctx->line); + my_free(_ALLOC_ID_, &xctx->poly); + my_free(_ALLOC_ID_, &xctx->arc); + my_free(_ALLOC_ID_, &xctx->rects); + my_free(_ALLOC_ID_, &xctx->polygons); + my_free(_ALLOC_ID_, &xctx->arcs); + my_free(_ALLOC_ID_, &xctx->lines); + my_free(_ALLOC_ID_, &xctx->maxr); + my_free(_ALLOC_ID_, &xctx->maxp); + my_free(_ALLOC_ID_, &xctx->maxa); + my_free(_ALLOC_ID_, &xctx->maxl); + my_free(_ALLOC_ID_, &xctx->sel_array); for(i=0;iportmap[i].table) str_hash_free(&xctx->portmap[i]); - if(xctx->sch[i]) my_free(2251, &xctx->sch[i]); - if(xctx->sch_path[i]) my_free(2252, &xctx->sch_path[i]); - if(xctx->hier_attr[i].templ) my_free(2253, &xctx->hier_attr[i].templ); - if(xctx->hier_attr[i].prop_ptr) my_free(2254, &xctx->hier_attr[i].prop_ptr); - if(xctx->hier_attr[i].symname) my_free(2255, &xctx->hier_attr[i].symname); + if(xctx->sch[i]) my_free(_ALLOC_ID_, &xctx->sch[i]); + if(xctx->sch_path[i]) my_free(_ALLOC_ID_, &xctx->sch_path[i]); + if(xctx->hier_attr[i].templ) my_free(_ALLOC_ID_, &xctx->hier_attr[i].templ); + if(xctx->hier_attr[i].prop_ptr) my_free(_ALLOC_ID_, &xctx->hier_attr[i].prop_ptr); + if(xctx->hier_attr[i].symname) my_free(_ALLOC_ID_, &xctx->hier_attr[i].symname); } - my_free(2256, &xctx->gridpoint); - my_free(2257, &xctx->biggridpoint); - my_free(2258, &xctx->gc); - my_free(2259, &xctx->gcstipple); - for(i=0;icolor_array[i]); - my_free(2261, &xctx->color_array); - my_free(2262, &xctx->enable_layer); - my_free(2263, &xctx->active_layer); - my_free(2264, &xctx->top_path); - my_free(2265, &xctx->current_win_path); - my_free(2266, &xctx->fill_type); - my_free(2267, &xctx->format); - my_free(2268, &xctx->custom_format); - my_free(2269, &xctx); + my_free(_ALLOC_ID_, &xctx->gridpoint); + my_free(_ALLOC_ID_, &xctx->biggridpoint); + my_free(_ALLOC_ID_, &xctx->gc); + my_free(_ALLOC_ID_, &xctx->gcstipple); + for(i=0;icolor_array[i]); + my_free(_ALLOC_ID_, &xctx->color_array); + my_free(_ALLOC_ID_, &xctx->enable_layer); + my_free(_ALLOC_ID_, &xctx->active_layer); + my_free(_ALLOC_ID_, &xctx->top_path); + my_free(_ALLOC_ID_, &xctx->current_win_path); + my_free(_ALLOC_ID_, &xctx->fill_type); + my_free(_ALLOC_ID_, &xctx->format); + my_free(_ALLOC_ID_, &xctx->custom_format); + my_free(_ALLOC_ID_, &xctx); } void create_gc(void) @@ -453,7 +453,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) { int i, j; - xctx = my_calloc(2270, 1, sizeof(Xschem_ctx)); + xctx = my_calloc(_ALLOC_ID_, 1, sizeof(Xschem_ctx)); xctx->cur_undo_ptr = 0; xctx->head_undo_ptr = 0; xctx->tail_undo_ptr = 0; @@ -542,12 +542,12 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) } } xctx->n_hash_objects = 0; - xctx->node_table = my_calloc(2271, HASHSIZE, sizeof(Node_hashentry *)); + xctx->node_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Node_hashentry *)); xctx->inst_name_table.table = NULL; xctx->inst_name_table.size = 0; xctx->floater_inst_table.table = NULL; xctx->floater_inst_table.size = 0; - xctx->hilight_table = my_calloc(2272, HASHSIZE, sizeof(Hilight_hashentry *)); + xctx->hilight_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Hilight_hashentry *)); xctx->window = xctx->save_pixmap = 0; xctx->xrect[0].width = xctx->xrect[0].height = xctx->xrect[0].x = xctx->xrect[0].y = 0; @@ -601,21 +601,21 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->portmap[i].table = NULL; xctx->portmap[i].size = 0; } - my_strdup(2273, &xctx->sch_path[0],"."); + my_strdup(_ALLOC_ID_, &xctx->sch_path[0],"."); xctx->sch_inst_number[0] = 1; xctx->maxt=CADMAXTEXT; xctx->maxw=CADMAXWIRES; xctx->maxi=ELEMINST; xctx->maxs=ELEMDEF; - xctx->text=my_calloc(2274, xctx->maxt,sizeof(xText)); - xctx->wire=my_calloc(2275, xctx->maxw,sizeof(xWire)); - xctx->inst=my_calloc(2276, xctx->maxi , sizeof(xInstance) ); - xctx->sym=my_calloc(2277, xctx->maxs , sizeof(xSymbol) ); - xctx->maxr=my_calloc(2278, cadlayers, sizeof(int)); - xctx->maxa=my_calloc(2279, cadlayers, sizeof(int)); - xctx->maxp=my_calloc(2280, cadlayers, sizeof(int)); - xctx->maxl=my_calloc(2281, cadlayers, sizeof(int)); + xctx->text=my_calloc(_ALLOC_ID_, xctx->maxt,sizeof(xText)); + xctx->wire=my_calloc(_ALLOC_ID_, xctx->maxw,sizeof(xWire)); + xctx->inst=my_calloc(_ALLOC_ID_, xctx->maxi , sizeof(xInstance) ); + xctx->sym=my_calloc(_ALLOC_ID_, xctx->maxs , sizeof(xSymbol) ); + xctx->maxr=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->maxa=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->maxp=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->maxl=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); for(i=0;imaxr[i]=CADMAXOBJECTS; @@ -623,28 +623,28 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->maxl[i]=CADMAXOBJECTS; xctx->maxa[i]=CADMAXOBJECTS; } - xctx->rect=my_calloc(2282, cadlayers, sizeof(xRect *)); - xctx->line=my_calloc(2283, cadlayers, sizeof(xLine *)); - xctx->poly=my_calloc(2284, cadlayers, sizeof(xPoly *)); - xctx->arc=my_calloc(2285, cadlayers, sizeof(xArc *)); + xctx->rect=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); + xctx->line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); + xctx->poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); + xctx->arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); for(i=0;irect[i]=my_calloc(2286, xctx->maxr[i],sizeof(xRect)); - xctx->arc[i]=my_calloc(2287, xctx->maxa[i],sizeof(xArc)); - xctx->poly[i]=my_calloc(2288, xctx->maxp[i],sizeof(xPoly)); - xctx->line[i]=my_calloc(2289, xctx->maxl[i],sizeof(xLine)); + xctx->rect[i]=my_calloc(_ALLOC_ID_, xctx->maxr[i],sizeof(xRect)); + xctx->arc[i]=my_calloc(_ALLOC_ID_, xctx->maxa[i],sizeof(xArc)); + xctx->poly[i]=my_calloc(_ALLOC_ID_, xctx->maxp[i],sizeof(xPoly)); + xctx->line[i]=my_calloc(_ALLOC_ID_, xctx->maxl[i],sizeof(xLine)); } - xctx->rects=my_calloc(2290, cadlayers, sizeof(int)); - xctx->polygons=my_calloc(2291, cadlayers, sizeof(int)); - xctx->arcs=my_calloc(2292, cadlayers, sizeof(int)); - xctx->lines=my_calloc(2293, cadlayers, sizeof(int)); + xctx->rects=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->polygons=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->arcs=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); + xctx->lines=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->maxsel=MAXGROUP; - xctx->sel_array=my_calloc(2294, xctx->maxsel, sizeof(Selected)); + xctx->sel_array=my_calloc(_ALLOC_ID_, xctx->maxsel, sizeof(Selected)); xctx->first_sel.n = -1; xctx->first_sel.type = 0; xctx->first_sel.col = 0; - xctx->biggridpoint=(XSegment*)my_calloc(2295, CADMAXGRIDPOINTS,sizeof(XSegment)); - xctx->gridpoint=(XPoint*)my_calloc(2296, CADMAXGRIDPOINTS,sizeof(XPoint)); + xctx->biggridpoint=(XSegment*)my_calloc(_ALLOC_ID_, CADMAXGRIDPOINTS,sizeof(XSegment)); + xctx->gridpoint=(XPoint*)my_calloc(_ALLOC_ID_, CADMAXGRIDPOINTS,sizeof(XPoint)); xctx->enable_drill = 0; xctx->prev_set_modify = -1; xctx->prev_crossx = xctx->prev_crossy = 0.0; @@ -677,13 +677,13 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->edit_sym_i = -1; xctx->netlist_commands = 0; xctx->draw_pixmap = 1; - xctx->gc=my_calloc(2297, cadlayers, sizeof(GC)); - xctx->gcstipple=my_calloc(2298, cadlayers, sizeof(GC)); - xctx->color_array=my_calloc(2299, cadlayers, sizeof(char*)); - xctx->enable_layer=my_calloc(2300, cadlayers, sizeof(int)); + xctx->gc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(GC)); + xctx->gcstipple=my_calloc(_ALLOC_ID_, cadlayers, sizeof(GC)); + xctx->color_array=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*)); + xctx->enable_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->crosshair_layer = TEXTLAYER; xctx->n_active_layers = 0; - xctx->active_layer=my_calloc(2301, cadlayers, sizeof(int)); + xctx->active_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->hide_symbols = 0; xctx->netlist_type = CAD_SPICE_NETLIST; xctx->format = NULL; /* format string for netlist, (copied from custom_format) otherwise use @@ -692,9 +692,9 @@ static void alloc_xschem_data(const char *top_path, const char *win_path) xctx->custom_format = NULL; xctx->top_path = NULL; xctx->current_win_path = NULL; - my_strdup2(2302, &xctx->top_path, top_path); - my_strdup2(2303, &xctx->current_win_path, win_path); - xctx->fill_type=my_calloc(2304, cadlayers, sizeof(int)); + my_strdup2(_ALLOC_ID_, &xctx->top_path, top_path); + my_strdup2(_ALLOC_ID_, &xctx->current_win_path, win_path); + xctx->fill_type=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->case_insensitive = 0; xctx->show_hidden_texts = 0; xctx->x_strcmp = strcmp; @@ -765,7 +765,7 @@ int compare_schematics(const char *f) /* HASH SCHEMATIC 1 */ for(i = 0; i < xctx->instances; ++i) { l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); - my_realloc(2305, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "C %s %g %g %d %d %s", tcl_hook2(xctx->inst[i].name), xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip, xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); @@ -774,7 +774,7 @@ int compare_schematics(const char *f) for(i=0;iwires; ++i) { l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); - my_realloc(2306, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2); int_hash_lookup(&table1, s, i, XINSERT_NOREPLACE); @@ -827,7 +827,7 @@ int compare_schematics(const char *f) /* HASH SCHEMATIC 2 , CHECK SCHEMATIC 2 WITH SCHEMATIC 1 */ for(i = 0; i < xctx->instances; ++i) { l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); - my_realloc(2307, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "C %s %g %g %d %d %s", tcl_hook2(xctx->inst[i].name), xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip, xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); @@ -845,7 +845,7 @@ int compare_schematics(const char *f) for(i=0;iwires; ++i) { l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); - my_realloc(2308, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2); int_hash_lookup(&table2, s, i, XINSERT_NOREPLACE); @@ -875,7 +875,7 @@ int compare_schematics(const char *f) /* CHECK SCHEMATIC 1 WITH SCHEMATIC 2*/ for(i = 0; i < xctx->instances; ++i) { l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); - my_realloc(2309,&s, l); + my_realloc(_ALLOC_ID_,&s, l); my_snprintf(s, l, "C %s %g %g %d %d %s", tcl_hook2(xctx->inst[i].name), xctx->inst[i].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip, xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); @@ -890,7 +890,7 @@ int compare_schematics(const char *f) for(i=0;iwires; ++i) { l = 1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); - my_realloc(2310, &s, l); + my_realloc(_ALLOC_ID_, &s, l); my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, xctx->wire[i].x2, xctx->wire[i].y2); found = int_hash_lookup(&table2, s, i, XLOOKUP); @@ -904,7 +904,7 @@ int compare_schematics(const char *f) int_hash_free(&table2); rebuild_selected_array(); draw_selection(xctx->gc[SELLAYER], 0); - my_free(2311, &s); + my_free(_ALLOC_ID_, &s); return ret; } @@ -917,7 +917,7 @@ static void xwin_exit(void) dbg(0, "xwin_exit() double call, doing nothing...\n"); return; } - if(xctx->infowindow_text) my_free(2312, &xctx->infowindow_text); + if(xctx->infowindow_text) my_free(_ALLOC_ID_, &xctx->infowindow_text); if(has_x) new_schematic("destroy_all", "1", NULL, 1); drawbezier(xctx->window, xctx->gc[0], 0, NULL, NULL, 0, 0); delete_schematic_data(1); @@ -936,18 +936,18 @@ static void xwin_exit(void) #else for(i = 0; i < cadlayers; ++i) Tk_FreePixmap(display, pixmap[i]); #endif - my_free(2313, &pixmap); + my_free(_ALLOC_ID_, &pixmap); } dbg(1, "xwin_exit(): clearing drawing data structures\n"); /* global context - graphic preferences/settings */ for(i=0;itop_path, save_xctx->current_win_path); /* alloc data into xctx */ init_pixdata(); /* populate xctx->fill_type array that is used in create_gc() to set fill styles */ @@ -1292,7 +1292,7 @@ int preview_window(const char *what, const char *win_path, const char *fname) delete_schematic_data(1); preview_xctx[i] = NULL; } - my_free(2324, ¤t_file[i]); + my_free(_ALLOC_ID_, ¤t_file[i]); xctx = save_xctx; /* restore schematic */ save_xctx = NULL; /* set_modify(-1); */ /* no more needed as load_schematic() called with reset_undo=0 */ @@ -1833,14 +1833,14 @@ static void destroy_window(int *window_count, const char *win_path) if(savectx == xctx) savectx = save_xctx[0]; if(has_x) { tclvareval("winfo toplevel ", win_path, NULL); - my_strdup2(2325, &toplevel, tclresult()); + my_strdup2(_ALLOC_ID_, &toplevel, tclresult()); } delete_schematic_data(1); save_xctx[n] = NULL; if(has_x) { Tk_DestroyWindow(Tk_NameToWindow(interp, window_path[n], mainwindow)); tclvareval("destroy ", toplevel, NULL); - my_free(2326, &toplevel); + my_free(_ALLOC_ID_, &toplevel); } my_strncpy(window_path[n], "", S(window_path[n])); (*window_count)--; @@ -1951,7 +1951,7 @@ static void destroy_all_windows(int *window_count, int force) char *toplevel = NULL; if(has_x) { tclvareval("winfo toplevel ", window_path[i], NULL); - my_strdup2(2327, &toplevel, tclresult()); + my_strdup2(_ALLOC_ID_, &toplevel, tclresult()); } /* set saved ctx to main window if previous is about to be destroyed */ if(savectx == save_xctx[i]) savectx = save_xctx[0]; @@ -1960,7 +1960,7 @@ static void destroy_all_windows(int *window_count, int force) if(has_x) { Tk_DestroyWindow(Tk_NameToWindow(interp, window_path[i], mainwindow)); tclvareval("destroy ", toplevel, NULL); - my_free(2328, &toplevel); + my_free(_ALLOC_ID_, &toplevel); } /* delete Tcl context of deleted schematic window */ tclvareval("delete_ctx ", window_path[i], NULL); @@ -2472,31 +2472,31 @@ int Tcl_AppInit(Tcl_Interp *inter) if (atoi(tclresult()) == 0) { running_in_src_dir = 1; /* no bin, so it's running in Visual studio source directory*/ - my_strdup(2329, &up_hier, "../../.."); + my_strdup(_ALLOC_ID_, &up_hier, "../../.."); } - else my_strdup(2330, &up_hier, "../share/xschem"); + else my_strdup(_ALLOC_ID_, &up_hier, "../share/xschem"); tclsetintvar("running_in_src_dir", running_in_src_dir); - /* my_strcat(2331, &win_xschem_library_path, "."); */ + /* my_strcat(_ALLOC_ID_, &win_xschem_library_path, "."); */ for (i = 0; i < WIN_XSCHEM_LIBRARY_PATH_NUM; ++i) { if (i==2) { - my_free(2332, &up_hier); + my_free(_ALLOC_ID_, &up_hier); if (running_in_src_dir==0) - my_strdup(2333, &up_hier, "../share/doc/xschem"); + my_strdup(_ALLOC_ID_, &up_hier, "../share/doc/xschem"); else - my_strdup(2334, &up_hier, "../../../xschem_library"); + my_strdup(_ALLOC_ID_, &up_hier, "../../../xschem_library"); } my_snprintf(tmp, S(tmp),"%s/%s/%s", install_dir, up_hier, WIN_XSCHEM_LIBRARY_PATH[i]); - if (i > 0) my_strcat(2335, &win_xschem_library_path, "\;"); - my_strcat(2336, &win_xschem_library_path, tmp); + if (i > 0) my_strcat(_ALLOC_ID_, &win_xschem_library_path, "\;"); + my_strcat(_ALLOC_ID_, &win_xschem_library_path, tmp); } my_snprintf(tmp, S(tmp), "set tmp2 {%s}; " "while {[regsub {([^/]*\\.*[^./]+[^/]*)/\\.\\./?} $tmp2 {} tmp2]} {}; ", win_xschem_library_path); const char *result2 = tcleval(tmp); const char *win_xschem_library_path_clean = tclgetvar("tmp2"); tclsetvar("XSCHEM_LIBRARY_PATH", win_xschem_library_path_clean); - my_free(2337, &win_xschem_library_path); - my_free(2338, &up_hier); + my_free(_ALLOC_ID_, &win_xschem_library_path); + my_free(_ALLOC_ID_, &up_hier); if ((xschem_sharedir=getenv("XSCHEM_SHAREDIR")) != NULL) { if (!stat(xschem_sharedir, &buf)) { tclsetvar("XSCHEM_SHAREDIR", xschem_sharedir); @@ -2705,7 +2705,7 @@ int Tcl_AppInit(Tcl_Interp *inter) /* */ /* resolve absolute pathname of xschem (argv[0]) for future usage */ - my_strdup(2339, &xschem_executable, get_file_path(xschem_executable)); + my_strdup(_ALLOC_ID_, &xschem_executable, get_file_path(xschem_executable)); dbg(1, "Tcl_AppInit(): resolved xschem_executable=%s\n", xschem_executable); /* get xschem globals from tcl variables set in xschemrc/xschem.tcl */ @@ -2742,19 +2742,19 @@ int Tcl_AppInit(Tcl_Interp *inter) } /* initialize current schematic name to empty string to avoid gazillion checks in the code for NULL */ - my_strdup2(2340, &xctx->sch[xctx->currsch], ""); + my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], ""); xctx->crosshair_layer = tclgetintvar("crosshair_layer"); if(xctx->crosshair_layer < 0 ) xctx->crosshair_layer = 2; if(xctx->crosshair_layer >= cadlayers ) xctx->crosshair_layer = 2; /* global context / graphic preferences/settings */ - pixdata=my_calloc(2341, cadlayers, sizeof(char*)); + pixdata=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*)); for(i=0;iplotfile, cli_opt_plotfile, S(xctx->plotfile)); xctx->draw_window = tclgetintvar("draw_window"); @@ -2764,8 +2764,8 @@ int Tcl_AppInit(Tcl_Interp *inter) /* set global variables fetching data from tcl code */ /* if lvs_netlist is set also use lvs_format for devices netlisting rule if existing */ - if(tclgetboolvar("lvs_netlist")) my_strdup(2344, &xctx->format, "lvs_format"); - else my_strdup(2345, &xctx->format, NULL); + if(tclgetboolvar("lvs_netlist")) my_strdup(_ALLOC_ID_, &xctx->format, "lvs_format"); + else my_strdup(_ALLOC_ID_, &xctx->format, NULL); if(cli_opt_netlist_type) { xctx->netlist_type = cli_opt_netlist_type; diff --git a/src/xschem.h b/src/xschem.h index 388f916b..3128dc1d 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -416,7 +416,7 @@ do { \ register size_t __str_alloc_tmp__ = add; \ if( __str_alloc_tmp__ >= *size) { \ *size = __str_alloc_tmp__ + CADCHUNKALLOC; \ - my_realloc(2346, dest_string, *size); \ + my_realloc(_ALLOC_ID_, dest_string, *size); \ } \ } while(0)