fix another small memory leak due to tclvareval("xschem exit...")--> use tcleval()

This commit is contained in:
stefan schippers 2024-09-06 22:19:36 +02:00
parent 882f7f7434
commit 391464bab9
31 changed files with 2219 additions and 2209 deletions

View File

@ -52,11 +52,11 @@ unsigned int hash_file(const char *f, int skip_path_lines)
* skip also .include /path/to/some/file */ * skip also .include /path/to/some/file */
if(skip_path_lines && n > 14) { if(skip_path_lines && n > 14) {
if(!strncmp(line+2, " sch_path: ", 11) || !strncmp(line+2, " sym_path: ", 11) ) { if(!strncmp(line+2, " sch_path: ", 11) || !strncmp(line+2, " sym_path: ", 11) ) {
my_free(_ALLOC_ID_, &line); my_free(0, &line);
continue; continue;
} }
if(!strncmp(line, ".include ", 9) || !strncmp(line, ".INCLUDE ", 9) ) { if(!strncmp(line, ".include ", 9) || !strncmp(line, ".INCLUDE ", 9) ) {
my_free(_ALLOC_ID_, &line); my_free(1, &line);
continue; continue;
} }
} }
@ -73,7 +73,7 @@ unsigned int hash_file(const char *f, int skip_path_lines)
} }
h += (h << 5) + (unsigned char)line[i]; h += (h << 5) + (unsigned char)line[i];
} }
my_free(_ALLOC_ID_, &line); my_free(2, &line);
} /* while(line ....) */ } /* while(line ....) */
if(cr) h += (h << 5) + '\r'; /* file ends with \r not followed by \n: keep it */ if(cr) h += (h << 5) + '\r'; /* file ends with \r not followed by \n: keep it */
fclose(fd); fclose(fd);
@ -122,7 +122,7 @@ const char *get_text_floater(int i)
txt_ptr = xctx->text[i].floater_ptr; txt_ptr = xctx->text[i].floater_ptr;
} else { } else {
/* cache floater translated text to avoid re-evaluating every time schematic is drawn */ /* cache floater translated text to avoid re-evaluating every time schematic is drawn */
my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_ptr, translate(inst, xctx->text[i].txt_ptr)); my_strdup2(3, &xctx->text[i].floater_ptr, translate(inst, xctx->text[i].txt_ptr));
txt_ptr = xctx->text[i].floater_ptr; txt_ptr = xctx->text[i].floater_ptr;
} }
dbg(1, "floater: %s\n",txt_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 * (but name=something or floater=something attribute must be present) and text
* matches tcleval(...) or contains '@' */ * matches tcleval(...) or contains '@' */
if(strstr(txt_ptr, "tcleval(") == txt_ptr || strchr(txt_ptr, '@')) { if(strstr(txt_ptr, "tcleval(") == txt_ptr || strchr(txt_ptr, '@')) {
/* my_strdup2(_ALLOC_ID_, &xctx->text[i].floater_ptr, tcl_hook2(xctx->text[i].txt_ptr)); */ /* my_strdup2(4, &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)); my_strdup2(5, &xctx->text[i].floater_ptr, translate(-1, xctx->text[i].txt_ptr));
txt_ptr = xctx->text[i].floater_ptr; txt_ptr = xctx->text[i].floater_ptr;
} }
} }
@ -188,7 +188,7 @@ int set_modify(int mod)
for(i = 0; i < xctx->texts; i++) for(i = 0; i < xctx->texts; i++)
if(xctx->text[i].flags & TEXT_FLOATER) { if(xctx->text[i].flags & TEXT_FLOATER) {
floaters++; floaters++;
my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); /* clear floater cached value */ my_free(6, &xctx->text[i].floater_ptr); /* clear floater cached value */
} }
int_hash_free(&xctx->floater_inst_table); int_hash_free(&xctx->floater_inst_table);
} }
@ -232,16 +232,16 @@ char *escape_chars(const char *source, const char *charset)
size_t slen, size; size_t slen, size;
if(!source) { if(!source) {
if(dest) my_free(_ALLOC_ID_, &dest); if(dest) my_free(7, &dest);
return NULL; return NULL;
} }
slen = strlen(source); slen = strlen(source);
size = slen + 1; size = slen + 1;
my_realloc(_ALLOC_ID_, &dest, size); my_realloc(8, &dest, size);
while(source && source[s]) { while(source && source[s]) {
if(d >= size - 2) { if(d >= size - 2) {
size += 2; size += 2;
my_realloc(_ALLOC_ID_, &dest, size); my_realloc(9, &dest, size);
} }
if(!strcmp(charset, "")) { if(!strcmp(charset, "")) {
switch(source[s]) { switch(source[s]) {
@ -627,7 +627,7 @@ void ask_new_file(void)
load_schematic(1, f, 1, 1); load_schematic(1, f, 1, 1);
tclvareval("update_recent_file {", f, "}", NULL); tclvareval("update_recent_file {", f, "}", NULL);
if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]); if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]);
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch],"."); my_strdup(10, &xctx->sch_path[xctx->currsch],".");
xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_path_hash[xctx->currsch] = 0;
xctx->sch_inst_number[xctx->currsch] = 1; xctx->sch_inst_number[xctx->currsch] = 1;
zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); zoom_full(1, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
@ -645,77 +645,77 @@ void remove_symbol(int j)
xSymbol save; xSymbol save;
dbg(1,"clearing symbol %d: %s\n", j, xctx->sym[j].name); dbg(1,"clearing symbol %d: %s\n", j, xctx->sym[j].name);
my_free(_ALLOC_ID_, &xctx->sym[j].prop_ptr); my_free(11, &xctx->sym[j].prop_ptr);
my_free(_ALLOC_ID_, &xctx->sym[j].templ); my_free(12, &xctx->sym[j].templ);
my_free(_ALLOC_ID_, &xctx->sym[j].parent_prop_ptr); my_free(13, &xctx->sym[j].parent_prop_ptr);
my_free(_ALLOC_ID_, &xctx->sym[j].type); my_free(14, &xctx->sym[j].type);
my_free(_ALLOC_ID_, &xctx->sym[j].name); my_free(15, &xctx->sym[j].name);
/* /20150409 */ /* /20150409 */
for(c=0;c<cadlayers; ++c) { for(c=0;c<cadlayers; ++c) {
for(i=0;i<xctx->sym[j].polygons[c]; ++i) { for(i=0;i<xctx->sym[j].polygons[c]; ++i) {
if(xctx->sym[j].poly[c][i].prop_ptr != NULL) { if(xctx->sym[j].poly[c][i].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].prop_ptr); my_free(16, &xctx->sym[j].poly[c][i].prop_ptr);
} }
my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].x); my_free(17, &xctx->sym[j].poly[c][i].x);
my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].y); my_free(18, &xctx->sym[j].poly[c][i].y);
my_free(_ALLOC_ID_, &xctx->sym[j].poly[c][i].selected_point); my_free(19, &xctx->sym[j].poly[c][i].selected_point);
} }
my_free(_ALLOC_ID_, &xctx->sym[j].poly[c]); my_free(20, &xctx->sym[j].poly[c]);
xctx->sym[j].polygons[c] = 0; xctx->sym[j].polygons[c] = 0;
for(i=0;i<xctx->sym[j].lines[c]; ++i) { for(i=0;i<xctx->sym[j].lines[c]; ++i) {
if(xctx->sym[j].line[c][i].prop_ptr != NULL) { if(xctx->sym[j].line[c][i].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].line[c][i].prop_ptr); my_free(21, &xctx->sym[j].line[c][i].prop_ptr);
} }
} }
my_free(_ALLOC_ID_, &xctx->sym[j].line[c]); my_free(22, &xctx->sym[j].line[c]);
xctx->sym[j].lines[c] = 0; xctx->sym[j].lines[c] = 0;
for(i=0;i<xctx->sym[j].arcs[c]; ++i) { for(i=0;i<xctx->sym[j].arcs[c]; ++i) {
if(xctx->sym[j].arc[c][i].prop_ptr != NULL) { if(xctx->sym[j].arc[c][i].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].arc[c][i].prop_ptr); my_free(23, &xctx->sym[j].arc[c][i].prop_ptr);
} }
} }
my_free(_ALLOC_ID_, &xctx->sym[j].arc[c]); my_free(24, &xctx->sym[j].arc[c]);
xctx->sym[j].arcs[c] = 0; xctx->sym[j].arcs[c] = 0;
for(i=0;i<xctx->sym[j].rects[c]; ++i) { for(i=0;i<xctx->sym[j].rects[c]; ++i) {
if(xctx->sym[j].rect[c][i].prop_ptr != NULL) { if(xctx->sym[j].rect[c][i].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].rect[c][i].prop_ptr); my_free(25, &xctx->sym[j].rect[c][i].prop_ptr);
} }
set_rect_extraptr(0, &xctx->sym[j].rect[c][i]); set_rect_extraptr(0, &xctx->sym[j].rect[c][i]);
} }
my_free(_ALLOC_ID_, &xctx->sym[j].rect[c]); my_free(26, &xctx->sym[j].rect[c]);
xctx->sym[j].rects[c] = 0; xctx->sym[j].rects[c] = 0;
} }
for(i=0;i<xctx->sym[j].texts; ++i) { for(i=0;i<xctx->sym[j].texts; ++i) {
if(xctx->sym[j].text[i].prop_ptr != NULL) { if(xctx->sym[j].text[i].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].prop_ptr); my_free(27, &xctx->sym[j].text[i].prop_ptr);
} }
if(xctx->sym[j].text[i].txt_ptr != NULL) { if(xctx->sym[j].text[i].txt_ptr != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].txt_ptr); my_free(28, &xctx->sym[j].text[i].txt_ptr);
dbg(1, "remove_symbol(): freeing symbol %d text_ptr %d\n", j, i); dbg(1, "remove_symbol(): freeing symbol %d text_ptr %d\n", j, i);
} }
if(xctx->sym[j].text[i].font != NULL) { if(xctx->sym[j].text[i].font != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].font); my_free(29, &xctx->sym[j].text[i].font);
} }
if(xctx->sym[j].text[i].floater_instname != NULL) { if(xctx->sym[j].text[i].floater_instname != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].floater_instname); my_free(30, &xctx->sym[j].text[i].floater_instname);
} }
if(xctx->sym[j].text[i].floater_ptr != NULL) { if(xctx->sym[j].text[i].floater_ptr != NULL) {
my_free(_ALLOC_ID_, &xctx->sym[j].text[i].floater_ptr); my_free(31, &xctx->sym[j].text[i].floater_ptr);
} }
} }
my_free(_ALLOC_ID_, &xctx->sym[j].text); my_free(32, &xctx->sym[j].text);
my_free(_ALLOC_ID_, &xctx->sym[j].line); my_free(33, &xctx->sym[j].line);
my_free(_ALLOC_ID_, &xctx->sym[j].rect); my_free(34, &xctx->sym[j].rect);
my_free(_ALLOC_ID_, &xctx->sym[j].arc); my_free(35, &xctx->sym[j].arc);
my_free(_ALLOC_ID_, &xctx->sym[j].poly); my_free(36, &xctx->sym[j].poly);
my_free(_ALLOC_ID_, &xctx->sym[j].lines); my_free(37, &xctx->sym[j].lines);
my_free(_ALLOC_ID_, &xctx->sym[j].polygons); my_free(38, &xctx->sym[j].polygons);
my_free(_ALLOC_ID_, &xctx->sym[j].arcs); my_free(39, &xctx->sym[j].arcs);
my_free(_ALLOC_ID_, &xctx->sym[j].rects); my_free(40, &xctx->sym[j].rects);
xctx->sym[j].texts = 0; xctx->sym[j].texts = 0;
@ -774,10 +774,10 @@ int set_sym_flags(xSymbol *sym)
{ {
const char *ptr; const char *ptr;
sym->flags = 0; sym->flags = 0;
my_strdup2(_ALLOC_ID_, &sym->templ, my_strdup2(41, &sym->templ,
get_tok_value(sym->prop_ptr, "template", 0)); get_tok_value(sym->prop_ptr, "template", 0));
my_strdup2(_ALLOC_ID_, &sym->type, my_strdup2(42, &sym->type,
get_tok_value(sym->prop_ptr, "type",0)); get_tok_value(sym->prop_ptr, "type",0));
if(!strboolcmp(get_tok_value(sym->prop_ptr,"highlight",0), "true")) if(!strboolcmp(get_tok_value(sym->prop_ptr,"highlight",0), "true"))
@ -823,14 +823,14 @@ int set_inst_flags(xInstance *inst)
{ {
const char *ptr; const char *ptr;
inst->flags &= IGNORE_INST; /* do not clear IGNORE_INST bit, used in draw_symbol() */ inst->flags &= IGNORE_INST; /* do not clear IGNORE_INST bit, used in draw_symbol() */
my_strdup2(_ALLOC_ID_, &inst->instname, get_tok_value(inst->prop_ptr, "name", 0)); my_strdup2(43, &inst->instname, get_tok_value(inst->prop_ptr, "name", 0));
dbg(1, "set_inst_flags(): instname=%s\n", inst->instname); dbg(1, "set_inst_flags(): instname=%s\n", inst->instname);
if(inst->ptr >=0) { if(inst->ptr >=0) {
char *type = xctx->sym[inst->ptr].type; char *type = xctx->sym[inst->ptr].type;
int cond= type && IS_LABEL_SH_OR_PIN(type); int cond= type && IS_LABEL_SH_OR_PIN(type);
if(cond) { if(cond) {
inst->flags |= PIN_OR_LABEL; inst->flags |= PIN_OR_LABEL;
my_strdup2(_ALLOC_ID_, &(inst->lab), get_tok_value(inst->prop_ptr,"lab",0)); my_strdup2(44, &(inst->lab), get_tok_value(inst->prop_ptr,"lab",0));
} }
} }
@ -886,7 +886,7 @@ int set_text_flags(xText *t)
t->vcenter = 0; t->vcenter = 0;
t->layer = -1; t->layer = -1;
if(t->prop_ptr) { if(t->prop_ptr) {
my_strdup(_ALLOC_ID_, &t->font, get_tok_value(t->prop_ptr, "font", 0)); my_strdup(45, &t->font, get_tok_value(t->prop_ptr, "font", 0));
str = get_tok_value(t->prop_ptr, "hcenter", 0); str = get_tok_value(t->prop_ptr, "hcenter", 0);
t->hcenter = strboolcmp(str, "true") ? 0 : 1; t->hcenter = strboolcmp(str, "true") ? 0 : 1;
str = get_tok_value(t->prop_ptr, "vcenter", 0); str = get_tok_value(t->prop_ptr, "vcenter", 0);
@ -906,7 +906,7 @@ int set_text_flags(xText *t)
str = get_tok_value(t->prop_ptr, "name", 0); str = get_tok_value(t->prop_ptr, "name", 0);
if(!xctx->tok_size) str = get_tok_value(t->prop_ptr, "floater", 0); if(!xctx->tok_size) str = get_tok_value(t->prop_ptr, "floater", 0);
t->flags |= xctx->tok_size ? TEXT_FLOATER : 0; t->flags |= xctx->tok_size ? TEXT_FLOATER : 0;
my_strdup2(_ALLOC_ID_, &t->floater_instname, str); my_strdup2(46, &t->floater_instname, str);
} }
return 0; return 0;
} }
@ -935,7 +935,7 @@ int set_rect_extraptr(int what, xRect *drptr)
if(drptr->flags & 1024) { /* embedded image */ if(drptr->flags & 1024) { /* embedded image */
if(!drptr->extraptr) { if(!drptr->extraptr) {
xEmb_image *d; xEmb_image *d;
d = my_malloc(_ALLOC_ID_, sizeof(xEmb_image)); d = my_malloc(47, sizeof(xEmb_image));
d->image = NULL; d->image = NULL;
drptr->extraptr = d; drptr->extraptr = d;
} }
@ -947,7 +947,7 @@ int set_rect_extraptr(int what, xRect *drptr)
if(d->image) { if(d->image) {
cairo_surface_destroy(d->image); cairo_surface_destroy(d->image);
} }
my_free(_ALLOC_ID_, &drptr->extraptr); my_free(48, &drptr->extraptr);
} }
} }
} }
@ -961,57 +961,57 @@ void clear_drawing(void)
xctx->graph_lastsel = -1; xctx->graph_lastsel = -1;
del_inst_table(); del_inst_table();
del_wire_table(); del_wire_table();
my_free(_ALLOC_ID_, &xctx->schtedaxprop); my_free(49, &xctx->schtedaxprop);
my_free(_ALLOC_ID_, &xctx->schsymbolprop); my_free(50, &xctx->schsymbolprop);
my_free(_ALLOC_ID_, &xctx->schprop); my_free(51, &xctx->schprop);
my_free(_ALLOC_ID_, &xctx->schvhdlprop); my_free(52, &xctx->schvhdlprop);
my_free(_ALLOC_ID_, &xctx->version_string); my_free(53, &xctx->version_string);
if(xctx->header_text) my_free(_ALLOC_ID_, &xctx->header_text); if(xctx->header_text) my_free(54, &xctx->header_text);
my_free(_ALLOC_ID_, &xctx->schverilogprop); my_free(55, &xctx->schverilogprop);
for(i=0;i<xctx->wires; ++i) for(i=0;i<xctx->wires; ++i)
{ {
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); my_free(56, &xctx->wire[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->wire[i].node); my_free(57, &xctx->wire[i].node);
} }
xctx->wires = 0; xctx->wires = 0;
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); my_free(58, &xctx->inst[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->inst[i].name); my_free(59, &xctx->inst[i].name);
my_free(_ALLOC_ID_, &xctx->inst[i].instname); my_free(60, &xctx->inst[i].instname);
my_free(_ALLOC_ID_, &xctx->inst[i].lab); my_free(61, &xctx->inst[i].lab);
delete_inst_node(i); delete_inst_node(i);
} }
xctx->instances = 0; xctx->instances = 0;
for(i=0;i<xctx->texts; ++i) for(i=0;i<xctx->texts; ++i)
{ {
my_free(_ALLOC_ID_, &xctx->text[i].font); my_free(62, &xctx->text[i].font);
my_free(_ALLOC_ID_, &xctx->text[i].floater_instname); my_free(63, &xctx->text[i].floater_instname);
my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); my_free(64, &xctx->text[i].floater_ptr);
my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr); my_free(65, &xctx->text[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr); my_free(66, &xctx->text[i].txt_ptr);
} }
xctx->texts = 0; xctx->texts = 0;
for(i=0;i<cadlayers; ++i) for(i=0;i<cadlayers; ++i)
{ {
for(j=0;j<xctx->lines[i]; ++j) for(j=0;j<xctx->lines[i]; ++j)
{ {
my_free(_ALLOC_ID_, &xctx->line[i][j].prop_ptr); my_free(67, &xctx->line[i][j].prop_ptr);
} }
for(j=0;j<xctx->rects[i]; ++j) for(j=0;j<xctx->rects[i]; ++j)
{ {
my_free(_ALLOC_ID_, &xctx->rect[i][j].prop_ptr); my_free(68, &xctx->rect[i][j].prop_ptr);
set_rect_extraptr(0, &xctx->rect[i][j]); set_rect_extraptr(0, &xctx->rect[i][j]);
} }
for(j=0;j<xctx->arcs[i]; ++j) for(j=0;j<xctx->arcs[i]; ++j)
{ {
my_free(_ALLOC_ID_, &xctx->arc[i][j].prop_ptr); my_free(69, &xctx->arc[i][j].prop_ptr);
} }
for(j=0;j<xctx->polygons[i]; ++j) { for(j=0;j<xctx->polygons[i]; ++j) {
my_free(_ALLOC_ID_, &xctx->poly[i][j].x); my_free(70, &xctx->poly[i][j].x);
my_free(_ALLOC_ID_, &xctx->poly[i][j].y); my_free(71, &xctx->poly[i][j].y);
my_free(_ALLOC_ID_, &xctx->poly[i][j].prop_ptr); my_free(72, &xctx->poly[i][j].prop_ptr);
my_free(_ALLOC_ID_, &xctx->poly[i][j].selected_point); my_free(73, &xctx->poly[i][j].selected_point);
} }
xctx->lines[i] = 0; xctx->lines[i] = 0;
xctx->arcs[i] = 0; xctx->arcs[i] = 0;
@ -1281,8 +1281,8 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
int use_label_prefix; int use_label_prefix;
int found=0; int found=0;
my_strdup(_ALLOC_ID_, &symname_pin, tcleval("rel_sym_path [find_file_first lab_pin.sym]")); my_strdup(74, &symname_pin, tcleval("rel_sym_path [find_file_first lab_pin.sym]"));
my_strdup(_ALLOC_ID_, &symname_wire, tcleval("rel_sym_path [find_file_first lab_wire.sym]")); my_strdup(75, &symname_wire, tcleval("rel_sym_path [find_file_first lab_wire.sym]"));
if(symname_pin && symname_wire) { if(symname_pin && symname_wire) {
rebuild_selected_array(); rebuild_selected_array();
k = xctx->lastsel; k = xctx->lastsel;
@ -1290,8 +1290,8 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
prepare_netlist_structs(0); prepare_netlist_structs(0);
for(j=0;j<k; ++j) if(xctx->sel_array[j].type==ELEMENT) { for(j=0;j<k; ++j) if(xctx->sel_array[j].type==ELEMENT) {
found=1; found=1;
my_strdup(_ALLOC_ID_, &prop, xctx->inst[xctx->sel_array[j].n].instname); my_strdup(76, &prop, xctx->inst[xctx->sel_array[j].n].instname);
my_strcat(_ALLOC_ID_, &prop, "_"); my_strcat(77, &prop, "_");
tclsetvar("custom_label_prefix",prop); tclsetvar("custom_label_prefix",prop);
if(interactive && !do_all_inst) { if(interactive && !do_all_inst) {
@ -1299,7 +1299,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
tcleval("attach_labels_to_inst"); tcleval("attach_labels_to_inst");
if(!strcmp(tclgetvar("tctx::rcode"),"") ) { if(!strcmp(tclgetvar("tctx::rcode"),"") ) {
bbox(END, 0., 0., 0., 0.); bbox(END, 0., 0., 0., 0.);
my_free(_ALLOC_ID_, &prop); my_free(78, &prop);
return; return;
} }
} }
@ -1313,7 +1313,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
use_label_prefix = tclgetboolvar("use_label_prefix"); use_label_prefix = tclgetboolvar("use_label_prefix");
rot_txt = tclgetvar("rotated_text"); rot_txt = tclgetvar("rotated_text");
if(strcmp(rot_txt,"")) rotated_text=atoi(rot_txt); if(strcmp(rot_txt,"")) rotated_text=atoi(rot_txt);
my_strdup(_ALLOC_ID_, &type,(xctx->inst[xctx->sel_array[j].n].ptr+ xctx->sym)->type); my_strdup(79, &type,(xctx->inst[xctx->sel_array[j].n].ptr+ xctx->sym)->type);
if( type && IS_LABEL_OR_PIN(type) ) { if( type && IS_LABEL_OR_PIN(type) ) {
continue; continue;
} }
@ -1333,7 +1333,7 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
rct=symbol->rect[PINLAYER]; rct=symbol->rect[PINLAYER];
for(i=0;i<npin; ++i) { for(i=0;i<npin; ++i) {
my_strdup(_ALLOC_ID_, &labname,get_tok_value(rct[i].prop_ptr,"name",1)); my_strdup(80, &labname,get_tok_value(rct[i].prop_ptr,"name",1));
dbg(1,"attach_labels_to_inst(): 2 --> labname=%s\n", labname); dbg(1,"attach_labels_to_inst(): 2 --> labname=%s\n", labname);
pinx0 = (rct[i].x1+rct[i].x2)/2; pinx0 = (rct[i].x1+rct[i].x2)/2;
@ -1377,13 +1377,13 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
wptr = wptr->next; wptr = wptr->next;
} }
if(!skip) { if(!skip) {
my_strdup(_ALLOC_ID_, &prop, "name=p1 lab="); my_strdup(81, &prop, "name=p1 lab=");
if(use_label_prefix) { if(use_label_prefix) {
my_strcat(_ALLOC_ID_, &prop, (char *)tclgetvar("custom_label_prefix")); my_strcat(82, &prop, (char *)tclgetvar("custom_label_prefix"));
} }
/* /20171005 */ /* /20171005 */
my_strcat(_ALLOC_ID_, &prop, labname); my_strcat(83, &prop, labname);
dir ^= flip; /* 20101129 20111030 */ dir ^= flip; /* 20101129 20111030 */
if(rotated_text ==-1) { if(rotated_text ==-1) {
rot1=rot; rot1=rot;
@ -1402,9 +1402,9 @@ void attach_labels_to_inst(int interactive) /* offloaded from callback.c 201710
} }
} }
if(first_call == 0) set_modify(1); if(first_call == 0) set_modify(1);
my_free(_ALLOC_ID_, &prop); my_free(84, &prop);
my_free(_ALLOC_ID_, &labname); my_free(85, &labname);
my_free(_ALLOC_ID_, &type); my_free(86, &type);
if(!found) return; if(!found) return;
/* draw things */ /* draw things */
if(!first_call) { if(!first_call) {
@ -1416,8 +1416,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"); 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} {}"); tcleval("alert_ {attach_labels_to_inst(): location of schematic labels not found} {}");
} }
my_free(_ALLOC_ID_, &symname_pin); my_free(87, &symname_pin);
my_free(_ALLOC_ID_, &symname_wire); my_free(88, &symname_wire);
} }
void delete_files(void) void delete_files(void)
@ -1517,7 +1517,7 @@ int place_symbol(int pos, const char *symbol_name, double x, double y, short rot
xctx->inst[n].name=NULL; xctx->inst[n].name=NULL;
xctx->inst[n].lab=NULL; xctx->inst[n].lab=NULL;
dbg(1, "place_symbol(): entering my_strdup: name=%s\n",name); /* 03-02-2000 */ dbg(1, "place_symbol(): entering my_strdup: name=%s\n",name); /* 03-02-2000 */
my_strdup2(_ALLOC_ID_, &xctx->inst[n].name ,name); my_strdup2(89, &xctx->inst[n].name ,name);
dbg(1, "place_symbol(): done my_strdup: name=%s\n",name); /* 03-02-2000 */ 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].x0=symbol_name ? x : xctx->mousex_snap; */
/* xctx->inst[n].y0=symbol_name ? y : xctx->mousey_snap; */ /* xctx->inst[n].y0=symbol_name ? y : xctx->mousey_snap; */
@ -1639,8 +1639,8 @@ int copy_hierarchy_data(const char *from_win_path, const char *to_win_path)
hier_attr = from->hier_attr; hier_attr = from->hier_attr;
to->currsch = from->currsch; to->currsch = from->currsch;
for(i = 0; i <= from->currsch; i++) { for(i = 0; i <= from->currsch; i++) {
my_strdup2(_ALLOC_ID_, &to->sch[i], sch[i]); my_strdup2(90, &to->sch[i], sch[i]);
my_strdup2(_ALLOC_ID_, &to->sch_path[i], sch_path[i]); my_strdup2(91, &to->sch_path[i], sch_path[i]);
to->sch_path_hash[i] = sch_path_hash[i]; to->sch_path_hash[i] = sch_path_hash[i];
to->sch_inst_number[i] = sch_inst_number[i]; to->sch_inst_number[i] = sch_inst_number[i];
to->previous_instance[i] = previous_instance[i]; to->previous_instance[i] = previous_instance[i];
@ -1652,9 +1652,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].rot = hier_attr[i].rot;
to->hier_attr[i].flip = hier_attr[i].flip; to->hier_attr[i].flip = hier_attr[i].flip;
to->hier_attr[i].fd = NULL; /* Never used outside load_sym_def() */ to->hier_attr[i].fd = NULL; /* Never used outside load_sym_def() */
my_strdup2(_ALLOC_ID_, &to->hier_attr[i].prop_ptr, hier_attr[i].prop_ptr); my_strdup2(92, &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(93, &to->hier_attr[i].templ, hier_attr[i].templ);
my_strdup2(_ALLOC_ID_, &to->hier_attr[i].symname, hier_attr[i].symname); my_strdup2(94, &to->hier_attr[i].symname, hier_attr[i].symname);
if(to->portmap[i].table) str_hash_free(&to->portmap[i]); if(to->portmap[i].table) str_hash_free(&to->portmap[i]);
str_hash_init(&to->portmap[i], HASHSIZE); str_hash_init(&to->portmap[i], HASHSIZE);
for(j = 0; j < HASHSIZE; j++) { for(j = 0; j < HASHSIZE; j++) {
@ -1663,10 +1663,10 @@ int copy_hierarchy_data(const char *from_win_path, const char *to_win_path)
tonext = &(to->portmap[i].table[j]); tonext = &(to->portmap[i].table[j]);
while(*fromnext) { while(*fromnext) {
Str_hashentry *e; Str_hashentry *e;
e = my_calloc(_ALLOC_ID_, 1, sizeof(Str_hashentry)); e = my_calloc(95, 1, sizeof(Str_hashentry));
e->hash = (*fromnext)->hash; e->hash = (*fromnext)->hash;
my_strdup2(_ALLOC_ID_, &e->token, (*fromnext)->token); my_strdup2(96, &e->token, (*fromnext)->token);
my_strdup2(_ALLOC_ID_, &e->value, (*fromnext)->value); my_strdup2(97, &e->value, (*fromnext)->value);
*tonext = e; *tonext = e;
fromnext = &( (*fromnext)->next ); fromnext = &( (*fromnext)->next );
tonext = &( (*tonext)->next ); tonext = &( (*tonext)->next );
@ -1746,7 +1746,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==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==WIRE) prop_ptr = xctx->wire[n].prop_ptr;
else if(xctx->sel_array[0].type==xTEXT) prop_ptr = xctx->text[n].prop_ptr; else if(xctx->sel_array[0].type==xTEXT) prop_ptr = xctx->text[n].prop_ptr;
my_strdup2(_ALLOC_ID_, &command, get_tok_value(prop_ptr,"tclcommand",0)); my_strdup2(98, &command, get_tok_value(prop_ptr,"tclcommand",0));
my_strncpy(program, get_tok_value(prop_ptr,"program",0), S(program)); /* handle backslashes */ my_strncpy(program, get_tok_value(prop_ptr,"program",0), S(program)); /* handle backslashes */
url = get_tok_value(prop_ptr,"url",0); /* handle backslashes */ url = get_tok_value(prop_ptr,"url",0); /* handle backslashes */
dbg(1, "launcher(): url=%s\n", url); dbg(1, "launcher(): url=%s\n", url);
@ -1763,7 +1763,7 @@ void launcher(void)
dbg(0, "%s\n", msg); dbg(0, "%s\n", msg);
if(has_x) tclvareval("alert_ {", msg, "} {}", NULL); if(has_x) tclvareval("alert_ {", msg, "} {}", NULL);
} }
my_free(_ALLOC_ID_, &command); my_free(99, &command);
tcleval("after 300"); tcleval("after 300");
select_object(mx,my,0, 0, NULL); select_object(mx,my,0, 0, NULL);
} }
@ -1817,59 +1817,59 @@ void copy_symbol(xSymbol *dest_sym, xSymbol *src_sym)
dest_sym->type = NULL; dest_sym->type = NULL;
dest_sym->templ = NULL; dest_sym->templ = NULL;
dest_sym->parent_prop_ptr = NULL; dest_sym->parent_prop_ptr = NULL;
my_strdup2(_ALLOC_ID_, &dest_sym->name, src_sym->name); my_strdup2(100, &dest_sym->name, src_sym->name);
my_strdup2(_ALLOC_ID_, &dest_sym->type, src_sym->type); my_strdup2(101, &dest_sym->type, src_sym->type);
my_strdup2(_ALLOC_ID_, &dest_sym->templ, src_sym->templ); my_strdup2(102, &dest_sym->templ, src_sym->templ);
my_strdup(_ALLOC_ID_, &dest_sym->parent_prop_ptr, src_sym->parent_prop_ptr); my_strdup(103, &dest_sym->parent_prop_ptr, src_sym->parent_prop_ptr);
my_strdup2(_ALLOC_ID_, &dest_sym->prop_ptr, src_sym->prop_ptr); my_strdup2(104, &dest_sym->prop_ptr, src_sym->prop_ptr);
dest_sym->line = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); dest_sym->line = my_calloc(105, cadlayers, sizeof(xLine *));
dest_sym->poly = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); dest_sym->poly = my_calloc(106, cadlayers, sizeof(xPoly *));
dest_sym->arc = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); dest_sym->arc = my_calloc(107, cadlayers, sizeof(xArc *));
dest_sym->rect = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); dest_sym->rect = my_calloc(108, cadlayers, sizeof(xRect *));
dest_sym->lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); dest_sym->lines = my_calloc(109, cadlayers, sizeof(int));
dest_sym->rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); dest_sym->rects = my_calloc(110, cadlayers, sizeof(int));
dest_sym->arcs = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); dest_sym->arcs = my_calloc(111, cadlayers, sizeof(int));
dest_sym->polygons = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); dest_sym->polygons = my_calloc(112, cadlayers, sizeof(int));
dest_sym->text = my_calloc(_ALLOC_ID_, src_sym->texts, sizeof(xText)); dest_sym->text = my_calloc(113, src_sym->texts, sizeof(xText));
memcpy(dest_sym->lines, src_sym->lines, sizeof(dest_sym->lines[0]) * cadlayers); 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->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->arcs, src_sym->arcs, sizeof(dest_sym->arcs[0]) * cadlayers);
memcpy(dest_sym->polygons, src_sym->polygons, sizeof(dest_sym->polygons[0]) * cadlayers); memcpy(dest_sym->polygons, src_sym->polygons, sizeof(dest_sym->polygons[0]) * cadlayers);
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
/* symbol lines */ /* symbol lines */
dest_sym->line[c] = my_calloc(_ALLOC_ID_, src_sym->lines[c], sizeof(xLine)); dest_sym->line[c] = my_calloc(114, src_sym->lines[c], sizeof(xLine));
for(j = 0; j < src_sym->lines[c]; ++j) { for(j = 0; j < src_sym->lines[c]; ++j) {
dest_sym->line[c][j] = src_sym->line[c][j]; dest_sym->line[c][j] = src_sym->line[c][j];
dest_sym->line[c][j].prop_ptr = NULL; dest_sym->line[c][j].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &dest_sym->line[c][j].prop_ptr, src_sym->line[c][j].prop_ptr); my_strdup(115, &dest_sym->line[c][j].prop_ptr, src_sym->line[c][j].prop_ptr);
} }
/* symbol rects */ /* symbol rects */
dest_sym->rect[c] = my_calloc(_ALLOC_ID_, src_sym->rects[c], sizeof(xRect)); dest_sym->rect[c] = my_calloc(116, src_sym->rects[c], sizeof(xRect));
for(j = 0; j < src_sym->rects[c]; ++j) { for(j = 0; j < src_sym->rects[c]; ++j) {
dest_sym->rect[c][j] = src_sym->rect[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].prop_ptr = NULL;
dest_sym->rect[c][j].extraptr = NULL; dest_sym->rect[c][j].extraptr = NULL;
my_strdup(_ALLOC_ID_, &dest_sym->rect[c][j].prop_ptr, src_sym->rect[c][j].prop_ptr); my_strdup(117, &dest_sym->rect[c][j].prop_ptr, src_sym->rect[c][j].prop_ptr);
} }
/* symbol arcs */ /* symbol arcs */
dest_sym->arc[c] = my_calloc(_ALLOC_ID_, src_sym->arcs[c], sizeof(xArc)); dest_sym->arc[c] = my_calloc(118, src_sym->arcs[c], sizeof(xArc));
for(j = 0; j < src_sym->arcs[c]; ++j) { for(j = 0; j < src_sym->arcs[c]; ++j) {
dest_sym->arc[c][j] = src_sym->arc[c][j]; dest_sym->arc[c][j] = src_sym->arc[c][j];
dest_sym->arc[c][j].prop_ptr = NULL; dest_sym->arc[c][j].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &dest_sym->arc[c][j].prop_ptr, src_sym->arc[c][j].prop_ptr); my_strdup(119, &dest_sym->arc[c][j].prop_ptr, src_sym->arc[c][j].prop_ptr);
} }
/* symbol polygons */ /* symbol polygons */
dest_sym->poly[c] = my_calloc(_ALLOC_ID_, src_sym->polygons[c], sizeof(xPoly)); dest_sym->poly[c] = my_calloc(120, src_sym->polygons[c], sizeof(xPoly));
for(j = 0; j < src_sym->polygons[c]; ++j) { for(j = 0; j < src_sym->polygons[c]; ++j) {
int points = src_sym->poly[c][j].points; int points = src_sym->poly[c][j].points;
dest_sym->poly[c][j] = src_sym->poly[c][j]; dest_sym->poly[c][j] = src_sym->poly[c][j];
dest_sym->poly[c][j].prop_ptr = NULL; dest_sym->poly[c][j].prop_ptr = NULL;
dest_sym->poly[c][j].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); dest_sym->poly[c][j].x = my_malloc(121, points * sizeof(double));
dest_sym->poly[c][j].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); dest_sym->poly[c][j].y = my_malloc(122, points * sizeof(double));
dest_sym->poly[c][j].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); dest_sym->poly[c][j].selected_point = my_malloc(123, points * sizeof(unsigned short));
my_strdup(_ALLOC_ID_, &dest_sym->poly[c][j].prop_ptr, src_sym->poly[c][j].prop_ptr); my_strdup(124, &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].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].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, memcpy(dest_sym->poly[c][j].selected_point, src_sym->poly[c][j].selected_point,
@ -1884,12 +1884,12 @@ void copy_symbol(xSymbol *dest_sym, xSymbol *src_sym)
dest_sym->text[j].font = NULL; dest_sym->text[j].font = NULL;
dest_sym->text[j].floater_instname = NULL; dest_sym->text[j].floater_instname = NULL;
dest_sym->text[j].floater_ptr = NULL; dest_sym->text[j].floater_ptr = NULL;
my_strdup2(_ALLOC_ID_, &dest_sym->text[j].prop_ptr, src_sym->text[j].prop_ptr); my_strdup2(125, &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); my_strdup2(126, &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); dbg(1, "copy_symbol1(): allocating sym %d text %d\n", dest_sym - xctx->sym, j);
my_strdup2(_ALLOC_ID_, &dest_sym->text[j].txt_ptr, src_sym->text[j].txt_ptr); my_strdup2(127, &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(128, &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); my_strdup2(129, &dest_sym->text[j].floater_instname, src_sym->text[j].floater_instname);
} }
} }
@ -1914,9 +1914,9 @@ void toggle_ignore(void)
remove = 0; remove = 0;
if(!strboolcmp(get_tok_value(xctx->inst[i].prop_ptr, attr, 0), "true")) remove = 1; if(!strboolcmp(get_tok_value(xctx->inst[i].prop_ptr, attr, 0), "true")) remove = 1;
if(remove) { if(remove) {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL)); my_strdup(130, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, NULL));
} else { } else {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "true")); my_strdup(131, &xctx->inst[i].prop_ptr, subst_token(xctx->inst[i].prop_ptr, attr, "true"));
} }
set_inst_flags(&xctx->inst[i]); set_inst_flags(&xctx->inst[i]);
set_modify(1); set_modify(1);
@ -1954,10 +1954,10 @@ void get_additional_symbols(int what)
char symbol_base_sch[PATH_MAX] = ""; char symbol_base_sch[PATH_MAX] = "";
/* copy instance based *_sym_def attributes to symbol */ /* copy instance based *_sym_def attributes to symbol */
my_strdup(_ALLOC_ID_, &spice_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"spice_sym_def",6)); my_strdup(132, &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(133, &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)); my_strdup(134, &vhdl_sym_def, get_tok_value(xctx->inst[i].prop_ptr,"vhdl_sym_def",4));
my_strdup2(_ALLOC_ID_, &sch, tcl_hook2( my_strdup2(135, &sch, tcl_hook2(
str_replace( get_tok_value(xctx->inst[i].prop_ptr,"schematic",2), "@symname", str_replace( get_tok_value(xctx->inst[i].prop_ptr,"schematic",2), "@symname",
get_cell(xctx->inst[i].name, 0), '\\'))); get_cell(xctx->inst[i].name, 0), '\\')));
dbg(1, "get_additional_symbols(): inst=%d sch=%s\n",i, sch); dbg(1, "get_additional_symbols(): inst=%d sch=%s\n",i, sch);
@ -1973,7 +1973,7 @@ void get_additional_symbols(int what)
char *symname_attr = NULL; char *symname_attr = NULL;
int ignore_schematic = 0; int ignore_schematic = 0;
xSymbol *symptr = xctx->inst[i].ptr + xctx->sym; xSymbol *symptr = xctx->inst[i].ptr + xctx->sym;
my_strdup2(_ALLOC_ID_, &default_schematic, get_tok_value(symptr->prop_ptr,"default_schematic",0)); my_strdup2(136, &default_schematic, get_tok_value(symptr->prop_ptr,"default_schematic",0));
ignore_schematic = !strcmp(default_schematic, "ignore"); ignore_schematic = !strcmp(default_schematic, "ignore");
dbg(1, "get_additional_symbols(): inst=%d, sch=%s\n", i, sch); dbg(1, "get_additional_symbols(): inst=%d, sch=%s\n", i, sch);
@ -1981,22 +1981,22 @@ void get_additional_symbols(int what)
is_gen = is_generator(sch); is_gen = is_generator(sch);
if(is_gen) { if(is_gen) {
my_strdup2(_ALLOC_ID_, &sym, sch); my_strdup2(137, &sym, sch);
dbg(1, "get_additional_symbols(): generator\n"); dbg(1, "get_additional_symbols(): generator\n");
} else { } else {
my_strdup2(_ALLOC_ID_, &sym, add_ext(rel_sym_path(sch), ".sym")); my_strdup2(138, &sym, add_ext(rel_sym_path(sch), ".sym"));
} }
my_strdup2(_ALLOC_ID_, &templ, get_tok_value(symptr->prop_ptr, "template", 0)); my_strdup2(139, &templ, get_tok_value(symptr->prop_ptr, "template", 0));
my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(sym, 0), NULL); my_mstrcat(140, &symname_attr, "symname=", get_cell(sym, 0), NULL);
my_mstrcat(_ALLOC_ID_, &symname_attr, " symref=", get_sym_name(i, 9999, 1, 1), NULL); my_mstrcat(141, &symname_attr, " symref=", get_sym_name(i, 9999, 1, 1), NULL);
my_strdup(_ALLOC_ID_, &spice_sym_def, my_strdup(142, &spice_sym_def,
translate3(spice_sym_def, 1, xctx->inst[i].prop_ptr, translate3(spice_sym_def, 1, xctx->inst[i].prop_ptr,
templ, templ,
symname_attr)); symname_attr));
dbg(1, "get_additional_symbols(): spice_sym_def=%s\n", spice_sym_def); dbg(1, "get_additional_symbols(): spice_sym_def=%s\n", spice_sym_def);
my_free(_ALLOC_ID_, &templ); my_free(143, &templ);
my_free(_ALLOC_ID_, &symname_attr); my_free(144, &symname_attr);
/* if instance symbol has default_schematic set to ignore copy the symbol anyway, since /* if instance symbol has default_schematic set to ignore copy the symbol anyway, since
* the base symbol will not be netlisted by *_block_netlist() */ * the base symbol will not be netlisted by *_block_netlist() */
found = ignore_schematic ? NULL : int_hash_lookup(&sym_table, sym, 0, XLOOKUP); found = ignore_schematic ? NULL : int_hash_lookup(&sym_table, sym, 0, XLOOKUP);
@ -2007,43 +2007,43 @@ void get_additional_symbols(int what)
check_symbol_storage(); check_symbol_storage();
copy_symbol(&xctx->sym[j], symptr); copy_symbol(&xctx->sym[j], symptr);
xctx->sym[j].base_name = symptr->name; xctx->sym[j].base_name = symptr->name;
my_strdup(_ALLOC_ID_, &xctx->sym[j].name, sym); my_strdup(145, &xctx->sym[j].name, sym);
my_strdup(_ALLOC_ID_, &xctx->sym[j].parent_prop_ptr, xctx->inst[i].prop_ptr); my_strdup(146, &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 /* the copied symbol will not inherit the default_schematic attribute otherwise it will also
* be skipped */ * be skipped */
if(default_schematic) { if(default_schematic) {
my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, my_strdup(147, &xctx->sym[j].prop_ptr,
subst_token(xctx->sym[j].prop_ptr, "default_schematic", NULL)); /* delete attribute */ subst_token(xctx->sym[j].prop_ptr, "default_schematic", NULL)); /* delete attribute */
} }
/* if symbol has no corresponding schematic file use symbol base schematic */ /* if symbol has no corresponding schematic file use symbol base schematic */
if(!is_gen && symbol_base_sch[0]) { if(!is_gen && symbol_base_sch[0]) {
my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, my_strdup(148, &xctx->sym[j].prop_ptr,
subst_token(xctx->sym[j].prop_ptr, "schematic", symbol_base_sch)); subst_token(xctx->sym[j].prop_ptr, "schematic", symbol_base_sch));
} }
if(spice_sym_def) { if(spice_sym_def) {
my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, my_strdup(149, &xctx->sym[j].prop_ptr,
subst_token(xctx->sym[j].prop_ptr, "spice_sym_def", spice_sym_def)); subst_token(xctx->sym[j].prop_ptr, "spice_sym_def", spice_sym_def));
} }
if(verilog_sym_def) { if(verilog_sym_def) {
my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, my_strdup(150, &xctx->sym[j].prop_ptr,
subst_token(xctx->sym[j].prop_ptr, "verilog_sym_def", verilog_sym_def)); subst_token(xctx->sym[j].prop_ptr, "verilog_sym_def", verilog_sym_def));
} }
if(vhdl_sym_def) { if(vhdl_sym_def) {
my_strdup(_ALLOC_ID_, &xctx->sym[j].prop_ptr, my_strdup(151, &xctx->sym[j].prop_ptr,
subst_token(xctx->sym[j].prop_ptr, "vhdl_sym_def", vhdl_sym_def)); subst_token(xctx->sym[j].prop_ptr, "vhdl_sym_def", vhdl_sym_def));
} }
xctx->symbols++; xctx->symbols++;
} else { } else {
j = found->value; j = found->value;
} }
my_free(_ALLOC_ID_, &sym); my_free(152, &sym);
my_free(_ALLOC_ID_, &default_schematic); my_free(153, &default_schematic);
} }
my_free(_ALLOC_ID_, &sch); my_free(154, &sch);
my_free(_ALLOC_ID_, &spice_sym_def); my_free(155, &spice_sym_def);
my_free(_ALLOC_ID_, &vhdl_sym_def); my_free(156, &vhdl_sym_def);
my_free(_ALLOC_ID_, &verilog_sym_def); my_free(157, &verilog_sym_def);
} }
int_hash_free(&sym_table); int_hash_free(&sym_table);
} else { /* end */ } else { /* end */
@ -2071,11 +2071,11 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
} }
dbg(1, "get_sch_from_sym(): current_dirname= %s\n", xctx->current_dirname); dbg(1, "get_sch_from_sym(): current_dirname= %s\n", xctx->current_dirname);
dbg(1, "get_sch_from_sym(): symbol %s inst=%d web_url=%d\n", sym->name, inst, web_url); dbg(1, "get_sch_from_sym(): symbol %s inst=%d web_url=%d\n", sym->name, inst, web_url);
if(inst >= 0) my_strdup(_ALLOC_ID_, &str_tmp, get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 2)); if(inst >= 0) my_strdup(158, &str_tmp, get_tok_value(xctx->inst[inst].prop_ptr, "schematic", 2));
if(!str_tmp) my_strdup2(_ALLOC_ID_, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 2)); if(!str_tmp) my_strdup2(159, &str_tmp, get_tok_value(sym->prop_ptr, "schematic", 2));
if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */ if(str_tmp[0]) { /* schematic attribute in symbol or instance was given */
/* @symname in schematic attribute will be replaced with symbol name */ /* @symname in schematic attribute will be replaced with symbol name */
my_strdup2(_ALLOC_ID_, &sch, tcl_hook2(str_replace(str_tmp, "@symname", my_strdup2(160, &sch, tcl_hook2(str_replace(str_tmp, "@symname",
get_cell(sym->name, 0), '\\'))); get_cell(sym->name, 0), '\\')));
if(is_generator(sch)) { /* generator: return as is */ if(is_generator(sch)) { /* generator: return as is */
my_strncpy(filename, sch, PATH_MAX); my_strncpy(filename, sch, PATH_MAX);
@ -2122,7 +2122,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
} }
} }
} }
if(sch) my_free(_ALLOC_ID_, &sch); if(sch) my_free(161, &sch);
if(web_url && filename[0] && xschem_web_dirname[0]) { if(web_url && filename[0] && xschem_web_dirname[0]) {
char sympath[PATH_MAX]; char sympath[PATH_MAX];
@ -2139,7 +2139,7 @@ void get_sch_from_sym(char *filename, xSymbol *sym, int inst, int fallback)
my_strncpy(filename, sympath, PATH_MAX); my_strncpy(filename, sympath, PATH_MAX);
} }
} }
my_free(_ALLOC_ID_, &str_tmp); my_free(162, &str_tmp);
dbg(1, "get_sch_from_sym(): sym->name=%s, filename=%s\n", sym->name, filename); dbg(1, "get_sch_from_sym(): sym->name=%s, filename=%s\n", sym->name, filename);
} }
@ -2202,9 +2202,9 @@ int descend_schematic(int instnumber, int fallback, int alert)
dbg(1, "descend_schematic(): selected instname=%s\n", xctx->inst[n].instname); dbg(1, "descend_schematic(): selected instname=%s\n", xctx->inst[n].instname);
if(xctx->inst[n].instname && xctx->inst[n].instname[0]) { if(xctx->inst[n].instname && xctx->inst[n].instname[0]) {
my_strdup2(_ALLOC_ID_, &str, expandlabel(xctx->inst[n].instname, &inst_mult)); my_strdup2(163, &str, expandlabel(xctx->inst[n].instname, &inst_mult));
} else { } else {
my_strdup2(_ALLOC_ID_, &str, ""); my_strdup2(164, &str, "");
inst_mult = 1; inst_mult = 1;
} }
prepare_netlist_structs(0); /* for portmap feature (mapping subcircuit nodes connected to prepare_netlist_structs(0); /* for portmap feature (mapping subcircuit nodes connected to
@ -2221,7 +2221,7 @@ int descend_schematic(int instnumber, int fallback, int alert)
inum = tclresult(); inum = tclresult();
dbg(1, "descend_schematic(): inum=%s\n", inum); dbg(1, "descend_schematic(): inum=%s\n", inum);
if(!inum[0]) { if(!inum[0]) {
my_free(_ALLOC_ID_, &str); my_free(165, &str);
return 0; return 0;
} }
inst_number=atoi(inum); inst_number=atoi(inum);
@ -2233,7 +2233,7 @@ int descend_schematic(int instnumber, int fallback, int alert)
if(inst_number <1 || inst_number > inst_mult) inst_number = 1; if(inst_number <1 || inst_number > inst_mult) inst_number = 1;
} }
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(166, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
xctx->sch_path_hash[xctx->currsch+1] =0; xctx->sch_path_hash[xctx->currsch+1] =0;
if(xctx->portmap[xctx->currsch + 1].table) str_hash_free(&xctx->portmap[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); str_hash_init(&xctx->portmap[xctx->currsch + 1], HASHSIZE);
@ -2249,40 +2249,40 @@ int descend_schematic(int instnumber, int fallback, int alert)
if(!pin_name[0]) continue; if(!pin_name[0]) continue;
if(!xctx->inst[n].node[i]) continue; if(!xctx->inst[n].node[i]) continue;
my_strdup2(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); my_strdup2(167, &pin_node, expandlabel(pin_name, &mult));
my_strdup2(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[n].node[i], &net_mult)); my_strdup2(168, &net_node, expandlabel(xctx->inst[n].node[i], &net_mult));
p_n_s1 = pin_node; p_n_s1 = pin_node;
for(k = 1; k<=mult; ++k) { for(k = 1; k<=mult; ++k) {
single_p = my_strtok_r(p_n_s1, ",", "", 0, &p_n_s2); single_p = my_strtok_r(p_n_s1, ",", "", 0, &p_n_s2);
p_n_s1 = NULL; p_n_s1 = NULL;
my_strdup2(_ALLOC_ID_, &single_n, my_strdup2(169, &single_n,
find_nth(net_node, ",", "", 0, ((inst_number - 1) * mult + k - 1) % net_mult + 1)); find_nth(net_node, ",", "", 0, ((inst_number - 1) * mult + k - 1) % net_mult + 1));
single_n_ptr = single_n; single_n_ptr = single_n;
if(single_n_ptr[0] == '#') { if(single_n_ptr[0] == '#') {
if(mult > 1) { if(mult > 1) {
my_mstrcat(_ALLOC_ID_, &single_n, "[", my_itoa((inst_mult - inst_number + 1) * mult - k), "]", NULL); my_mstrcat(170, &single_n, "[", my_itoa((inst_mult - inst_number + 1) * mult - k), "]", NULL);
} }
single_n_ptr = single_n + 1; single_n_ptr = single_n + 1;
} }
str_hash_lookup(&xctx->portmap[xctx->currsch + 1], single_p, single_n_ptr, XINSERT); 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); dbg(1, "descend_schematic(): %s: %s ->%s\n", xctx->inst[n].instname, single_p, single_n_ptr);
} }
if(single_n) my_free(_ALLOC_ID_, &single_n); if(single_n) my_free(171, &single_n);
my_free(_ALLOC_ID_, &net_node); my_free(172, &net_node);
my_free(_ALLOC_ID_, &pin_node); my_free(173, &pin_node);
} }
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr, my_strdup(174, &xctx->hier_attr[xctx->currsch].prop_ptr,
xctx->inst[n].prop_ptr); xctx->inst[n].prop_ptr);
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ, my_strdup(175, &xctx->hier_attr[xctx->currsch].templ,
get_tok_value((xctx->inst[n].ptr+ xctx->sym)->prop_ptr, "template", 0)); get_tok_value((xctx->inst[n].ptr+ xctx->sym)->prop_ptr, "template", 0));
dbg(1,"descend_schematic(): inst_number=%d\n", inst_number); dbg(1,"descend_schematic(): inst_number=%d\n", inst_number);
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", "", 0, inst_number)); my_strcat(176, &xctx->sch_path[xctx->currsch+1], find_nth(str, ",", "", 0, inst_number));
my_free(_ALLOC_ID_, &str); my_free(177, &str);
dbg(1,"descend_schematic(): inst_number=%d\n", inst_number); dbg(1,"descend_schematic(): inst_number=%d\n", inst_number);
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "."); my_strcat(178, &xctx->sch_path[xctx->currsch+1], ".");
xctx->sch_inst_number[xctx->currsch] = inst_number; 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(): current path: %s\n", xctx->sch_path[xctx->currsch+1]);
dbg(1, "descend_schematic(): inst_number=%d\n", inst_number); dbg(1, "descend_schematic(): inst_number=%d\n", inst_number);
@ -2352,13 +2352,13 @@ void go_back(int confirm) /* 20171006 add confirm */
load_sym_def(xctx->sch[xctx->currsch], NULL); load_sym_def(xctx->sch[xctx->currsch], NULL);
from_embedded_sym=1; from_embedded_sym=1;
} }
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(179, &xctx->sch[xctx->currsch]);
if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]); if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]);
xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_path_hash[xctx->currsch] = 0;
xctx->currsch--; xctx->currsch--;
my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].prop_ptr); my_free(180, &xctx->hier_attr[xctx->currsch].prop_ptr);
my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch].templ); my_free(181, &xctx->hier_attr[xctx->currsch].templ);
save_modified = xctx->modified; /* we propagate modified flag (cleared by load_schematic */ save_modified = xctx->modified; /* we propagate modified flag (cleared by load_schematic */
/* by default) to parent schematic if going back from embedded symbol */ /* by default) to parent schematic if going back from embedded symbol */
@ -2405,8 +2405,8 @@ void clear_schematic(int cancel, int symbol)
else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i); else my_snprintf(name, S(name), "%s-%d.sym", "untitled", i);
if(stat(name, &buf)) break; if(stat(name, &buf)) break;
} }
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(182, &xctx->sch[xctx->currsch]);
my_mstrcat(_ALLOC_ID_, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL); my_mstrcat(183, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL);
my_strncpy(xctx->current_name, name, S(xctx->current_name)); my_strncpy(xctx->current_name, name, S(xctx->current_name));
} else { } else {
xctx->netlist_type = CAD_SPICE_NETLIST; xctx->netlist_type = CAD_SPICE_NETLIST;
@ -2416,8 +2416,8 @@ void clear_schematic(int cancel, int symbol)
else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i); else my_snprintf(name, S(name), "%s-%d.sch", "untitled", i);
if(stat(name, &buf)) break; if(stat(name, &buf)) break;
} }
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(184, &xctx->sch[xctx->currsch]);
my_mstrcat(_ALLOC_ID_, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL); my_mstrcat(185, &xctx->sch[xctx->currsch], pwd_dir, "/", name, NULL);
my_strncpy(xctx->current_name, name, S(xctx->current_name)); my_strncpy(xctx->current_name, name, S(xctx->current_name));
} }
draw(); draw();
@ -2567,7 +2567,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
++count; ++count;
updatebbox(count,boundbox,&rect); updatebbox(count,boundbox,&rect);
} }
my_free(_ALLOC_ID_, &estr); my_free(186, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
@ -3089,7 +3089,7 @@ void change_layer()
else if(type==xTEXT && xctx->text[n].sel==SELECTED) { else if(type==xTEXT && xctx->text[n].sel==SELECTED) {
if(xctx->rectcolor != xctx->text[n].layer) { if(xctx->rectcolor != xctx->text[n].layer) {
char *p; char *p;
my_strdup2(_ALLOC_ID_, &xctx->text[n].prop_ptr, my_strdup2(187, &xctx->text[n].prop_ptr,
subst_token(xctx->text[n].prop_ptr, "layer", dtoa(xctx->rectcolor) )); subst_token(xctx->text[n].prop_ptr, "layer", dtoa(xctx->rectcolor) ));
xctx->text[n].layer = xctx->rectcolor; xctx->text[n].layer = xctx->rectcolor;
p = xctx->text[n].prop_ptr; p = xctx->text[n].prop_ptr;
@ -3338,8 +3338,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 */ if(xctx->nl_points >= xctx->nl_maxpoints-1) { /* check storage for 2 xctx->nl_points */
xctx->nl_maxpoints = (1+xctx->nl_points / CADCHUNKALLOC) * CADCHUNKALLOC; xctx->nl_maxpoints = (1+xctx->nl_points / CADCHUNKALLOC) * CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &xctx->nl_polyx, sizeof(double)*xctx->nl_maxpoints); my_realloc(188, &xctx->nl_polyx, sizeof(double)*xctx->nl_maxpoints);
my_realloc(_ALLOC_ID_, &xctx->nl_polyy, sizeof(double)*xctx->nl_maxpoints); my_realloc(189, &xctx->nl_polyy, sizeof(double)*xctx->nl_maxpoints);
} }
if( what & PLACE ) if( what & PLACE )
{ {
@ -3392,8 +3392,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); drawtemppolygon(xctx->gc[xctx->rectcolor], NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0);
xctx->ui_state &= ~STARTPOLYGON; xctx->ui_state &= ~STARTPOLYGON;
drawpolygon(xctx->rectcolor, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0, 0, 0); drawpolygon(xctx->rectcolor, NOW, xctx->nl_polyx, xctx->nl_polyy, xctx->nl_points, 0, 0, 0);
my_free(_ALLOC_ID_, &xctx->nl_polyx); my_free(190, &xctx->nl_polyx);
my_free(_ALLOC_ID_, &xctx->nl_polyy); my_free(191, &xctx->nl_polyy);
xctx->nl_maxpoints = xctx->nl_points = 0; xctx->nl_maxpoints = xctx->nl_points = 0;
} }
if(what & RUBBER) if(what & RUBBER)
@ -3439,7 +3439,7 @@ int text_bbox(const char *str, double xscale, double yscale,
ww=0.; hh=1.; ww=0.; hh=1.;
c=0; c=0;
*cairo_lines=1; *cairo_lines=1;
my_strdup2(_ALLOC_ID_, &s, str); my_strdup2(192, &s, str);
str_ptr = s; str_ptr = s;
while( s && s[c] ) { while( s && s[c] ) {
if(s[c] == '\n') { if(s[c] == '\n') {
@ -3462,7 +3462,7 @@ int text_bbox(const char *str, double xscale, double yscale,
maxw = ext.x_advance > ext.width ? ext.x_advance : ext.width; maxw = ext.x_advance > ext.width ? ext.x_advance : ext.width;
if(maxw > ww) ww= maxw; if(maxw > ww) ww= maxw;
} }
my_free(_ALLOC_ID_, &s); my_free(193, &s);
hh = hh*fext.height * cairo_font_line_spacing; hh = hh*fext.height * cairo_font_line_spacing;
*cairo_longest_line = ww; *cairo_longest_line = ww;
@ -3607,7 +3607,7 @@ int create_text(int draw_text, double x, double y, int rot, int flip, const char
t->floater_ptr = NULL; t->floater_ptr = NULL;
t->font=NULL; t->font=NULL;
t->floater_instname=NULL; t->floater_instname=NULL;
my_strdup2(_ALLOC_ID_, &t->txt_ptr, txt); my_strdup2(194, &t->txt_ptr, txt);
t->x0=x; t->x0=x;
t->y0=y; t->y0=y;
t->rot=(short int) rot; t->rot=(short int) rot;
@ -3615,7 +3615,7 @@ int create_text(int draw_text, double x, double y, int rot, int flip, const char
t->sel=0; t->sel=0;
t->xscale= hsize; t->xscale= hsize;
t->yscale= vsize; t->yscale= vsize;
my_strdup(_ALLOC_ID_, &t->prop_ptr, props); my_strdup(195, &t->prop_ptr, props);
/* debug ... */ /* debug ... */
/* t->prop_ptr=NULL; */ /* t->prop_ptr=NULL; */
dbg(1, "create_text(): done text input\n"); dbg(1, "create_text(): done text input\n");

View File

@ -390,7 +390,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
c = G_X(xctx->mousex); c = G_X(xctx->mousex);
if(gr->logx) c = pow(10, c); if(gr->logx) c = pow(10, c);
if(r->flags & 4) { /* private_cursor */ if(r->flags & 4) { /* private_cursor */
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); my_strdup(196, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c)));
} else { } else {
xctx->graph_cursor1_x = c; xctx->graph_cursor1_x = c;
} }
@ -404,7 +404,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
c = G_X(xctx->mousex); c = G_X(xctx->mousex);
if(gr->logx) c = pow(10, c); if(gr->logx) c = pow(10, c);
if(r->flags & 4) { /* private_cursor */ if(r->flags & 4) { /* private_cursor */
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); my_strdup(197, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c)));
} else { } else {
xctx->graph_cursor2_x = c; xctx->graph_cursor2_x = c;
} }
@ -499,7 +499,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
cursor1 = atof_spice(tclresult()); cursor1 = atof_spice(tclresult());
here(cursor1); here(cursor1);
if(r->flags & 4) { if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1))); my_strdup(198, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1)));
} else { } else {
xctx->graph_cursor1_x = cursor1; xctx->graph_cursor1_x = cursor1;
} }
@ -529,7 +529,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
tclvareval("input_line {Pos:} {} ", dtoa_eng(cursor2), NULL); tclvareval("input_line {Pos:} {} ", dtoa_eng(cursor2), NULL);
cursor2 = atof_spice(tclresult()); cursor2 = atof_spice(tclresult());
if(r->flags & 4) { if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2))); my_strdup(199, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2)));
} else { } else {
xctx->graph_cursor2_x = cursor2; xctx->graph_cursor2_x = cursor2;
} }
@ -554,7 +554,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
if(gr->logx) c = pow(10, c); if(gr->logx) c = pow(10, c);
if(r->flags & 4) { if(r->flags & 4) {
if(!get_tok_value(r->prop_ptr, "cursor1_x", 0)[0]) { if(!get_tok_value(r->prop_ptr, "cursor1_x", 0)[0]) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c))); my_strdup(200, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(c)));
} }
} else { } else {
xctx->graph_cursor1_x = c; xctx->graph_cursor1_x = c;
@ -572,7 +572,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
if(gr->logx) c = pow(10, c); if(gr->logx) c = pow(10, c);
if(r->flags & 4) { if(r->flags & 4) {
if(!get_tok_value(r->prop_ptr, "cursor2_x", 0)[0]) { if(!get_tok_value(r->prop_ptr, "cursor2_x", 0)[0]) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c))); my_strdup(201, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(c)));
} }
} else { } else {
xctx->graph_cursor2_x = c; xctx->graph_cursor2_x = c;
@ -623,12 +623,12 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
cursor1 = tmp; cursor1 = tmp;
if(r->flags & 4) { if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1))); my_strdup(202, &r->prop_ptr, subst_token(r->prop_ptr, "cursor1_x", dtoa(cursor1)));
} else { } else {
xctx->graph_cursor1_x = cursor1; xctx->graph_cursor1_x = cursor1;
} }
if(r->flags & 4) { if(r->flags & 4) {
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2))); my_strdup(203, &r->prop_ptr, subst_token(r->prop_ptr, "cursor2_x", dtoa(cursor2)));
} else { } else {
xctx->graph_cursor2_x = cursor2; xctx->graph_cursor2_x = cursor2;
} }
@ -697,11 +697,11 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
char *sim_type = NULL; char *sim_type = NULL;
int switched = 0; int switched = 0;
my_strdup2(_ALLOC_ID_, &rawfile, get_tok_value(r->prop_ptr, "rawfile", 0)); my_strdup2(204, &rawfile, get_tok_value(r->prop_ptr, "rawfile", 0));
my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr, "sim_type", 0)); my_strdup2(205, &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); if(rawfile[0] && sim_type[0]) switched = extra_rawfile(2, rawfile, sim_type, -1.0, -1.0);
my_free(_ALLOC_ID_, &rawfile); my_free(206, &rawfile);
my_free(_ALLOC_ID_, &sim_type); my_free(207, &sim_type);
idx = get_raw_index(find_nth(get_tok_value(r->prop_ptr, "sweep", 0), ", ", "\"", 0, 1), NULL); idx = get_raw_index(find_nth(get_tok_value(r->prop_ptr, "sweep", 0), ", ", "\"", 0, 1), NULL);
dset = dataset == -1 ? 0 : dataset; dset = dataset == -1 ? 0 : dataset;
@ -812,8 +812,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) { 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; yy1 = gr->ypos1 + (xctx->my_double_save - xctx->mousey_snap) / gr->dcy;
yy2 = gr->ypos2 + (xctx->my_double_save - xctx->mousey_snap) / gr->dcy; yy2 = gr->ypos2 + (xctx->my_double_save - xctx->mousey_snap) / gr->dcy;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); my_strdup(208, &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))); my_strdup(209, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2)));
xctx->my_double_save = xctx->mousey_snap; xctx->my_double_save = xctx->mousey_snap;
need_redraw = 1; need_redraw = 1;
} }
@ -823,8 +823,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) { 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; yy1 = gr->gy1 + (xctx->my_double_save - xctx->mousey_snap) / gr->cy;
yy2 = gr->gy2 + (xctx->my_double_save - xctx->mousey_snap) / gr->cy; yy2 = gr->gy2 + (xctx->my_double_save - xctx->mousey_snap) / gr->cy;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); my_strdup(210, &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))); my_strdup(211, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2)));
xctx->my_double_save = xctx->mousey_snap; xctx->my_double_save = xctx->mousey_snap;
need_redraw = 1; need_redraw = 1;
} }
@ -840,8 +840,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) { 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; xx1 = gr->gx1 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx;
xx2 = gr->gx2 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx; xx2 = gr->gx2 + (xctx->mx_double_save - xctx->mousex_snap) / gr->cx;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(212, &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))); my_strdup(213, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -855,16 +855,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
delta = gr->posh * 0.05; delta = gr->posh * 0.05;
yy1 = gr->ypos1 + delta; yy1 = gr->ypos1 + delta;
yy2 = gr->ypos2 + delta; yy2 = gr->ypos2 + delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); my_strdup(214, &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))); my_strdup(215, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} else { } else {
delta = gr->gh/ gr->divy; delta = gr->gh/ gr->divy;
delta_threshold = 1.0; delta_threshold = 1.0;
yy1 = gr->gy1 + delta * delta_threshold; yy1 = gr->gy1 + delta * delta_threshold;
yy2 = gr->gy2 + delta * delta_threshold; yy2 = gr->gy2 + delta * delta_threshold;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); my_strdup(216, &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))); my_strdup(217, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -875,8 +875,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
delta_threshold = 0.05; delta_threshold = 0.05;
xx1 = gr->gx1 - delta * delta_threshold; xx1 = gr->gx1 - delta * delta_threshold;
xx2 =gr->gx2 - delta * delta_threshold; xx2 =gr->gx2 - delta * delta_threshold;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(218, &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))); my_strdup(219, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -890,7 +890,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
int floaters = there_are_floaters(); int floaters = there_are_floaters();
if(i == xctx->graph_master || !unlocked) { if(i == xctx->graph_master || !unlocked) {
gr->dataset = track_dset; gr->dataset = track_dset;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "dataset", my_itoa(track_dset))); my_strdup(220, &r->prop_ptr, subst_token(r->prop_ptr, "dataset", my_itoa(track_dset)));
} }
/* do this here to update texts printing current dataset in graph /* do this here to update texts printing current dataset in graph
@ -921,8 +921,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = delta * 0.2; double var = delta * 0.2;
yy2 = gr->gy2 + var * b / delta; yy2 = gr->gy2 + var * b / delta;
yy1 = gr->gy1 - var * a / delta; yy1 = gr->gy1 - var * a / delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); my_strdup(221, &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))); my_strdup(222, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} }
} else { } else {
@ -930,8 +930,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
delta_threshold = 0.05; delta_threshold = 0.05;
xx1 = gr->gx1 - delta * delta_threshold; xx1 = gr->gx1 - delta * delta_threshold;
xx2 = gr->gx2 - delta * delta_threshold; xx2 = gr->gx2 - delta * delta_threshold;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(223, &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))); my_strdup(224, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -943,16 +943,16 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
delta = gr->posh * 0.05; delta = gr->posh * 0.05;
yy1 = gr->ypos1 - delta; yy1 = gr->ypos1 - delta;
yy2 = gr->ypos2 - delta; yy2 = gr->ypos2 - delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); my_strdup(225, &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))); my_strdup(226, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} else { } else {
delta = gr->gh / gr->divy; delta = gr->gh / gr->divy;
delta_threshold = 1.0; delta_threshold = 1.0;
yy1 = gr->gy1 - delta * delta_threshold; yy1 = gr->gy1 - delta * delta_threshold;
yy2 = gr->gy2 - delta * delta_threshold; yy2 = gr->gy2 - delta * delta_threshold;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); my_strdup(227, &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))); my_strdup(228, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -963,8 +963,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
delta_threshold = 0.05; delta_threshold = 0.05;
xx1 = gr->gx1 + delta * delta_threshold; xx1 = gr->gx1 + delta * delta_threshold;
xx2 = gr->gx2 + delta * delta_threshold; xx2 = gr->gx2 + delta * delta_threshold;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(229, &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))); my_strdup(230, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -980,8 +980,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = delta * 0.2; double var = delta * 0.2;
yy2 = gr->gy2 - var * b / delta; yy2 = gr->gy2 - var * b / delta;
yy1 = gr->gy1 + var * a / delta; yy1 = gr->gy1 + var * a / delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); my_strdup(231, &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))); my_strdup(232, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} }
} else { } else {
@ -989,8 +989,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
delta_threshold = 0.05; delta_threshold = 0.05;
xx1 = gr->gx1 + delta * delta_threshold; xx1 = gr->gx1 + delta * delta_threshold;
xx2 = gr->gx2 + delta * delta_threshold; xx2 = gr->gx2 + delta * delta_threshold;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(233, &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))); my_strdup(234, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1005,8 +1005,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = delta * 0.05; double var = delta * 0.05;
yy2 = gr->ypos2 + var * b / delta; yy2 = gr->ypos2 + var * b / delta;
yy1 = gr->ypos1 - var * a / delta; yy1 = gr->ypos1 - var * a / delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); my_strdup(235, &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))); my_strdup(236, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} else { } else {
@ -1017,8 +1017,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = delta * 0.2; double var = delta * 0.2;
yy2 = gr->gy2 + var * b / delta; yy2 = gr->gy2 + var * b / delta;
yy1 = gr->gy1 - var * a / delta; yy1 = gr->gy1 - var * a / delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); my_strdup(237, &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))); my_strdup(238, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1028,8 +1028,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = 0.2 * gr->gw; double var = 0.2 * gr->gw;
xx2 = gr->gx2 + var * (1 - zoom_m); xx2 = gr->gx2 + var * (1 - zoom_m);
xx1 = gr->gx1 - var * zoom_m; xx1 = gr->gx1 - var * zoom_m;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(239, &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))); my_strdup(240, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1041,8 +1041,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = 0.2 * gr->gw; double var = 0.2 * gr->gw;
xx2 = gr->gx2 + var * (1 - zoom_m); xx2 = gr->gx2 + var * (1 - zoom_m);
xx1 = gr->gx1 - var * zoom_m; xx1 = gr->gx1 - var * zoom_m;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(241, &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))); my_strdup(242, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1058,8 +1058,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = delta * 0.05; double var = delta * 0.05;
yy2 = gr->ypos2 - var * b / delta; yy2 = gr->ypos2 - var * b / delta;
yy1 = gr->ypos1 + var * a / delta; yy1 = gr->ypos1 + var * a / delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", dtoa(yy1))); my_strdup(243, &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))); my_strdup(244, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} else { } else {
double m = G_Y(xctx->mousey); double m = G_Y(xctx->mousey);
@ -1069,8 +1069,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = delta * 0.2; double var = delta * 0.2;
yy2 = gr->gy2 - var * b / delta; yy2 = gr->gy2 - var * b / delta;
yy1 = gr->gy1 + var * a / delta; yy1 = gr->gy1 + var * a / delta;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(yy1))); my_strdup(245, &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))); my_strdup(246, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(yy2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1080,8 +1080,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = 0.2 * gr->gw; double var = 0.2 * gr->gw;
xx2 = gr->gx2 - var * (1 - zoom_m); xx2 = gr->gx2 - var * (1 - zoom_m);
xx1 = gr->gx1 + var * zoom_m; xx1 = gr->gx1 + var * zoom_m;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(247, &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))); my_strdup(248, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1093,8 +1093,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
double var = 0.2 * gr->gw; double var = 0.2 * gr->gw;
xx2 = gr->gx2 - var * (1 - zoom_m); xx2 = gr->gx2 - var * (1 - zoom_m);
xx1 = gr->gx1 + var * zoom_m; xx1 = gr->gx1 + var * zoom_m;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(249, &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))); my_strdup(250, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1142,8 +1142,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
xx2 = pp + delta / 2.0; xx2 = pp + delta / 2.0;
*/ */
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(251, &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))); my_strdup(252, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} }
} }
@ -1171,8 +1171,8 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
if(xx1 == xx2) xx2 += 1e-6; if(xx1 == xx2) xx2 += 1e-6;
*/ */
if(xx1 == xx2) xx2 += 1e-6; if(xx1 == xx2) xx2 += 1e-6;
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(253, &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))); my_strdup(254, &r->prop_ptr, subst_token(r->prop_ptr, "x2", dtoa(xx2)));
need_redraw = 1; need_redraw = 1;
} else if(i == xctx->graph_master) { } else if(i == xctx->graph_master) {
clear_graphpan_at_end = 1; clear_graphpan_at_end = 1;
@ -1610,9 +1610,9 @@ static int edit_polygon_point(int state)
if(state & ShiftMask) { if(state & ShiftMask) {
xctx->push_undo(); xctx->push_undo();
points++; points++;
my_realloc(_ALLOC_ID_, &p->x, sizeof(double) * points); my_realloc(255, &p->x, sizeof(double) * points);
my_realloc(_ALLOC_ID_, &p->y, sizeof(double) * points); my_realloc(256, &p->y, sizeof(double) * points);
my_realloc(_ALLOC_ID_, &p->selected_point, sizeof(unsigned short) * points); my_realloc(257, &p->selected_point, sizeof(unsigned short) * points);
p->selected_point[i] = 0; p->selected_point[i] = 0;
for(j = points - 2; j > i; j--) { for(j = points - 2; j > i; j--) {
p->x[j + 1] = p->x[j]; p->x[j + 1] = p->x[j];
@ -1636,9 +1636,9 @@ static int edit_polygon_point(int state)
p->y[j] = p->y[j + 1]; p->y[j] = p->y[j + 1];
p->selected_point[j] = p->selected_point[j + 1]; p->selected_point[j] = p->selected_point[j + 1];
} }
my_realloc(_ALLOC_ID_, &p->x, sizeof(double) * points); my_realloc(258, &p->x, sizeof(double) * points);
my_realloc(_ALLOC_ID_, &p->y, sizeof(double) * points); my_realloc(259, &p->y, sizeof(double) * points);
my_realloc(_ALLOC_ID_, &p->selected_point, sizeof(unsigned short) * points); my_realloc(260, &p->selected_point, sizeof(unsigned short) * points);
p->points = points; p->points = points;
p->sel = SELECTED; p->sel = SELECTED;
return 1; return 1;
@ -1986,12 +1986,12 @@ static int grabscreen(const char *winpath, int event, int mx, int my, KeySym key
dbg(1, "closure.size = %ld\n", closure.size); dbg(1, "closure.size = %ld\n", closure.size);
encoded_data = base64_encode((unsigned char *)closure.buffer, closure.size, &olength, 0); encoded_data = base64_encode((unsigned char *)closure.buffer, closure.size, &olength, 0);
dbg(1, "olength = %ld\n", olength); dbg(1, "olength = %ld\n", olength);
my_free(_ALLOC_ID_, &closure.buffer); my_free(261, &closure.buffer);
my_mstrcat(_ALLOC_ID_, &prop, "flags=image,unscaled\nalpha=0.8\nimage_data=", encoded_data, NULL); my_mstrcat(262, &prop, "flags=image,unscaled\nalpha=0.8\nimage_data=", encoded_data, NULL);
my_free(_ALLOC_ID_, &encoded_data); my_free(263, &encoded_data);
storeobject(-1, xctx->mousex_snap, xctx->mousey_snap, xctx->mousex_snap + grab_w, xctx->mousey_snap + grab_h, storeobject(-1, xctx->mousex_snap, xctx->mousey_snap, xctx->mousex_snap + grab_w, xctx->mousey_snap + grab_h,
xRECT, GRIDLAYER, SELECTED, prop); xRECT, GRIDLAYER, SELECTED, prop);
my_free(_ALLOC_ID_, &prop); my_free(264, &prop);
xctx->need_reb_sel_arr=1; xctx->need_reb_sel_arr=1;
rebuild_selected_array(); rebuild_selected_array();
move_objects(START,0,0,0); move_objects(START,0,0,0);
@ -3092,11 +3092,11 @@ int rstate; /* (reduced state, without ShiftMask) */
if(!tool) { if(!tool) {
tool = tclgetintvar("sim(spicewave,default)"); tool = tclgetintvar("sim(spicewave,default)");
my_snprintf(str, S(str), "sim(spicewave,%d,name)", tool); my_snprintf(str, S(str), "sim(spicewave,%d,name)", tool);
my_strdup(_ALLOC_ID_, &tool_name, tclgetvar(str)); my_strdup(265, &tool_name, tclgetvar(str));
dbg(1,"callback(): tool_name=%s\n", tool_name); dbg(1,"callback(): tool_name=%s\n", tool_name);
if(strstr(tool_name, "Gaw")) tool=GAW; if(strstr(tool_name, "Gaw")) tool=GAW;
else if(strstr(tool_name, "Bespice")) tool=BESPICE; else if(strstr(tool_name, "Bespice")) tool=BESPICE;
my_free(_ALLOC_ID_, &tool_name); my_free(266, &tool_name);
} }
} }
if(tool) { if(tool) {

View File

@ -217,14 +217,14 @@ void trim_wires(void)
xctx->wire[j].sel = 0; xctx->wire[j].sel = 0;
} }
xctx->wire[xctx->wires].prop_ptr=NULL; xctx->wire[xctx->wires].prop_ptr=NULL;
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[j].prop_ptr); my_strdup(267, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[j].prop_ptr);
if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true")) if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
xctx->wire[xctx->wires].bus=1; xctx->wire[xctx->wires].bus=1;
else else
xctx->wire[xctx->wires].bus=0; xctx->wire[xctx->wires].bus=0;
xctx->wire[xctx->wires].node=NULL; xctx->wire[xctx->wires].node=NULL;
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[j].node); my_strdup(268, &xctx->wire[xctx->wires].node, xctx->wire[j].node);
xctx->wire[j].x1 = x0; xctx->wire[j].x1 = x0;
xctx->wire[j].y1 = y0; xctx->wire[j].y1 = y0;
hash_wire(XINSERT, xctx->wires, 0); hash_wire(XINSERT, xctx->wires, 0);
@ -240,7 +240,7 @@ void trim_wires(void)
} }
/* dbg(1, "trim_wires(): break: %g\n", timer(1)); */ /* dbg(1, "trim_wires(): break: %g\n", timer(1)); */
/* reduce included wires */ /* reduce included wires */
my_realloc(_ALLOC_ID_, &wireflag, xctx->wires*sizeof(unsigned short)); my_realloc(269, &wireflag, xctx->wires*sizeof(unsigned short));
memset(wireflag, 0, xctx->wires*sizeof(unsigned short)); memset(wireflag, 0, xctx->wires*sizeof(unsigned short));
for(i=0;i<xctx->wires; ++i) { for(i=0;i<xctx->wires; ++i) {
if(wireflag[i]) continue; if(wireflag[i]) continue;
@ -283,8 +283,8 @@ void trim_wires(void)
if(wireflag[i]) { if(wireflag[i]) {
++j; ++j;
/* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */ /* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); my_free(270, &xctx->wire[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->wire[i].node); my_free(271, &xctx->wire[i].node);
continue; continue;
} }
if(j) { if(j) {
@ -301,7 +301,7 @@ void trim_wires(void)
/* after wire deletions full rehash is needed */ /* after wire deletions full rehash is needed */
hash_wires(); hash_wires();
my_realloc(_ALLOC_ID_, &wireflag, xctx->wires*sizeof(unsigned short)); my_realloc(272, &wireflag, xctx->wires*sizeof(unsigned short));
memset(wireflag, 0, xctx->wires*sizeof(unsigned short)); memset(wireflag, 0, xctx->wires*sizeof(unsigned short));
/* dbg(1, "trim_wires(): hash_wires_2: %g\n", timer(1)); */ /* dbg(1, "trim_wires(): hash_wires_2: %g\n", timer(1)); */
@ -380,8 +380,8 @@ void trim_wires(void)
if(wireflag[i]) { if(wireflag[i]) {
++j; ++j;
/* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */ /* hash_wire(XDELETE, i, 0);*/ /* can not be done since wire deletions change wire idexes in array */
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); my_free(273, &xctx->wire[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->wire[i].node); my_free(274, &xctx->wire[i].node);
continue; continue;
} }
if(j) { if(j) {
@ -403,7 +403,7 @@ void trim_wires(void)
} }
} while(changed); } while(changed);
dbg(1, "trim_wires(): doloops=%d changed=%d\n", doloops, changed); dbg(1, "trim_wires(): doloops=%d changed=%d\n", doloops, changed);
my_free(_ALLOC_ID_, &wireflag); my_free(275, &wireflag);
update_conn_cues(WIRELAYER, 0, 0); update_conn_cues(WIRELAYER, 0, 0);
} }
@ -499,7 +499,7 @@ void break_wires_at_point(double x0, double y0, int align)
xctx->wire[xctx->wires].y2=y0; xctx->wire[xctx->wires].y2=y0;
xctx->wire[xctx->wires].sel=0; xctx->wire[xctx->wires].sel=0;
xctx->wire[xctx->wires].prop_ptr=NULL; xctx->wire[xctx->wires].prop_ptr=NULL;
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); my_strdup(276, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr);
if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true")) if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
xctx->wire[xctx->wires].bus=1; xctx->wire[xctx->wires].bus=1;
else else
@ -509,7 +509,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", 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->wires, xctx->wire[xctx->wires].x1, xctx->wire[xctx->wires].y1,
xctx->wire[xctx->wires].x2, xctx->wire[xctx->wires].y2); xctx->wire[xctx->wires].x2, xctx->wire[xctx->wires].y2);
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[i].node); my_strdup(277, &xctx->wire[xctx->wires].node, xctx->wire[i].node);
xctx->need_reb_sel_arr=1; xctx->need_reb_sel_arr=1;
xctx->wires++; xctx->wires++;
xctx->wire[i].x1 = x0; xctx->wire[i].x1 = x0;
@ -576,7 +576,7 @@ void break_wires_at_pins(int remove)
xctx->wire[xctx->wires].y2=y0; xctx->wire[xctx->wires].y2=y0;
xctx->wire[xctx->wires].sel=xctx->wire[i].sel; xctx->wire[xctx->wires].sel=xctx->wire[i].sel;
xctx->wire[xctx->wires].prop_ptr=NULL; xctx->wire[xctx->wires].prop_ptr=NULL;
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); my_strdup(278, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr);
if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true")) if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
xctx->wire[xctx->wires].bus=1; xctx->wire[xctx->wires].bus=1;
else else
@ -586,7 +586,7 @@ void break_wires_at_pins(int remove)
dbg(1, "break_wires_at_pins(): hashing new wire %d: %g %g %g %g\n", 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->wires, xctx->wire[xctx->wires].x1, xctx->wire[xctx->wires].y1,
xctx->wire[xctx->wires].x2, xctx->wire[xctx->wires].y2); xctx->wire[xctx->wires].x2, xctx->wire[xctx->wires].y2);
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].node, xctx->wire[i].node); my_strdup(279, &xctx->wire[xctx->wires].node, xctx->wire[i].node);
xctx->need_reb_sel_arr=1; xctx->need_reb_sel_arr=1;
xctx->wires++; xctx->wires++;
} else { } else {
@ -672,7 +672,7 @@ void break_wires_at_pins(int remove)
xctx->wire[xctx->wires].sel=SELECTED; xctx->wire[xctx->wires].sel=SELECTED;
set_first_sel(WIRE, xctx->wires, 0); set_first_sel(WIRE, xctx->wires, 0);
xctx->wire[xctx->wires].prop_ptr=NULL; xctx->wire[xctx->wires].prop_ptr=NULL;
my_strdup(_ALLOC_ID_, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr); my_strdup(280, &xctx->wire[xctx->wires].prop_ptr, xctx->wire[i].prop_ptr);
if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true")) if(!strboolcmp(get_tok_value(xctx->wire[xctx->wires].prop_ptr,"bus",0), "true"))
xctx->wire[xctx->wires].bus=1; xctx->wire[xctx->wires].bus=1;
else else

View File

@ -277,7 +277,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); &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line);
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2, if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,
xctx->areay2,textx1,texty1,textx2,texty2)) { xctx->areay2,textx1,texty1,textx2,texty2)) {
my_free(_ALLOC_ID_, &estr); my_free(281, &estr);
return; return;
} }
@ -309,7 +309,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", dbg(1, "draw_string(): size * mooz=%g height=%g ascent=%g descent=%g\n",
size * xctx->mooz, fext.height, fext.ascent, fext.descent); size * xctx->mooz, fext.height, fext.ascent, fext.descent);
llength=0; llength=0;
my_strdup2(_ALLOC_ID_, &sss, estr); my_strdup2(282, &sss, estr);
tt=ss=sss; tt=ss=sss;
for(;;) { for(;;) {
c=*ss; c=*ss;
@ -330,8 +330,8 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in
} }
++ss; ++ss;
} }
my_free(_ALLOC_ID_, &sss); my_free(283, &sss);
my_free(_ALLOC_ID_, &estr); my_free(284, &estr);
} }
#else /* !HAS_CAIRO */ #else /* !HAS_CAIRO */
@ -365,7 +365,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); &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line);
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2, if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,
textx1,texty1,textx2,texty2)) { textx1,texty1,textx2,texty2)) {
my_free(_ALLOC_ID_, &estr); my_free(285, &estr);
return; return;
} }
x1=textx1;y1=texty1; x1=textx1;y1=texty1;
@ -401,7 +401,7 @@ void draw_string(int layer, int what, const char *str, short rot, short flip, in
++pos; ++pos;
a += FONTWIDTH+FONTWHITESPACE; a += FONTWIDTH+FONTWHITESPACE;
} }
my_free(_ALLOC_ID_, &estr); my_free(286, &estr);
} }
} }
@ -420,11 +420,11 @@ void draw_temp_string(GC gctext, int what, const char *str, short rot, short fli
dbg(2, "draw_string(): string=%s\n",estr); dbg(2, "draw_string(): string=%s\n",estr);
if(!text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1, if(!text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x1,y1,
&textx1,&texty1,&textx2,&texty2, &tmp, &dtmp)) { &textx1,&texty1,&textx2,&texty2, &tmp, &dtmp)) {
my_free(_ALLOC_ID_, &estr); my_free(287, &estr);
return; return;
} }
drawtemprect(gctext,what, textx1,texty1,textx2,texty2); drawtemprect(gctext,what, textx1,texty1,textx2,texty2);
my_free(_ALLOC_ID_, &estr); my_free(288, &estr);
} }
void get_sym_text_layer(int inst, int text_n, int *layer) void get_sym_text_layer(int inst, int text_n, int *layer)
@ -648,16 +648,16 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
polygon = &(symptr->poly[layer])[j]; polygon = &(symptr->poly[layer])[j];
bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true"); bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true");
dash = (disabled == 1) ? 3 : polygon->dash; dash = (disabled == 1) ? 3 : polygon->dash;
x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); x = my_malloc(289, sizeof(double) * polygon->points);
y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); y = my_malloc(290, sizeof(double) * polygon->points);
for(k=0;k<polygon->points; ++k) { for(k=0;k<polygon->points; ++k) {
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
x[k]+= x0; x[k]+= x0;
y[k] += y0; y[k] += y0;
} }
drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, dash, bezier); /* added fill */ drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, dash, bezier); /* added fill */
my_free(_ALLOC_ID_, &x); my_free(291, &x);
my_free(_ALLOC_ID_, &y); my_free(292, &y);
} }
for(j=0;j< symptr->arcs[layer]; ++j) for(j=0;j< symptr->arcs[layer]; ++j)
{ {
@ -774,17 +774,17 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
} }
#endif #endif
dbg(1, "draw_symbol(): drawing string: before translate(): text.txt_ptr=%s\n", text.txt_ptr); dbg(1, "draw_symbol(): drawing string: before translate(): text.txt_ptr=%s\n", text.txt_ptr);
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr)); my_strdup2(293, &txtptr, translate(n, text.txt_ptr));
/* do another round of substitutions if some @var are found, but if not found leave @var as is */ /* 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 : "NULL"); dbg(1, "draw_symbol(): drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr ? text.prop_ptr : "NULL");
my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr, my_strdup2(294, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr,
xctx->sym[xctx->inst[n].ptr].templ, NULL )); xctx->sym[xctx->inst[n].ptr].templ, NULL ));
dbg(1, "draw_symbol(): after translate3: str=%s\n", txtptr); dbg(1, "draw_symbol(): after translate3: str=%s\n", txtptr);
draw_string(textlayer, what, txtptr, draw_string(textlayer, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3, (text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
flip^text.flip, text.hcenter, text.vcenter, flip^text.flip, text.hcenter, text.vcenter,
x0+x1, y0+y1, xscale, yscale); x0+x1, y0+y1, xscale, yscale);
my_free(_ALLOC_ID_, &txtptr); my_free(295, &txtptr);
#if HAS_CAIRO!=1 #if HAS_CAIRO!=1
drawrect(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, -1, -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); drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0, NULL);
@ -895,16 +895,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"); bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true");
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
int k; int k;
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); double *x = my_malloc(296, sizeof(double) * polygon->points);
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); double *y = my_malloc(297, sizeof(double) * polygon->points);
for(k=0;k<polygon->points; ++k) { for(k=0;k<polygon->points; ++k) {
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
x[k] += x0; x[k] += x0;
y[k] += y0; y[k] += y0;
} }
drawtemppolygon(gc, NOW, x, y, polygon->points, bezier); drawtemppolygon(gc, NOW, x, y, polygon->points, bezier);
my_free(_ALLOC_ID_, &x); my_free(298, &x);
my_free(_ALLOC_ID_, &y); my_free(299, &y);
} }
} }
@ -945,15 +945,15 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
#if HAS_CAIRO==1 #if HAS_CAIRO==1
customfont = set_text_custom_font(&text); customfont = set_text_custom_font(&text);
#endif #endif
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr)); my_strdup2(300, &txtptr, translate(n, text.txt_ptr));
/* do another round of substitutions if some @var are found, but if not found leave @var as is */ /* do another round of substitutions if some @var are found, but if not found leave @var as is */
my_strdup2(_ALLOC_ID_, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr, my_strdup2(301, &txtptr, translate3(txtptr, 1, xctx->inst[n].prop_ptr,
xctx->sym[xctx->inst[n].ptr].templ, NULL )); xctx->sym[xctx->inst[n].ptr].templ, NULL ));
dbg(1, "draw_temp_symbol(): after translate3: str=%s\n", txtptr); dbg(1, "draw_temp_symbol(): after translate3: str=%s\n", txtptr);
if(txtptr[0]) draw_temp_string(gc, what, txtptr, if(txtptr[0]) draw_temp_string(gc, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3, (text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, xscale, yscale); flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, xscale, yscale);
my_free(_ALLOC_ID_, &txtptr); my_free(302, &txtptr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
@ -1790,10 +1790,10 @@ void drawbezier(Drawable w, GC gc, int c, double *x, double *y, int points, int
double x0, x1, x2, y0, y1, y2; double x0, x1, x2, y0, y1, y2;
if(points == 0 && x == NULL && y == NULL) { /* cleanup */ if(points == 0 && x == NULL && y == NULL) { /* cleanup */
my_free(_ALLOC_ID_, &p); my_free(303, &p);
return; return;
} }
if(!p) p = my_malloc(_ALLOC_ID_, psize * sizeof(XPoint)); if(!p) p = my_malloc(304, psize * sizeof(XPoint));
i = 0; i = 0;
for(b = 0; b < points - 2; b++) { for(b = 0; b < points - 2; b++) {
if(points == 3) { /* 3 points: only one bezier */ if(points == 3) { /* 3 points: only one bezier */
@ -1830,7 +1830,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; yp = (1 - t) * (1 - t) * y0 + 2 * (1 - t) * t * y1 + t * t * y2;
if(i >= psize) { if(i >= psize) {
psize *= 2; psize *= 2;
my_realloc(_ALLOC_ID_, &p, psize * sizeof(XPoint)); my_realloc(305, &p, psize * sizeof(XPoint));
} }
p[i].x = (short)X_TO_SCREEN(xp); p[i].x = (short)X_TO_SCREEN(xp);
p[i].y = (short)Y_TO_SCREEN(yp); p[i].y = (short)Y_TO_SCREEN(yp);
@ -1865,7 +1865,7 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
return; return;
} }
if(!xctx->only_probes && (x2-x1)<1.0 && (y2-y1)<1.0) return; if(!xctx->only_probes && (x2-x1)<1.0 && (y2-y1)<1.0) return;
p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points); p = my_malloc(306, sizeof(XPoint) * points);
if(what) { if(what) {
for(i=0;i<points; ++i) { for(i=0;i<points; ++i) {
clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy); clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy);
@ -1911,7 +1911,7 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
if(dash) { if(dash) {
XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw) ,LineSolid, LINECAP , LINEJOIN); XSetLineAttributes (display, xctx->gc[c], XLINEWIDTH(xctx->lw) ,LineSolid, LINECAP , LINEJOIN);
} }
my_free(_ALLOC_ID_, &p); my_free(307, &p);
} }
/* flags: bit 0: bezier /* flags: bit 0: bezier
@ -1949,14 +1949,14 @@ void drawtemppolygon(GC gc, int what, double *x, double *y, int points, int flag
if(bezier) { if(bezier) {
drawbezier(xctx->window, gc, 0, x, y, points, 0); drawbezier(xctx->window, gc, 0, x, y, points, 0);
} else { } else {
p = my_malloc(_ALLOC_ID_, sizeof(XPoint) * points); p = my_malloc(308, sizeof(XPoint) * points);
for(i=0;i<points; ++i) { for(i=0;i<points; ++i) {
clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy); clip_xy_to_short(X_TO_SCREEN(x[i]), Y_TO_SCREEN(y[i]), &sx, &sy);
p[i].x = sx; p[i].x = sx;
p[i].y = sy; p[i].y = sy;
} }
XDrawLines(display, xctx->window, gc, p, points, CoordModeOrigin); XDrawLines(display, xctx->window, gc, p, points, CoordModeOrigin);
my_free(_ALLOC_ID_, &p); my_free(309, &p);
} }
} }
} }
@ -2263,9 +2263,9 @@ static SPICE_DATA **get_bus_idx_array(const char *ntok, int *n_bits)
*n_bits = count_items(ntok, ";,", "") - 1; *n_bits = count_items(ntok, ";,", "") - 1;
dbg(1, "get_bus_idx_array(): ntok=%s\n", ntok); dbg(1, "get_bus_idx_array(): ntok=%s\n", ntok);
dbg(1, "get_bus_idx_array(): *n_bits=%d\n", *n_bits); dbg(1, "get_bus_idx_array(): *n_bits=%d\n", *n_bits);
idx_arr = my_malloc(_ALLOC_ID_, (*n_bits) * sizeof(SPICE_DATA *)); idx_arr = my_malloc(310, (*n_bits) * sizeof(SPICE_DATA *));
p = 0; p = 0;
my_strdup2(_ALLOC_ID_, &ntok_copy, ntok); my_strdup2(311, &ntok_copy, ntok);
nptr = ntok_copy; nptr = ntok_copy;
my_strtok_r(nptr, ";,", "", 0, &saven); /*strip off bus name (1st field) */ my_strtok_r(nptr, ";,", "", 0, &saven); /*strip off bus name (1st field) */
while( (bit_name = my_strtok_r(NULL, ";, \n", "", 0, &saven)) ) { while( (bit_name = my_strtok_r(NULL, ";, \n", "", 0, &saven)) ) {
@ -2279,7 +2279,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); */ /* dbg(0, "get_bus_idx_array(): bit_name=%s, p=%d\n", bit_name, p); */
++p; ++p;
} }
my_free(_ALLOC_ID_, &ntok_copy); my_free(312, &ntok_copy);
return idx_arr; return idx_arr;
} }
@ -2318,12 +2318,12 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
if(autoload == 0) autoload = 2; if(autoload == 0) autoload = 2;
ptr = get_tok_value(r->prop_ptr,"rawfile",0); ptr = get_tok_value(r->prop_ptr,"rawfile",0);
if(!ptr[0]) { if(!ptr[0]) {
if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile); if(raw && raw->rawfile) my_strdup2(313, &custom_rawfile, raw->rawfile);
else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); else my_strdup2(314, &custom_rawfile, "");
} else { } else {
my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); my_strdup2(315, &custom_rawfile, ptr);
} }
my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type",0)); my_strdup2(316, &sim_type, get_tok_value(r->prop_ptr,"sim_type",0));
if((i == xctx->graph_master) && custom_rawfile[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); extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0);
} }
@ -2334,13 +2334,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); ptr = get_tok_value(xctx->rect[GRIDLAYER][xctx->graph_master].prop_ptr,"rawfile",0);
if(!ptr[0]) { if(!ptr[0]) {
if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile); if(raw && raw->rawfile) my_strdup2(317, &custom_rawfile, raw->rawfile);
else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); else my_strdup2(318, &custom_rawfile, "");
} else { } else {
my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); my_strdup2(319, &custom_rawfile, ptr);
} }
my_strdup2(_ALLOC_ID_, &sim_type, my_strdup2(320, &sim_type,
get_tok_value(xctx->rect[GRIDLAYER][xctx->graph_master].prop_ptr,"sim_type",0)); get_tok_value(xctx->rect[GRIDLAYER][xctx->graph_master].prop_ptr,"sim_type",0));
if(custom_rawfile[0]) { if(custom_rawfile[0]) {
extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0); extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0);
@ -2371,12 +2371,12 @@ int graph_fullxzoom(int i, Graph_ctx *gr, int dataset)
xx1 = mylog10(xx1); xx1 = mylog10(xx1);
xx2 = mylog10(xx2); xx2 = mylog10(xx2);
} }
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "x1", dtoa(xx1))); my_strdup(321, &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))); my_strdup(322, &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); if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0);
my_free(_ALLOC_ID_, &custom_rawfile); my_free(323, &custom_rawfile);
my_free(_ALLOC_ID_, &sim_type); my_free(324, &sim_type);
need_redraw = 1; need_redraw = 1;
if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */ if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */
@ -2415,18 +2415,18 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
autoload = !strboolcmp(get_tok_value(r->prop_ptr,"autoload",0), "1"); autoload = !strboolcmp(get_tok_value(r->prop_ptr,"autoload",0), "1");
if(autoload == 0) autoload = 2; if(autoload == 0) autoload = 2;
dbg(1, "graph_fullyzoom(): graph_dataset=%d\n", graph_dataset); dbg(1, "graph_fullyzoom(): graph_dataset=%d\n", graph_dataset);
my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); my_strdup2(325, &node, get_tok_value(r->prop_ptr,"node",0));
my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); my_strdup2(326, &sweep, get_tok_value(r->prop_ptr,"sweep",0));
ptr = get_tok_value(r->prop_ptr,"rawfile",0); ptr = get_tok_value(r->prop_ptr,"rawfile",0);
if(!ptr[0]) { if(!ptr[0]) {
if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile); if(raw && raw->rawfile) my_strdup2(327, &custom_rawfile, raw->rawfile);
else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); else my_strdup2(328, &custom_rawfile, "");
} else { } else {
my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); my_strdup2(329, &custom_rawfile, ptr);
} }
my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type",0)); my_strdup2(330, &sim_type, get_tok_value(r->prop_ptr,"sim_type",0));
save_extra_idx = xctx->extra_idx; save_extra_idx = xctx->extra_idx;
nptr = node; nptr = node;
@ -2444,7 +2444,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
} }
raw = xctx->raw; raw = xctx->raw;
my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2)); my_strdup2(331, &nd, find_nth(ntok, "%", "\"", 0, 2));
/* if %<n> is specified after node name, <n> is the dataset number to plot in graph */ /* if %<n> is specified after node name, <n> is the dataset number to plot in graph */
if(nd[0]) { if(nd[0]) {
int pos = 1; int pos = 1;
@ -2453,25 +2453,25 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
char *node_rawfile = NULL; char *node_rawfile = NULL;
char *node_sim_type = NULL; char *node_sim_type = NULL;
tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos), "}", NULL); tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos), "}", NULL);
my_strdup2(_ALLOC_ID_, &node_rawfile, tclresult()); my_strdup2(332, &node_rawfile, tclresult());
tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos + 1), "}", NULL); tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos + 1), "}", NULL);
my_strdup2(_ALLOC_ID_, &node_sim_type, tclresult()[0] ? tclresult() : my_strdup2(333, &node_sim_type, tclresult()[0] ? tclresult() :
sim_type[0] ? sim_type : xctx->raw->sim_type); sim_type[0] ? sim_type : xctx->raw->sim_type);
dbg(1, "node_rawfile=|%s| node_sim_type=|%s|\n", node_rawfile, node_sim_type); dbg(1, "node_rawfile=|%s| node_sim_type=|%s|\n", node_rawfile, node_sim_type);
if(node_rawfile && node_rawfile[0]) { if(node_rawfile && node_rawfile[0]) {
extra_rawfile(autoload, node_rawfile, node_sim_type, -1.0, -1.0); extra_rawfile(autoload, node_rawfile, node_sim_type, -1.0, -1.0);
raw = xctx->raw; raw = xctx->raw;
} }
my_free(_ALLOC_ID_, &node_rawfile); my_free(334, &node_rawfile);
my_free(_ALLOC_ID_, &node_sim_type); my_free(335, &node_sim_type);
} }
if(pos == 2) node_dataset = atoi(nd); if(pos == 2) node_dataset = atoi(nd);
else node_dataset = -1; else node_dataset = -1;
dbg(1, "nd=|%s|, node_dataset = %d\n", nd, node_dataset); dbg(1, "nd=|%s|, node_dataset = %d\n", nd, node_dataset);
my_strdup(_ALLOC_ID_, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1)); my_strdup(336, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1));
} else { } else {
node_dataset = -1; node_dataset = -1;
my_strdup(_ALLOC_ID_, &ntok_copy, ntok); my_strdup(337, &ntok_copy, ntok);
} }
/* transform multiple OP points into a dc sweep */ /* transform multiple OP points into a dc sweep */
@ -2483,14 +2483,14 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
raw->npoints[0] = raw->allpoints; raw->npoints[0] = raw->allpoints;
} }
my_free(_ALLOC_ID_, &nd); my_free(338, &nd);
dbg(1, "ntok=|%s|\nntok_copy=|%s|\nnode_dataset=%d\n", ntok, ntok_copy, node_dataset); dbg(1, "ntok=|%s|\nntok_copy=|%s|\nnode_dataset=%d\n", ntok, ntok_copy, node_dataset);
tmp_ptr = find_nth(ntok_copy, ";", "\"", 4, 2); tmp_ptr = find_nth(ntok_copy, ";", "\"", 4, 2);
if(strstr(tmp_ptr, ",")) { if(strstr(tmp_ptr, ",")) {
tmp_ptr = find_nth(tmp_ptr, ",", "\"", 4, 1); tmp_ptr = find_nth(tmp_ptr, ",", "\"", 4, 1);
/* also trim spaces */ /* also trim spaces */
my_strdup2(_ALLOC_ID_, &bus_msb, trim_chars(tmp_ptr, "\n ")); my_strdup2(339, &bus_msb, trim_chars(tmp_ptr, "\n "));
} }
dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "NULL"); dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "NULL");
stok = my_strtok_r(sptr, "\n\t ", "\"", 0, &saves); stok = my_strtok_r(sptr, "\n\t ", "\"", 0, &saves);
@ -2504,9 +2504,9 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
if(!bus_msb) { if(!bus_msb) {
char *express = NULL; char *express = NULL;
if(strstr(ntok_copy, ";")) { if(strstr(ntok_copy, ";")) {
my_strdup2(_ALLOC_ID_, &express, find_nth(ntok_copy, ";", "\"", 0, 2)); my_strdup2(340, &express, find_nth(ntok_copy, ";", "\"", 0, 2));
} else { } else {
my_strdup2(_ALLOC_ID_, &express, ntok_copy); my_strdup2(341, &express, ntok_copy);
} }
if(strpbrk(express, " \n\t")) { if(strpbrk(express, " \n\t")) {
/* we *need* to recalculate the expression column for any new expression /* we *need* to recalculate the expression column for any new expression
@ -2515,7 +2515,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
} else { } else {
v = get_raw_index(express, NULL); v = get_raw_index(express, NULL);
} }
my_free(_ALLOC_ID_, &express); my_free(342, &express);
dbg(1, "graph_fullyzoom(): v=%d\n", v); dbg(1, "graph_fullyzoom(): v=%d\n", v);
} }
if(xctx->raw && v >= 0) { if(xctx->raw && v >= 0) {
@ -2558,7 +2558,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
sweepvar_wrap++; sweepvar_wrap++;
} /* for(dset...) */ } /* for(dset...) */
} }
if(bus_msb) my_free(_ALLOC_ID_, &bus_msb); if(bus_msb) my_free(343, &bus_msb);
if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */ if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */
raw->datasets = save_datasets; raw->datasets = save_datasets;
raw->npoints[0] = save_npoints; raw->npoints[0] = save_npoints;
@ -2573,18 +2573,18 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
if(max == min) max += 0.01; if(max == min) max += 0.01;
min = floor_to_n_digits(min, 2); min = floor_to_n_digits(min, 2);
max = ceil_to_n_digits(max, 2); max = ceil_to_n_digits(max, 2);
my_free(_ALLOC_ID_, &node); my_free(344, &node);
my_free(_ALLOC_ID_, &sweep); my_free(345, &sweep);
my_free(_ALLOC_ID_, &custom_rawfile); my_free(346, &custom_rawfile);
my_free(_ALLOC_ID_, &sim_type); my_free(347, &sim_type);
if(ntok_copy) my_free(_ALLOC_ID_, &ntok_copy); if(ntok_copy) my_free(348, &ntok_copy);
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "y1", dtoa(min))); my_strdup(349, &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))); my_strdup(350, &r->prop_ptr, subst_token(r->prop_ptr, "y2", dtoa(max)));
need_redraw = 1; need_redraw = 1;
} else { /* digital plot */ } else { /* digital plot */
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1", my_strdup(351, &r->prop_ptr, subst_token(r->prop_ptr, "ypos1",
get_tok_value(r->prop_ptr, "y1", 0) )); get_tok_value(r->prop_ptr, "y1", 0) ));
my_strdup(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2", my_strdup(352, &r->prop_ptr, subst_token(r->prop_ptr, "ypos2",
get_tok_value(r->prop_ptr, "y2", 0) )); get_tok_value(r->prop_ptr, "y2", 0) ));
need_redraw = 1; need_redraw = 1;
} }
@ -3115,18 +3115,18 @@ static void draw_graph_variables(int wcnt, int wave_color, int n_nodes, int swee
char *alias_ptr = NULL; char *alias_ptr = NULL;
dbg(1, "ntok=%s\n", ntok); dbg(1, "ntok=%s\n", ntok);
if(strstr(ntok, ";")) { if(strstr(ntok, ";")) {
my_strdup2(_ALLOC_ID_, &alias_ptr, find_nth(ntok, ";", "\"", 0, 1)); my_strdup2(353, &alias_ptr, find_nth(ntok, ";", "\"", 0, 1));
my_strdup2(_ALLOC_ID_, &ntok_ptr, find_nth(ntok, ";", "\"", 0, 2)); my_strdup2(354, &ntok_ptr, find_nth(ntok, ";", "\"", 0, 2));
} }
else { else {
my_strdup2(_ALLOC_ID_, &alias_ptr, ntok); my_strdup2(355, &alias_ptr, ntok);
my_strdup2(_ALLOC_ID_, &ntok_ptr, ntok); my_strdup2(356, &ntok_ptr, ntok);
} }
if(gr->unity != 1.0) my_snprintf(tmpstr, S(tmpstr), "%s[%c]", alias_ptr, gr->unity_suffix); 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); else my_snprintf(tmpstr, S(tmpstr), "%s", alias_ptr);
my_free(_ALLOC_ID_, &alias_ptr); my_free(357, &alias_ptr);
my_free(_ALLOC_ID_, &ntok_ptr); my_free(358, &ntok_ptr);
} }
if(gr->digital) { if(gr->digital) {
double xt = gr->x1 - 15 * gr->txtsizelab; double xt = gr->x1 - 15 * gr->txtsizelab;
@ -3262,8 +3262,8 @@ int embed_rawfile(const char *rawfile)
xInstance *i = &xctx->inst[xctx->sel_array[0].n]; xInstance *i = &xctx->inst[xctx->sel_array[0].n];
xctx->push_undo(); xctx->push_undo();
ptr = base64_from_file(rawfile, &len); ptr = base64_from_file(rawfile, &len);
my_strdup2(_ALLOC_ID_, &i->prop_ptr, subst_token(i->prop_ptr, "spice_data", ptr)); my_strdup2(359, &i->prop_ptr, subst_token(i->prop_ptr, "spice_data", ptr));
my_free(_ALLOC_ID_, &ptr); my_free(360, &ptr);
set_modify(1); set_modify(1);
} }
return res; return res;
@ -3288,9 +3288,9 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr)
xRect *r = &xctx->rect[GRIDLAYER][i]; xRect *r = &xctx->rect[GRIDLAYER][i];
/* get plot data */ /* get plot data */
my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); my_strdup2(361, &node, get_tok_value(r->prop_ptr,"node",0));
my_strdup2(_ALLOC_ID_, &color, get_tok_value(r->prop_ptr,"color",0)); my_strdup2(362, &color, get_tok_value(r->prop_ptr,"color",0));
my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); my_strdup2(363, &sweep, get_tok_value(r->prop_ptr,"sweep",0));
nptr = node; nptr = node;
cptr = color; cptr = color;
sptr = sweep; sptr = sweep;
@ -3328,10 +3328,10 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr)
} else { } else {
if(gr->hilight_wave == wcnt) { if(gr->hilight_wave == wcnt) {
gr->hilight_wave = -1; gr->hilight_wave = -1;
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); my_strdup2(364, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave)));
} else { } else {
gr->hilight_wave = wcnt; gr->hilight_wave = wcnt;
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); my_strdup2(365, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave)));
} }
} }
} }
@ -3353,19 +3353,19 @@ int edit_wave_attributes(int what, int i, Graph_ctx *gr)
} else { } else {
if(gr->hilight_wave == wcnt) { if(gr->hilight_wave == wcnt) {
gr->hilight_wave = -1; gr->hilight_wave = -1;
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); my_strdup2(366, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave)));
} else { } else {
gr->hilight_wave = wcnt; gr->hilight_wave = wcnt;
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave))); my_strdup2(367, &r->prop_ptr, subst_token(r->prop_ptr, "hilight_wave", my_itoa(gr->hilight_wave)));
} }
} }
} }
} }
++wcnt; ++wcnt;
} /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */ } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */
my_free(_ALLOC_ID_, &node); my_free(368, &node);
my_free(_ALLOC_ID_, &color); my_free(369, &color);
my_free(_ALLOC_ID_, &sweep); my_free(370, &sweep);
return ret; return ret;
} }
@ -3466,18 +3466,18 @@ int find_closest_wave(int i, Graph_ctx *gr)
yval = G_Y(xctx->mousey); yval = G_Y(xctx->mousey);
xval = G_X(xctx->mousex); xval = G_X(xctx->mousex);
/* get data to plot */ /* get data to plot */
my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); my_strdup2(371, &node, get_tok_value(r->prop_ptr,"node",0));
my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); my_strdup2(372, &sweep, get_tok_value(r->prop_ptr,"sweep",0));
ptr = get_tok_value(r->prop_ptr,"rawfile",0); ptr = get_tok_value(r->prop_ptr,"rawfile",0);
if(!ptr[0]) { if(!ptr[0]) {
if(raw && raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, raw->rawfile); if(raw && raw->rawfile) my_strdup2(373, &custom_rawfile, raw->rawfile);
else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); else my_strdup2(374, &custom_rawfile, "");
} else { } else {
my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); my_strdup2(375, &custom_rawfile, ptr);
} }
my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type",0)); my_strdup2(376, &sim_type, get_tok_value(r->prop_ptr,"sim_type",0));
if(sch_waves_loaded()!= -1 && custom_rawfile[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); extra_rawfile(autoload, custom_rawfile, sim_type[0] ? sim_type : xctx->raw->sim_type, -1.0, -1.0);
} }
@ -3504,9 +3504,9 @@ int find_closest_wave(int i, Graph_ctx *gr)
expression = 0; expression = 0;
if(raw->values) { if(raw->values) {
if(strstr(ntok, ";")) { if(strstr(ntok, ";")) {
my_strdup2(_ALLOC_ID_, &express, find_nth(ntok, ";", "\"", 0, 2)); my_strdup2(377, &express, find_nth(ntok, ";", "\"", 0, 2));
} else { } else {
my_strdup2(_ALLOC_ID_, &express, ntok); my_strdup2(378, &express, ntok);
} }
if(strpbrk(express, " \n\t")) { if(strpbrk(express, " \n\t")) {
expression = 1; expression = 1;
@ -3590,14 +3590,14 @@ int find_closest_wave(int i, Graph_ctx *gr)
++wcnt; ++wcnt;
} /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */ } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */
dbg(0, "closest dataset=%d\n", closest_dataset); dbg(0, "closest dataset=%d\n", closest_dataset);
if(express) my_free(_ALLOC_ID_, &express); if(express) my_free(379, &express);
if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0); if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0);
my_free(_ALLOC_ID_, &custom_rawfile); my_free(380, &custom_rawfile);
my_free(_ALLOC_ID_, &sim_type); my_free(381, &sim_type);
my_free(_ALLOC_ID_, &node); my_free(382, &node);
my_free(_ALLOC_ID_, &sweep); my_free(383, &sweep);
return closest_dataset; return closest_dataset;
} }
@ -3683,18 +3683,18 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
/* graph box, gridlines and axes */ /* graph box, gridlines and axes */
draw_graph_grid(gr, ct); draw_graph_grid(gr, ct);
/* get data to plot */ /* get data to plot */
my_strdup2(_ALLOC_ID_, &node, get_tok_value(r->prop_ptr,"node",0)); my_strdup2(384, &node, get_tok_value(r->prop_ptr,"node",0));
my_strdup2(_ALLOC_ID_, &color, get_tok_value(r->prop_ptr,"color",0)); my_strdup2(385, &color, get_tok_value(r->prop_ptr,"color",0));
my_strdup2(_ALLOC_ID_, &sweep, get_tok_value(r->prop_ptr,"sweep",0)); my_strdup2(386, &sweep, get_tok_value(r->prop_ptr,"sweep",0));
ptr = get_tok_value(r->prop_ptr,"rawfile",0); ptr = get_tok_value(r->prop_ptr,"rawfile",0);
if(!ptr[0]) { if(!ptr[0]) {
if(xctx->raw && xctx->raw->rawfile) my_strdup2(_ALLOC_ID_, &custom_rawfile, xctx->raw->rawfile); if(xctx->raw && xctx->raw->rawfile) my_strdup2(387, &custom_rawfile, xctx->raw->rawfile);
else my_strdup2(_ALLOC_ID_, &custom_rawfile, ""); else my_strdup2(388, &custom_rawfile, "");
} else { } else {
my_strdup2(_ALLOC_ID_, &custom_rawfile, ptr); my_strdup2(389, &custom_rawfile, ptr);
} }
my_strdup2(_ALLOC_ID_, &sim_type, get_tok_value(r->prop_ptr,"sim_type",0)); my_strdup2(390, &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", dbg(1, "draw_graph(): graph %d: custom_rawfile=%s autoload=%d sim_type=%s\n",
i, custom_rawfile, autoload, sim_type); i, custom_rawfile, autoload, sim_type);
save_extra_idx = xctx->extra_idx; save_extra_idx = xctx->extra_idx;
@ -3719,7 +3719,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
continue; continue;
} }
} }
my_strdup2(_ALLOC_ID_, &nd, find_nth(ntok, "%", "\"", 0, 2)); my_strdup2(391, &nd, find_nth(ntok, "%", "\"", 0, 2));
if(wcnt >= n_nodes) { if(wcnt >= n_nodes) {
dbg(0, "draw_graph(): WARNING: wcnt (wave #) >= n_nodes (counted # of waves)\n"); dbg(0, "draw_graph(): WARNING: wcnt (wave #) >= n_nodes (counted # of waves)\n");
dbg(0, "draw_graph(): n_nodes=%d\n", n_nodes); dbg(0, "draw_graph(): n_nodes=%d\n", n_nodes);
@ -3735,29 +3735,29 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
char *node_rawfile = NULL; char *node_rawfile = NULL;
char *node_sim_type = NULL; char *node_sim_type = NULL;
tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos), "}", NULL); tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos), "}", NULL);
my_strdup2(_ALLOC_ID_, &node_rawfile, tclresult()); my_strdup2(392, &node_rawfile, tclresult());
tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos + 1), "}", NULL); tclvareval("subst {", find_nth(nd, "\n ", "\"", 0, pos + 1), "}", NULL);
my_strdup2(_ALLOC_ID_, &node_sim_type, tclresult()[0] ? tclresult() : my_strdup2(393, &node_sim_type, tclresult()[0] ? tclresult() :
sim_type[0] ? sim_type : xctx->raw->sim_type); sim_type[0] ? sim_type : xctx->raw->sim_type);
dbg(1, "node_rawfile=|%s| node_sim_type=|%s|\n", node_rawfile, node_sim_type); dbg(1, "node_rawfile=|%s| node_sim_type=|%s|\n", node_rawfile, node_sim_type);
if(node_rawfile && node_rawfile[0]) { if(node_rawfile && node_rawfile[0]) {
if(extra_rawfile(autoload, node_rawfile, node_sim_type, -1.0, -1.0) == 0) { if(extra_rawfile(autoload, node_rawfile, node_sim_type, -1.0, -1.0) == 0) {
my_free(_ALLOC_ID_, &node_rawfile); my_free(394, &node_rawfile);
my_free(_ALLOC_ID_, &node_sim_type); my_free(395, &node_sim_type);
my_free(_ALLOC_ID_, &nd); my_free(396, &nd);
continue; continue;
} }
} }
my_free(_ALLOC_ID_, &node_rawfile); my_free(397, &node_rawfile);
my_free(_ALLOC_ID_, &node_sim_type); my_free(398, &node_sim_type);
} }
if(pos == 2) node_dataset = atoi(nd); if(pos == 2) node_dataset = atoi(nd);
else node_dataset = -1; else node_dataset = -1;
dbg(1, "nd=|%s|, node_dataset = %d\n", nd, node_dataset); dbg(1, "nd=|%s|, node_dataset = %d\n", nd, node_dataset);
my_strdup(_ALLOC_ID_, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1)); my_strdup(399, &ntok_copy, find_nth(ntok, "%", "\"", 4, 1));
} else { } else {
node_dataset = -1; node_dataset = -1;
my_strdup(_ALLOC_ID_, &ntok_copy, ntok); my_strdup(400, &ntok_copy, ntok);
} }
/* transform multiple OP points into a dc sweep */ /* transform multiple OP points into a dc sweep */
@ -3770,14 +3770,14 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
xctx->raw->npoints[0] = xctx->raw->allpoints; xctx->raw->npoints[0] = xctx->raw->allpoints;
} }
my_free(_ALLOC_ID_, &nd); my_free(401, &nd);
dbg(1, "ntok=|%s|\nntok_copy=|%s|\nnode_dataset=%d\n", ntok, ntok_copy, node_dataset); dbg(1, "ntok=|%s|\nntok_copy=|%s|\nnode_dataset=%d\n", ntok, ntok_copy, node_dataset);
tmp_ptr = find_nth(ntok_copy, ";", "\"", 4, 2); tmp_ptr = find_nth(ntok_copy, ";", "\"", 4, 2);
if(strstr(tmp_ptr, ",")) { if(strstr(tmp_ptr, ",")) {
tmp_ptr = find_nth(tmp_ptr, ",", "\"", 4, 1); tmp_ptr = find_nth(tmp_ptr, ",", "\"", 4, 1);
/* also trim spaces */ /* also trim spaces */
my_strdup2(_ALLOC_ID_, &bus_msb, trim_chars(tmp_ptr, "\n ")); my_strdup2(402, &bus_msb, trim_chars(tmp_ptr, "\n "));
} }
dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "NULL"); dbg(1, "ntok_copy=|%s|, bus_msb=|%s|\n", ntok_copy, bus_msb ? bus_msb : "NULL");
ctok = my_strtok_r(cptr, " ", "", 0, &savec); ctok = my_strtok_r(cptr, " ", "", 0, &savec);
@ -3799,9 +3799,9 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
expression = 0; expression = 0;
if(xctx->raw && xctx->raw->values && !bus_msb) { if(xctx->raw && xctx->raw->values && !bus_msb) {
if(strstr(ntok_copy, ";")) { if(strstr(ntok_copy, ";")) {
my_strdup2(_ALLOC_ID_, &express, find_nth(ntok_copy, ";", "\"", 0, 2)); my_strdup2(403, &express, find_nth(ntok_copy, ";", "\"", 0, 2));
} else { } else {
my_strdup2(_ALLOC_ID_, &express, ntok_copy); my_strdup2(404, &express, ntok_copy);
} }
dbg(1, "express=|%s|\n", express); dbg(1, "express=|%s|\n", express);
if(strpbrk(express, " \n\t")) { if(strpbrk(express, " \n\t")) {
@ -3850,7 +3850,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
ofs_end = ofs + xctx->raw->npoints[dset]; ofs_end = ofs + xctx->raw->npoints[dset];
first = -1; first = -1;
poly_npoints = 0; poly_npoints = 0;
my_realloc(_ALLOC_ID_, &point, xctx->raw->npoints[dset] * sizeof(XPoint)); my_realloc(405, &point, xctx->raw->npoints[dset] * sizeof(XPoint));
/* Process "npoints" simulation items /* Process "npoints" simulation items
* p loop split repeated 2 timed (for x and y points) to preserve cache locality */ * p loop split repeated 2 timed (for x and y points) to preserve cache locality */
prev_x = 0; prev_x = 0;
@ -3935,11 +3935,11 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
show_node_measures(measure_p, measure_x, measure_prev_x, bus_msb, wave_color, 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); idx, idx_arr, n_bits, n_nodes, ntok_copy, wcnt, gr, r, cursor1);
my_free(_ALLOC_ID_, &point); my_free(406, &point);
if(idx_arr) my_free(_ALLOC_ID_, &idx_arr); if(idx_arr) my_free(407, &idx_arr);
} /* if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) */ } /* if( expression || (idx = get_raw_index(bus_msb ? bus_msb : express, NULL)) != -1 ) */
++wcnt; ++wcnt;
if(bus_msb) my_free(_ALLOC_ID_, &bus_msb); if(bus_msb) my_free(408, &bus_msb);
if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */ if(save_npoints != -1) { /* restore multiple OP points from artificial dc sweep */
xctx->raw->datasets = save_datasets; xctx->raw->datasets = save_datasets;
xctx->raw->npoints[0] = save_npoints; xctx->raw->npoints[0] = save_npoints;
@ -3950,14 +3950,14 @@ void draw_graph(int i, const int flags, Graph_ctx *gr, void *ct)
} }
} /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */ } /* while( (ntok = my_strtok_r(nptr, "\n\t ", "", 0, &saven)) ) */
if(ntok_copy) my_free(_ALLOC_ID_, &ntok_copy); if(ntok_copy) my_free(409, &ntok_copy);
if(express) my_free(_ALLOC_ID_, &express); if(express) my_free(410, &express);
/* if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0); */ /* if(sch_waves_loaded()!= -1 && custom_rawfile[0]) extra_rawfile(5, NULL, NULL, -1.0, -1.0); */
my_free(_ALLOC_ID_, &custom_rawfile); my_free(411, &custom_rawfile);
my_free(_ALLOC_ID_, &sim_type); my_free(412, &sim_type);
my_free(_ALLOC_ID_, &node); my_free(413, &node);
my_free(_ALLOC_ID_, &color); my_free(414, &color);
my_free(_ALLOC_ID_, &sweep); my_free(415, &sweep);
} /* if(flags & 8) */ } /* if(flags & 8) */
/* /*
* bbox(START, 0.0, 0.0, 0.0, 0.0); * bbox(START, 0.0, 0.0, 0.0, 0.0);
@ -4063,7 +4063,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; png_to_byte_closure_t *closure = (png_to_byte_closure_t *) in_closure;
if(!in_data) return CAIRO_STATUS_WRITE_ERROR; if(!in_data) return CAIRO_STATUS_WRITE_ERROR;
if(closure->pos + length > closure->size) { if(closure->pos + length > closure->size) {
my_realloc(_ALLOC_ID_, &closure->buffer, closure->pos + length + 65536); my_realloc(416, &closure->buffer, closure->pos + length + 65536);
closure->size = closure->pos + length + 65536; closure->size = closure->pos + length + 65536;
} }
memcpy(closure->buffer + closure->pos, in_data, length); memcpy(closure->buffer + closure->pos, in_data, length);
@ -4209,9 +4209,9 @@ int edit_image(int what, xRect *r)
/* put base64 encoded data to rect image_data attribute */ /* put base64 encoded data to rect image_data attribute */
encoded_data = base64_encode((unsigned char *)closure.buffer, closure.size, &olength, 0); encoded_data = base64_encode((unsigned char *)closure.buffer, closure.size, &olength, 0);
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data)); my_strdup2(417, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data));
my_free(_ALLOC_ID_, &closure.buffer); my_free(418, &closure.buffer);
my_free(_ALLOC_ID_, &encoded_data); my_free(419, &encoded_data);
} }
dbg(1, "size_x = %d, size_y = %d, stride = %d\n", size_x, size_y, stride); dbg(1, "size_x = %d, size_y = %d, stride = %d\n", size_x, size_y, stride);
return 1; return 1;
@ -4245,7 +4245,7 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char *
fd = fopen(filename, fopen_read_mode); fd = fopen(filename, fopen_read_mode);
if(fd) { if(fd) {
size_t bytes_read; size_t bytes_read;
filedata = my_malloc(_ALLOC_ID_, filesize); filedata = my_malloc(420, filesize);
if((bytes_read = fread(filedata, 1, filesize, fd)) < filesize) { if((bytes_read = fread(filedata, 1, filesize, fd)) < filesize) {
filesize = bytes_read; filesize = bytes_read;
dbg(0, "get_surface_from_file(): less bytes read than expected from %s, got %ld bytes\n", dbg(0, "get_surface_from_file(): less bytes read than expected from %s, got %ld bytes\n",
@ -4264,11 +4264,11 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char *
size_t filtered_img_size = 0; size_t filtered_img_size = 0;
char *filtered_img_data = NULL; char *filtered_img_data = NULL;
filter_data(filedata, filesize, &filtered_img_data, &filtered_img_size, filter); filter_data(filedata, filesize, &filtered_img_data, &filtered_img_size, filter);
my_free(_ALLOC_ID_, &filedata); my_free(421, &filedata);
closure.buffer = (unsigned char *)filtered_img_data; closure.buffer = (unsigned char *)filtered_img_data;
closure.size = filtered_img_size; closure.size = filtered_img_size;
closure.pos = 0; closure.pos = 0;
my_free(_ALLOC_ID_, &filter); my_free(422, &filter);
} else { /* no filter attribute */ } else { /* no filter attribute */
closure.buffer = (unsigned char *)filedata; closure.buffer = (unsigned char *)filedata;
filedata = NULL; filedata = NULL;
@ -4294,7 +4294,7 @@ static cairo_surface_t *get_surface_from_file(const char *filename, const char *
if(!surface || cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) { if(!surface || cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
if(jpg != 1) dbg(0, "draw_image(): failure creating image surface from %s\n", filename); if(jpg != 1) dbg(0, "draw_image(): failure creating image surface from %s\n", filename);
if(surface) cairo_surface_destroy(surface); if(surface) cairo_surface_destroy(surface);
my_free(_ALLOC_ID_, &closure.buffer); my_free(423, &closure.buffer);
*buffer = NULL; *buffer = NULL;
*size = 0; *size = 0;
return NULL; return NULL;
@ -4337,7 +4337,7 @@ static cairo_surface_t *get_surface_from_b64data(const char *attr, size_t attr_l
if(surface) cairo_surface_destroy(surface); if(surface) cairo_surface_destroy(surface);
surface = NULL; surface = NULL;
} }
my_free(_ALLOC_ID_, &closure.buffer); my_free(424, &closure.buffer);
return surface; return surface;
} }
#endif /* HAS_CAIRO==1 */ #endif /* HAS_CAIRO==1 */
@ -4390,16 +4390,16 @@ int draw_image(int dr, xRect *r, double *x1, double *y1, double *x2, double *y2,
char *encoded_data = NULL; char *encoded_data = NULL;
size_t olength; size_t olength;
my_strdup(_ALLOC_ID_, &filter, get_tok_value(r->prop_ptr, "filter", 0)); my_strdup(425, &filter, get_tok_value(r->prop_ptr, "filter", 0));
emb_ptr->image = get_surface_from_file(filename, filter, &buffer, &size); emb_ptr->image = get_surface_from_file(filename, filter, &buffer, &size);
if(!emb_ptr->image) { if(!emb_ptr->image) {
return 0; return 0;
} }
/* put base64 encoded data to rect image_data attribute */ /* put base64 encoded data to rect image_data attribute */
encoded_data = base64_encode((unsigned char *)buffer, size, &olength, 0); encoded_data = base64_encode((unsigned char *)buffer, size, &olength, 0);
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data)); my_strdup2(426, &r->prop_ptr, subst_token(r->prop_ptr, "image_data", encoded_data));
my_free(_ALLOC_ID_, &encoded_data); my_free(427, &encoded_data);
my_free(_ALLOC_ID_, &buffer); my_free(428, &buffer);
} else { /* no emb_ptr->image and no "image_data" attribute */ } else { /* no emb_ptr->image and no "image_data" attribute */
return 0; return 0;
} }
@ -4551,7 +4551,7 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2,
closure.pos = 0; closure.pos = 0;
cairo_surface_write_to_png_stream(png_sfc, png_writer, &closure); cairo_surface_write_to_png_stream(png_sfc, png_writer, &closure);
ptr = base64_encode(closure.buffer, closure.pos, &olength, 1); ptr = base64_encode(closure.buffer, closure.pos, &olength, 1);
my_free(_ALLOC_ID_, &closure.buffer); my_free(429, &closure.buffer);
cairo_surface_destroy(png_sfc); cairo_surface_destroy(png_sfc);
xctx->draw_pixmap=1; xctx->draw_pixmap=1;
xctx->draw_window=save_draw_window; xctx->draw_window=save_draw_window;
@ -4573,7 +4573,7 @@ void svg_embedded_graph(FILE *fd, xRect *r, double rx1, double ry1, double rx2,
"xlink:href=\"data:image/png;base64,%s\"/>\n", "xlink:href=\"data:image/png;base64,%s\"/>\n",
0.0, 0.0, w, h, transform, ptr); 0.0, 0.0, w, h, transform, ptr);
} }
my_free(_ALLOC_ID_, &ptr); my_free(430, &ptr);
#endif #endif
} }

View File

@ -127,7 +127,7 @@ char *my_fgets(FILE *fd, size_t *line_len)
if(line_len) *line_len = 0; if(line_len) *line_len = 0;
while(fgets(buf, SIZE, fd)) { while(fgets(buf, SIZE, fd)) {
my_strcat(_ALLOC_ID_, &s, buf); my_strcat(431, &s, buf);
len = strlen(buf); len = strlen(buf);
if(line_len) *line_len += len; if(line_len) *line_len += len;
if(buf[len - 1] == '\n') break; if(buf[len - 1] == '\n') break;
@ -193,7 +193,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); dbg(3,"my_strdup(%d,): duplicated string %s\n", id, src);
return len-1; return len-1;
} else if(*dest) { } else if(*dest) {
my_free(_ALLOC_ID_, dest); my_free(432, dest);
dbg(3,"my_strdup(%d,): freed destination ptr\n", id); dbg(3,"my_strdup(%d,): freed destination ptr\n", id);
} }
@ -206,7 +206,7 @@ void my_strndup(int id, char **dest, const char *src, size_t n) /* empty source
{ {
if(*dest!=NULL) { if(*dest!=NULL) {
dbg(3," my_strndup: calling my_free\n"); dbg(3," my_strndup: calling my_free\n");
my_free(_ALLOC_ID_, dest); my_free(433, dest);
} }
if(src!=NULL && src[0]!='\0') if(src!=NULL && src[0]!='\0')
{ {
@ -236,7 +236,7 @@ char *my_expand(const char *s, int tabstop)
if(!s) { if(!s) {
return NULL; return NULL;
} }
my_strcat2(_ALLOC_ID_, &t, ""); my_strcat2(434, &t, "");
while(*sptr) { while(*sptr) {
if(*sptr == '\t') { if(*sptr == '\t') {
int i; int i;
@ -249,7 +249,7 @@ char *my_expand(const char *s, int tabstop)
pad[1] = '\0'; pad[1] = '\0';
spos++; spos++;
} }
my_strcat2(_ALLOC_ID_, &t, pad); my_strcat2(435, &t, pad);
if(*sptr == '\n') spos = 0; if(*sptr == '\n') spos = 0;
sptr++; sptr++;
} }
@ -427,7 +427,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); dbg(3,"my_strdup2(%d,): duplicated string %s\n", id, src);
return len-1; return len-1;
} else if(*dest) { } else if(*dest) {
my_free(_ALLOC_ID_, dest); my_free(436, dest);
dbg(3,"my_strdup2(%d,): freed destination ptr\n", id); dbg(3,"my_strdup2(%d,): freed destination ptr\n", id);
} }
return 0; return 0;
@ -776,11 +776,11 @@ void set_inst_prop(int i)
ptr = (xctx->inst[i].ptr+ xctx->sym)->templ; ptr = (xctx->inst[i].ptr+ xctx->sym)->templ;
dbg(1, "set_inst_prop(): i=%d, name=%s, prop_ptr = %s, template=%s\n", 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); i, xctx->inst[i].name, xctx->inst[i].prop_ptr, ptr);
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, ptr); my_strdup(437, &xctx->inst[i].prop_ptr, ptr);
if(get_tok_value(ptr, "name",0)[0]) { if(get_tok_value(ptr, "name",0)[0]) {
my_strdup(_ALLOC_ID_, &tmp, xctx->inst[i].prop_ptr); my_strdup(438, &tmp, xctx->inst[i].prop_ptr);
new_prop_string(i, tmp, tclgetboolvar("disable_unique_names")); /* sets also inst[].instname */ new_prop_string(i, tmp, tclgetboolvar("disable_unique_names")); /* sets also inst[].instname */
my_free(_ALLOC_ID_, &tmp); my_free(439, &tmp);
} }
} }
@ -941,7 +941,7 @@ static int edit_rect_property(int x)
fprintf(errfp, "edit_rect_property() : unknown parameter x=%d\n",x); fprintf(errfp, "edit_rect_property() : unknown parameter x=%d\n",x);
return 0; return 0;
} }
my_strdup(_ALLOC_ID_, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); my_strdup(440, &oldprop, xctx->rect[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
if(oldprop && oldprop[0]) { if(oldprop && oldprop[0]) {
tclsetvar("retval",oldprop); tclsetvar("retval",oldprop);
} else { } else {
@ -965,7 +965,7 @@ static int edit_rect_property(int x)
if(oldprop && preserve == 1) { if(oldprop && preserve == 1) {
set_different_token(&xctx->rect[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop); set_different_token(&xctx->rect[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop);
} else { } else {
my_strdup(_ALLOC_ID_, &xctx->rect[c][n].prop_ptr, my_strdup(441, &xctx->rect[c][n].prop_ptr,
(char *) tclgetvar("retval")); (char *) tclgetvar("retval"));
} }
set_rect_flags(&xctx->rect[c][n]); /* set cached .flags bitmask from attributes */ set_rect_flags(&xctx->rect[c][n]); /* set cached .flags bitmask from attributes */
@ -1019,7 +1019,7 @@ static int edit_rect_property(int x)
bbox(END , 0.0 , 0.0 , 0.0 , 0.0); bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
} }
} }
my_free(_ALLOC_ID_, &oldprop); my_free(442, &oldprop);
return modified; return modified;
} }
@ -1029,7 +1029,7 @@ static int edit_line_property(void)
const char *dash; const char *dash;
int preserve, modified = 0; int preserve, modified = 0;
char *oldprop=NULL; char *oldprop=NULL;
my_strdup(_ALLOC_ID_, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); my_strdup(443, &oldprop, xctx->line[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
if(oldprop && oldprop[0]) { if(oldprop && oldprop[0]) {
tclsetvar("retval", oldprop); tclsetvar("retval", oldprop);
} else { } else {
@ -1051,7 +1051,7 @@ static int edit_line_property(void)
if(oldprop && preserve == 1) { if(oldprop && preserve == 1) {
set_different_token(&xctx->line[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop); set_different_token(&xctx->line[c][n].prop_ptr, (char *) tclgetvar("retval"), oldprop);
} else { } else {
my_strdup(_ALLOC_ID_, &xctx->line[c][n].prop_ptr, my_strdup(444, &xctx->line[c][n].prop_ptr,
(char *) tclgetvar("retval")); (char *) tclgetvar("retval"));
} }
xctx->line[c][n].bus = !strboolcmp(get_tok_value(xctx->line[c][n].prop_ptr,"bus",0), "true"); xctx->line[c][n].bus = !strboolcmp(get_tok_value(xctx->line[c][n].prop_ptr,"bus",0), "true");
@ -1073,7 +1073,7 @@ static int edit_line_property(void)
bbox(END , 0.0 , 0.0 , 0.0 , 0.0); bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
modified = 1; modified = 1;
} }
my_free(_ALLOC_ID_, &oldprop); my_free(445, &oldprop);
return modified; return modified;
} }
@ -1085,7 +1085,7 @@ static int edit_wire_property(void)
char *oldprop=NULL; char *oldprop=NULL;
const char *bus_ptr; const char *bus_ptr;
my_strdup(_ALLOC_ID_, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr); my_strdup(446, &oldprop, xctx->wire[xctx->sel_array[0].n].prop_ptr);
if(oldprop && oldprop[0]) { if(oldprop && oldprop[0]) {
tclsetvar("retval", oldprop); tclsetvar("retval", oldprop);
} else { } else {
@ -1111,7 +1111,7 @@ static int edit_wire_property(void)
if(oldprop && preserve == 1) { if(oldprop && preserve == 1) {
set_different_token(&xctx->wire[k].prop_ptr, (char *) tclgetvar("retval"), oldprop); set_different_token(&xctx->wire[k].prop_ptr, (char *) tclgetvar("retval"), oldprop);
} else { } else {
my_strdup(_ALLOC_ID_, &xctx->wire[k].prop_ptr,(char *) tclgetvar("retval")); my_strdup(447, &xctx->wire[k].prop_ptr,(char *) tclgetvar("retval"));
} }
bus_ptr = get_tok_value(xctx->wire[k].prop_ptr,"bus",0); bus_ptr = get_tok_value(xctx->wire[k].prop_ptr,"bus",0);
if(!strboolcmp(bus_ptr, "true")) { if(!strboolcmp(bus_ptr, "true")) {
@ -1137,7 +1137,7 @@ static int edit_wire_property(void)
bbox(END , 0.0 , 0.0 , 0.0 , 0.0); bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
modified = 1; modified = 1;
} }
my_free(_ALLOC_ID_, &oldprop); my_free(448, &oldprop);
return modified; return modified;
} }
@ -1150,7 +1150,7 @@ static int edit_arc_property(void)
const char *dash, *fill_ptr; const char *dash, *fill_ptr;
int preserve, modified = 0; int preserve, modified = 0;
my_strdup(_ALLOC_ID_, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); my_strdup(449, &oldprop, xctx->arc[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
if(oldprop && oldprop[0]) { if(oldprop && oldprop[0]) {
tclsetvar("retval", oldprop); tclsetvar("retval", oldprop);
} else { } else {
@ -1173,7 +1173,7 @@ static int edit_arc_property(void)
set_different_token(&xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop); set_different_token(&xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop);
} else { } else {
my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval")); my_strdup(450, &xctx->arc[c][i].prop_ptr, (char *) tclgetvar("retval"));
} }
old_fill = xctx->arc[c][i].fill; old_fill = xctx->arc[c][i].fill;
fill_ptr = get_tok_value(xctx->arc[c][i].prop_ptr,"fill",0); fill_ptr = get_tok_value(xctx->arc[c][i].prop_ptr,"fill",0);
@ -1225,7 +1225,7 @@ static int edit_polygon_property(void)
int preserve, modified = 0; int preserve, modified = 0;
dbg(1, "edit_property(): input property:\n"); dbg(1, "edit_property(): input property:\n");
my_strdup(_ALLOC_ID_, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr); my_strdup(451, &oldprop, xctx->poly[xctx->sel_array[0].col][xctx->sel_array[0].n].prop_ptr);
if(oldprop && oldprop[0]) { if(oldprop && oldprop[0]) {
tclsetvar("retval", oldprop); tclsetvar("retval", oldprop);
} else { } else {
@ -1248,7 +1248,7 @@ static int edit_polygon_property(void)
if(oldprop && preserve == 1) { if(oldprop && preserve == 1) {
set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop); set_different_token(&xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"), oldprop);
} else { } else {
my_strdup(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval")); my_strdup(452, &xctx->poly[c][i].prop_ptr, (char *) tclgetvar("retval"));
} }
old_fill = xctx->poly[c][i].fill; old_fill = xctx->poly[c][i].fill;
old_dash = xctx->poly[c][i].dash; old_dash = xctx->poly[c][i].dash;
@ -1315,7 +1315,7 @@ static int edit_text_property(int x)
} }
dbg(1, "edit_text_property(): entering\n"); dbg(1, "edit_text_property(): entering\n");
sel = xctx->sel_array[0].n; sel = xctx->sel_array[0].n;
my_strdup(_ALLOC_ID_, &oldprop, xctx->text[sel].prop_ptr); my_strdup(453, &oldprop, xctx->text[sel].prop_ptr);
if(oldprop && oldprop[0]) if(oldprop && oldprop[0])
tclsetvar("props", oldprop); tclsetvar("props", oldprop);
else else
@ -1370,7 +1370,7 @@ static int edit_text_property(int x)
xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter, xctx->text[sel].yscale, (short)rot, (short)flip, xctx->text[sel].hcenter,
xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0, xctx->text[sel].vcenter, xctx->text[sel].x0, xctx->text[sel].y0,
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(454, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
@ -1379,7 +1379,7 @@ static int edit_text_property(int x)
/* dbg(1, "edit_property(): text props=%s text=%s\n", tclgetvar("props"), tclgetvar("retval")); */ /* dbg(1, "edit_property(): text props=%s text=%s\n", tclgetvar("props"), tclgetvar("retval")); */
if(text_changed) { if(text_changed) {
double cg; double cg;
my_free(_ALLOC_ID_, &xctx->text[sel].floater_ptr); my_free(455, &xctx->text[sel].floater_ptr);
cg = tclgetdoublevar("cadgrid"); cg = tclgetdoublevar("cadgrid");
c = xctx->rects[PINLAYER]; c = xctx->rects[PINLAYER];
for(l=0;l<c; ++l) { for(l=0;l<c; ++l) {
@ -1396,25 +1396,25 @@ static int edit_text_property(int x)
(fabs(yy1 - pcy) < cg*3 || fabs(yy2 - pcy) < cg*3) ) (fabs(yy1 - pcy) < cg*3 || fabs(yy2 - pcy) < cg*3) )
) { ) {
if(x==0) if(x==0)
my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr, my_strdup(456, &xctx->rect[PINLAYER][l].prop_ptr,
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name", subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
(char *) tclgetvar("retval")) ); (char *) tclgetvar("retval")) );
else else
my_strdup(_ALLOC_ID_, &xctx->rect[PINLAYER][l].prop_ptr, my_strdup(457, &xctx->rect[PINLAYER][l].prop_ptr,
subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name", subst_token(xctx->rect[PINLAYER][l].prop_ptr, "name",
(char *) tclgetvar("retval")) ); (char *) tclgetvar("retval")) );
} }
} }
} }
my_strdup2(_ALLOC_ID_, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval")); my_strdup2(458, &xctx->text[sel].txt_ptr, (char *) tclgetvar("retval"));
} }
if(props_changed) { if(props_changed) {
if(oldprop && preserve) if(oldprop && preserve)
set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop); set_different_token(&xctx->text[sel].prop_ptr, (char *) tclgetvar("props"), oldprop);
else else
my_strdup(_ALLOC_ID_, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props")); my_strdup(459, &xctx->text[sel].prop_ptr,(char *) tclgetvar("props"));
my_free(_ALLOC_ID_, &xctx->text[sel].floater_ptr); my_free(460, &xctx->text[sel].floater_ptr);
set_text_flags(&xctx->text[sel]); set_text_flags(&xctx->text[sel]);
} }
if(text_changed || props_changed) { if(text_changed || props_changed) {
@ -1427,7 +1427,7 @@ static int edit_text_property(int x)
} /* for(k=0;k<xctx->lastsel; ++k) */ } /* for(k=0;k<xctx->lastsel; ++k) */
draw(); draw();
} }
my_free(_ALLOC_ID_, &oldprop); my_free(461, &oldprop);
return modified; return modified;
} }
@ -1447,9 +1447,9 @@ int drc_check(int i)
end = i + 1; end = i + 1;
} }
for(j = start; j < end; j++) { for(j = start; j < end; j++) {
my_strdup(_ALLOC_ID_, &drc, get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, "drc", 2)); my_strdup(462, &drc, get_tok_value(xctx->sym[xctx->inst[j].ptr].prop_ptr, "drc", 2));
if(drc) { if(drc) {
my_strdup(_ALLOC_ID_, &res, translate3(drc, 1, my_strdup(463, &res, translate3(drc, 1,
xctx->inst[j].prop_ptr, xctx->sym[xctx->inst[j].ptr].templ, NULL)); xctx->inst[j].prop_ptr, xctx->sym[xctx->inst[j].ptr].templ, NULL));
dbg(1, "drc_check(): res = |%s|, drc=|%s|\n", res, drc); dbg(1, "drc_check(): res = |%s|, drc=|%s|\n", res, drc);
if(res) { if(res) {
@ -1460,13 +1460,13 @@ int drc_check(int i)
result = tcleval(replace_res); result = tcleval(replace_res);
if(result && result[0]) { if(result && result[0]) {
ret = 1; ret = 1;
my_mstrcat(_ALLOC_ID_, &check_result, result, NULL); my_mstrcat(464, &check_result, result, NULL);
} }
} }
} }
} }
if(drc) my_free(_ALLOC_ID_, &drc); if(drc) my_free(465, &drc);
if(res) my_free(_ALLOC_ID_, &res); if(res) my_free(466, &res);
if(check_result) { if(check_result) {
if(has_x) { if(has_x) {
/* tclvareval("alert_ {", check_result, "} {}", NULL); */ /* tclvareval("alert_ {", check_result, "} {}", NULL); */
@ -1475,7 +1475,7 @@ int drc_check(int i)
} else { } else {
dbg(0, "%s\n", check_result); dbg(0, "%s\n", check_result);
} }
my_free(_ALLOC_ID_, &check_result); my_free(467, &check_result);
} }
return ret; return ret;
} }
@ -1500,19 +1500,19 @@ static int update_symbol(const char *result, int x, int selected_inst)
*ii = selected_inst; *ii = selected_inst;
if(!result) { if(!result) {
dbg(1, "update_symbol(): edit symbol prop aborted\n"); dbg(1, "update_symbol(): edit symbol prop aborted\n");
my_free(_ALLOC_ID_, &xctx->old_prop); my_free(468, &xctx->old_prop);
return 0; return 0;
} }
/* create new_prop updated attribute string */ /* create new_prop updated attribute string */
if(*netl_com && x==1) { if(*netl_com && x==1) {
my_strdup(_ALLOC_ID_, &new_prop, my_strdup(469, &new_prop,
subst_token(xctx->old_prop, "value", (char *) tclgetvar("retval") ) subst_token(xctx->old_prop, "value", (char *) tclgetvar("retval") )
); );
dbg(1, "update_symbol(): new_prop=%s\n", new_prop); dbg(1, "update_symbol(): new_prop=%s\n", new_prop);
dbg(1, "update_symbol(): tcl retval==%s\n", tclgetvar("retval")); dbg(1, "update_symbol(): tcl retval==%s\n", tclgetvar("retval"));
} }
else { else {
my_strdup(_ALLOC_ID_, &new_prop, (char *) tclgetvar("retval")); my_strdup(470, &new_prop, (char *) tclgetvar("retval"));
dbg(1, "update_symbol(): new_prop=%s\n", new_prop); dbg(1, "update_symbol(): new_prop=%s\n", new_prop);
} }
my_strncpy(symbol, (char *) tclgetvar("symbol") , S(symbol)); my_strncpy(symbol, (char *) tclgetvar("symbol") , S(symbol));
@ -1540,18 +1540,18 @@ static int update_symbol(const char *result, int x, int selected_inst)
/* 20171220 calculate bbox before changes to correctly redraw areas */ /* 20171220 calculate bbox before changes to correctly redraw areas */
/* must be recalculated as cairo text extents vary with zoom factor. */ /* 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); symbol_bbox(*ii, &xctx->inst[*ii].x1, &xctx->inst[*ii].y1, &xctx->inst[*ii].x2, &xctx->inst[*ii].y2);
my_strdup2(_ALLOC_ID_, &old_translated_sym, translate(*ii, xctx->inst[*ii].name)); my_strdup2(471, &old_translated_sym, translate(*ii, xctx->inst[*ii].name));
/* update property string from tcl dialog */ /* update property string from tcl dialog */
if(!no_change_props) if(!no_change_props)
{ {
if(only_different) { if(only_different) {
char * ss=NULL; char * ss=NULL;
my_strdup(_ALLOC_ID_, &ss, xctx->inst[*ii].prop_ptr); my_strdup(472, &ss, xctx->inst[*ii].prop_ptr);
if( set_different_token(&ss, new_prop, xctx->old_prop) ) { if( set_different_token(&ss, new_prop, xctx->old_prop) ) {
if(!pushed) { xctx->push_undo(); pushed=1;} if(!pushed) { xctx->push_undo(); pushed=1;}
my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, ss); my_strdup(473, &xctx->inst[*ii].prop_ptr, ss);
} }
my_free(_ALLOC_ID_, &ss); my_free(474, &ss);
} }
else { else {
if(new_prop) { if(new_prop) {
@ -1560,11 +1560,11 @@ static int update_symbol(const char *result, int x, int selected_inst)
xctx->inst[*ii].prop_ptr, new_prop); xctx->inst[*ii].prop_ptr, new_prop);
if(!pushed) { xctx->push_undo(); pushed=1;} if(!pushed) { xctx->push_undo(); pushed=1;}
dbg(1, "update_symbol(): *ii=%d, new_prop=%s\n", *ii, new_prop ? new_prop : "NULL"); dbg(1, "update_symbol(): *ii=%d, new_prop=%s\n", *ii, new_prop ? new_prop : "NULL");
my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, new_prop); my_strdup(475, &xctx->inst[*ii].prop_ptr, new_prop);
} }
} else { } else {
if(!pushed) { xctx->push_undo(); pushed=1;} if(!pushed) { xctx->push_undo(); pushed=1;}
my_strdup(_ALLOC_ID_, &xctx->inst[*ii].prop_ptr, ""); my_strdup(476, &xctx->inst[*ii].prop_ptr, "");
} }
} }
} }
@ -1573,7 +1573,7 @@ static int update_symbol(const char *result, int x, int selected_inst)
* to use for inst name (from symbol template) */ * to use for inst name (from symbol template) */
prefix = 0; prefix = 0;
sym_number = -1; sym_number = -1;
my_strdup2(_ALLOC_ID_, &translated_sym, translate(*ii, symbol)); my_strdup2(477, &translated_sym, translate(*ii, symbol));
dbg(1, "update_symbol: %s -- %s\n", translated_sym, old_translated_sym); dbg(1, "update_symbol: %s -- %s\n", translated_sym, old_translated_sym);
if(changed_symbol || if(changed_symbol ||
( !strcmp(symbol, xctx->inst[*ii].name) && strcmp(translated_sym, old_translated_sym) ) ) { ( !strcmp(symbol, xctx->inst[*ii].name) && strcmp(translated_sym, old_translated_sym) ) ) {
@ -1589,23 +1589,23 @@ 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 */ 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* */ /* if number of pins is different we must delete these data *before* */
/* changing ysmbol, otherwise *ii might end up deleting non allocated data. */ /* changing ysmbol, otherwise *ii might end up deleting non allocated data. */
my_strdup2(_ALLOC_ID_, &xctx->inst[*ii].name, rel_sym_path(symbol)); my_strdup2(478, &xctx->inst[*ii].name, rel_sym_path(symbol));
xctx->inst[*ii].ptr=sym_number; /* update instance to point to new symbol */ xctx->inst[*ii].ptr=sym_number; /* update instance to point to new symbol */
} }
my_free(_ALLOC_ID_, &translated_sym); my_free(479, &translated_sym);
my_free(_ALLOC_ID_, &old_translated_sym); my_free(480, &old_translated_sym);
/* if symbol changed ensure instance name (with new prefix char) is unique */ /* if symbol changed ensure instance name (with new prefix char) is unique */
/* preserve backslashes in name ---------0---------------------------------->. */ /* preserve backslashes in name ---------0---------------------------------->. */
my_strdup(_ALLOC_ID_, &name, get_tok_value(xctx->inst[*ii].prop_ptr, "name", 1)); my_strdup(481, &name, get_tok_value(xctx->inst[*ii].prop_ptr, "name", 1));
if(name && name[0] ) { if(name && name[0] ) {
dbg(1, "update_symbol(): prefix!='\\0', name=%s\n", name); dbg(1, "update_symbol(): prefix!='\\0', name=%s\n", name);
/* change prefix if changing symbol type; */ /* change prefix if changing symbol type; */
if(prefix && old_prefix && old_prefix != prefix) { if(prefix && old_prefix && old_prefix != prefix) {
name[0]=(char)prefix; name[0]=(char)prefix;
my_strdup(_ALLOC_ID_, &ptr, subst_token(xctx->inst[*ii].prop_ptr, "name", name) ); my_strdup(482, &ptr, subst_token(xctx->inst[*ii].prop_ptr, "name", name) );
} else { } else {
my_strdup(_ALLOC_ID_, &ptr, xctx->inst[*ii].prop_ptr); my_strdup(483, &ptr, xctx->inst[*ii].prop_ptr);
} }
/* set unique name of current inst */ /* set unique name of current inst */
if(!pushed) { xctx->push_undo(); pushed=1;} if(!pushed) { xctx->push_undo(); pushed=1;}
@ -1636,10 +1636,10 @@ static int update_symbol(const char *result, int x, int selected_inst)
/* redraw symbol with new props */ /* redraw symbol with new props */
set_modify(-2); /* reset floaters caches */ set_modify(-2); /* reset floaters caches */
draw(); draw();
my_free(_ALLOC_ID_, &name); my_free(484, &name);
my_free(_ALLOC_ID_, &ptr); my_free(485, &ptr);
my_free(_ALLOC_ID_, &new_prop); my_free(486, &new_prop);
my_free(_ALLOC_ID_, &xctx->old_prop); my_free(487, &xctx->old_prop);
return modified; return modified;
} }
@ -1666,12 +1666,12 @@ static int edit_symbol_property(int x, int first_sel)
else { else {
tclsetvar("retval",""); tclsetvar("retval","");
} }
my_strdup(_ALLOC_ID_, &xctx->old_prop, xctx->inst[*ii].prop_ptr); my_strdup(488, &xctx->old_prop, xctx->inst[*ii].prop_ptr);
tclsetvar("symbol",xctx->inst[*ii].name); tclsetvar("symbol",xctx->inst[*ii].name);
if(x==0) { if(x==0) {
tcleval("edit_prop {Input property:}"); tcleval("edit_prop {Input property:}");
my_strdup(_ALLOC_ID_, &result, tclresult()); my_strdup(489, &result, tclresult());
} }
else { else {
/* edit_vi_netlist_prop will replace \" with " before editing, /* edit_vi_netlist_prop will replace \" with " before editing,
@ -1680,11 +1680,11 @@ static int edit_symbol_property(int x, int first_sel)
if(*netl_com && x==1) tcleval("edit_vi_netlist_prop {Input property:}"); 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==1) tcleval("edit_vi_prop {Input property:}");
else if(x==2) tcleval("viewdata $::retval"); else if(x==2) tcleval("viewdata $::retval");
my_strdup(_ALLOC_ID_, &result, tclresult()); my_strdup(490, &result, tclresult());
} }
dbg(1, "edit_symbol_property(): before update_symbol, modified=%d\n", xctx->modified); dbg(1, "edit_symbol_property(): before update_symbol, modified=%d\n", xctx->modified);
modified = update_symbol(result, x, *ii); modified = update_symbol(result, x, *ii);
my_free(_ALLOC_ID_, &result); my_free(491, &result);
dbg(1, "edit_symbol_property(): done update_symbol, modified=%d\n", modified); dbg(1, "edit_symbol_property(): done update_symbol, modified=%d\n", modified);
*ii=-1; *ii=-1;
return modified; return modified;
@ -1780,7 +1780,7 @@ char *str_replace(const char *str, const char *rep, const char *with, int escape
int cond; int cond;
if(s==NULL || rep == NULL || with == NULL || rep[0] == '\0') { if(s==NULL || rep == NULL || with == NULL || rep[0] == '\0') {
my_free(_ALLOC_ID_, &result); my_free(492, &result);
size = 0; size = 0;
return NULL; return NULL;
} }
@ -1789,7 +1789,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); dbg(1, "str_replace(): %s, %s, %s\n", s, rep, with);
if( size == 0 ) { if( size == 0 ) {
size = CADCHUNKALLOC; size = CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &result, size); my_realloc(493, &result, size);
} }
while(*s) { while(*s) {
STR_ALLOC(&result, result_pos + with_len + 1, &size); STR_ALLOC(&result, result_pos + with_len + 1, &size);
@ -1814,7 +1814,7 @@ char *str_chars_replace(const char *str, const char *replace_set, const char wit
{ {
char *res = NULL; char *res = NULL;
char *s; char *s;
my_strdup(_ALLOC_ID_, &res, str); my_strdup(494, &res, str);
s = res; s = res;
dbg(1, "*str_chars_replace(): %s\n", res); dbg(1, "*str_chars_replace(): %s\n", res);
while( *s) { while( *s) {
@ -1881,9 +1881,9 @@ void edit_property(int x)
dbg(1, "edit_property(): done executing edit_vi_prop, result=%s\n",tclresult()); dbg(1, "edit_property(): done executing edit_vi_prop, result=%s\n",tclresult());
dbg(1, "edit_property(): tctx::rcode=%s\n",tclgetvar("tctx::rcode") ); dbg(1, "edit_property(): tctx::rcode=%s\n",tclgetvar("tctx::rcode") );
my_strdup(_ALLOC_ID_, &new_prop, (char *) tclgetvar("retval")); my_strdup(495, &new_prop, (char *) tclgetvar("retval"));
tclsetvar("retval", new_prop); tclsetvar("retval", new_prop);
my_free(_ALLOC_ID_, &new_prop); my_free(496, &new_prop);
if(strcmp(tclgetvar("tctx::rcode"),"") ) if(strcmp(tclgetvar("tctx::rcode"),"") )
@ -1892,31 +1892,31 @@ void edit_property(int x)
(!xctx->schsymbolprop || strcmp(xctx->schsymbolprop, tclgetvar("retval") ) ) ) { (!xctx->schsymbolprop || strcmp(xctx->schsymbolprop, tclgetvar("retval") ) ) ) {
xctx->push_undo(); xctx->push_undo();
modified = 1; modified = 1;
my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, (char *) tclgetvar("retval")); my_strdup(497, &xctx->schsymbolprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_VERILOG_NETLIST && } else if(xctx->netlist_type==CAD_VERILOG_NETLIST &&
(!xctx->schverilogprop || strcmp(xctx->schverilogprop, tclgetvar("retval") ) ) ) { (!xctx->schverilogprop || strcmp(xctx->schverilogprop, tclgetvar("retval") ) ) ) {
modified = 1; modified = 1;
xctx->push_undo(); xctx->push_undo();
my_strdup(_ALLOC_ID_, &xctx->schverilogprop, (char *) tclgetvar("retval")); my_strdup(498, &xctx->schverilogprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_SPICE_NETLIST && } else if(xctx->netlist_type==CAD_SPICE_NETLIST &&
(!xctx->schprop || strcmp(xctx->schprop, tclgetvar("retval") ) ) ) { (!xctx->schprop || strcmp(xctx->schprop, tclgetvar("retval") ) ) ) {
modified = 1; modified = 1;
xctx->push_undo(); xctx->push_undo();
my_strdup(_ALLOC_ID_, &xctx->schprop, (char *) tclgetvar("retval")); my_strdup(499, &xctx->schprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_TEDAX_NETLIST && } else if(xctx->netlist_type==CAD_TEDAX_NETLIST &&
(!xctx->schtedaxprop || strcmp(xctx->schtedaxprop, tclgetvar("retval") ) ) ) { (!xctx->schtedaxprop || strcmp(xctx->schtedaxprop, tclgetvar("retval") ) ) ) {
modified = 1; modified = 1;
xctx->push_undo(); xctx->push_undo();
my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, (char *) tclgetvar("retval")); my_strdup(500, &xctx->schtedaxprop, (char *) tclgetvar("retval"));
} else if(xctx->netlist_type==CAD_VHDL_NETLIST && } else if(xctx->netlist_type==CAD_VHDL_NETLIST &&
(!xctx->schvhdlprop || strcmp(xctx->schvhdlprop, tclgetvar("retval") ) ) ) { (!xctx->schvhdlprop || strcmp(xctx->schvhdlprop, tclgetvar("retval") ) ) ) {
modified = 1; modified = 1;
xctx->push_undo(); xctx->push_undo();
my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, (char *) tclgetvar("retval")); my_strdup(501, &xctx->schvhdlprop, (char *) tclgetvar("retval"));
} }
} }

View File

@ -70,13 +70,13 @@ static char *expandlabel_strdup(char *src)
char *ptr; char *ptr;
if(src==NULL || src[0]=='\0') { if(src==NULL || src[0]=='\0') {
ptr=NULL; ptr=NULL;
my_strdup(_ALLOC_ID_, &ptr,""); my_strdup(502, &ptr,"");
return ptr; return ptr;
} }
else else
{ {
ptr=NULL; ptr=NULL;
my_strdup(_ALLOC_ID_, &ptr,src); my_strdup(503, &ptr,src);
dbg(3, "expandlabel_strdup(): duplicated %lu string %s\n",(unsigned long)ptr,src); dbg(3, "expandlabel_strdup(): duplicated %lu string %s\n",(unsigned long)ptr,src);
return ptr; return ptr;
} }
@ -90,7 +90,7 @@ static char *expandlabel_strcat(char *s1, char *s2)
if(s1) l1=strlen(s1); if(s1) l1=strlen(s1);
if(s2) l2=strlen(s2); if(s2) l2=strlen(s2);
res=my_malloc(_ALLOC_ID_, l1+l2+1); /* 2 strings plus '\0' */ res=my_malloc(504, l1+l2+1); /* 2 strings plus '\0' */
if(s1) memcpy(res, s1, l1); if(s1) memcpy(res, s1, l1);
if(s2) memcpy(res + l1 , s2, l2+1); if(s2) memcpy(res + l1 , s2, l2+1);
else memcpy(res + l1 , "", 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(s1) l1=strlen(s1);
if(s2) l2=strlen(s2); if(s2) l2=strlen(s2);
res=my_malloc(_ALLOC_ID_, l1+l2+2); /* 2 strings plus 'c' and '\0' */ res=my_malloc(505, l1+l2+2); /* 2 strings plus 'c' and '\0' */
if(s1) memcpy(res, s1, l1); if(s1) memcpy(res, s1, l1);
res[l1] = c; res[l1] = c;
if(s2) memcpy(res + l1 + 1, s2, l2+1); 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(""); if(n==0) return expandlabel_strdup("");
len=strlen(s); len=strlen(s);
prev=s; prev=s;
ss = str=my_malloc(_ALLOC_ID_, (len+1)*n); ss = str=my_malloc(506, (len+1)*n);
str[0]='\0'; str[0]='\0';
for(pos=s;pos<=s+len;pos++) { for(pos=s;pos<=s+len;pos++) {
if(*pos==',' || *pos=='\0') { if(*pos==',' || *pos=='\0') {
@ -162,7 +162,7 @@ static char *expandlabel_strmult(int n, char *s)
if(n==0) return expandlabel_strdup(""); if(n==0) return expandlabel_strdup("");
len=strlen(s); len=strlen(s);
str=pos=my_malloc(_ALLOC_ID_, (len+1)*n); str=pos=my_malloc(507, (len+1)*n);
for(i=1;i<=n;i++) for(i=1;i<=n;i++)
{ {
/* strcpy(pos,s); */ /* strcpy(pos,s); */
@ -181,8 +181,8 @@ static char *expandlabel_strbus_suffix(char *s, int *n, char *suffix)
int tmplen; int tmplen;
char *res=NULL; char *res=NULL;
char *tmp=NULL; char *tmp=NULL;
my_realloc(_ALLOC_ID_, &res, n[0] * (strlen(s) + strlen(suffix) + 30)); my_realloc(508, &res, n[0] * (strlen(s) + strlen(suffix) + 30));
my_realloc(_ALLOC_ID_, &tmp, strlen(s) + strlen(suffix) + 30); my_realloc(509, &tmp, strlen(s) + strlen(suffix) + 30);
l=0; l=0;
for(i=1;i<n[0];i++) for(i=1;i<n[0];i++)
{ {
@ -191,7 +191,7 @@ static char *expandlabel_strbus_suffix(char *s, int *n, char *suffix)
memcpy(res+l,tmp, tmplen+1); /* 20180923 */ memcpy(res+l,tmp, tmplen+1); /* 20180923 */
l+=tmplen; l+=tmplen;
} }
my_free(_ALLOC_ID_, &tmp); my_free(510, &tmp);
sprintf(res+l, "%s[%d]%s", s, n[i], suffix); sprintf(res+l, "%s[%d]%s", s, n[i], suffix);
return res; return res;
} }
@ -202,8 +202,8 @@ static char *expandlabel_strbus(char *s, int *n)
int tmplen; int tmplen;
char *res=NULL; char *res=NULL;
char *tmp=NULL; char *tmp=NULL;
my_realloc(_ALLOC_ID_, &res, n[0]*(strlen(s)+20)); my_realloc(511, &res, n[0]*(strlen(s)+20));
my_realloc(_ALLOC_ID_, &tmp, strlen(s)+30); my_realloc(512, &tmp, strlen(s)+30);
l=0; l=0;
for(i=1;i<n[0];i++) for(i=1;i<n[0];i++)
{ {
@ -212,7 +212,7 @@ static char *expandlabel_strbus(char *s, int *n)
memcpy(res+l,tmp, tmplen+1); /* 20180923 */ memcpy(res+l,tmp, tmplen+1); /* 20180923 */
l+=tmplen; l+=tmplen;
} }
my_free(_ALLOC_ID_, &tmp); my_free(513, &tmp);
sprintf(res+l, "%s[%d]", s, n[i]); sprintf(res+l, "%s[%d]", s, n[i]);
return res; return res;
} }
@ -223,7 +223,7 @@ static void check_idx(int **ptr,int n)
{ {
idxsize*=2; idxsize*=2;
dbg(3, "check_idx(): reallocating idx array: size=%d\n",idxsize); dbg(3, "check_idx(): reallocating idx array: size=%d\n",idxsize);
my_realloc(_ALLOC_ID_, ptr, idxsize*sizeof(int)); my_realloc(514, ptr, idxsize*sizeof(int));
} }
} }
@ -233,8 +233,8 @@ static char *expandlabel_strbus_nobracket(char *s, int *n)
int tmplen; int tmplen;
char *res=NULL; char *res=NULL;
char *tmp=NULL; char *tmp=NULL;
my_realloc(_ALLOC_ID_, &res, n[0]*(strlen(s)+20)); my_realloc(515, &res, n[0]*(strlen(s)+20));
my_realloc(_ALLOC_ID_, &tmp, strlen(s)+30); my_realloc(516, &tmp, strlen(s)+30);
l=0; l=0;
for(i=1;i<n[0];i++) for(i=1;i<n[0];i++)
{ {
@ -243,7 +243,7 @@ static char *expandlabel_strbus_nobracket(char *s, int *n)
memcpy(res+l,tmp, tmplen+1); memcpy(res+l,tmp, tmplen+1);
l+=tmplen; l+=tmplen;
} }
my_free(_ALLOC_ID_, &tmp); my_free(517, &tmp);
sprintf(res+l, "%s%d", s, n[i]); sprintf(res+l, "%s%d", s, n[i]);
return res; return res;
} }
@ -254,8 +254,8 @@ static char *expandlabel_strbus_nobracket_suffix(char *s, int *n, char *suffix)
int tmplen; int tmplen;
char *res=NULL; char *res=NULL;
char *tmp=NULL; char *tmp=NULL;
my_realloc(_ALLOC_ID_, &res, n[0] * (strlen(s) + strlen(suffix) + 30)); my_realloc(518, &res, n[0] * (strlen(s) + strlen(suffix) + 30));
my_realloc(_ALLOC_ID_, &tmp, strlen(s) + strlen(suffix) + 30); my_realloc(519, &tmp, strlen(s) + strlen(suffix) + 30);
l=0; l=0;
for(i=1;i<n[0];i++) for(i=1;i<n[0];i++)
{ {
@ -264,7 +264,7 @@ static char *expandlabel_strbus_nobracket_suffix(char *s, int *n, char *suffix)
memcpy(res+l,tmp, tmplen+1); memcpy(res+l,tmp, tmplen+1);
l+=tmplen; l+=tmplen;
} }
my_free(_ALLOC_ID_, &tmp); my_free(520, &tmp);
sprintf(res+l, "%s%d%s", s, n[i], suffix); sprintf(res+l, "%s%d%s", s, n[i], suffix);
return res; return res;
} }
@ -308,28 +308,28 @@ int *idx; /* for bus index & bus index ranges */
line: /* empty */ line: /* empty */
| list { | list {
dbg(dbg_var, "yyparse(): list, dest_string.str=%s\n", $1.str); dbg(dbg_var, "yyparse(): list, dest_string.str=%s\n", $1.str);
my_strdup(_ALLOC_ID_, &(dest_string.str),$1.str); my_strdup(521, &(dest_string.str),$1.str);
my_free(_ALLOC_ID_, &$1.str); my_free(522, &$1.str);
dest_string.m=$1.m; dest_string.m=$1.m;
} }
; ;
list: B_NAME { list: B_NAME {
dbg(dbg_var, "yyparse(): B_NAME, $1=%s\n", $1); dbg(dbg_var, "yyparse(): B_NAME, $1=%s\n", $1);
$$.str = expandlabel_strdup($1); $$.str = expandlabel_strdup($1);
my_free(_ALLOC_ID_, &$1); my_free(523, &$1);
$$.m = 1; $$.m = 1;
} }
| B_LINE { | B_LINE {
dbg(dbg_var, "yyparse(): B_LINE\n"); dbg(dbg_var, "yyparse(): B_LINE\n");
$$.str = expandlabel_strdup($1); /* prima era =$1 */ $$.str = expandlabel_strdup($1); /* prima era =$1 */
my_free(_ALLOC_ID_, &$1); my_free(524, &$1);
$$.m = 1; $$.m = 1;
} }
| list B_NAME { | list B_NAME {
dbg(dbg_var, "yyparse(): list B_NAME, $2=%s\n", $2); dbg(dbg_var, "yyparse(): list B_NAME, $2=%s\n", $2);
$$.str = expandlabel_strcat($1.str, $2); $$.str = expandlabel_strcat($1.str, $2);
my_free(_ALLOC_ID_, &$1.str); my_free(525, &$1.str);
my_free(_ALLOC_ID_, &$2); my_free(526, &$2);
$$.m = $1.m; $$.m = $1.m;
} }
| list '*' B_NUM | list '*' B_NUM
@ -339,29 +339,29 @@ list: B_NAME {
$$.str=expandlabel_strmult2($3,$1.str); $$.str=expandlabel_strmult2($3,$1.str);
dbg(dbg_var, "yyparse(): |%s|\n",$$.str); dbg(dbg_var, "yyparse(): |%s|\n",$$.str);
$$.m = $3 * $1.m; $$.m = $3 * $1.m;
my_free(_ALLOC_ID_, &$1.str); my_free(527, &$1.str);
} }
| B_NUM '*' list | B_NUM '*' list
{ {
dbg(dbg_var, "yyparse(): B_NUM * list\n"); dbg(dbg_var, "yyparse(): B_NUM * list\n");
$$.str=expandlabel_strmult($1,$3.str); $$.str=expandlabel_strmult($1,$3.str);
$$.m = $1 * $3.m; $$.m = $1 * $3.m;
my_free(_ALLOC_ID_, &$3.str); my_free(528, &$3.str);
} }
| list ',' list { | list ',' list {
dbg(dbg_var, "yyparse(): list , list\n"); dbg(dbg_var, "yyparse(): list , list\n");
$$.str=expandlabel_strcat_char($1.str, ',', $3.str); $$.str=expandlabel_strcat_char($1.str, ',', $3.str);
$$.m = $1.m + $3.m; $$.m = $1.m + $3.m;
my_free(_ALLOC_ID_, &$1.str); my_free(529, &$1.str);
my_free(_ALLOC_ID_, &$3.str); my_free(530, &$3.str);
} }
| list B_CAR list | list B_CAR list
{ {
dbg(dbg_var, "yyparse(): list B_CAR list\n"); dbg(dbg_var, "yyparse(): list B_CAR list\n");
$$.str=expandlabel_strcat_char($1.str, (char)$2, $3.str); $$.str=expandlabel_strcat_char($1.str, (char)$2, $3.str);
$$.m = $1.m + $3.m; $$.m = $1.m + $3.m;
my_free(_ALLOC_ID_, &$1.str); my_free(531, &$1.str);
my_free(_ALLOC_ID_, &$3.str); my_free(532, &$3.str);
} }
| '(' list ')' { | '(' list ')' {
dbg(dbg_var, "yyparse(): ( list )\n"); dbg(dbg_var, "yyparse(): ( list )\n");
@ -371,29 +371,29 @@ list: B_NAME {
{ {
size_t size = strlen($1) + strlen($3) + 3; size_t size = strlen($1) + strlen($3) + 3;
dbg(dbg_var, "yyparse(): B_NAME [ B_NAME ] , $1=%s $3=%s\n", $1, $3); dbg(dbg_var, "yyparse(): B_NAME [ B_NAME ] , $1=%s $3=%s\n", $1, $3);
$$.str = my_malloc(_ALLOC_ID_, size); $$.str = my_malloc(533, size);
$$.m=-1; $$.m=-1;
my_snprintf($$.str, size, "%s[%s]", $1, $3); my_snprintf($$.str, size, "%s[%s]", $1, $3);
my_free(_ALLOC_ID_, &$1); my_free(534, &$1);
my_free(_ALLOC_ID_, &$3); my_free(535, &$3);
} }
| B_NAME '[' index ']' | B_NAME '[' index ']'
{ {
dbg(dbg_var, "yyparse(): B_NAME [ index ] , $1=%s $3=%d\n", $1, $3[0]); dbg(dbg_var, "yyparse(): B_NAME [ index ] , $1=%s $3=%d\n", $1, $3[0]);
$$.str=expandlabel_strbus($1,$3); $$.str=expandlabel_strbus($1,$3);
my_free(_ALLOC_ID_, &$1); my_free(536, &$1);
$$.m=$3[0]; $$.m=$3[0];
my_free(_ALLOC_ID_, &$3); my_free(537, &$3);
idxsize=INITIALIDXSIZE; idxsize=INITIALIDXSIZE;
} }
| B_NAME '[' index ']' B_TRAILER | B_NAME '[' index ']' B_TRAILER
{ {
dbg(dbg_var, "yyparse(): B_NAME [ index ] B_NAME, $1=%s $3=%d, $5=%s\n", $1, $3[0], $5); dbg(dbg_var, "yyparse(): B_NAME [ index ] B_NAME, $1=%s $3=%d, $5=%s\n", $1, $3[0], $5);
$$.str=expandlabel_strbus_suffix($1, $3, $5); $$.str=expandlabel_strbus_suffix($1, $3, $5);
my_free(_ALLOC_ID_, &$1); my_free(538, &$1);
my_free(_ALLOC_ID_, &$5); my_free(539, &$5);
$$.m=$3[0]; $$.m=$3[0];
my_free(_ALLOC_ID_, &$3); my_free(540, &$3);
idxsize=INITIALIDXSIZE; idxsize=INITIALIDXSIZE;
} }
@ -401,19 +401,19 @@ list: B_NAME {
{ {
dbg(dbg_var, "yyparse(): B_NAME [ index_nobracket ] $1=%s $3=%d\n",$1, $3[0]); dbg(dbg_var, "yyparse(): B_NAME [ index_nobracket ] $1=%s $3=%d\n",$1, $3[0]);
$$.str=expandlabel_strbus_nobracket($1,$3); $$.str=expandlabel_strbus_nobracket($1,$3);
my_free(_ALLOC_ID_, &$1); my_free(541, &$1);
$$.m=$3[0]; $$.m=$3[0];
my_free(_ALLOC_ID_, &$3); my_free(542, &$3);
idxsize=INITIALIDXSIZE; idxsize=INITIALIDXSIZE;
} }
| B_NAME '[' index_nobracket ']' B_TRAILER | B_NAME '[' index_nobracket ']' B_TRAILER
{ {
dbg(dbg_var, "yyparse(): B_NAME [ index_nobracket ] $1=%s $3=%d, $5=%s\n",$1, $3[0], $5); dbg(dbg_var, "yyparse(): B_NAME [ index_nobracket ] $1=%s $3=%d, $5=%s\n",$1, $3[0], $5);
$$.str=expandlabel_strbus_nobracket_suffix($1, $3, $5); $$.str=expandlabel_strbus_nobracket_suffix($1, $3, $5);
my_free(_ALLOC_ID_, &$1); my_free(543, &$1);
my_free(_ALLOC_ID_, &$5); my_free(544, &$5);
$$.m=$3[0]; $$.m=$3[0];
my_free(_ALLOC_ID_, &$3); my_free(545, &$3);
idxsize=INITIALIDXSIZE; idxsize=INITIALIDXSIZE;
} }
@ -423,7 +423,7 @@ index: B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM
/* start : end : extend : repetitions */ /* start : end : extend : repetitions */
int r, i, sign, offset; int r, i, sign, offset;
sign = XSIGN($3-$1); sign = XSIGN($3-$1);
$$=my_malloc(_ALLOC_ID_, INITIALIDXSIZE*sizeof(int)); $$=my_malloc(546, INITIALIDXSIZE*sizeof(int));
$$[0]=0; $$[0]=0;
offset = 0; offset = 0;
for(r=0; r < $7; r++) { for(r=0; r < $7; r++) {
@ -441,7 +441,7 @@ index: B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM
int sign; int sign;
sign = XSIGN($3-$1); sign = XSIGN($3-$1);
$$=my_malloc(_ALLOC_ID_, INITIALIDXSIZE*sizeof(int)); $$=my_malloc(547, INITIALIDXSIZE*sizeof(int));
$$[0]=0; $$[0]=0;
for(i=$1;;i+=sign*$5) for(i=$1;;i+=sign*$5)
{ {
@ -455,7 +455,7 @@ index: B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM
| B_IDXNUM ':' B_IDXNUM | B_IDXNUM ':' B_IDXNUM
{ {
int i; int i;
$$=my_malloc(_ALLOC_ID_, INITIALIDXSIZE*sizeof(int)); $$=my_malloc(548, INITIALIDXSIZE*sizeof(int));
$$[0]=0; $$[0]=0;
for(i=$1;;i+=XSIGN($3-$1)) for(i=$1;;i+=XSIGN($3-$1))
{ {
@ -465,7 +465,7 @@ index: B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM ':' B_IDXNUM
} }
} }
| B_IDXNUM { | B_IDXNUM {
$$=my_malloc(_ALLOC_ID_, INITIALIDXSIZE*sizeof(int)); $$=my_malloc(549, INITIALIDXSIZE*sizeof(int));
$$[0]=0; $$[0]=0;
check_idx(&$$, ++$$[0]); check_idx(&$$, ++$$[0]);
$$[$$[0]]=$1; $$[$$[0]]=$1;
@ -520,7 +520,7 @@ index_nobracket: B_IDXNUM B_DOUBLEDOT B_IDXNUM B_DOUBLEDOT B_IDXNUM B_DOUBLEDOT
/* start .. end .. offset .. repetitions */ /* start .. end .. offset .. repetitions */
int r, i, sign, offset; int r, i, sign, offset;
sign = XSIGN($3-$1); sign = XSIGN($3-$1);
$$=my_malloc(_ALLOC_ID_, INITIALIDXSIZE*sizeof(int)); $$=my_malloc(550, INITIALIDXSIZE*sizeof(int));
$$[0]=0; $$[0]=0;
offset = 0; offset = 0;
for(r=0; r < $7; r++) { for(r=0; r < $7; r++) {
@ -538,7 +538,7 @@ index_nobracket: B_IDXNUM B_DOUBLEDOT B_IDXNUM B_DOUBLEDOT B_IDXNUM B_DOUBLEDOT
int sign; int sign;
sign = XSIGN($3-$1); sign = XSIGN($3-$1);
$$=my_malloc(_ALLOC_ID_, INITIALIDXSIZE*sizeof(int)); $$=my_malloc(551, INITIALIDXSIZE*sizeof(int));
$$[0]=0; $$[0]=0;
for(i=$1;;i+=sign*$5) for(i=$1;;i+=sign*$5)
{ {
@ -552,7 +552,7 @@ index_nobracket: B_IDXNUM B_DOUBLEDOT B_IDXNUM B_DOUBLEDOT B_IDXNUM B_DOUBLEDOT
| B_IDXNUM B_DOUBLEDOT B_IDXNUM | B_IDXNUM B_DOUBLEDOT B_IDXNUM
{ {
int i; int i;
$$=my_malloc(_ALLOC_ID_, INITIALIDXSIZE*sizeof(int)); $$=my_malloc(552, INITIALIDXSIZE*sizeof(int));
$$[0]=0; $$[0]=0;
for(i=$1;;i+=XSIGN($3-$1)) for(i=$1;;i+=XSIGN($3-$1))
{ {

View File

@ -198,7 +198,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
y0=xctx->inst[i].y0; y0=xctx->inst[i].y0;
rot = xctx->inst[i].rot; rot = xctx->inst[i].rot;
flip = xctx->inst[i].flip; flip = xctx->inst[i].flip;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(553, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if(!type) continue; if(!type) continue;
no_of_pin_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]; no_of_pin_rects = (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER];
@ -241,7 +241,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y)
} }
*x = min_dist_x; *x = min_dist_x;
*y = min_dist_y; *y = min_dist_y;
my_free(_ALLOC_ID_, &type); my_free(554, &type);
} }
static void find_closest_arc(double mx,double my) static void find_closest_arc(double mx,double my)
@ -371,7 +371,7 @@ static void find_closest_text(double mx,double my)
xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].hcenter, xctx->text[i].vcenter,
xctx->text[i].x0, xctx->text[i].y0, xctx->text[i].x0, xctx->text[i].y0,
&xx1,&yy1, &xx2,&yy2, &tmp, &dtmp); &xx1,&yy1, &xx2,&yy2, &tmp, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(555, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);

View File

@ -38,7 +38,7 @@ void compile_font(void)
select_inside(code*FONTOFFSET-1,-FONTHEIGHT-1, select_inside(code*FONTOFFSET-1,-FONTHEIGHT-1,
code*FONTOFFSET+FONTWIDTH+1,FONTWHITESPACE + FONTDESCENT+1, 1); code*FONTOFFSET+FONTWIDTH+1,FONTWHITESPACE + FONTDESCENT+1, 1);
rebuild_selected_array(); rebuild_selected_array();
character[code] = my_calloc(_ALLOC_ID_, xctx->lastsel*4+1, sizeof(double)); character[code] = my_calloc(556, xctx->lastsel*4+1, sizeof(double));
character[code][0] = (double)xctx->lastsel; character[code][0] = (double)xctx->lastsel;
dbg(2, "compile_font(): character[%d][]={%.16g",code,character[code][0]); dbg(2, "compile_font(): character[%d][]={%.16g",code,character[code][0]);
for(i=0;i<xctx->lastsel; ++i) for(i=0;i<xctx->lastsel; ++i)
@ -60,6 +60,6 @@ void compile_font(void)
clear_drawing(); clear_drawing();
unselect_all(1); unselect_all(1);
xctx->currsch = 0; xctx->currsch = 0;
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(557, &xctx->sch[xctx->currsch]);
} }

View File

@ -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); dbg(3, "init_inst_iterator(): instances=%d\n", xctx->instances);
if(xctx->instances) { if(xctx->instances) {
my_realloc(_ALLOC_ID_, &ctx->instflag, xctx->instances*sizeof(unsigned short)); my_realloc(558, &ctx->instflag, xctx->instances*sizeof(unsigned short));
memset(ctx->instflag, 0, xctx->instances*sizeof(unsigned short)); memset(ctx->instflag, 0, xctx->instances*sizeof(unsigned short));
} }
/* calculate square 4 1st corner of drawing area */ /* 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->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES;
ctx->instanceptr = xctx->inst_spatial_table[ctx->tmpi][ctx->tmpj]; ctx->instanceptr = xctx->inst_spatial_table[ctx->tmpi][ctx->tmpj];
} else { } else {
my_free(_ALLOC_ID_, &ctx->instflag); my_free(559, &ctx->instflag);
return NULL; return NULL;
} }
} }
@ -83,7 +83,7 @@ void init_wire_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, doub
ctx->wireflag = NULL; ctx->wireflag = NULL;
dbg(3, "init_wire_iterator(): wires=%d\n", xctx->wires); dbg(3, "init_wire_iterator(): wires=%d\n", xctx->wires);
if(xctx->wires) { if(xctx->wires) {
my_realloc(_ALLOC_ID_, &ctx->wireflag, xctx->wires*sizeof(unsigned short)); my_realloc(560, &ctx->wireflag, xctx->wires*sizeof(unsigned short));
memset(ctx->wireflag, 0, xctx->wires*sizeof(unsigned short)); memset(ctx->wireflag, 0, xctx->wires*sizeof(unsigned short));
} }
/* calculate square 4 1st corner of drawing area */ /* 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->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES;
ctx->wireptr = xctx->wire_spatial_table[ctx->tmpi][ctx->tmpj]; ctx->wireptr = xctx->wire_spatial_table[ctx->tmpi][ctx->tmpj];
} else { } else {
my_free(_ALLOC_ID_, &ctx->wireflag); my_free(561, &ctx->wireflag);
return NULL; return NULL;
} }
} }
@ -139,7 +139,7 @@ void init_object_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, do
ctx->objectflag = NULL; ctx->objectflag = NULL;
dbg(3, "init_object_iterator(): objects=%d\n", xctx->n_hash_objects); dbg(3, "init_object_iterator(): objects=%d\n", xctx->n_hash_objects);
if(xctx->n_hash_objects) { if(xctx->n_hash_objects) {
my_realloc(_ALLOC_ID_, &ctx->objectflag, xctx->n_hash_objects * sizeof(unsigned short)); my_realloc(562, &ctx->objectflag, xctx->n_hash_objects * sizeof(unsigned short));
memset(ctx->objectflag, 0, 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 */ /* 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->tmpj = ctx->j % NBOXES; if(ctx->tmpj < 0) ctx->tmpj += NBOXES;
ctx->objectptr = xctx->object_spatial_table[ctx->tmpi][ctx->tmpj]; ctx->objectptr = xctx->object_spatial_table[ctx->tmpi][ctx->tmpj];
} else { } else {
my_free(_ALLOC_ID_, &ctx->objectflag); my_free(563, &ctx->objectflag);
return NULL; return NULL;
} }
} }

View File

@ -48,9 +48,9 @@ static void hilight_hash_free_entry(Hilight_hashentry *entry)
Hilight_hashentry *tmp; Hilight_hashentry *tmp;
while(entry) { while(entry) {
tmp = entry->next; tmp = entry->next;
my_free(_ALLOC_ID_, &entry->token); my_free(564, &entry->token);
my_free(_ALLOC_ID_, &entry->path); my_free(565, &entry->path);
my_free(_ALLOC_ID_, &entry); my_free(566, &entry);
entry = tmp; entry = tmp;
} }
} }
@ -92,11 +92,11 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int
size_t lenp = strlen(xctx->sch_path[xctx->currsch]) + 1; size_t lenp = strlen(xctx->sch_path[xctx->currsch]) + 1;
if( what==XINSERT || what == XINSERT_NOREPLACE) { /* insert data */ if( what==XINSERT || what == XINSERT_NOREPLACE) { /* insert data */
s=sizeof( Hilight_hashentry ); s=sizeof( Hilight_hashentry );
entry= (Hilight_hashentry *)my_malloc(_ALLOC_ID_, s ); entry= (Hilight_hashentry *)my_malloc(567, s );
entry->next = NULL; entry->next = NULL;
entry->token = my_malloc(_ALLOC_ID_, lent); entry->token = my_malloc(568, lent);
memcpy(entry->token, token, lent); memcpy(entry->token, token, lent);
entry->path = my_malloc(_ALLOC_ID_, lenp); entry->path = my_malloc(569, lenp);
memcpy(entry->path, xctx->sch_path[xctx->currsch], lenp); memcpy(entry->path, xctx->sch_path[xctx->currsch], lenp);
entry->oldvalue = value-1000; /* no old value, set different value anyway*/ entry->oldvalue = value-1000; /* no old value, set different value anyway*/
entry->value = value; entry->value = value;
@ -111,9 +111,9 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int
!strcmp(xctx->sch_path[xctx->currsch], entry->path) ) { /* found matching tok */ !strcmp(xctx->sch_path[xctx->currsch], entry->path) ) { /* found matching tok */
if(what==XDELETE) { /* remove token from the hash table ... */ if(what==XDELETE) { /* remove token from the hash table ... */
saveptr=entry->next; saveptr=entry->next;
my_free(_ALLOC_ID_, &entry->token); my_free(570, &entry->token);
my_free(_ALLOC_ID_, &entry->path); my_free(571, &entry->path);
my_free(_ALLOC_ID_, &entry); my_free(572, &entry);
*preventry=saveptr; *preventry=saveptr;
} else if(what == XINSERT ) { } else if(what == XINSERT ) {
entry->oldvalue = entry->value; entry->oldvalue = entry->value;
@ -137,13 +137,13 @@ Hilight_hashentry *inst_hilight_hash_lookup(int i, int value, int what)
Hilight_hashentry *entry; Hilight_hashentry *entry;
if(IS_LABEL_SH_OR_PIN( (xctx->inst[i].ptr+xctx->sym)->type )) label = 1; 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); dbg(1, "inst_hilight_hash_lookup: token=%s value=%d what=%d\n", token, value, what);
inst_tok = my_malloc(_ALLOC_ID_, len); inst_tok = my_malloc(573, len);
/* instance name uglyfication: add a space at beginning so it will never match a valid net name */ /* 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 */ /* use 2 spaces for pins/labels to distinguish from other instances */
if(label) my_snprintf(inst_tok, len, " %s", token); if(label) my_snprintf(inst_tok, len, " %s", token);
else my_snprintf(inst_tok, len, " %s", token); else my_snprintf(inst_tok, len, " %s", token);
entry = hilight_hash_lookup(inst_tok, value, what); entry = hilight_hash_lookup(inst_tok, value, what);
my_free(_ALLOC_ID_, &inst_tok); my_free(574, &inst_tok);
return entry; return entry;
} }
@ -166,7 +166,7 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha
if(!ptr1) xctx->some_nets_added = 1; if(!ptr1) xctx->some_nets_added = 1;
return ptr1; return ptr1;
} }
my_strdup(_ALLOC_ID_, &string, expandlabel(token,&mult)); my_strdup(575, &string, expandlabel(token,&mult));
if(string==NULL) { if(string==NULL) {
return NULL; return NULL;
} }
@ -190,7 +190,7 @@ Hilight_hashentry *bus_hilight_hash_lookup(const char *token, int value, int wha
string_ptr++; string_ptr++;
} }
/* if something found return first pointer */ /* if something found return first pointer */
my_free(_ALLOC_ID_, &string); my_free(576, &string);
return ptr2; return ptr2;
} }
@ -201,9 +201,9 @@ Hilight_hashentry *hier_hilight_hash_lookup(const char *token, int value, const
char *oldpath = xctx->sch_path[xctx->currsch]; char *oldpath = xctx->sch_path[xctx->currsch];
xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_path_hash[xctx->currsch] = 0;
xctx->sch_path[xctx->currsch] = NULL; xctx->sch_path[xctx->currsch] = NULL;
my_strdup2(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], path); my_strdup2(577, &xctx->sch_path[xctx->currsch], path);
entry = bus_hilight_hash_lookup(token, value, what); entry = bus_hilight_hash_lookup(token, value, what);
my_free(_ALLOC_ID_, &xctx->sch_path[xctx->currsch]); my_free(578, &xctx->sch_path[xctx->currsch]);
xctx->sch_path[xctx->currsch] = oldpath; xctx->sch_path[xctx->currsch] = oldpath;
xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_path_hash[xctx->currsch] = 0;
return entry; return entry;
@ -231,11 +231,11 @@ void display_hilights(int what, char **str)
dbg(1, "what=%d, instance=%d, token=%s\n", what, instance, ptr); dbg(1, "what=%d, instance=%d, token=%s\n", what, instance, ptr);
if( ((what & 1) && !instance) || ((what & 2) && instance) ) { if( ((what & 1) && !instance) || ((what & 2) && instance) ) {
if(instance) ptr++; /* skip uglyfication space */ if(instance) ptr++; /* skip uglyfication space */
if(!first) my_strcat(_ALLOC_ID_, str, " "); if(!first) my_strcat(579, str, " ");
my_strcat(_ALLOC_ID_, str,"{"); my_strcat(580, str,"{");
my_strcat(_ALLOC_ID_, str, entry->path+1); my_strcat(581, str, entry->path+1);
my_strcat(_ALLOC_ID_, str, ptr); my_strcat(582, str, ptr);
my_strcat(_ALLOC_ID_, str,"}"); my_strcat(583, str,"}");
first = 0; first = 0;
} }
skip: skip:
@ -279,7 +279,7 @@ int hilight_graph_node(const char *node, int col)
++path_skip; ++path_skip;
} }
my_strdup2(_ALLOC_ID_, &n, node); my_strdup2(584, &n, node);
nptr = n; nptr = n;
dbg(1, "hilight_graph_node(): path_skip=%s, %s: %d\n", path_skip, node, col); dbg(1, "hilight_graph_node(): path_skip=%s, %s: %d\n", path_skip, node, col);
@ -296,12 +296,12 @@ int hilight_graph_node(const char *node, int col)
path3 = nptr; path3 = nptr;
nptr = ptr2 + 1; nptr = ptr2 + 1;
if(!strstr(path_skip, path3)) if(!strstr(path_skip, path3))
my_mstrcat(_ALLOC_ID_, &path2, path, path3, ".", NULL); my_mstrcat(585, &path2, path, path3, ".", NULL);
else else
my_strdup2(_ALLOC_ID_, &path2, path); my_strdup2(586, &path2, path);
} }
else { else {
my_strdup2(_ALLOC_ID_, &path2, path); my_strdup2(587, &path2, path);
} }
if(current) { if(current) {
nptr--; nptr--;
@ -313,8 +313,8 @@ int hilight_graph_node(const char *node, int col)
dbg(1, "hilight_graph_node(): propagate_hilights(), col=%d\n", col); dbg(1, "hilight_graph_node(): propagate_hilights(), col=%d\n", col);
propagate_hilights(1, 0, XINSERT_NOREPLACE); propagate_hilights(1, 0, XINSERT_NOREPLACE);
} }
my_free(_ALLOC_ID_, &n); my_free(588, &n);
my_free(_ALLOC_ID_, &path2); my_free(589, &path2);
return 1; return 1;
} }
@ -398,12 +398,12 @@ void create_plot_cmd(void)
if(exists) { if(exists) {
viewer = tclgetintvar("sim(spicewave,default)"); viewer = tclgetintvar("sim(spicewave,default)");
my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer); my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer);
my_strdup(_ALLOC_ID_, &viewer_name, tclgetvar(tcl_str)); my_strdup(590, &viewer_name, tclgetvar(tcl_str));
dbg(1,"create_plot_cmd(): viewer_name=%s\n", viewer_name); dbg(1,"create_plot_cmd(): viewer_name=%s\n", viewer_name);
if(strstr(viewer_name, "Gaw")) viewer=GAW; if(strstr(viewer_name, "Gaw")) viewer=GAW;
else if(strstr(viewer_name, "Bespice")) viewer=BESPICE; else if(strstr(viewer_name, "Bespice")) viewer=BESPICE;
else if(strstr(viewer_name, "Ngspice")) viewer=NGSPICE; else if(strstr(viewer_name, "Ngspice")) viewer=NGSPICE;
my_free(_ALLOC_ID_, &viewer_name); my_free(591, &viewer_name);
} }
if(!exists || !viewer) return; if(!exists || !viewer) return;
my_snprintf(plotfile, S(plotfile), "%s/xplot", tclgetvar("netlist_dir")); my_snprintf(plotfile, S(plotfile), "%s/xplot", tclgetvar("netlist_dir"));
@ -438,24 +438,24 @@ void create_plot_cmd(void)
fprintf(fd, "%s", str); fprintf(fd, "%s", str);
fprintf(fd, "\n"); fprintf(fd, "\n");
first = 1; first = 1;
my_free(_ALLOC_ID_, &str); my_free(592, &str);
} }
fprintf(fd, "set color%d=rgb:%s\n", idx, color_str); fprintf(fd, "set color%d=rgb:%s\n", idx, color_str);
if(first) { if(first) {
my_strcat(_ALLOC_ID_, &str, "plot "); my_strcat(593, &str, "plot ");
first = 0; first = 0;
} }
my_strcat(_ALLOC_ID_, &str, "\""); my_strcat(594, &str, "\"");
my_strcat(_ALLOC_ID_, &str, (entry->path)+1); my_strcat(595, &str, (entry->path)+1);
my_strcat(_ALLOC_ID_, &str, tok); my_strcat(596, &str, tok);
my_strcat(_ALLOC_ID_, &str, "\" "); my_strcat(597, &str, "\" ");
} }
if(viewer == GAW) { if(viewer == GAW) {
char *t=NULL, *p=NULL; char *t=NULL, *p=NULL;
sprintf(color_str, "%02x%02x%02x", sprintf(color_str, "%02x%02x%02x",
xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8);
my_strdup(_ALLOC_ID_, &t, tok); my_strdup(598, &t, tok);
my_strdup2(_ALLOC_ID_, &p, (entry->path)+1); my_strdup2(599, &p, (entry->path)+1);
if(simtype == 0 ) { /* spice */ if(simtype == 0 ) { /* spice */
tclvareval("puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t), tclvareval("puts $gaw_fd {copyvar v(", strtolower(p), strtolower(t),
") sel #", color_str, "}\nvwait gaw_fd\n", NULL); ") sel #", color_str, "}\nvwait gaw_fd\n", NULL);
@ -468,15 +468,15 @@ void create_plot_cmd(void)
tclvareval("puts $gaw_fd {copyvar ", strtoupper(p), strtoupper(t), tclvareval("puts $gaw_fd {copyvar ", strtoupper(p), strtoupper(t),
" sel #", color_str, "}\nvwait gaw_fd\n", NULL); " sel #", color_str, "}\nvwait gaw_fd\n", NULL);
} }
my_free(_ALLOC_ID_, &p); my_free(600, &p);
my_free(_ALLOC_ID_, &t); my_free(601, &t);
} }
if(viewer == BESPICE) { if(viewer == BESPICE) {
char *t=NULL, *p=NULL; char *t=NULL, *p=NULL;
sprintf(color_str, "#%02x%02x%02x", sprintf(color_str, "#%02x%02x%02x",
xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8); xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8, xctx->xcolor_array[c].blue>>8);
my_strdup(_ALLOC_ID_, &t, tok); my_strdup(602, &t, tok);
my_strdup2(_ALLOC_ID_, &p, (entry->path)+1); my_strdup2(603, &p, (entry->path)+1);
/* bespice command syntax : /* bespice command syntax :
add_voltage_on_spice_node_to_plot <plot name> <section name> <hierarchical spice node name> <flag clear> [<color>] add_voltage_on_spice_node_to_plot <plot name> <section name> <hierarchical spice node name> <flag clear> [<color>]
@ -488,8 +488,8 @@ void create_plot_cmd(void)
"{add_voltage_on_spice_node_to_plot * \"\" \"", "{add_voltage_on_spice_node_to_plot * \"\" \"",
p, t, "\" 0 ", color_str, "}", p, t, "\" 0 ", color_str, "}",
NULL); NULL);
my_free(_ALLOC_ID_, &p); my_free(604, &p);
my_free(_ALLOC_ID_, &t); my_free(605, &t);
} }
} }
entry = entry->next; entry = entry->next;
@ -498,7 +498,7 @@ void create_plot_cmd(void)
if(viewer == NGSPICE) { if(viewer == NGSPICE) {
fprintf(fd, "%s", str); fprintf(fd, "%s", str);
fprintf(fd, "\nremcirc\n.endc\n"); fprintf(fd, "\nremcirc\n.endc\n");
my_free(_ALLOC_ID_, &str); my_free(606, &str);
fclose(fd); fclose(fd);
} }
if(viewer == GAW) { if(viewer == GAW) {
@ -538,16 +538,16 @@ void hilight_net_pin_mismatches(void)
for(k=0; k<xctx->lastsel; ++k) { for(k=0; k<xctx->lastsel; ++k) {
if(xctx->sel_array[k].type!=ELEMENT) continue; if(xctx->sel_array[k].type!=ELEMENT) continue;
j = xctx->sel_array[k].n ; j = xctx->sel_array[k].n ;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type); my_strdup(607, &type,(xctx->inst[j].ptr+ xctx->sym)->type);
if( type && IS_LABEL_SH_OR_PIN(type)) break; if( type && IS_LABEL_SH_OR_PIN(type)) break;
symbol = xctx->sym + xctx->inst[j].ptr; symbol = xctx->sym + xctx->inst[j].ptr;
npin = symbol->rects[PINLAYER]; npin = symbol->rects[PINLAYER];
rct=symbol->rect[PINLAYER]; rct=symbol->rect[PINLAYER];
dbg(1, "hilight_net_pin_mismatches(): \n"); dbg(1, "hilight_net_pin_mismatches(): \n");
for(i=0;i<npin; ++i) { for(i=0;i<npin; ++i) {
my_strdup(_ALLOC_ID_, &labname,get_tok_value(rct[i].prop_ptr,"name",0)); my_strdup(608, &labname,get_tok_value(rct[i].prop_ptr,"name",0));
my_strdup(_ALLOC_ID_, &lab, expandlabel(labname, &mult)); my_strdup(609, &lab, expandlabel(labname, &mult));
my_strdup(_ALLOC_ID_, &netname, net_name(j,i, &mult, 0, 0)); my_strdup(610, &netname, net_name(j,i, &mult, 0, 0));
dbg(1, "hilight_net_pin_mismatches(): i=%d labname=%s explabname = %s net = %s\n", i, labname, lab, netname); dbg(1, "hilight_net_pin_mismatches(): i=%d labname=%s explabname = %s net = %s\n", i, labname, lab, netname);
if(netname && strcmp(lab, netname)) { if(netname && strcmp(lab, netname)) {
dbg(1, "hilight_net_pin_mismatches(): hilight: %s\n", netname); dbg(1, "hilight_net_pin_mismatches(): hilight: %s\n", netname);
@ -556,10 +556,10 @@ void hilight_net_pin_mismatches(void)
} }
} }
} }
my_free(_ALLOC_ID_, &type); my_free(611, &type);
my_free(_ALLOC_ID_, &labname); my_free(612, &labname);
my_free(_ALLOC_ID_, &lab); my_free(613, &lab);
my_free(_ALLOC_ID_, &netname); my_free(614, &netname);
if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE); if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE);
redraw_hilights(0); redraw_hilights(0);
} }
@ -592,12 +592,12 @@ void hilight_parent_pins(void)
{ {
char *p_n_s1, *p_n_s2; char *p_n_s1, *p_n_s2;
if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue; if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue;
my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); my_strdup(615, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult));
dbg(1, "hilight_parent_pins(): net_node=%s\n", net_node); dbg(1, "hilight_parent_pins(): net_node=%s\n", net_node);
pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0); pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0);
dbg(1, "pin_name=%s\n", pin_name); dbg(1, "pin_name=%s\n", pin_name);
if(!pin_name[0]) continue; if(!pin_name[0]) continue;
my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); my_strdup(616, &pin_node, expandlabel(pin_name, &mult));
dbg(1, "hilight_parent_pins(): pin_node=%s\n", pin_node); dbg(1, "hilight_parent_pins(): pin_node=%s\n", pin_node);
p_n_s1 = pin_node; p_n_s1 = pin_node;
@ -628,8 +628,8 @@ void hilight_parent_pins(void)
} }
} }
} }
my_free(_ALLOC_ID_, &pin_node); my_free(617, &pin_node);
my_free(_ALLOC_ID_, &net_node); my_free(618, &net_node);
} }
void hilight_child_pins(void) void hilight_child_pins(void)
@ -660,11 +660,11 @@ void hilight_child_pins(void)
dbg(1, "hilight_child_pins(): inst_number=%d\n", inst_number); dbg(1, "hilight_child_pins(): inst_number=%d\n", inst_number);
if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue; if(!xctx->inst[i].node || !xctx->inst[i].node[j]) continue;
my_strdup(_ALLOC_ID_, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult)); my_strdup(619, &net_node, expandlabel(xctx->inst[i].node[j], &net_mult));
dbg(1, "hilight_child_pins(): net_node=%s\n", net_node); dbg(1, "hilight_child_pins(): net_node=%s\n", net_node);
pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0); pin_name = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0);
if(!pin_name[0]) continue; if(!pin_name[0]) continue;
my_strdup(_ALLOC_ID_, &pin_node, expandlabel(pin_name, &mult)); my_strdup(620, &pin_node, expandlabel(pin_name, &mult));
dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node); dbg(1, "hilight_child_pins(): pin_node=%s\n", pin_node);
p_n_s1 = pin_node; p_n_s1 = pin_node;
for(k = 1; k<=mult; ++k) { for(k = 1; k<=mult; ++k) {
@ -683,8 +683,8 @@ void hilight_child_pins(void)
p_n_s1 = NULL; p_n_s1 = NULL;
} /* for(k..) */ } /* for(k..) */
} }
my_free(_ALLOC_ID_, &pin_node); my_free(621, &pin_node);
my_free(_ALLOC_ID_, &net_node); my_free(622, &net_node);
} }
@ -774,7 +774,7 @@ int search(const char *tok, const char *val, int sub, int sel, int match_case)
} else if(!strcmp(tok,"cell::propstring")) { } else if(!strcmp(tok,"cell::propstring")) {
has_token = (str = (xctx->inst[i].ptr+ xctx->sym)->prop_ptr) ? 1 : 0; 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 */ } else if(!strncmp(tok,"cell::", 6)) { /* cell::xxx looks for xxx in global symbol attributes */
my_strdup(_ALLOC_ID_, &tmpname,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,tok+6,0)); my_strdup(623, &tmpname,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,tok+6,0));
has_token = xctx->tok_size; has_token = xctx->tok_size;
if(tmpname) { if(tmpname) {
str = tmpname; str = tmpname;
@ -1019,7 +1019,7 @@ int search(const char *tok, const char *val, int sub, int sel, int match_case)
regfree(&re); regfree(&re);
#endif #endif
xctx->draw_window = save_draw; xctx->draw_window = save_draw;
my_free(_ALLOC_ID_, &tmpname); my_free(624, &tmpname);
return found; return found;
} }
@ -1050,10 +1050,10 @@ static void drill_hilight(int mode)
if(xctx->inst[i].node && xctx->inst[i].node[j] && if(xctx->inst[i].node && xctx->inst[i].node[j] &&
strstr(xctx->inst[i].node[j], "#net") == xctx->inst[i].node[j]) { strstr(xctx->inst[i].node[j], "#net") == xctx->inst[i].node[j]) {
my_strdup2(_ALLOC_ID_, &netname,xctx->inst[i].node[j]); my_strdup2(625, &netname,xctx->inst[i].node[j]);
} else { } else {
/* mult here will be set to pin multiplicity */ /* mult here will be set to pin multiplicity */
my_strdup2(_ALLOC_ID_, &netname, net_name(i, j, &mult, 1, 0)); my_strdup2(626, &netname, net_name(i, j, &mult, 1, 0));
} }
/* mult here will be set to net multiplicity */ /* mult here will be set to net multiplicity */
expandlabel(netname, &mult); expandlabel(netname, &mult);
@ -1066,7 +1066,7 @@ static void drill_hilight(int mode)
xctx->inst[i].color = entry->value; xctx->inst[i].color = entry->value;
inst_hilight_hash_lookup(i, entry->value, XINSERT_NOREPLACE); inst_hilight_hash_lookup(i, entry->value, XINSERT_NOREPLACE);
} }
my_strdup(_ALLOC_ID_, &propagate_str, get_tok_value(rct[j].prop_ptr, "propag", 0)); my_strdup(627, &propagate_str, get_tok_value(rct[j].prop_ptr, "propag", 0));
if(propagate_str) { if(propagate_str) {
int n = 1; int n = 1;
const char *propag; const char *propag;
@ -1084,9 +1084,9 @@ static void drill_hilight(int mode)
if(xctx->inst[i].node && xctx->inst[i].node[propagate] && if(xctx->inst[i].node && xctx->inst[i].node[propagate] &&
strstr(xctx->inst[i].node[propagate], "#net") == xctx->inst[i].node[propagate]) { strstr(xctx->inst[i].node[propagate], "#net") == xctx->inst[i].node[propagate]) {
my_strdup2(_ALLOC_ID_, &propagated_net,xctx->inst[i].node[propagate]); my_strdup2(628, &propagated_net,xctx->inst[i].node[propagate]);
} else { } else {
my_strdup2(_ALLOC_ID_, &propagated_net, net_name(i, propagate, &mult2, 1, 0)); my_strdup2(629, &propagated_net, net_name(i, propagate, &mult2, 1, 0));
} }
netbitname = find_nth(propagated_net, ",", "", 0, k); netbitname = find_nth(propagated_net, ",", "", 0, k);
dbg(1, "netbitname=%s\n", netbitname); dbg(1, "netbitname=%s\n", netbitname);
@ -1102,9 +1102,9 @@ static void drill_hilight(int mode)
} /* for(i...) */ } /* for(i...) */
if(!found) break; if(!found) break;
} /* while(1) */ } /* while(1) */
my_free(_ALLOC_ID_, &netname); my_free(630, &netname);
if(propagated_net) my_free(_ALLOC_ID_, &propagated_net); if(propagated_net) my_free(631, &propagated_net);
if(propagate_str) my_free(_ALLOC_ID_, &propagate_str); if(propagate_str) my_free(632, &propagate_str);
} }
int hilight_netname(const char *name) int hilight_netname(const char *name)
@ -1143,9 +1143,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, sprintf(color_str, "#%02x%02x%02x", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8,
xctx->xcolor_array[c].blue>>8); xctx->xcolor_array[c].blue>>8);
expanded_tok = expandlabel(tok, &tok_mult); expanded_tok = expandlabel(tok, &tok_mult);
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); my_strdup2(633, &p, xctx->sch_path[xctx->currsch]+1);
for(k=1; k<=tok_mult; ++k) { for(k=1; k<=tok_mult; ++k) {
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); my_strdup(634, &t, find_nth(expanded_tok, ",", "", 0, k));
/* bespice command syntax : /* bespice command syntax :
add_voltage_on_spice_node_to_plot <plot name> <section name> <hierarchical spice node name> <flag clear> [<color>] add_voltage_on_spice_node_to_plot <plot name> <section name> <hierarchical spice node name> <flag clear> [<color>]
plot name is "*" => automatic plot name is "*" => automatic
@ -1157,8 +1157,8 @@ static void send_net_to_bespice(int simtype, const char *node)
p, t, "\" 0 ", color_str, "}", p, t, "\" 0 ", color_str, "}",
NULL); NULL);
} }
my_free(_ALLOC_ID_, &p); my_free(635, &p);
my_free(_ALLOC_ID_, &t); my_free(636, &t);
} }
} }
@ -1182,7 +1182,7 @@ static void send_net_to_graph(char **s, int simtype, const char *node)
int start_level; int start_level;
c = get_color(xctx->hilight_color); c = get_color(xctx->hilight_color);
expanded_tok = expandlabel(tok, &tok_mult); expanded_tok = expandlabel(tok, &tok_mult);
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); my_strdup2(637, &p, xctx->sch_path[xctx->currsch]+1);
path = p; path = p;
start_level = sch_waves_loaded(); start_level = sch_waves_loaded();
if(path) { if(path) {
@ -1195,20 +1195,20 @@ static void send_net_to_graph(char **s, int simtype, const char *node)
} }
strtolower(path); strtolower(path);
for(k=1; k<=tok_mult; ++k) { for(k=1; k<=tok_mult; ++k) {
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); my_strdup(638, &t, find_nth(expanded_tok, ",", "", 0, k));
strtolower(t); strtolower(t);
if(simtype == 0 ) { /* ngspice */ if(simtype == 0 ) { /* ngspice */
dbg(1, "%s%s color=%d\n", path, t, c); dbg(1, "%s%s color=%d\n", path, t, c);
my_snprintf(ss, S(ss), "%s%s %d ", path, t, c); my_snprintf(ss, S(ss), "%s%s %d ", path, t, c);
my_strcat(_ALLOC_ID_, s, ss); my_strcat(639, s, ss);
} else { /* Xyce */ } else { /* Xyce */
my_snprintf(ss, S(ss), "%s%s %d", path, t, c); my_snprintf(ss, S(ss), "%s%s %d", path, t, c);
my_strcat(_ALLOC_ID_, s, ss); my_strcat(640, s, ss);
} }
} }
my_free(_ALLOC_ID_, &p); my_free(641, &p);
my_free(_ALLOC_ID_, &t); my_free(642, &t);
} }
} }
@ -1233,11 +1233,11 @@ static void send_net_to_gaw(int simtype, const char *node)
expanded_tok = expandlabel(tok, &tok_mult); expanded_tok = expandlabel(tok, &tok_mult);
tcleval("setup_tcp_gaw"); tcleval("setup_tcp_gaw");
if(tclresult()[0] == '0') return; if(tclresult()[0] == '0') return;
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); my_strdup2(643, &p, xctx->sch_path[xctx->currsch]+1);
path = p; path = p;
strtolower(path); strtolower(path);
for(k=1; k<=tok_mult; ++k) { for(k=1; k<=tok_mult; ++k) {
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); my_strdup(644, &t, find_nth(expanded_tok, ",", "", 0, k));
strtolower(t); strtolower(t);
if(simtype == 0 ) { /* ngspice */ if(simtype == 0 ) { /* ngspice */
tclvareval("puts $gaw_fd {copyvar v(", path, t, tclvareval("puts $gaw_fd {copyvar v(", path, t,
@ -1247,8 +1247,8 @@ static void send_net_to_gaw(int simtype, const char *node)
") sel #", color_str, "}\nvwait gaw_fd\n", NULL); ") sel #", color_str, "}\nvwait gaw_fd\n", NULL);
} }
} }
my_free(_ALLOC_ID_, &p); my_free(645, &p);
my_free(_ALLOC_ID_, &t); my_free(646, &t);
} }
} }
@ -1269,9 +1269,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, sprintf(color_str, "#%02x%02x%02x", xctx->xcolor_array[c].red>>8, xctx->xcolor_array[c].green>>8,
xctx->xcolor_array[c].blue>>8); xctx->xcolor_array[c].blue>>8);
expanded_tok = expandlabel(tok, &tok_mult); expanded_tok = expandlabel(tok, &tok_mult);
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); my_strdup2(647, &p, xctx->sch_path[xctx->currsch]+1);
for(k=1; k<=tok_mult; ++k) { for(k=1; k<=tok_mult; ++k) {
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); my_strdup(648, &t, find_nth(expanded_tok, ",", "", 0, k));
/* bespice command syntax : /* bespice command syntax :
add_current_through_spice_device_to_plot <plot name> <section name> <hierarchical spice device name> <flag clear> [<color>] add_current_through_spice_device_to_plot <plot name> <section name> <hierarchical spice device name> <flag clear> [<color>]
plot name is "*" => automatic plot name is "*" => automatic
@ -1283,8 +1283,8 @@ static void send_current_to_bespice(int simtype, const char *node)
p, t, "\" 0 ", color_str, "}", p, t, "\" 0 ", color_str, "}",
NULL); NULL);
} }
my_free(_ALLOC_ID_, &p); my_free(649, &p);
my_free(_ALLOC_ID_, &t); my_free(650, &t);
} }
static void send_current_to_graph(char **s, int simtype, const char *node) static void send_current_to_graph(char **s, int simtype, const char *node)
@ -1299,7 +1299,7 @@ static void send_current_to_graph(char **s, int simtype, const char *node)
tok = node; tok = node;
c = get_color(xctx->hilight_color); c = get_color(xctx->hilight_color);
expanded_tok = expandlabel(tok, &tok_mult); expanded_tok = expandlabel(tok, &tok_mult);
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); my_strdup2(651, &p, xctx->sch_path[xctx->currsch]+1);
path = p; path = p;
start_level = sch_waves_loaded(); start_level = sch_waves_loaded();
if(path) { if(path) {
@ -1313,22 +1313,22 @@ static void send_current_to_graph(char **s, int simtype, const char *node)
strtolower(path); strtolower(path);
there_is_hierarchy = (strstr(path, ".") != NULL); there_is_hierarchy = (strstr(path, ".") != NULL);
for(k=1; k<=tok_mult; ++k) { for(k=1; k<=tok_mult; ++k) {
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); my_strdup(652, &t, find_nth(expanded_tok, ",", "", 0, k));
strtolower(t); strtolower(t);
if(!simtype) { /* ngspice */ if(!simtype) { /* ngspice */
my_snprintf(ss, S(ss), "i(%s%s%s) %d", there_is_hierarchy ? "v." : "", path, t, c); my_snprintf(ss, S(ss), "i(%s%s%s) %d", there_is_hierarchy ? "v." : "", path, t, c);
my_strcat(_ALLOC_ID_, s, ss); my_strcat(653, s, ss);
} else { /* Xyce */ } else { /* Xyce */
/* /*
my_snprintf(ss, S(ss), "%s%s%s#branch %d", there_is_hierarchy ? "v." : "", my_snprintf(ss, S(ss), "%s%s%s#branch %d", there_is_hierarchy ? "v." : "",
path, (there_is_hierarchy ? t+1 : t) , c); path, (there_is_hierarchy ? t+1 : t) , c);
*/ */
my_snprintf(ss, S(ss), "i(%s%s) %d", path, t, c); my_snprintf(ss, S(ss), "i(%s%s) %d", path, t, c);
my_strcat(_ALLOC_ID_, s, ss); my_strcat(654, s, ss);
} }
} }
my_free(_ALLOC_ID_, &p); my_free(655, &p);
my_free(_ALLOC_ID_, &t); my_free(656, &t);
} }
static void send_current_to_gaw(int simtype, const char *node) static void send_current_to_gaw(int simtype, const char *node)
@ -1348,12 +1348,12 @@ static void send_current_to_gaw(int simtype, const char *node)
expanded_tok = expandlabel(tok, &tok_mult); expanded_tok = expandlabel(tok, &tok_mult);
tcleval("setup_tcp_gaw"); tcleval("setup_tcp_gaw");
if(tclresult()[0] == '0') return; if(tclresult()[0] == '0') return;
my_strdup2(_ALLOC_ID_, &p, xctx->sch_path[xctx->currsch]+1); my_strdup2(657, &p, xctx->sch_path[xctx->currsch]+1);
path = p; path = p;
strtolower(path); strtolower(path);
there_is_hierarchy = (xctx->currsch > 0); there_is_hierarchy = (xctx->currsch > 0);
for(k=1; k<=tok_mult; ++k) { for(k=1; k<=tok_mult; ++k) {
my_strdup(_ALLOC_ID_, &t, find_nth(expanded_tok, ",", "", 0, k)); my_strdup(658, &t, find_nth(expanded_tok, ",", "", 0, k));
strtolower(t); strtolower(t);
if(!simtype) { /* spice */ if(!simtype) { /* spice */
tclvareval("puts $gaw_fd {copyvar i(", there_is_hierarchy ? "v." : "", path, t, tclvareval("puts $gaw_fd {copyvar i(", there_is_hierarchy ? "v." : "", path, t,
@ -1373,8 +1373,8 @@ static void send_current_to_gaw(int simtype, const char *node)
" sel #", color_str, "}\nvwait gaw_fd\n", NULL); " sel #", color_str, "}\nvwait gaw_fd\n", NULL);
} }
} }
my_free(_ALLOC_ID_, &p); my_free(659, &p);
my_free(_ALLOC_ID_, &t); my_free(660, &t);
} }
/* hilight/clear pin/label instances attached to hilight nets, or instances with "highlight=true" /* hilight/clear pin/label instances attached to hilight nets, or instances with "highlight=true"
@ -1649,21 +1649,21 @@ static void create_simdata(void)
int i, j; int i, j;
const char *str; const char *str;
free_simdata(); free_simdata();
my_realloc(_ALLOC_ID_, &xctx->simdata, xctx->instances * sizeof(Simdata)); my_realloc(661, &xctx->simdata, xctx->instances * sizeof(Simdata));
xctx->simdata_ninst = xctx->instances; xctx->simdata_ninst = xctx->instances;
for(i = 0; i < xctx->instances; ++i) { for(i = 0; i < xctx->instances; ++i) {
xSymbol *symbol = xctx->inst[i].ptr + xctx->sym; xSymbol *symbol = xctx->inst[i].ptr + xctx->sym;
int npin = symbol->rects[PINLAYER]; int npin = symbol->rects[PINLAYER];
xctx->simdata[i].pin = NULL; xctx->simdata[i].pin = NULL;
if(npin) my_realloc(_ALLOC_ID_, &xctx->simdata[i].pin, npin * sizeof(Simdata_pin)); if(npin) my_realloc(662, &xctx->simdata[i].pin, npin * sizeof(Simdata_pin));
xctx->simdata[i].npin = npin; xctx->simdata[i].npin = npin;
for(j = 0; j < npin; ++j) { for(j = 0; j < npin; ++j) {
char function[20]; char function[20];
xctx->simdata[i].pin[j].function=NULL; xctx->simdata[i].pin[j].function=NULL;
xctx->simdata[i].pin[j].go_to=NULL; xctx->simdata[i].pin[j].go_to=NULL;
my_snprintf(function, S(function), "function%d", j); my_snprintf(function, S(function), "function%d", j);
my_strdup(_ALLOC_ID_, &xctx->simdata[i].pin[j].function, get_tok_value(symbol->prop_ptr, function, 0)); my_strdup(663, &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, my_strdup(664, &xctx->simdata[i].pin[j].go_to,
get_tok_value(symbol->rect[PINLAYER][j].prop_ptr, "goto", 0)); get_tok_value(symbol->rect[PINLAYER][j].prop_ptr, "goto", 0));
str = get_tok_value(symbol->rect[PINLAYER][j].prop_ptr, "clock", 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; xctx->simdata[i].pin[j].clock = str[0] ? str[0] - '0' : -1;
@ -1679,12 +1679,12 @@ void free_simdata(void)
for(i = 0; i < xctx->simdata_ninst; ++i) { /* can not use xctx->instances if a new sch is loaded */ 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; int npin = xctx->simdata[i].npin;
for(j = 0; j < npin; ++j) { for(j = 0; j < npin; ++j) {
my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].function); my_free(665, &xctx->simdata[i].pin[j].function);
my_free(_ALLOC_ID_, &xctx->simdata[i].pin[j].go_to); my_free(666, &xctx->simdata[i].pin[j].go_to);
} }
if(npin) my_free(_ALLOC_ID_, &xctx->simdata[i].pin); if(npin) my_free(667, &xctx->simdata[i].pin);
} }
my_free(_ALLOC_ID_, &xctx->simdata); my_free(668, &xctx->simdata);
} }
xctx->simdata_ninst = 0; xctx->simdata_ninst = 0;
} }
@ -1809,7 +1809,7 @@ static void propagate_logic()
if( tclresult()[0] == '1') break; if( tclresult()[0] == '1') break;
++iter; ++iter;
} /* while(1) */ } /* while(1) */
/* my_free(_ALLOC_ID_, &propagated_net); */ /* my_free(669, &propagated_net); */
} }
void logic_set(int value, int num, const char *net_name) void logic_set(int value, int num, const char *net_name)
@ -1949,7 +1949,7 @@ void hilight_net(int viewer)
} }
if( viewer == XSCHEM_GRAPH && s) { if( viewer == XSCHEM_GRAPH && s) {
tclvareval("graph_add_nodes_from_list {", s, "}", NULL); tclvareval("graph_add_nodes_from_list {", s, "}", NULL);
my_free(_ALLOC_ID_, &s); my_free(670, &s);
} }
if(!incr_hi) incr_hilight_color(); if(!incr_hi) incr_hilight_color();
if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE); if(xctx->hilight_nets) propagate_hilights(1, 0, XINSERT_NOREPLACE);
@ -2067,7 +2067,7 @@ char *resolved_net(const char *net)
/* global node ? return as is */ /* global node ? return as is */
if(net && record_global_node(3, NULL, net)) { if(net && record_global_node(3, NULL, net)) {
my_strdup(_ALLOC_ID_, &rnet, net); my_strdup(671, &rnet, net);
return rnet; return rnet;
} }
if(net) { if(net) {
@ -2091,18 +2091,18 @@ char *resolved_net(const char *net)
} }
} }
dbg(1, "path=%s\n", path); dbg(1, "path=%s\n", path);
my_strdup2(_ALLOC_ID_, &exp_net, expandlabel(net, &mult)); my_strdup2(672, &exp_net, expandlabel(net, &mult));
n_s1 = exp_net; n_s1 = exp_net;
for(k = 0; k < mult; k++) { for(k = 0; k < mult; k++) {
char *net_name = my_strtok_r(n_s1, ",", "", 0, &n_s2); char *net_name = my_strtok_r(n_s1, ",", "", 0, &n_s2);
level = xctx->currsch; level = xctx->currsch;
n_s1 = NULL; n_s1 = NULL;
my_strdup2(_ALLOC_ID_, &resolved_net, net_name); my_strdup2(673, &resolved_net, net_name);
dbg(1, "resolved_net(): resolved_net=%s\n", resolved_net); dbg(1, "resolved_net(): resolved_net=%s\n", resolved_net);
if(xctx->currsch > 0) { /* check if net passed by attribute instead of by port */ 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); const char *ptr = get_tok_value(xctx->hier_attr[xctx->currsch - 1].prop_ptr, resolved_net, 0);
if(ptr && ptr[0]) { if(ptr && ptr[0]) {
my_strdup2(_ALLOC_ID_, &resolved_net, ptr); my_strdup2(674, &resolved_net, ptr);
level--; level--;
dbg(1, "lcc[%d].prop_ptr=%s\n", xctx->currsch - 1, xctx->hier_attr[xctx->currsch - 1].prop_ptr); 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); dbg(1, "resolved_net(): resolved_net=%s\n", resolved_net);
@ -2111,13 +2111,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 */ 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); entry = str_hash_lookup(&xctx->portmap[level], resolved_net, NULL, XLOOKUP);
if(entry) { if(entry) {
my_strdup2(_ALLOC_ID_, &resolved_net, entry->value); my_strdup2(675, &resolved_net, entry->value);
dbg(1, "resolved_net(): while loop: resolved_net=%s\n", resolved_net); dbg(1, "resolved_net(): while loop: resolved_net=%s\n", resolved_net);
} }
else break; else break;
level--; level--;
} }
my_strdup2(_ALLOC_ID_, &path2, path); my_strdup2(676, &path2, path);
skip = start_level; skip = start_level;
path2_ptr = path2; path2_ptr = path2;
if(level == start_level) path2_ptr[0] = '\0'; if(level == start_level) path2_ptr[0] = '\0';
@ -2132,15 +2132,15 @@ char *resolved_net(const char *net)
dbg(1, "path2=%s level=%d start_level=%d\n", path2, level, start_level); dbg(1, "path2=%s level=%d start_level=%d\n", path2, level, start_level);
if(record_global_node(3, NULL, resolved_net)) { if(record_global_node(3, NULL, resolved_net)) {
my_strdup2(_ALLOC_ID_, &rnet, resolved_net); my_strdup2(677, &rnet, resolved_net);
} else { } else {
my_mstrcat(_ALLOC_ID_, &rnet, path2, resolved_net, NULL); my_mstrcat(678, &rnet, path2, resolved_net, NULL);
} }
if(k < mult - 1) my_strcat(_ALLOC_ID_, &rnet, ","); if(k < mult - 1) my_strcat(679, &rnet, ",");
} }
if(resolved_net) my_free(_ALLOC_ID_, &resolved_net); if(resolved_net) my_free(680, &resolved_net);
my_free(_ALLOC_ID_, &path2); my_free(681, &path2);
my_free(_ALLOC_ID_, &exp_net); my_free(682, &exp_net);
} }
dbg(1, "resolved_net(): got %s, return %s\n", net, rnet); dbg(1, "resolved_net(): got %s, return %s\n", net, rnet);
return rnet; return rnet;
@ -2261,14 +2261,14 @@ void print_hilight_net(int show)
fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr);
return; return;
} }
my_strdup(_ALLOC_ID_, &filetmp2, filename_ptr); my_strdup(683, &filetmp2, filename_ptr);
fclose(fd); fclose(fd);
if(!(fd = open_tmpfile("hilight1_", &filename_ptr))) { if(!(fd = open_tmpfile("hilight1_", &filename_ptr))) {
fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr); fprintf(errfp, "print_hilight_net(): can not create tmpfile %s\n", filename_ptr);
my_free(_ALLOC_ID_, &filetmp2); my_free(684, &filetmp2);
return; return;
} }
my_strdup(_ALLOC_ID_, &filetmp1, filename_ptr); my_strdup(685, &filetmp1, filename_ptr);
my_snprintf(cmd, S(cmd), "awk -f \"%s/order_labels.awk\"", tclgetvar("XSCHEM_SHAREDIR")); 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(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); my_snprintf(cmd3, S(cmd3), "awk -f \"%s/sort_labels.awk\" %s", tclgetvar("XSCHEM_SHAREDIR"), filetmp1);
@ -2341,8 +2341,8 @@ void print_hilight_net(int show)
xctx->prep_hi_structs=0; xctx->prep_hi_structs=0;
xctx->prep_net_structs=0; xctx->prep_net_structs=0;
my_free(_ALLOC_ID_, &filetmp1); my_free(686, &filetmp1);
my_free(_ALLOC_ID_, &filetmp2); my_free(687, &filetmp2);
} }
void list_hilights(int all) void list_hilights(int all)

View File

@ -28,9 +28,9 @@ static void free_undo_lines(int slot)
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
for(i = 0;i<xctx->uslot[slot].lines[c]; ++i) { for(i = 0;i<xctx->uslot[slot].lines[c]; ++i) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr); my_free(688, &xctx->uslot[slot].lptr[c][i].prop_ptr);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr[c]); my_free(689, &xctx->uslot[slot].lptr[c]);
xctx->uslot[slot].lines[c] = 0; xctx->uslot[slot].lines[c] = 0;
} }
} }
@ -41,9 +41,9 @@ static void free_undo_rects(int slot)
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
for(i = 0;i<xctx->uslot[slot].rects[c]; ++i) { for(i = 0;i<xctx->uslot[slot].rects[c]; ++i) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr); my_free(690, &xctx->uslot[slot].bptr[c][i].prop_ptr);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr[c]); my_free(691, &xctx->uslot[slot].bptr[c]);
xctx->uslot[slot].rects[c] = 0; xctx->uslot[slot].rects[c] = 0;
} }
} }
@ -54,12 +54,12 @@ static void free_undo_polygons(int slot)
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
for(i = 0;i<xctx->uslot[slot].polygons[c]; ++i) { for(i = 0;i<xctx->uslot[slot].polygons[c]; ++i) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].prop_ptr); my_free(692, &xctx->uslot[slot].pptr[c][i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].x); my_free(693, &xctx->uslot[slot].pptr[c][i].x);
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].y); my_free(694, &xctx->uslot[slot].pptr[c][i].y);
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].selected_point); my_free(695, &xctx->uslot[slot].pptr[c][i].selected_point);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr[c]); my_free(696, &xctx->uslot[slot].pptr[c]);
xctx->uslot[slot].polygons[c] = 0; xctx->uslot[slot].polygons[c] = 0;
} }
} }
@ -70,9 +70,9 @@ static void free_undo_arcs(int slot)
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
for(i = 0;i<xctx->uslot[slot].arcs[c]; ++i) { for(i = 0;i<xctx->uslot[slot].arcs[c]; ++i) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr); my_free(697, &xctx->uslot[slot].aptr[c][i].prop_ptr);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr[c]); my_free(698, &xctx->uslot[slot].aptr[c]);
xctx->uslot[slot].arcs[c] = 0; xctx->uslot[slot].arcs[c] = 0;
} }
} }
@ -82,9 +82,9 @@ static void free_undo_wires(int slot)
int i; int i;
for(i = 0;i<xctx->uslot[slot].wires; ++i) { for(i = 0;i<xctx->uslot[slot].wires; ++i) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr[i].prop_ptr); my_free(699, &xctx->uslot[slot].wptr[i].prop_ptr);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].wptr); my_free(700, &xctx->uslot[slot].wptr);
xctx->uslot[slot].wires = 0; xctx->uslot[slot].wires = 0;
} }
@ -93,13 +93,13 @@ static void free_undo_texts(int slot)
int i; int i;
for(i = 0;i<xctx->uslot[slot].texts; ++i) { for(i = 0;i<xctx->uslot[slot].texts; ++i) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr); my_free(701, &xctx->uslot[slot].tptr[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].txt_ptr); my_free(702, &xctx->uslot[slot].tptr[i].txt_ptr);
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].font); my_free(703, &xctx->uslot[slot].tptr[i].font);
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_instname); my_free(704, &xctx->uslot[slot].tptr[i].floater_instname);
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].floater_ptr); my_free(705, &xctx->uslot[slot].tptr[i].floater_ptr);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].tptr); my_free(706, &xctx->uslot[slot].tptr);
xctx->uslot[slot].texts = 0; xctx->uslot[slot].texts = 0;
} }
@ -108,12 +108,12 @@ static void free_undo_instances(int slot)
int i; int i;
for(i = 0;i<xctx->uslot[slot].instances; ++i) { for(i = 0;i<xctx->uslot[slot].instances; ++i) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].name); my_free(707, &xctx->uslot[slot].iptr[i].name);
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].prop_ptr); my_free(708, &xctx->uslot[slot].iptr[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].instname); my_free(709, &xctx->uslot[slot].iptr[i].instname);
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].lab); my_free(710, &xctx->uslot[slot].iptr[i].lab);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].iptr); my_free(711, &xctx->uslot[slot].iptr);
xctx->uslot[slot].instances = 0; xctx->uslot[slot].instances = 0;
} }
@ -125,77 +125,77 @@ static void free_undo_symbols(int slot)
symbols = xctx->uslot[slot].symbols; symbols = xctx->uslot[slot].symbols;
for(i = 0;i < symbols; ++i) { for(i = 0;i < symbols; ++i) {
sym = &xctx->uslot[slot].symptr[i]; sym = &xctx->uslot[slot].symptr[i];
my_free(_ALLOC_ID_, &sym->name); my_free(712, &sym->name);
my_free(_ALLOC_ID_, &sym->prop_ptr); my_free(713, &sym->prop_ptr);
my_free(_ALLOC_ID_, &sym->type); my_free(714, &sym->type);
my_free(_ALLOC_ID_, &sym->templ); my_free(715, &sym->templ);
my_free(_ALLOC_ID_, &sym->parent_prop_ptr); my_free(716, &sym->parent_prop_ptr);
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
for(j = 0;j<sym->polygons[c]; ++j) { for(j = 0;j<sym->polygons[c]; ++j) {
if(sym->poly[c][j].prop_ptr != NULL) { if(sym->poly[c][j].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &sym->poly[c][j].prop_ptr); my_free(717, &sym->poly[c][j].prop_ptr);
} }
my_free(_ALLOC_ID_, &sym->poly[c][j].x); my_free(718, &sym->poly[c][j].x);
my_free(_ALLOC_ID_, &sym->poly[c][j].y); my_free(719, &sym->poly[c][j].y);
my_free(_ALLOC_ID_, &sym->poly[c][j].selected_point); my_free(720, &sym->poly[c][j].selected_point);
} }
my_free(_ALLOC_ID_, &sym->poly[c]); my_free(721, &sym->poly[c]);
sym->polygons[c] = 0; sym->polygons[c] = 0;
for(j = 0;j<sym->lines[c]; ++j) { for(j = 0;j<sym->lines[c]; ++j) {
if(sym->line[c][j].prop_ptr != NULL) { if(sym->line[c][j].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &sym->line[c][j].prop_ptr); my_free(722, &sym->line[c][j].prop_ptr);
} }
} }
my_free(_ALLOC_ID_, &sym->line[c]); my_free(723, &sym->line[c]);
sym->lines[c] = 0; sym->lines[c] = 0;
for(j = 0;j<sym->arcs[c]; ++j) { for(j = 0;j<sym->arcs[c]; ++j) {
if(sym->arc[c][j].prop_ptr != NULL) { if(sym->arc[c][j].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &sym->arc[c][j].prop_ptr); my_free(724, &sym->arc[c][j].prop_ptr);
} }
} }
my_free(_ALLOC_ID_, &sym->arc[c]); my_free(725, &sym->arc[c]);
sym->arcs[c] = 0; sym->arcs[c] = 0;
for(j = 0;j<sym->rects[c]; ++j) { for(j = 0;j<sym->rects[c]; ++j) {
if(sym->rect[c][j].prop_ptr != NULL) { if(sym->rect[c][j].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &sym->rect[c][j].prop_ptr); my_free(726, &sym->rect[c][j].prop_ptr);
} }
} }
my_free(_ALLOC_ID_, &sym->rect[c]); my_free(727, &sym->rect[c]);
sym->rects[c] = 0; sym->rects[c] = 0;
} }
for(j = 0;j<sym->texts; ++j) { for(j = 0;j<sym->texts; ++j) {
if(sym->text[j].prop_ptr != NULL) { if(sym->text[j].prop_ptr != NULL) {
my_free(_ALLOC_ID_, &sym->text[j].prop_ptr); my_free(728, &sym->text[j].prop_ptr);
} }
if(sym->text[j].txt_ptr != NULL) { if(sym->text[j].txt_ptr != NULL) {
my_free(_ALLOC_ID_, &sym->text[j].txt_ptr); my_free(729, &sym->text[j].txt_ptr);
} }
if(sym->text[j].font != NULL) { if(sym->text[j].font != NULL) {
my_free(_ALLOC_ID_, &sym->text[j].font); my_free(730, &sym->text[j].font);
} }
if(sym->text[j].floater_instname != NULL) { if(sym->text[j].floater_instname != NULL) {
my_free(_ALLOC_ID_, &sym->text[j].floater_instname); my_free(731, &sym->text[j].floater_instname);
} }
if(sym->text[j].floater_ptr != NULL) { if(sym->text[j].floater_ptr != NULL) {
my_free(_ALLOC_ID_, &sym->text[j].floater_ptr); my_free(732, &sym->text[j].floater_ptr);
} }
} }
my_free(_ALLOC_ID_, &sym->text); my_free(733, &sym->text);
sym->texts = 0; sym->texts = 0;
my_free(_ALLOC_ID_, &sym->line); my_free(734, &sym->line);
my_free(_ALLOC_ID_, &sym->rect); my_free(735, &sym->rect);
my_free(_ALLOC_ID_, &sym->poly); my_free(736, &sym->poly);
my_free(_ALLOC_ID_, &sym->arc); my_free(737, &sym->arc);
my_free(_ALLOC_ID_, &sym->lines); my_free(738, &sym->lines);
my_free(_ALLOC_ID_, &sym->rects); my_free(739, &sym->rects);
my_free(_ALLOC_ID_, &sym->polygons); my_free(740, &sym->polygons);
my_free(_ALLOC_ID_, &sym->arcs); my_free(741, &sym->arcs);
} }
my_free(_ALLOC_ID_, &xctx->uslot[slot].symptr); my_free(742, &xctx->uslot[slot].symptr);
xctx->uslot[slot].symbols = 0; 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->undo_initialized); dbg(1, "mem_init_undo(): undo_initialized = %d\n", xctx->undo_initialized);
if(!xctx->undo_initialized) { if(!xctx->undo_initialized) {
for(slot = 0;slot<MAX_UNDO; slot++) { for(slot = 0;slot<MAX_UNDO; slot++) {
xctx->uslot[slot].lines = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->uslot[slot].lines = my_calloc(743, cadlayers, sizeof(int));
xctx->uslot[slot].rects = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->uslot[slot].rects = my_calloc(744, cadlayers, sizeof(int));
xctx->uslot[slot].arcs = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->uslot[slot].arcs = my_calloc(745, cadlayers, sizeof(int));
xctx->uslot[slot].polygons = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->uslot[slot].polygons = my_calloc(746, cadlayers, sizeof(int));
xctx->uslot[slot].lptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); xctx->uslot[slot].lptr = my_calloc(747, cadlayers, sizeof(xLine *));
xctx->uslot[slot].bptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); xctx->uslot[slot].bptr = my_calloc(748, cadlayers, sizeof(xRect *));
xctx->uslot[slot].aptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); xctx->uslot[slot].aptr = my_calloc(749, cadlayers, sizeof(xArc *));
xctx->uslot[slot].pptr = my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); xctx->uslot[slot].pptr = my_calloc(750, cadlayers, sizeof(xPoly *));
} }
xctx->undo_initialized = 1; xctx->undo_initialized = 1;
} }
@ -248,14 +248,14 @@ void mem_delete_undo(void)
if(!xctx->undo_initialized) return; if(!xctx->undo_initialized) return;
mem_clear_undo(); mem_clear_undo();
for(slot = 0;slot<MAX_UNDO; slot++) { for(slot = 0;slot<MAX_UNDO; slot++) {
my_free(_ALLOC_ID_, &xctx->uslot[slot].lines); my_free(751, &xctx->uslot[slot].lines);
my_free(_ALLOC_ID_, &xctx->uslot[slot].rects); my_free(752, &xctx->uslot[slot].rects);
my_free(_ALLOC_ID_, &xctx->uslot[slot].arcs); my_free(753, &xctx->uslot[slot].arcs);
my_free(_ALLOC_ID_, &xctx->uslot[slot].polygons); my_free(754, &xctx->uslot[slot].polygons);
my_free(_ALLOC_ID_, &xctx->uslot[slot].lptr); my_free(755, &xctx->uslot[slot].lptr);
my_free(_ALLOC_ID_, &xctx->uslot[slot].bptr); my_free(756, &xctx->uslot[slot].bptr);
my_free(_ALLOC_ID_, &xctx->uslot[slot].aptr); my_free(757, &xctx->uslot[slot].aptr);
my_free(_ALLOC_ID_, &xctx->uslot[slot].pptr); my_free(758, &xctx->uslot[slot].pptr);
} }
xctx->undo_initialized = 0; xctx->undo_initialized = 0;
} }
@ -268,11 +268,11 @@ void mem_push_undo(void)
mem_init_undo(); mem_init_undo();
slot = xctx->cur_undo_ptr%MAX_UNDO; slot = xctx->cur_undo_ptr%MAX_UNDO;
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].gptr, xctx->schvhdlprop); my_strdup(759, &xctx->uslot[slot].gptr, xctx->schvhdlprop);
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].vptr, xctx->schverilogprop); my_strdup(760, &xctx->uslot[slot].vptr, xctx->schverilogprop);
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].sptr, xctx->schprop); my_strdup(761, &xctx->uslot[slot].sptr, xctx->schprop);
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].kptr, xctx->schsymbolprop); my_strdup(762, &xctx->uslot[slot].kptr, xctx->schsymbolprop);
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].eptr, xctx->schtedaxprop); my_strdup(763, &xctx->uslot[slot].eptr, xctx->schtedaxprop);
free_undo_lines(slot); free_undo_lines(slot);
free_undo_rects(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].arcs, xctx->arcs, sizeof(xctx->arcs[0]) * cadlayers);
memcpy(xctx->uslot[slot].polygons, xctx->polygons, sizeof(xctx->polygons[0]) * cadlayers); memcpy(xctx->uslot[slot].polygons, xctx->polygons, sizeof(xctx->polygons[0]) * cadlayers);
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
xctx->uslot[slot].lptr[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine)); xctx->uslot[slot].lptr[c] = my_calloc(764, xctx->lines[c], sizeof(xLine));
xctx->uslot[slot].bptr[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect)); xctx->uslot[slot].bptr[c] = my_calloc(765, xctx->rects[c], sizeof(xRect));
xctx->uslot[slot].pptr[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly)); xctx->uslot[slot].pptr[c] = my_calloc(766, xctx->polygons[c], sizeof(xPoly));
xctx->uslot[slot].aptr[c] = my_calloc(_ALLOC_ID_, xctx->arcs[c], sizeof(xArc)); xctx->uslot[slot].aptr[c] = my_calloc(767, xctx->arcs[c], sizeof(xArc));
} }
xctx->uslot[slot].wptr = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(xWire)); xctx->uslot[slot].wptr = my_calloc(768, xctx->wires, sizeof(xWire));
xctx->uslot[slot].tptr = my_calloc(_ALLOC_ID_, xctx->texts, sizeof(xText)); xctx->uslot[slot].tptr = my_calloc(769, xctx->texts, sizeof(xText));
xctx->uslot[slot].iptr = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(xInstance)); xctx->uslot[slot].iptr = my_calloc(770, xctx->instances, sizeof(xInstance));
xctx->uslot[slot].symptr = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(xSymbol)); xctx->uslot[slot].symptr = my_calloc(771, xctx->symbols, sizeof(xSymbol));
xctx->uslot[slot].texts = xctx->texts; xctx->uslot[slot].texts = xctx->texts;
xctx->uslot[slot].instances = xctx->instances; xctx->uslot[slot].instances = xctx->instances;
xctx->uslot[slot].symbols = xctx->symbols; xctx->uslot[slot].symbols = xctx->symbols;
@ -307,34 +307,34 @@ void mem_push_undo(void)
for(i = 0;i<xctx->lines[c]; ++i) { for(i = 0;i<xctx->lines[c]; ++i) {
xctx->uslot[slot].lptr[c][i] = xctx->line[c][i]; xctx->uslot[slot].lptr[c][i] = xctx->line[c][i];
xctx->uslot[slot].lptr[c][i].prop_ptr = NULL; xctx->uslot[slot].lptr[c][i].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr); my_strdup(772, &xctx->uslot[slot].lptr[c][i].prop_ptr, xctx->line[c][i].prop_ptr);
} }
/* rects */ /* rects */
for(i = 0;i<xctx->rects[c]; ++i) { for(i = 0;i<xctx->rects[c]; ++i) {
xctx->uslot[slot].bptr[c][i] = xctx->rect[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].prop_ptr = NULL;
xctx->uslot[slot].bptr[c][i].extraptr = NULL; xctx->uslot[slot].bptr[c][i].extraptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr); my_strdup(773, &xctx->uslot[slot].bptr[c][i].prop_ptr, xctx->rect[c][i].prop_ptr);
} }
/* arcs */ /* arcs */
for(i = 0;i<xctx->arcs[c]; ++i) { for(i = 0;i<xctx->arcs[c]; ++i) {
xctx->uslot[slot].aptr[c][i] = xctx->arc[c][i]; xctx->uslot[slot].aptr[c][i] = xctx->arc[c][i];
xctx->uslot[slot].aptr[c][i].prop_ptr = NULL; xctx->uslot[slot].aptr[c][i].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr); my_strdup(774, &xctx->uslot[slot].aptr[c][i].prop_ptr, xctx->arc[c][i].prop_ptr);
} }
/*polygons */ /*polygons */
for(i = 0;i<xctx->polygons[c]; ++i) { for(i = 0;i<xctx->polygons[c]; ++i) {
int points = xctx->poly[c][i].points; int points = xctx->poly[c][i].points;
xctx->uslot[slot].pptr[c][i] = xctx->poly[c][i]; 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].prop_ptr = NULL;
xctx->uslot[slot].pptr[c][i].x = my_malloc(_ALLOC_ID_, points * sizeof(double)); xctx->uslot[slot].pptr[c][i].x = my_malloc(775, points * sizeof(double));
xctx->uslot[slot].pptr[c][i].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); xctx->uslot[slot].pptr[c][i].y = my_malloc(776, points * sizeof(double));
xctx->uslot[slot].pptr[c][i].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); xctx->uslot[slot].pptr[c][i].selected_point = my_malloc(777, 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].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].y, xctx->poly[c][i].y, points * sizeof(double));
memcpy(xctx->uslot[slot].pptr[c][i].selected_point, xctx->poly[c][i].selected_point, memcpy(xctx->uslot[slot].pptr[c][i].selected_point, xctx->poly[c][i].selected_point,
points * sizeof(unsigned short)); points * sizeof(unsigned short));
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr); my_strdup(778, &xctx->uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr);
} }
} }
/* instances */ /* instances */
@ -345,10 +345,10 @@ void mem_push_undo(void)
xctx->uslot[slot].iptr[i].instname = NULL; xctx->uslot[slot].iptr[i].instname = NULL;
xctx->uslot[slot].iptr[i].lab = NULL; xctx->uslot[slot].iptr[i].lab = NULL;
xctx->uslot[slot].iptr[i].node = NULL; xctx->uslot[slot].iptr[i].node = NULL;
my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].iptr[i].lab, xctx->inst[i].lab); my_strdup2(779, &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(780, &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(781, &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); my_strdup2(782, &xctx->uslot[slot].iptr[i].name, xctx->inst[i].name);
} }
/* symbols */ /* symbols */
@ -363,11 +363,11 @@ void mem_push_undo(void)
xctx->uslot[slot].tptr[i].font = NULL; xctx->uslot[slot].tptr[i].font = NULL;
xctx->uslot[slot].tptr[i].floater_instname = NULL; xctx->uslot[slot].tptr[i].floater_instname = NULL;
xctx->uslot[slot].tptr[i].floater_ptr = NULL; xctx->uslot[slot].tptr[i].floater_ptr = NULL;
my_strdup2(_ALLOC_ID_, &xctx->uslot[slot].tptr[i].prop_ptr, xctx->text[i].prop_ptr); my_strdup2(783, &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(784, &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(785, &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(786, &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); my_strdup2(787, &xctx->uslot[slot].tptr[i].floater_ptr, xctx->text[i].floater_ptr);
} }
/* wires */ /* wires */
@ -375,7 +375,7 @@ void mem_push_undo(void)
xctx->uslot[slot].wptr[i] = xctx->wire[i]; xctx->uslot[slot].wptr[i] = xctx->wire[i];
xctx->uslot[slot].wptr[i].prop_ptr = NULL; xctx->uslot[slot].wptr[i].prop_ptr = NULL;
xctx->uslot[slot].wptr[i].node = NULL; xctx->uslot[slot].wptr[i].node = NULL;
my_strdup(_ALLOC_ID_, &xctx->uslot[slot].wptr[i].prop_ptr, xctx->wire[i].prop_ptr); my_strdup(788, &xctx->uslot[slot].wptr[i].prop_ptr, xctx->wire[i].prop_ptr);
} }
@ -416,78 +416,78 @@ void mem_pop_undo(int redo, int set_modify_status)
slot = xctx->cur_undo_ptr%MAX_UNDO; slot = xctx->cur_undo_ptr%MAX_UNDO;
clear_drawing(); clear_drawing();
unselect_all(1); unselect_all(1);
my_free(_ALLOC_ID_, &xctx->wire); my_free(789, &xctx->wire);
my_free(_ALLOC_ID_, &xctx->text); my_free(790, &xctx->text);
my_free(_ALLOC_ID_, &xctx->inst); my_free(791, &xctx->inst);
for(i = 0;i<cadlayers; ++i) { for(i = 0;i<cadlayers; ++i) {
my_free(_ALLOC_ID_, &xctx->rect[i]); my_free(792, &xctx->rect[i]);
my_free(_ALLOC_ID_, &xctx->line[i]); my_free(793, &xctx->line[i]);
my_free(_ALLOC_ID_, &xctx->poly[i]); my_free(794, &xctx->poly[i]);
my_free(_ALLOC_ID_, &xctx->arc[i]); my_free(795, &xctx->arc[i]);
} }
remove_symbols(); remove_symbols();
for(i = 0;i<xctx->maxs; ++i) { for(i = 0;i<xctx->maxs; ++i) {
my_free(_ALLOC_ID_, &xctx->sym[i].line); my_free(796, &xctx->sym[i].line);
my_free(_ALLOC_ID_, &xctx->sym[i].rect); my_free(797, &xctx->sym[i].rect);
my_free(_ALLOC_ID_, &xctx->sym[i].arc); my_free(798, &xctx->sym[i].arc);
my_free(_ALLOC_ID_, &xctx->sym[i].poly); my_free(799, &xctx->sym[i].poly);
my_free(_ALLOC_ID_, &xctx->sym[i].lines); my_free(800, &xctx->sym[i].lines);
my_free(_ALLOC_ID_, &xctx->sym[i].polygons); my_free(801, &xctx->sym[i].polygons);
my_free(_ALLOC_ID_, &xctx->sym[i].arcs); my_free(802, &xctx->sym[i].arcs);
my_free(_ALLOC_ID_, &xctx->sym[i].rects); my_free(803, &xctx->sym[i].rects);
} }
my_free(_ALLOC_ID_, &xctx->sym); my_free(804, &xctx->sym);
my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, xctx->uslot[slot].gptr); my_strdup(805, &xctx->schvhdlprop, xctx->uslot[slot].gptr);
my_strdup(_ALLOC_ID_, &xctx->schverilogprop, xctx->uslot[slot].vptr); my_strdup(806, &xctx->schverilogprop, xctx->uslot[slot].vptr);
my_strdup(_ALLOC_ID_, &xctx->schprop, xctx->uslot[slot].sptr); my_strdup(807, &xctx->schprop, xctx->uslot[slot].sptr);
my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, xctx->uslot[slot].kptr); my_strdup(808, &xctx->schsymbolprop, xctx->uslot[slot].kptr);
my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, xctx->uslot[slot].eptr); my_strdup(809, &xctx->schtedaxprop, xctx->uslot[slot].eptr);
for(c = 0;c<cadlayers; ++c) { for(c = 0;c<cadlayers; ++c) {
/* lines */ /* lines */
xctx->maxl[c] = xctx->lines[c] = xctx->uslot[slot].lines[c]; xctx->maxl[c] = xctx->lines[c] = xctx->uslot[slot].lines[c];
xctx->line[c] = my_calloc(_ALLOC_ID_, xctx->lines[c], sizeof(xLine)); xctx->line[c] = my_calloc(810, xctx->lines[c], sizeof(xLine));
for(i = 0;i<xctx->lines[c]; ++i) { for(i = 0;i<xctx->lines[c]; ++i) {
xctx->line[c][i] = xctx->uslot[slot].lptr[c][i]; xctx->line[c][i] = xctx->uslot[slot].lptr[c][i];
xctx->line[c][i].prop_ptr = NULL; xctx->line[c][i].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->line[c][i].prop_ptr, xctx->uslot[slot].lptr[c][i].prop_ptr); my_strdup(811, &xctx->line[c][i].prop_ptr, xctx->uslot[slot].lptr[c][i].prop_ptr);
} }
/* rects */ /* rects */
xctx->maxr[c] = xctx->rects[c] = xctx->uslot[slot].rects[c]; xctx->maxr[c] = xctx->rects[c] = xctx->uslot[slot].rects[c];
xctx->rect[c] = my_calloc(_ALLOC_ID_, xctx->rects[c], sizeof(xRect)); xctx->rect[c] = my_calloc(812, xctx->rects[c], sizeof(xRect));
for(i = 0;i<xctx->rects[c]; ++i) { for(i = 0;i<xctx->rects[c]; ++i) {
xctx->rect[c][i] = xctx->uslot[slot].bptr[c][i]; xctx->rect[c][i] = xctx->uslot[slot].bptr[c][i];
xctx->rect[c][i].prop_ptr = NULL; xctx->rect[c][i].prop_ptr = NULL;
xctx->rect[c][i].extraptr = NULL; xctx->rect[c][i].extraptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr, xctx->uslot[slot].bptr[c][i].prop_ptr); my_strdup(813, &xctx->rect[c][i].prop_ptr, xctx->uslot[slot].bptr[c][i].prop_ptr);
} }
/* arcs */ /* arcs */
xctx->maxa[c] = xctx->arcs[c] = xctx->uslot[slot].arcs[c]; xctx->maxa[c] = xctx->arcs[c] = xctx->uslot[slot].arcs[c];
xctx->arc[c] = my_calloc(_ALLOC_ID_, xctx->arcs[c], sizeof(xArc)); xctx->arc[c] = my_calloc(814, xctx->arcs[c], sizeof(xArc));
for(i = 0;i<xctx->arcs[c]; ++i) { for(i = 0;i<xctx->arcs[c]; ++i) {
xctx->arc[c][i] = xctx->uslot[slot].aptr[c][i]; xctx->arc[c][i] = xctx->uslot[slot].aptr[c][i];
xctx->arc[c][i].prop_ptr = NULL; xctx->arc[c][i].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr, xctx->uslot[slot].aptr[c][i].prop_ptr); my_strdup(815, &xctx->arc[c][i].prop_ptr, xctx->uslot[slot].aptr[c][i].prop_ptr);
} }
/* polygons */ /* polygons */
xctx->maxp[c] = xctx->polygons[c] = xctx->uslot[slot].polygons[c]; xctx->maxp[c] = xctx->polygons[c] = xctx->uslot[slot].polygons[c];
xctx->poly[c] = my_calloc(_ALLOC_ID_, xctx->polygons[c], sizeof(xPoly)); xctx->poly[c] = my_calloc(816, xctx->polygons[c], sizeof(xPoly));
for(i = 0;i<xctx->polygons[c]; ++i) { for(i = 0;i<xctx->polygons[c]; ++i) {
int points = xctx->uslot[slot].pptr[c][i].points; int points = xctx->uslot[slot].pptr[c][i].points;
xctx->poly[c][i] = xctx->uslot[slot].pptr[c][i]; xctx->poly[c][i] = xctx->uslot[slot].pptr[c][i];
xctx->poly[c][i].prop_ptr = NULL; xctx->poly[c][i].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr, xctx->uslot[slot].pptr[c][i].prop_ptr); my_strdup(817, &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].x = my_malloc(818, points * sizeof(double));
xctx->poly[c][i].y = my_malloc(_ALLOC_ID_, points * sizeof(double)); xctx->poly[c][i].y = my_malloc(819, points * sizeof(double));
xctx->poly[c][i].selected_point = my_malloc(_ALLOC_ID_, points * sizeof(unsigned short)); xctx->poly[c][i].selected_point = my_malloc(820, 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].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].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, memcpy(xctx->poly[c][i].selected_point, xctx->uslot[slot].pptr[c][i].selected_point,
@ -497,22 +497,22 @@ void mem_pop_undo(int redo, int set_modify_status)
/* instances */ /* instances */
xctx->maxi = xctx->instances = xctx->uslot[slot].instances; xctx->maxi = xctx->instances = xctx->uslot[slot].instances;
xctx->inst = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(xInstance)); xctx->inst = my_calloc(821, xctx->instances, sizeof(xInstance));
for(i = 0;i<xctx->instances; ++i) { for(i = 0;i<xctx->instances; ++i) {
xctx->inst[i] = xctx->uslot[slot].iptr[i]; xctx->inst[i] = xctx->uslot[slot].iptr[i];
xctx->inst[i].prop_ptr = NULL; xctx->inst[i].prop_ptr = NULL;
xctx->inst[i].name = NULL; xctx->inst[i].name = NULL;
xctx->inst[i].instname = NULL; xctx->inst[i].instname = NULL;
xctx->inst[i].lab = NULL; xctx->inst[i].lab = NULL;
my_strdup2(_ALLOC_ID_, &xctx->inst[i].prop_ptr, xctx->uslot[slot].iptr[i].prop_ptr); my_strdup2(822, &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(823, &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(824, &xctx->inst[i].instname, xctx->uslot[slot].iptr[i].instname);
my_strdup2(_ALLOC_ID_, &xctx->inst[i].lab, xctx->uslot[slot].iptr[i].lab); my_strdup2(825, &xctx->inst[i].lab, xctx->uslot[slot].iptr[i].lab);
} }
/* symbols */ /* symbols */
xctx->maxs = xctx->symbols = xctx->uslot[slot].symbols; xctx->maxs = xctx->symbols = xctx->uslot[slot].symbols;
xctx->sym = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(xSymbol)); xctx->sym = my_calloc(826, xctx->symbols, sizeof(xSymbol));
for(i = 0;i<xctx->symbols; ++i) { for(i = 0;i<xctx->symbols; ++i) {
copy_symbol(&xctx->sym[i], &xctx->uslot[slot].symptr[i]); copy_symbol(&xctx->sym[i], &xctx->uslot[slot].symptr[i]);
@ -520,7 +520,7 @@ void mem_pop_undo(int redo, int set_modify_status)
/* texts */ /* texts */
xctx->maxt = xctx->texts = xctx->uslot[slot].texts; xctx->maxt = xctx->texts = xctx->uslot[slot].texts;
xctx->text = my_calloc(_ALLOC_ID_, xctx->texts, sizeof(xText)); xctx->text = my_calloc(827, xctx->texts, sizeof(xText));
for(i = 0;i<xctx->texts; ++i) { for(i = 0;i<xctx->texts; ++i) {
xctx->text[i] = xctx->uslot[slot].tptr[i]; xctx->text[i] = xctx->uslot[slot].tptr[i];
xctx->text[i].txt_ptr = NULL; xctx->text[i].txt_ptr = NULL;
@ -528,21 +528,21 @@ void mem_pop_undo(int redo, int set_modify_status)
xctx->text[i].floater_instname = NULL; xctx->text[i].floater_instname = NULL;
xctx->text[i].floater_ptr = NULL; xctx->text[i].floater_ptr = NULL;
xctx->text[i].prop_ptr = NULL; xctx->text[i].prop_ptr = NULL;
my_strdup2(_ALLOC_ID_, &xctx->text[i].prop_ptr, xctx->uslot[slot].tptr[i].prop_ptr); my_strdup2(828, &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(829, &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(830, &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(831, &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); my_strdup2(832, &xctx->text[i].floater_ptr, xctx->uslot[slot].tptr[i].floater_ptr);
} }
/* wires */ /* wires */
xctx->maxw = xctx->wires = xctx->uslot[slot].wires; xctx->maxw = xctx->wires = xctx->uslot[slot].wires;
xctx->wire = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(xWire)); xctx->wire = my_calloc(833, xctx->wires, sizeof(xWire));
for(i = 0;i<xctx->wires; ++i) { for(i = 0;i<xctx->wires; ++i) {
xctx->wire[i] = xctx->uslot[slot].wptr[i]; xctx->wire[i] = xctx->uslot[slot].wptr[i];
xctx->wire[i].prop_ptr = NULL; xctx->wire[i].prop_ptr = NULL;
xctx->wire[i].node = NULL; xctx->wire[i].node = NULL;
my_strdup(_ALLOC_ID_, &xctx->wire[i].prop_ptr, xctx->uslot[slot].wptr[i].prop_ptr); my_strdup(834, &xctx->wire[i].prop_ptr, xctx->uslot[slot].wptr[i].prop_ptr);
} }
/* unnecessary since in_memory_undo saves all symbols */ /* unnecessary since in_memory_undo saves all symbols */
/* link_symbols_to_instances(-1); */ /* link_symbols_to_instances(-1); */

View File

@ -118,17 +118,17 @@ int main(int argc, char **argv)
} }
#endif #endif
my_strdup(_ALLOC_ID_, &xschem_executable, argv[0]); my_strdup(835, &xschem_executable, argv[0]);
if(debug_var>=1 && !has_x) if(debug_var>=1 && !has_x)
fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n"); fprintf(errfp, "main(): no DISPLAY set, assuming no X available\n");
/* if cli_opt_detach is 1 no interactive command shell is created ... /* 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 * using cli_opt_detach if no windowing exists (has_x == 0) is non sense so do nothing
*/ */
cli_opt_argv = my_malloc(_ALLOC_ID_, cli_opt_argc * sizeof(char *)); cli_opt_argv = my_malloc(836, cli_opt_argc * sizeof(char *));
for(i = 0; i < cli_opt_argc; ++i) { for(i = 0; i < cli_opt_argc; ++i) {
cli_opt_argv[i] = NULL; cli_opt_argv[i] = NULL;
my_strdup(_ALLOC_ID_, &cli_opt_argv[i], argv[i]); my_strdup(837, &cli_opt_argv[i], argv[i]);
} }

View File

@ -32,7 +32,7 @@ void flip_rotate_ellipse(xRect *r, int rot, int flip)
if(flip) { if(flip) {
r->ellipse_a = 180 - r->ellipse_a - r->ellipse_b; r->ellipse_a = 180 - r->ellipse_a - r->ellipse_b;
my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b); my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b);
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); my_strdup2(838, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str));
} }
if(rot) { if(rot) {
if(rot == 3) { if(rot == 3) {
@ -44,7 +44,7 @@ void flip_rotate_ellipse(xRect *r, int rot, int flip)
} }
r->ellipse_a %= 360; r->ellipse_a %= 360;
my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b); my_snprintf(str, S(str), "%d,%d", r->ellipse_a, r->ellipse_b);
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, "ellipse", str)); my_strdup2(839, &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) if(xctx->wire[i].x1==xctx->wire[i].x2 && xctx->wire[i].y1 == xctx->wire[i].y2)
{ {
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); my_free(840, &xctx->wire[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->wire[i].node); my_free(841, &xctx->wire[i].node);
found=1; found=1;
++j; ++j;
continue; 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) if(xctx->line[c][i].x1==xctx->line[c][i].x2 && xctx->line[c][i].y1 == xctx->line[c][i].y2)
{ {
my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr); my_free(842, &xctx->line[c][i].prop_ptr);
found=1; found=1;
++j; ++j;
continue; 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) if(xctx->rect[c][i].x1==xctx->rect[c][i].x2 || xctx->rect[c][i].y1 == xctx->rect[c][i].y2)
{ {
my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr); my_free(843, &xctx->rect[c][i].prop_ptr);
set_rect_extraptr(0, &xctx->rect[c][i]); set_rect_extraptr(0, &xctx->rect[c][i]);
found=1; found=1;
++j; ++j;
@ -334,8 +334,8 @@ void draw_selection(GC g, int interruptable)
case POLYGON: case POLYGON:
{ {
int bezier; int bezier;
double *x = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); double *x = my_malloc(844, sizeof(double) *xctx->poly[c][n].points);
double *y = my_malloc(_ALLOC_ID_, sizeof(double) *xctx->poly[c][n].points); double *y = my_malloc(845, sizeof(double) *xctx->poly[c][n].points);
bezier = 2 + !strboolcmp(get_tok_value(xctx->poly[c][n].prop_ptr, "bezier", 0), "true"); 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) { if(xctx->poly[c][n].sel==SELECTED || xctx->poly[c][n].sel==SELECTED1) {
for(k=0;k<xctx->poly[c][n].points; ++k) { for(k=0;k<xctx->poly[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); drawtemppolygon(g, NOW, x, y, xctx->poly[c][n].points, bezier);
} }
my_free(_ALLOC_ID_, &x); my_free(846, &x);
my_free(_ALLOC_ID_, &y); my_free(847, &y);
} }
break; break;
@ -698,8 +698,8 @@ void copy_objects(int what)
{ {
xPoly *p = &xctx->poly[c][n]; xPoly *p = &xctx->poly[c][n];
double bx1 = 0.0, by1 = 0.0, bx2 = 0.0, by2 = 0.0; double bx1 = 0.0, by1 = 0.0, bx2 = 0.0, by2 = 0.0;
double *x = my_malloc(_ALLOC_ID_, sizeof(double) *p->points); double *x = my_malloc(848, sizeof(double) *p->points);
double *y = my_malloc(_ALLOC_ID_, sizeof(double) *p->points); double *y = my_malloc(849, sizeof(double) *p->points);
int j; int j;
for(j=0; j<p->points; ++j) { for(j=0; j<p->points; ++j) {
if( p->sel==SELECTED || p->selected_point[j]) { if( p->sel==SELECTED || p->selected_point[j]) {
@ -722,8 +722,8 @@ void copy_objects(int what)
xctx->sel_array[i].n=xctx->polygons[c]; xctx->sel_array[i].n=xctx->polygons[c];
store_poly(-1, x, y, p->points, c, p->sel, p->prop_ptr); store_poly(-1, x, y, p->points, c, p->sel, p->prop_ptr);
p->sel=0; p->sel=0;
my_free(_ALLOC_ID_, &x); my_free(850, &x);
my_free(_ALLOC_ID_, &y); my_free(851, &y);
} }
break; break;
case ARC: case ARC:
@ -787,7 +787,7 @@ void copy_objects(int what)
xctx->text[n].x0, xctx->text[n].y0, xctx->rx1,xctx->ry1); xctx->text[n].x0, xctx->text[n].y0, xctx->rx1,xctx->ry1);
} }
xctx->text[xctx->texts].txt_ptr=NULL; xctx->text[xctx->texts].txt_ptr=NULL;
my_strdup2(_ALLOC_ID_, &xctx->text[xctx->texts].txt_ptr,xctx->text[n].txt_ptr); my_strdup2(852, &xctx->text[xctx->texts].txt_ptr,xctx->text[n].txt_ptr);
xctx->text[n].sel=0; xctx->text[n].sel=0;
dbg(2, "copy_objects(): current str=%s\n", dbg(2, "copy_objects(): current str=%s\n",
xctx->text[xctx->texts].txt_ptr); xctx->text[xctx->texts].txt_ptr);
@ -802,9 +802,9 @@ void copy_objects(int what)
xctx->text[xctx->texts].font=NULL; xctx->text[xctx->texts].font=NULL;
xctx->text[xctx->texts].floater_instname=NULL; xctx->text[xctx->texts].floater_instname=NULL;
xctx->text[xctx->texts].floater_ptr=NULL; xctx->text[xctx->texts].floater_ptr=NULL;
my_strdup2(_ALLOC_ID_, &xctx->text[xctx->texts].prop_ptr, xctx->text[n].prop_ptr); my_strdup2(853, &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(854, &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); my_strdup2(855, &xctx->text[xctx->texts].floater_instname, xctx->text[n].floater_instname);
set_text_flags(&xctx->text[xctx->texts]); set_text_flags(&xctx->text[xctx->texts]);
xctx->text[xctx->texts].xscale=xctx->text[n].xscale; xctx->text[xctx->texts].xscale=xctx->text[n].xscale;
xctx->text[xctx->texts].yscale=xctx->text[n].yscale; xctx->text[xctx->texts].yscale=xctx->text[n].yscale;
@ -820,7 +820,7 @@ void copy_objects(int what)
xctx->text[l].hcenter, xctx->text[l].vcenter, xctx->text[l].hcenter, xctx->text[l].vcenter,
xctx->text[l].x0, xctx->text[l].y0, xctx->text[l].x0, xctx->text[l].y0,
&xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpi, &dtmp); &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpi, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(856, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
@ -858,9 +858,9 @@ void copy_objects(int what)
xctx->inst[xctx->instances].lab=NULL; xctx->inst[xctx->instances].lab=NULL;
xctx->inst[xctx->instances].node=NULL; xctx->inst[xctx->instances].node=NULL;
xctx->inst[xctx->instances].name=NULL; xctx->inst[xctx->instances].name=NULL;
my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].name, xctx->inst[n].name); my_strdup2(857, &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(858, &xctx->inst[xctx->instances].prop_ptr, xctx->inst[n].prop_ptr);
my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab); my_strdup2(859, &xctx->inst[xctx->instances].lab, xctx->inst[n].lab);
xctx->inst[n].sel=0; xctx->inst[n].sel=0;
xctx->inst[xctx->instances].embed = xctx->inst[n].embed; xctx->inst[xctx->instances].embed = xctx->inst[n].embed;
xctx->inst[xctx->instances].flags = xctx->inst[n].flags; xctx->inst[xctx->instances].flags = xctx->inst[n].flags;
@ -872,7 +872,7 @@ void copy_objects(int what)
xctx->inst[xctx->instances].rot = (xctx->inst[xctx->instances].rot + ( (xctx->move_flip && 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].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); xctx->inst[xctx->instances].flip = (xctx->move_flip? !xctx->inst[n].flip:xctx->inst[n].flip);
my_strdup2(_ALLOC_ID_, &xctx->inst[xctx->instances].instname, xctx->inst[n].instname); my_strdup2(860, &xctx->inst[xctx->instances].instname, xctx->inst[n].instname);
/* the newpropcnt argument is zero for the 1st call and used in */ /* the newpropcnt argument is zero for the 1st call and used in */
/* new_prop_string() for cleaning some internal caches. */ /* new_prop_string() for cleaning some internal caches. */
if(!newpropcnt) hash_names(-1, XINSERT); if(!newpropcnt) hash_names(-1, XINSERT);
@ -1272,7 +1272,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].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->text[n].vcenter, xctx->text[n].x0, xctx->text[n].y0,
&xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp); &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(861, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
@ -1299,7 +1299,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].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->text[n].vcenter, xctx->text[n].x0, xctx->text[n].y0,
&xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp); &xctx->rx1,&xctx->ry1, &xctx->rx2,&xctx->ry2, &tmpint, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(862, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);

View File

@ -33,7 +33,7 @@ static void instdelete(int n, int x, int y)
while(ptr) { while(ptr) {
if(ptr->n == n) { if(ptr->n == n) {
saveptr = ptr->next; saveptr = ptr->next;
my_free(_ALLOC_ID_, &ptr); my_free(863, &ptr);
*prevptr = saveptr; *prevptr = saveptr;
return; return;
} }
@ -46,7 +46,7 @@ static void instinsert(int n, int x, int y)
{ {
Instentry *ptr, *newptr; Instentry *ptr, *newptr;
ptr=xctx->inst_spatial_table[x][y]; ptr=xctx->inst_spatial_table[x][y];
newptr=my_malloc(_ALLOC_ID_, sizeof(Instentry)); newptr=my_malloc(864, sizeof(Instentry));
newptr->next=ptr; newptr->next=ptr;
newptr->n=n; newptr->n=n;
xctx->inst_spatial_table[x][y]=newptr; xctx->inst_spatial_table[x][y]=newptr;
@ -58,7 +58,7 @@ static Instentry *delinstentry(Instentry *t)
Instentry *tmp; Instentry *tmp;
while( t ) { while( t ) {
tmp = t->next; tmp = t->next;
my_free(_ALLOC_ID_, &t); my_free(865, &t);
t = tmp; t = tmp;
} }
return NULL; return NULL;
@ -140,7 +140,7 @@ static Objectentry *delobjectentry(Objectentry *t)
Objectentry *tmp; Objectentry *tmp;
while( t ) { while( t ) {
tmp = t->next; tmp = t->next;
my_free(_ALLOC_ID_, &t); my_free(866, &t);
t = tmp; t = tmp;
} }
return NULL; return NULL;
@ -169,7 +169,7 @@ static void objectdelete(int type, int n, int c, int x, int y)
while(ptr) { while(ptr) {
if(ptr->n == n && ptr->type == type && ptr->c == c ) { if(ptr->n == n && ptr->type == type && ptr->c == c ) {
saveptr = ptr->next; saveptr = ptr->next;
my_free(_ALLOC_ID_, &ptr); my_free(867, &ptr);
*prevptr = saveptr; *prevptr = saveptr;
return; return;
} }
@ -182,7 +182,7 @@ static void objectinsert(int type, int n, int c, int x, int y)
{ {
Objectentry *ptr, *newptr; Objectentry *ptr, *newptr;
ptr=xctx->object_spatial_table[x][y]; ptr=xctx->object_spatial_table[x][y];
newptr=my_malloc(_ALLOC_ID_, sizeof(Instentry)); newptr=my_malloc(868, sizeof(Instentry));
newptr->next=ptr; newptr->next=ptr;
newptr->type=type; newptr->type=type;
newptr->n=n; 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].hcenter, xctx->text[n].vcenter,
xctx->text[n].x0, xctx->text[n].y0, xctx->text[n].x0, xctx->text[n].y0,
&x1,&y1, &x2,&y2, &tmpi, &tmpd); &x1,&y1, &x2,&y2, &tmpi, &tmpd);
my_free(_ALLOC_ID_, &estr); my_free(869, &estr);
break; break;
default: default:
skip = 1; skip = 1;
@ -330,7 +330,7 @@ static void instpindelete(int n,int pin, int x, int y)
while(ptr) { while(ptr) {
if(ptr->n == n && ptr->pin == pin) { if(ptr->n == n && ptr->pin == pin) {
saveptr = ptr->next; saveptr = ptr->next;
my_free(_ALLOC_ID_, &ptr); my_free(870, &ptr);
*prevptr = saveptr; *prevptr = saveptr;
return; return;
} }
@ -345,7 +345,7 @@ static void instpininsert(int n,int pin, double x0, double y0, int x, int y)
Instpinentry *ptr, *newptr; Instpinentry *ptr, *newptr;
ptr=xctx->instpin_spatial_table[x][y]; ptr=xctx->instpin_spatial_table[x][y];
newptr=my_malloc(_ALLOC_ID_, sizeof(Instpinentry)); newptr=my_malloc(871, sizeof(Instpinentry));
newptr->next=ptr; newptr->next=ptr;
newptr->n=n; newptr->n=n;
newptr->x0=x0; newptr->x0=x0;
@ -362,7 +362,7 @@ static Instpinentry *delinstpinentry(Instpinentry *t)
while(t) { while(t) {
tmp = t->next; tmp = t->next;
my_free(_ALLOC_ID_, &t); my_free(872, &t);
t = tmp; t = tmp;
} }
return NULL; return NULL;
@ -387,7 +387,7 @@ static void wiredelete(int n, int x, int y)
while(ptr) { while(ptr) {
if(ptr->n == n) { if(ptr->n == n) {
saveptr = ptr->next; saveptr = ptr->next;
my_free(_ALLOC_ID_, &ptr); my_free(873, &ptr);
*prevptr = saveptr; *prevptr = saveptr;
return; return;
} }
@ -401,7 +401,7 @@ static void wireinsert(int n, int x, int y)
Wireentry *ptr, *newptr; Wireentry *ptr, *newptr;
ptr=xctx->wire_spatial_table[x][y]; ptr=xctx->wire_spatial_table[x][y];
newptr=my_malloc(_ALLOC_ID_, sizeof(Wireentry)); newptr=my_malloc(874, sizeof(Wireentry));
newptr->next=ptr; newptr->next=ptr;
newptr->n=n; newptr->n=n;
xctx->wire_spatial_table[x][y]=newptr; xctx->wire_spatial_table[x][y]=newptr;
@ -414,7 +414,7 @@ static Wireentry *delwireentry(Wireentry *t)
while( t ) { while( t ) {
tmp = t->next; tmp = t->next;
my_free(_ALLOC_ID_, &t); my_free(875, &t);
t = tmp; t = tmp;
} }
return NULL; return NULL;
@ -705,10 +705,10 @@ int record_global_node(int what, FILE *fp, const char *node)
if(what == 3) return 0; /* node is not a global */ if(what == 3) return 0; /* node is not a global */
if(xctx->max_globals >= xctx->size_globals) { if(xctx->max_globals >= xctx->size_globals) {
xctx->size_globals+=CADCHUNKALLOC; xctx->size_globals+=CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &xctx->globals, xctx->size_globals*sizeof(char *) ); my_realloc(876, &xctx->globals, xctx->size_globals*sizeof(char *) );
} }
xctx->globals[xctx->max_globals]=NULL; xctx->globals[xctx->max_globals]=NULL;
my_strdup(_ALLOC_ID_, &xctx->globals[xctx->max_globals], node); my_strdup(877, &xctx->globals[xctx->max_globals], node);
xctx->max_globals++; xctx->max_globals++;
} else if(what == 0) { } else if(what == 0) {
for(i = 0;i < xctx->max_globals; ++i) { for(i = 0;i < xctx->max_globals; ++i) {
@ -717,9 +717,9 @@ int record_global_node(int what, FILE *fp, const char *node)
} }
} else if(what == 2) { } else if(what == 2) {
for(i=0;i<xctx->max_globals; ++i) { for(i=0;i<xctx->max_globals; ++i) {
my_free(_ALLOC_ID_, &xctx->globals[i]); my_free(878, &xctx->globals[i]);
} }
my_free(_ALLOC_ID_, &xctx->globals); my_free(879, &xctx->globals);
xctx->size_globals = xctx->max_globals=0; xctx->size_globals = xctx->max_globals=0;
} }
@ -757,7 +757,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); dbg(2, "get_unnamed_node(): what=%d mult=%d node=%d\n", what, mult, node);
if(what==0) { /* initialize unnamed node data structures */ if(what==0) { /* initialize unnamed node data structures */
xctx->new_node=0; xctx->new_node=0;
my_free(_ALLOC_ID_, &xctx->node_mult); my_free(880, &xctx->node_mult);
xctx->node_mult_size=0; xctx->node_mult_size=0;
return 0; return 0;
} }
@ -771,7 +771,7 @@ int get_unnamed_node(int what, int mult,int node)
if(xctx->new_node >= xctx->node_mult_size) { /* enlarge array and zero it */ if(xctx->new_node >= xctx->node_mult_size) { /* enlarge array and zero it */
int oldsize = xctx->node_mult_size; int oldsize = xctx->node_mult_size;
xctx->node_mult_size = xctx->new_node + CADCHUNKALLOC; xctx->node_mult_size = xctx->new_node + CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &xctx->node_mult, sizeof(xctx->node_mult[0]) * xctx->node_mult_size ); my_realloc(881, &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])); memset(xctx->node_mult + oldsize, 0, (xctx->node_mult_size - oldsize) * sizeof(xctx->node_mult[0]));
} }
xctx->node_mult[xctx->new_node]=mult; xctx->node_mult[xctx->new_node]=mult;
@ -807,7 +807,7 @@ static void name_generics()
dbg(2, "name_generics(): naming generics from attached labels\n"); dbg(2, "name_generics(): naming generics from attached labels\n");
if(for_netlist) for (i=0;i<instances; ++i) { /* ... assign node fields on all (non label) instances */ if(for_netlist) for (i=0;i<instances; ++i) { /* ... assign node fields on all (non label) instances */
if(skip_instance(i, 0, netlist_lvs_ignore)) continue; if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type); my_strdup(882, &type,(inst[i].ptr+ xctx->sym)->type);
if(type && !IS_LABEL_OR_PIN(type) ) { if(type && !IS_LABEL_OR_PIN(type) ) {
if((generic_rects = (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]) > 0) { if((generic_rects = (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]) > 0) {
rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER]; rects = (inst[i].ptr+ xctx->sym)->rects[PINLAYER];
@ -833,12 +833,12 @@ static void name_generics()
if((inst[n].ptr+ xctx->sym)->type && inst[n].node[p] != NULL && if((inst[n].ptr+ xctx->sym)->type && inst[n].node[p] != NULL &&
!strcmp((inst[n].ptr+ xctx->sym)->type, "label")) { !strcmp((inst[n].ptr+ xctx->sym)->type, "label")) {
dbg(2, "name_generics(): naming generic %s\n", inst[n].node[p]); dbg(2, "name_generics(): naming generic %s\n", inst[n].node[p]);
my_strdup(_ALLOC_ID_, &inst[i].node[j], get_tok_value(inst[n].prop_ptr,"value",0) ); my_strdup(883, &inst[i].node[j], get_tok_value(inst[n].prop_ptr,"value",0) );
if(!for_netlist) { if(!for_netlist) {
my_strdup(_ALLOC_ID_, &sig_type,""); my_strdup(884, &sig_type,"");
bus_node_hash_lookup(inst[n].node[p],"", XINSERT, 1, sig_type,"", "",""); bus_node_hash_lookup(inst[n].node[p],"", XINSERT, 1, sig_type,"", "","");
} else { } else {
my_strdup(_ALLOC_ID_, &sig_type, my_strdup(885, &sig_type,
get_tok_value((inst[i].ptr+ xctx->sym)->rect[GENERICLAYER][j-rects].prop_ptr, "sig_type", 0)); get_tok_value((inst[i].ptr+ xctx->sym)->rect[GENERICLAYER][j-rects].prop_ptr, "sig_type", 0));
/* insert generic label in hash table as a port so it will not */ /* 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 */ /* be declared as a signal in the vhdl netlist. this is a workaround */
@ -854,7 +854,7 @@ static void name_generics()
} /* end if( rects=...>0) */ } /* end if( rects=...>0) */
} /* end if(type not a label nor pin)... */ } /* end if(type not a label nor pin)... */
} /* end for(i...) */ } /* end for(i...) */
if(type) my_free(_ALLOC_ID_, &type); if(type) my_free(886, &type);
} }
static int signal_short( const char *tag, const char *n1, const char *n2) static int signal_short( const char *tag, const char *n1, const char *n2)
@ -887,7 +887,7 @@ static void set_inst_node(int i, int j, const char *node)
if(!inst[i].node) return; if(!inst[i].node) return;
dbg(1, "set_inst_node(): inst %s pin %d <-- %s\n", inst[i].instname, j, node); dbg(1, "set_inst_node(): inst %s pin %d <-- %s\n", inst[i].instname, j, node);
expandlabel(inst[i].instname, &inst_mult); expandlabel(inst[i].instname, &inst_mult);
my_strdup(_ALLOC_ID_, &inst[i].node[j], node); my_strdup(887, &inst[i].node[j], node);
skip = skip_instance(i, 1, netlist_lvs_ignore); skip = skip_instance(i, 1, netlist_lvs_ignore);
if(!for_netlist || skip) { if(!for_netlist || skip) {
bus_node_hash_lookup(inst[i].node[j],"", XINSERT, 0,"","","",""); bus_node_hash_lookup(inst[i].node[j],"", XINSERT, 0,"","","","");
@ -973,8 +973,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); touch(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, wire[k].x2, wire[k].y2);
if( touches ) { if( touches ) {
if(!wire[n].node) { if(!wire[n].node) {
my_strdup(_ALLOC_ID_, &wire[n].node, wire[k].node); my_strdup(888, &wire[n].node, wire[k].node);
my_strdup(_ALLOC_ID_, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); my_strdup(889, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node));
err |= name_attached_inst_to_net(n, tmpi, tmpj); err |= name_attached_inst_to_net(n, tmpi, tmpj);
err |= wirecheck(n); /* recursive check */ err |= wirecheck(n); /* recursive check */
} else { } else {
@ -996,8 +996,8 @@ static int name_attached_nets(double x0, double y0, int sqx, int sqy, const char
int n = wptr->n; int n = wptr->n;
if(touch(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, x0,y0)) { if(touch(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, x0,y0)) {
if(!wire[n].node) { if(!wire[n].node) {
my_strdup(_ALLOC_ID_, &wire[n].node, node); my_strdup(890, &wire[n].node, node);
my_strdup(_ALLOC_ID_, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node)); my_strdup(891, &wire[n].prop_ptr, subst_token(wire[n].prop_ptr, "lab", wire[n].node));
err |= wirecheck(n); err |= wirecheck(n);
} else { } else {
if(for_netlist>0) err |= signal_short("Net", wire[n].node, node); if(for_netlist>0) err |= signal_short("Net", wire[n].node, node);
@ -1097,8 +1097,8 @@ static int find_pass_through_symbols(int what, int ninst)
int *symtable = NULL; int *symtable = NULL;
if(what == 0 ) { /* initialize */ if(what == 0 ) { /* initialize */
pt_symbol = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); pt_symbol = my_calloc(892, xctx->symbols, sizeof(int));
symtable = my_calloc(_ALLOC_ID_, xctx->symbols, sizeof(int)); symtable = my_calloc(893, xctx->symbols, sizeof(int));
for(i = 0; i < instances; ++i) { for(i = 0; i < instances; ++i) {
k = inst[i].ptr; k = inst[i].ptr;
if( k < 0 || symtable[k] ) continue; if( k < 0 || symtable[k] ) continue;
@ -1114,13 +1114,13 @@ static int find_pass_through_symbols(int what, int ninst)
int_hash_free(&table); int_hash_free(&table);
if(pt_symbol[k]) dbg(1, "duplicated pins: %s\n", xctx->sym[k].name); if(pt_symbol[k]) dbg(1, "duplicated pins: %s\n", xctx->sym[k].name);
} }
my_free(_ALLOC_ID_, &symtable); my_free(894, &symtable);
} else if(what ==1) { /* query */ } else if(what ==1) { /* query */
k = inst[ninst].ptr; k = inst[ninst].ptr;
if(k >=0 && pt_symbol[k]) return 1; if(k >=0 && pt_symbol[k]) return 1;
return 0; return 0;
} else if(what ==2) { /* cleanup */ } else if(what ==2) { /* cleanup */
my_free(_ALLOC_ID_, &pt_symbol); my_free(895, &pt_symbol);
} }
return -1; return -1;
} }
@ -1169,7 +1169,7 @@ static int instcheck(int n, int p)
char *node_base_name = NULL; char *node_base_name = NULL;
const char *tap; const char *tap;
if(inst[n].node && inst[n].node[0] && inst[n].node[0][0] == '#') { if(inst[n].node && inst[n].node[0] && inst[n].node[0][0] == '#') {
my_free(_ALLOC_ID_, &inst[n].node[0]); /* bus tap forces net name on pin 0 (the tap) */ my_free(896, &inst[n].node[0]); /* bus tap forces net name on pin 0 (the tap) */
} /* delete any previously set unnamed net */ } /* delete any previously set unnamed net */
if(!inst[n].node[0]) { /* still unnamed */ if(!inst[n].node[0]) { /* still unnamed */
/* tap = get_tok_value(inst[n].prop_ptr, "lab", 0); */ /* tap = get_tok_value(inst[n].prop_ptr, "lab", 0); */
@ -1189,12 +1189,12 @@ static int instcheck(int n, int p)
} else { } else {
nptr = inst[n].node[p]; nptr = inst[n].node[p];
} }
node_base_name = my_malloc(_ALLOC_ID_, strlen(inst[n].node[p]) + 1); node_base_name = my_malloc(897, strlen(inst[n].node[p]) + 1);
sscanf(nptr, "%[^[]", node_base_name); sscanf(nptr, "%[^[]", node_base_name);
my_strcat(_ALLOC_ID_, &node_base_name, tap); my_strcat(898, &node_base_name, tap);
} }
else { else {
my_strdup2(_ALLOC_ID_, &node_base_name, tap); my_strdup2(899, &node_base_name, tap);
} }
set_inst_node(n, 0, node_base_name); set_inst_node(n, 0, node_base_name);
get_inst_pin_coord(n, 0, &x0, &y0); get_inst_pin_coord(n, 0, &x0, &y0);
@ -1205,7 +1205,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]); 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]); dbg(1, "instcheck: bus tap node: p=%d, %s, tap=%s\n", p, inst[n].node[p], inst[n].node[0]);
my_free(_ALLOC_ID_, &node_base_name); my_free(900, &node_base_name);
} }
@ -1213,7 +1213,7 @@ static int instcheck(int n, int p)
else if(shorted_inst || find_pass_through_symbols(1, n)) { else if(shorted_inst || find_pass_through_symbols(1, n)) {
int k = inst[n].ptr; int k = inst[n].ptr;
char *pin_name = NULL; char *pin_name = NULL;
my_strdup(_ALLOC_ID_, &pin_name, get_tok_value(xctx->sym[k].rect[PINLAYER][p].prop_ptr, "name", 0)); my_strdup(901, &pin_name, get_tok_value(xctx->sym[k].rect[PINLAYER][p].prop_ptr, "name", 0));
if(p >= rects) return 1; if(p >= rects) return 1;
for(j = 0; j < rects; ++j) { for(j = 0; j < rects; ++j) {
const char *other_pin; const char *other_pin;
@ -1237,7 +1237,7 @@ static int instcheck(int n, int p)
} }
} }
} }
my_free(_ALLOC_ID_, &pin_name); my_free(902, &pin_name);
} }
return err; return err;
} }
@ -1274,7 +1274,7 @@ static int name_nodes_of_pins_labels_and_propagate()
for (i=0;i<instances; ++i) { for (i=0;i<instances; ++i) {
/* name ipin opin label node fields from prop_ptr attributes */ /* name ipin opin label node fields from prop_ptr attributes */
if(skip_instance(i, 0, netlist_lvs_ignore)) continue; if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(inst[i].ptr+ xctx->sym)->type); my_strdup(903, &type,(inst[i].ptr+ xctx->sym)->type);
if(print_erc && (!inst[i].instname || !inst[i].instname[0]) && if(print_erc && (!inst[i].instname || !inst[i].instname[0]) &&
!get_tok_value((inst[i].ptr+ xctx->sym)->templ, "name", 0)[0] !get_tok_value((inst[i].ptr+ xctx->sym)->templ, "name", 0)[0]
) { ) {
@ -1313,32 +1313,32 @@ static int name_nodes_of_pins_labels_and_propagate()
} }
#endif #endif
port=0; port=0;
my_strdup2(_ALLOC_ID_, &dir, ""); my_strdup2(904, &dir, "");
if(strcmp(type,"label")) { /* instance is a port (not a label) */ if(strcmp(type,"label")) { /* instance is a port (not a label) */
port=1; port=1;
/* 20071204 only define a dir property if instance is not a label */ /* 20071204 only define a dir property if instance is not a label */
if(for_netlist) if(for_netlist)
my_strdup2(_ALLOC_ID_, &dir, my_strdup2(905, &dir,
get_tok_value( (inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "dir",0)); get_tok_value( (inst[i].ptr+ xctx->sym)->rect[PINLAYER][0].prop_ptr, "dir",0));
} }
else { else {
/* handle global nodes (global=1 set as symbol property) 28032003 */ /* handle global nodes (global=1 set as symbol property) 28032003 */
my_strdup(_ALLOC_ID_, &global_node,get_tok_value(inst[i].prop_ptr,"global",0)); my_strdup(906, &global_node,get_tok_value(inst[i].prop_ptr,"global",0));
if(!xctx->tok_size) { if(!xctx->tok_size) {
my_strdup(_ALLOC_ID_, &global_node,get_tok_value((inst[i].ptr+ xctx->sym)->prop_ptr,"global",0)); my_strdup(907, &global_node,get_tok_value((inst[i].ptr+ xctx->sym)->prop_ptr,"global",0));
} }
/*20071204 if instance is a label dont define a dir property for more precise erc checking */ /*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) */ /* obtain ipin/opin/label signal type (default: std_logic) */
if(for_netlist) { if(for_netlist) {
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(inst[i].prop_ptr,"sig_type",0)); my_strdup(908, &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(909, &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(910, &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(911, &class,get_tok_value(inst[i].prop_ptr,"class",0));
} }
my_strdup(_ALLOC_ID_, &inst[i].node[0], inst[i].lab); my_strdup(912, &inst[i].node[0], inst[i].lab);
if(!(inst[i].node[0])) { if(!(inst[i].node[0])) {
my_strdup(_ALLOC_ID_, &inst[i].node[0], get_tok_value((inst[i].ptr+ xctx->sym)->templ, "lab",0)); my_strdup(913, &inst[i].node[0], get_tok_value((inst[i].ptr+ xctx->sym)->templ, "lab",0));
dbg(1, "name_nodes_of_pins_labels_and_propagate(): no lab attr on instance, pick from symbol: %s\n", dbg(1, "name_nodes_of_pins_labels_and_propagate(): no lab attr on instance, pick from symbol: %s\n",
inst[i].node[0]); inst[i].node[0]);
} }
@ -1360,14 +1360,14 @@ static int name_nodes_of_pins_labels_and_propagate()
err |= name_attached_inst(i, x0, y0, sqx, sqy, inst[i].node[0]); err |= name_attached_inst(i, x0, y0, sqx, sqy, inst[i].node[0]);
} /* if(type && ... */ } /* if(type && ... */
} /* for(i=0;i<instances... */ } /* for(i=0;i<instances... */
if(dir) my_free(_ALLOC_ID_, &dir); if(dir) my_free(914, &dir);
if(type) my_free(_ALLOC_ID_, &type); if(type) my_free(915, &type);
if(global_node) my_free(_ALLOC_ID_, &global_node); if(global_node) my_free(916, &global_node);
if(for_netlist) { if(for_netlist) {
if(sig_type) my_free(_ALLOC_ID_, &sig_type); if(sig_type) my_free(917, &sig_type);
if(verilog_type) my_free(_ALLOC_ID_, &verilog_type); if(verilog_type) my_free(918, &verilog_type);
if(value) my_free(_ALLOC_ID_, &value); if(value) my_free(919, &value);
if(class) my_free(_ALLOC_ID_, &class); if(class) my_free(920, &class);
} }
return err; return err;
} }
@ -1377,8 +1377,8 @@ static int set_unnamed_net(int i)
int err = 0; int err = 0;
char tmp_str[30]; char tmp_str[30];
my_snprintf(tmp_str, S(tmp_str), "#net%d", get_unnamed_node(1,0,0)); my_snprintf(tmp_str, S(tmp_str), "#net%d", get_unnamed_node(1,0,0));
my_strdup(_ALLOC_ID_, &xctx->wire[i].node, tmp_str); my_strdup(921, &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)); my_strdup(922, &xctx->wire[i].prop_ptr, subst_token(xctx->wire[i].prop_ptr, "lab", tmp_str));
/* insert unnamed wire name in hash table */ /* insert unnamed wire name in hash table */
bus_node_hash_lookup(tmp_str, "", XINSERT, 0,"","","",""); bus_node_hash_lookup(tmp_str, "", XINSERT, 0,"","","","");
err |= wirecheck(i); err |= wirecheck(i);
@ -1470,7 +1470,7 @@ static int reset_node_data_and_rehash()
(inst[i].ptr+ xctx->sym)->rects[GENERICLAYER]; (inst[i].ptr+ xctx->sym)->rects[GENERICLAYER];
if(rects > 0) if(rects > 0)
{ {
inst[i].node = my_malloc(_ALLOC_ID_, sizeof(char *) * rects); inst[i].node = my_malloc(923, sizeof(char *) * rects);
for (j=0;j<rects; ++j) for (j=0;j<rects; ++j)
{ {
inst[i].node[j]=NULL; inst[i].node[j]=NULL;
@ -1532,8 +1532,8 @@ void delete_inst_node(int i)
if( rects > 0 ) if( rects > 0 )
{ {
for(j=0;j< rects ; ++j) for(j=0;j< rects ; ++j)
my_free(_ALLOC_ID_, &xctx->inst[i].node[j]); my_free(924, &xctx->inst[i].node[j]);
my_free(_ALLOC_ID_, &xctx->inst[i].node ); my_free(925, &xctx->inst[i].node );
} }
} }
@ -1548,7 +1548,7 @@ void delete_netlist_structs(void)
} }
for(i=0;i<xctx->wires; ++i) for(i=0;i<xctx->wires; ++i)
{ {
my_free(_ALLOC_ID_, &xctx->wire[i].node); my_free(926, &xctx->wire[i].node);
} }
/* erase inst and wire topological hash tables */ /* erase inst and wire topological hash tables */
del_inst_pin_table(); del_inst_pin_table();
@ -1751,21 +1751,21 @@ int sym_vs_sch_pins(int all)
} }
symbol = match_symbol(name); symbol = match_symbol(name);
my_strdup(_ALLOC_ID_, &type, xctx->sym[symbol].type); my_strdup(927, &type, xctx->sym[symbol].type);
if(type && IS_PIN(type)) { if(type && IS_PIN(type)) {
my_strdup(_ALLOC_ID_, &lab, expandlabel(get_tok_value(tmp, "lab", 0), &mult)); my_strdup(928, &lab, expandlabel(get_tok_value(tmp, "lab", 0), &mult));
if(pin_cnt >= lab_array_size) { if(pin_cnt >= lab_array_size) {
lab_array_size += CADCHUNKALLOC; lab_array_size += CADCHUNKALLOC;
my_realloc(_ALLOC_ID_, &lab_array, lab_array_size * sizeof(char *)); my_realloc(929, &lab_array, lab_array_size * sizeof(char *));
} }
lab_array[pin_cnt] = NULL; lab_array[pin_cnt] = NULL;
my_strdup(_ALLOC_ID_, &(lab_array[pin_cnt]), lab); my_strdup(930, &(lab_array[pin_cnt]), lab);
pin_cnt++; pin_cnt++;
pin_match = 0; pin_match = 0;
for(j=0; j < rects; ++j) { for(j=0; j < rects; ++j) {
my_strdup(_ALLOC_ID_, &pin_name, my_strdup(931, &pin_name,
expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult)); expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult));
my_strdup(_ALLOC_ID_, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0)); my_strdup(932, &pin_dir, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "dir", 0));
if( pin_name && !strcmp(pin_name, lab)) { if( pin_name && !strcmp(pin_name, lab)) {
@ -1852,7 +1852,7 @@ int sym_vs_sch_pins(int all)
} }
} }
for(j=0; j < rects; ++j) { for(j=0; j < rects; ++j) {
my_strdup(_ALLOC_ID_, &pin_name, my_strdup(933, &pin_name,
expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult)); expandlabel(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr, "name", 0), &mult));
pin_match = 0; pin_match = 0;
for(k=0; k<pin_cnt; ++k) { for(k=0; k<pin_cnt; ++k) {
@ -1879,18 +1879,18 @@ int sym_vs_sch_pins(int all)
} }
if(lab_array_size) { if(lab_array_size) {
for(k=0;k<pin_cnt; ++k) { for(k=0;k<pin_cnt; ++k) {
my_free(_ALLOC_ID_, &(lab_array[k])); my_free(934, &(lab_array[k]));
} }
my_free(_ALLOC_ID_, &lab_array); my_free(935, &lab_array);
lab_array_size = 0; lab_array_size = 0;
pin_cnt=0; pin_cnt=0;
} }
} /* if( ... "subcircuit"... ) */ } /* if( ... "subcircuit"... ) */
my_free(_ALLOC_ID_, &type); my_free(936, &type);
my_free(_ALLOC_ID_, &tmp); my_free(937, &tmp);
my_free(_ALLOC_ID_, &lab); my_free(938, &lab);
my_free(_ALLOC_ID_, &pin_name); my_free(939, &pin_name);
my_free(_ALLOC_ID_, &pin_dir); my_free(940, &pin_dir);
} /* for(i=0;i<n_syms; ++i) */ } /* for(i=0;i<n_syms; ++i) */
if(all == -1) while(xctx->symbols > n_syms) remove_symbol(xctx->symbols - 1); if(all == -1) while(xctx->symbols > n_syms) remove_symbol(xctx->symbols - 1);

View File

@ -59,16 +59,16 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
if( what==XINSERT ) /* insert data */ if( what==XINSERT ) /* insert data */
{ {
s=sizeof( Node_hashentry ); s=sizeof( Node_hashentry );
entry=(Node_hashentry *)my_malloc(_ALLOC_ID_, s); entry=(Node_hashentry *)my_malloc(941, s);
entry->next = NULL; entry->next = NULL;
entry->token = entry->sig_type = entry->verilog_type = entry->token = entry->sig_type = entry->verilog_type =
entry->value = entry->class = entry->orig_tok = NULL; entry->value = entry->class = entry->orig_tok = NULL;
my_strdup(_ALLOC_ID_, &(entry->token),token); my_strdup(942, &(entry->token),token);
if(sig_type &&sig_type[0]) my_strdup(_ALLOC_ID_, &(entry->sig_type), sig_type); if(sig_type &&sig_type[0]) my_strdup(943, &(entry->sig_type), sig_type);
if(verilog_type &&verilog_type[0]) my_strdup(_ALLOC_ID_, &(entry->verilog_type), verilog_type); if(verilog_type &&verilog_type[0]) my_strdup(944, &(entry->verilog_type), verilog_type);
if(class && class[0]) my_strdup(_ALLOC_ID_, &(entry->class), class); if(class && class[0]) my_strdup(945, &(entry->class), class);
if(orig_tok && orig_tok[0]) my_strdup(_ALLOC_ID_, &(entry->orig_tok), orig_tok); if(orig_tok && orig_tok[0]) my_strdup(946, &(entry->orig_tok), orig_tok);
if(value && value[0]) my_strdup(_ALLOC_ID_, &(entry->value), value); if(value && value[0]) my_strdup(947, &(entry->value), value);
entry->d.port=d.port; entry->d.port=d.port;
entry->d.in=d.in; entry->d.in=d.in;
entry->d.out=d.out; entry->d.out=d.out;
@ -87,13 +87,13 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
if(what==XDELETE) /* remove token from the hash table ... */ if(what==XDELETE) /* remove token from the hash table ... */
{ {
saveptr=entry->next; saveptr=entry->next;
my_free(_ALLOC_ID_, &entry->token); my_free(948, &entry->token);
my_free(_ALLOC_ID_, &entry->verilog_type); my_free(949, &entry->verilog_type);
my_free(_ALLOC_ID_, &entry->sig_type); my_free(950, &entry->sig_type);
my_free(_ALLOC_ID_, &entry->class); my_free(951, &entry->class);
my_free(_ALLOC_ID_, &entry->orig_tok); my_free(952, &entry->orig_tok);
my_free(_ALLOC_ID_, &entry->value); my_free(953, &entry->value);
my_free(_ALLOC_ID_, &entry); my_free(954, &entry);
*preventry=saveptr; *preventry=saveptr;
return NULL; return NULL;
} }
@ -104,11 +104,11 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
entry->d.out+=d.out; entry->d.out+=d.out;
entry->d.inout+=d.inout; entry->d.inout+=d.inout;
if(sig_type && sig_type[0] !='\0') if(sig_type && sig_type[0] !='\0')
my_strdup(_ALLOC_ID_, &(entry->sig_type), sig_type); my_strdup(955, &(entry->sig_type), sig_type);
if(verilog_type && verilog_type[0] !='\0') if(verilog_type && verilog_type[0] !='\0')
my_strdup(_ALLOC_ID_, &(entry->verilog_type), verilog_type); my_strdup(956, &(entry->verilog_type), verilog_type);
if(value && value[0] !='\0') if(value && value[0] !='\0')
my_strdup(_ALLOC_ID_, &(entry->value), value); my_strdup(957, &(entry->value), value);
dbg(3, "node_hash_lookup(): hashing %s : value=%s\n\n", dbg(3, "node_hash_lookup(): hashing %s : value=%s\n\n",
entry->token, entry->value? entry->value:"NULL"); entry->token, entry->value? entry->value:"NULL");
return entry; return entry;
@ -132,12 +132,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==NULL || token[0] == 0) return NULL;
if( token[0] == '#') if( token[0] == '#')
{ {
my_strdup(_ALLOC_ID_, &string, token); my_strdup(958, &string, token);
} }
else else
{ {
dbg(3, "bus_node_hash_lookup(): expanding node: %s\n", token); dbg(3, "bus_node_hash_lookup(): expanding node: %s\n", token);
my_strdup(_ALLOC_ID_, &string, expandlabel(token,&mult)); my_strdup(959, &string, expandlabel(token,&mult));
dbg(3, "bus_node_hash_lookup(): done expanding node: %s\n", token); dbg(3, "bus_node_hash_lookup(): done expanding node: %s\n", token);
} }
if(string==NULL) return NULL; if(string==NULL) return NULL;
@ -159,7 +159,7 @@ Node_hashentry *bus_node_hash_lookup(const char *token, const char *dir, int wha
string_ptr++; string_ptr++;
} }
/* if something found return first pointer */ /* if something found return first pointer */
my_free(_ALLOC_ID_, &string); my_free(960, &string);
return ptr2; return ptr2;
} }
@ -169,13 +169,13 @@ static void node_hash_free_entry(Node_hashentry *entry)
while(entry) { while(entry) {
tmp = entry->next; tmp = entry->next;
my_free(_ALLOC_ID_, &entry->token); my_free(961, &entry->token);
my_free(_ALLOC_ID_, &entry->verilog_type); my_free(962, &entry->verilog_type);
my_free(_ALLOC_ID_, &entry->sig_type); my_free(963, &entry->sig_type);
my_free(_ALLOC_ID_, &entry->class); my_free(964, &entry->class);
my_free(_ALLOC_ID_, &entry->orig_tok); my_free(965, &entry->orig_tok);
my_free(_ALLOC_ID_, &entry->value); my_free(966, &entry->value);
my_free(_ALLOC_ID_, &entry); my_free(967, &entry);
entry = tmp; entry = tmp;
} }
} }
@ -280,9 +280,9 @@ void print_vhdl_signals(FILE *fd)
dbg(2, "print_vhdl_signals(): node: %s mult: %d value=%s \n\n", dbg(2, "print_vhdl_signals(): node: %s mult: %d value=%s \n\n",
ptr->token,mult, ptr->value?ptr->value:"NULL"); ptr->token,mult, ptr->value?ptr->value:"NULL");
if( ptr->class && ptr->class[0] ) if( ptr->class && ptr->class[0] )
my_strdup(_ALLOC_ID_, &class, ptr->class); my_strdup(968, &class, ptr->class);
else else
my_strdup(_ALLOC_ID_, &class, "signal"); my_strdup(969, &class, "signal");
if(mult>1) { if(mult>1) {
for(j=mult-1;j>=0;j--) { for(j=mult-1;j>=0;j--) {
fprintf(fd, "%s %s[%d] : ", class, ptr->token[0]=='#' ? ptr->token+1 : ptr->token,j); fprintf(fd, "%s %s[%d] : ", class, ptr->token[0]=='#' ? ptr->token+1 : ptr->token,j);
@ -312,7 +312,7 @@ void print_vhdl_signals(FILE *fd)
} }
} }
if(found) fprintf(fd, "\n" ); if(found) fprintf(fd, "\n" );
my_free(_ALLOC_ID_, &class); my_free(970, &class);
} }
@ -378,18 +378,18 @@ void list_nets(char **result)
prepare_netlist_structs(1); prepare_netlist_structs(1);
for(i = 0; i < xctx->instances; i++) { for(i = 0; i < xctx->instances; i++) {
if(skip_instance(i, 0, netlist_lvs_ignore)) continue; if(skip_instance(i, 0, netlist_lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(971, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if(type && xctx->inst[i].node && IS_PIN(type)) { if(type && xctx->inst[i].node && IS_PIN(type)) {
my_mstrcat(_ALLOC_ID_, result, my_mstrcat(972, result,
"{", get_tok_value(xctx->inst[i].prop_ptr, "lab", 0), " ", type, "}\n", NULL); "{", get_tok_value(xctx->inst[i].prop_ptr, "lab", 0), " ", type, "}\n", NULL);
} }
} }
if(type) my_free(_ALLOC_ID_, &type); if(type) my_free(973, &type);
for(i=0;i<HASHSIZE; ++i) { for(i=0;i<HASHSIZE; ++i) {
ptr = xctx->node_table[i]; ptr = xctx->node_table[i];
while(ptr) { while(ptr) {
if(!ptr->d.port) { if(!ptr->d.port) {
my_mstrcat(_ALLOC_ID_, result, my_mstrcat(974, result,
"{", ptr->token, " ", "net", "}\n", NULL); "{", ptr->token, " ", "net", "}\n", NULL);
} }
ptr = ptr->next; ptr = ptr->next;

View File

@ -74,11 +74,11 @@ static void check_opt(char *opt, char *optval, int type)
} else if( (type == LONG && !strcmp("preinit", opt)) ) { } else if( (type == LONG && !strcmp("preinit", opt)) ) {
dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval);
if(optval) my_strdup(_ALLOC_ID_, &cli_opt_preinit_command, optval); if(optval) my_strdup(975, &cli_opt_preinit_command, optval);
} else if( (type == LONG && !strcmp("tcl", opt)) ) { } else if( (type == LONG && !strcmp("tcl", opt)) ) {
dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval);
if(optval) my_strdup(_ALLOC_ID_, &cli_opt_tcl_command, optval); if(optval) my_strdup(976, &cli_opt_tcl_command, optval);
} else if( (type == LONG && !strcmp("script", opt)) ) { } else if( (type == LONG && !strcmp("script", opt)) ) {
dbg(1, "process_options(): passing tcl script file to interpreter: %s\n", optval); 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)) ) { } else if( (type == LONG && !strcmp("command", opt)) ) {
dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval); dbg(1, "process_options(): passing tcl command to interpreter: %s\n", optval);
if(optval) my_strdup(_ALLOC_ID_, &cli_opt_tcl_post_command, optval); if(optval) my_strdup(977, &cli_opt_tcl_post_command, optval);
} else if( (type == LONG && !strcmp("diff", opt)) ) { } else if( (type == LONG && !strcmp("diff", opt)) ) {
dbg(1, "process_options(): diff with: %s\n", optval); dbg(1, "process_options(): diff with: %s\n", optval);

View File

@ -66,7 +66,7 @@ extern int yylex();
void clear_expandlabel_data(void) void clear_expandlabel_data(void)
{ {
my_free(_ALLOC_ID_, &dest_string.str); my_free(978, &dest_string.str);
} }
static void str_char_replace(char s[], char chr, char repl_chr) 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) const char *expandlabel(const char *s, int *m)
{ {
YY_BUFFER_STATE buf; YY_BUFFER_STATE buf;
my_free(_ALLOC_ID_, &dest_string.str); /* 30102004 delete 'memory' of previous execution */ my_free(979, &dest_string.str); /* 30102004 delete 'memory' of previous execution */
if(!s) { if(!s) {
*m = -1; *m = -1;
@ -104,7 +104,7 @@ const char *expandlabel(const char *s, int *m)
if(parselabel_debug >= 3) fprintf(errfp, "expandlabel(): entering\n"); if(parselabel_debug >= 3) fprintf(errfp, "expandlabel(): entering\n");
if(!strpbrk(s, "*,.:") || s[0] == '$') { /* shortcut: nothing to parse / expand */ if(!strpbrk(s, "*,.:") || s[0] == '$') { /* shortcut: nothing to parse / expand */
*m = 1; *m = 1;
my_strdup2(_ALLOC_ID_, &dest_string.str, s); my_strdup2(980, &dest_string.str, s);
if(xctx->netlist_type == CAD_SPICE_NETLIST && bus_char[0] && bus_char[1]) { 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[0]);
str_char_replace(dest_string.str, ']', bus_char[1]); str_char_replace(dest_string.str, ']', bus_char[1]);
@ -119,13 +119,13 @@ const char *expandlabel(const char *s, int *m)
size_t l; size_t l;
yyparse_error = -1; yyparse_error = -1;
l = strlen(s)+400; l = strlen(s)+400;
cmd = my_malloc(_ALLOC_ID_, l); cmd = my_malloc(981, l);
fprintf(errfp, "syntax error in %s\n", s); fprintf(errfp, "syntax error in %s\n", s);
my_snprintf(cmd, l, my_snprintf(cmd, l,
"tk_messageBox -icon error -type ok -parent [xschem get topwindow] " "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]); "-message {Syntax error in identifier expansion: %s\nschematic:\n%s}", s, xctx->sch[xctx->currsch]);
if(has_x) tcleval(cmd); if(has_x) tcleval(cmd);
my_free(_ALLOC_ID_, &cmd); my_free(982, &cmd);
} }
if(parselabel_debug >= 3) if(parselabel_debug >= 3)
@ -138,7 +138,7 @@ const char *expandlabel(const char *s, int *m)
} }
} else { } else {
*m=-1; *m=-1;
my_strdup2(_ALLOC_ID_, &dest_string.str, s); my_strdup2(983, &dest_string.str, s);
} }
return dest_string.str; 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 */ /* recognize characters after a bus label: AA[33:31]_xx --> _xx */
{IDX_ID_N} { {IDX_ID_N} {
yylval.ptr.str=NULL;/*19102004 */ yylval.ptr.str=NULL;/*19102004 */
my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ my_strdup(984, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_TRAILER: |%s|\n", yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_TRAILER: |%s|\n", yytext);
BEGIN(INITIAL); BEGIN(INITIAL);
return B_TRAILER; 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] .... */ /* 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}) { ({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; yylval.ptr.str=NULL;
my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); my_strdup(985, &yylval.ptr.str, yytext);
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME3: |%s|\n", yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME3: |%s|\n", yytext);
return B_NAME; 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}) { ({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; yylval.ptr.str=NULL;
my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); my_strdup(986, &yylval.ptr.str, yytext);
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME2: |%s|\n", yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME2: |%s|\n", yytext);
return B_NAME; 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] */ /* 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}) { ({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; yylval.ptr.str=NULL;
my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); my_strdup(987, &yylval.ptr.str, yytext);
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME1: |%s|\n", yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME1: |%s|\n", yytext);
return B_NAME; return B_NAME;
} }
@ -268,7 +268,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
^\*.* { ^\*.* {
yylval.ptr.str=NULL; /*19102004 */ yylval.ptr.str=NULL; /*19102004 */
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_LINE: |%s|\n",yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_LINE: |%s|\n",yytext);
my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ my_strdup(988, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */
BEGIN(INITIAL); BEGIN(INITIAL);
return B_LINE; 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 */ /* a number: if not a multiplier nor a node index return as a node name */
{INT} { {INT} {
yylval.ptr.str=NULL; yylval.ptr.str=NULL;
my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); my_strdup(989, &yylval.ptr.str, yytext);
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME4: |%s|\n", yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME4: |%s|\n", yytext);
BEGIN(INITIAL); BEGIN(INITIAL);
return B_NAME; return B_NAME;
@ -301,7 +301,7 @@ ID_EXT_PARENTHESIS ([-~"#+/=_a-zA-Z][-#!@\\/:.=_+a-zA-Z0-9]*\([-~"#!@\\/:.=_+a-z
/* recognize the most esotheric identifiers */ /* recognize the most esotheric identifiers */
{ID_NUM}|{ID_EXT_PARENTHESIS} { {ID_NUM}|{ID_EXT_PARENTHESIS} {
yylval.ptr.str=NULL;/*19102004 */ yylval.ptr.str=NULL;/*19102004 */
my_strdup(_ALLOC_ID_, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */ my_strdup(990, &yylval.ptr.str, yytext); /* freed after use in expandlabel.y */
if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME0: |%s|\n", yytext); if(parselabel_debug >= 3) fprintf(errfp, "yylex(): B_NAME0: |%s|\n", yytext);
BEGIN(INITIAL); BEGIN(INITIAL);
return B_NAME; return B_NAME;

View File

@ -65,7 +65,7 @@ static void merge_wire(FILE *fd)
} }
load_ascii_string( &ptr, fd); load_ascii_string( &ptr, fd);
storeobject(-1, x1,y1,x2,y2,WIRE,0,SELECTED,ptr); storeobject(-1, x1,y1,x2,y2,WIRE,0,SELECTED,ptr);
my_free(_ALLOC_ID_, &ptr); my_free(991, &ptr);
select_wire(i, SELECTED, 1); select_wire(i, SELECTED, 1);
} }
@ -201,17 +201,17 @@ static void merge_polygon(FILE *fd)
ptr[i].y=NULL; ptr[i].y=NULL;
ptr[i].selected_point=NULL; ptr[i].selected_point=NULL;
ptr[i].prop_ptr=NULL; ptr[i].prop_ptr=NULL;
ptr[i].x = my_calloc(_ALLOC_ID_, points, sizeof(double)); ptr[i].x = my_calloc(992, points, sizeof(double));
ptr[i].y = my_calloc(_ALLOC_ID_, points, sizeof(double)); ptr[i].y = my_calloc(993, points, sizeof(double));
ptr[i].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); ptr[i].selected_point= my_calloc(994, points, sizeof(unsigned short));
ptr[i].points=points; ptr[i].points=points;
ptr[i].sel=0; ptr[i].sel=0;
for(j=0;j<points; ++j) { for(j=0;j<points; ++j) {
if(fscanf(fd, "%lf %lf ",&(ptr[i].x[j]), &(ptr[i].y[j]))<2) { if(fscanf(fd, "%lf %lf ",&(ptr[i].x[j]), &(ptr[i].y[j]))<2) {
fprintf(errfp,"merge_polygon(): WARNING: missing fields for POLYGON points, ignoring.\n"); fprintf(errfp,"merge_polygon(): WARNING: missing fields for POLYGON points, ignoring.\n");
my_free(_ALLOC_ID_, &ptr[i].x); my_free(995, &ptr[i].x);
my_free(_ALLOC_ID_, &ptr[i].y); my_free(996, &ptr[i].y);
my_free(_ALLOC_ID_, &ptr[i].selected_point); my_free(997, &ptr[i].selected_point);
read_line(fd, 0); read_line(fd, 0);
return; return;
} }
@ -286,12 +286,12 @@ static void merge_inst(int k,FILE *fd)
load_ascii_string(&tmp, fd); load_ascii_string(&tmp, fd);
/* avoid as much as possible calls to rel_sym_path (slow) */ /* avoid as much as possible calls to rel_sym_path (slow) */
#ifdef __unix__ #ifdef __unix__
if(tmp[0] == '/') my_strdup(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(tmp)); if(tmp[0] == '/') my_strdup(998, &xctx->inst[i].name, rel_sym_path(tmp));
else my_strdup(_ALLOC_ID_, &xctx->inst[i].name,tmp); else my_strdup(999, &xctx->inst[i].name,tmp);
#else #else
my_strdup(_ALLOC_ID_, &xctx->inst[i].name, rel_sym_path(tmp)); my_strdup(1000, &xctx->inst[i].name, rel_sym_path(tmp));
#endif #endif
my_free(_ALLOC_ID_, &tmp); my_free(1001, &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) { 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"); fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n");
read_line(fd, 0); read_line(fd, 0);
@ -305,14 +305,14 @@ static void merge_inst(int k,FILE *fd)
xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */ xctx->inst[i].lab=NULL; /* assigned in link_symbols_to_instances */
xctx->inst[i].node=NULL; xctx->inst[i].node=NULL;
load_ascii_string(&prop_ptr,fd); load_ascii_string(&prop_ptr,fd);
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, prop_ptr); my_strdup(1002, &xctx->inst[i].prop_ptr, prop_ptr);
set_inst_flags(&xctx->inst[i]); set_inst_flags(&xctx->inst[i]);
if(!k) hash_names(-1, XINSERT); if(!k) hash_names(-1, XINSERT);
new_prop_string(i, prop_ptr, tclgetboolvar("disable_unique_names")); /* will also assign .instname */ 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 */ /* the final tmp argument is zero for the 1st call and used in */
/* new_prop_string() for cleaning some internal caches. */ /* new_prop_string() for cleaning some internal caches. */
hash_names(i, XINSERT); hash_names(i, XINSERT);
my_free(_ALLOC_ID_, &prop_ptr); my_free(1003, &prop_ptr);
xctx->instances++; xctx->instances++;
} }
@ -376,7 +376,7 @@ void merge_file(int selection_load, const char ext[])
cmd = get_generator_command(name); cmd = get_generator_command(name);
if(cmd) { if(cmd) {
fd = popen(cmd, "r"); fd = popen(cmd, "r");
my_free(_ALLOC_ID_, &cmd); my_free(1004, &cmd);
} else fd = NULL; } else fd = NULL;
} else { } else {
fd=fopen(name, fopen_read_mode); fd=fopen(name, fopen_read_mode);
@ -460,7 +460,7 @@ void merge_file(int selection_load, const char ext[])
xctx->mousex_snap = 0.; xctx->mousex_snap = 0.;
xctx->mousey_snap = 0.; xctx->mousey_snap = 0.;
} }
my_free(_ALLOC_ID_, &aux_ptr); my_free(1005, &aux_ptr);
link_symbols_to_instances(old); /* in case of paste/merge will set instances .sel to SELECTED */ link_symbols_to_instances(old); /* in case of paste/merge will set instances .sel to SELECTED */
if(generator) pclose(fd); if(generator) pclose(fd);
else fclose(fd); else fclose(fd);

View File

@ -223,7 +223,7 @@ int ps_embedded_image(xRect* r, double x1, double y1, double x2, double y2, int
fprintf(fd, "~>\n"); fprintf(fd, "~>\n");
fprintf(fd, "grestore\n"); fprintf(fd, "grestore\n");
my_free(_ALLOC_ID_, &ascii85EncodedJpeg); my_free(1006, &ascii85EncodedJpeg);
free(jpgData); free(jpgData);
#endif #endif
return 1; return 1;
@ -368,7 +368,7 @@ void ps_embedded_graph(xRect* r, double rx1, double ry1, double rx2, double ry2)
fprintf(fd, "grestore\n"); fprintf(fd, "grestore\n");
my_free(_ALLOC_ID_, &ascii85EncodedJpeg); my_free(1007, &ascii85EncodedJpeg);
#endif #endif
} }
@ -686,7 +686,7 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2, if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,
xctx->areay2,textx1,texty1,textx2,texty2)) { xctx->areay2,textx1,texty1,textx2,texty2)) {
my_free(_ALLOC_ID_, &estr); my_free(1008, &estr);
return; return;
} }
if(hcenter) { if(hcenter) {
@ -710,7 +710,7 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in
if(rot == 3 && flip == 1 ) { x=textx1;} if(rot == 3 && flip == 1 ) { x=textx1;}
} }
llength=0; llength=0;
my_strdup2(_ALLOC_ID_, &sss, estr); my_strdup2(1009, &sss, estr);
tt=ss=sss; tt=ss=sss;
for(;;) { for(;;) {
c=*ss; c=*ss;
@ -728,8 +728,8 @@ static void ps_draw_string(int layer, const char *str, short rot, short flip, in
} }
++ss; ++ss;
} }
my_free(_ALLOC_ID_, &sss); my_free(1010, &sss);
my_free(_ALLOC_ID_, &estr); my_free(1011, &estr);
} }
static void old_ps_draw_string(int gctext, const char *str, static void old_ps_draw_string(int gctext, const char *str,
@ -757,7 +757,7 @@ static void old_ps_draw_string(int gctext, const char *str,
#endif #endif
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) { if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) {
my_free(_ALLOC_ID_, &estr); my_free(1012, &estr);
return; return;
} }
set_ps_colors(gctext); set_ps_colors(gctext);
@ -790,7 +790,7 @@ static void old_ps_draw_string(int gctext, const char *str,
} }
++pos; ++pos;
} }
my_free(_ALLOC_ID_, &estr); my_free(1013, &estr);
} }
static void ps_drawgrid() static void ps_drawgrid()
@ -903,8 +903,8 @@ static void ps_draw_symbol(int c, int n,int layer, int what, short tmp_flip, sho
polygon = &((xctx->inst[n].ptr+ xctx->sym)->poly[layer])[j]; polygon = &((xctx->inst[n].ptr+ xctx->sym)->poly[layer])[j];
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
int k, bezier; int k, bezier;
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); double *x = my_malloc(1014, sizeof(double) * polygon->points);
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); double *y = my_malloc(1015, sizeof(double) * polygon->points);
for(k=0;k<polygon->points; ++k) { for(k=0;k<polygon->points; ++k) {
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
x[k]+= x0; x[k]+= x0;
@ -912,8 +912,8 @@ static void ps_draw_symbol(int c, int n,int layer, int what, short tmp_flip, sho
} }
bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true"); bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true");
ps_drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, polygon->dash, bezier); ps_drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, polygon->dash, bezier);
my_free(_ALLOC_ID_, &x); my_free(1016, &x);
my_free(_ALLOC_ID_, &y); my_free(1017, &y);
} }
} }
@ -1067,7 +1067,7 @@ void create_ps(char **psfile, int what, int fullzoom, int eps)
} }
} }
setbuf(fd, NULL); /*To prevent buffer errors, still investigating cause. */ setbuf(fd, NULL); /*To prevent buffer errors, still investigating cause. */
ps_colors=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Ps_color)); ps_colors=my_calloc(1018, cadlayers, sizeof(Ps_color));
if(ps_colors==NULL){ if(ps_colors==NULL){
fprintf(errfp, "create_ps(): calloc error\n"); fprintf(errfp, "create_ps(): calloc error\n");
return; return;
@ -1393,7 +1393,7 @@ void create_ps(char **psfile, int what, int fullzoom, int eps)
fclose(fd); fclose(fd);
} }
tclsetboolvar("draw_grid", old_grid); tclsetboolvar("draw_grid", old_grid);
my_free(_ALLOC_ID_, &ps_colors); my_free(1019, &ps_colors);
/* restore original size and zoom factor */ /* restore original size and zoom factor */

File diff suppressed because it is too large Load Diff

View File

@ -29,16 +29,16 @@ void statusmsg(char str[],int n)
{ {
if(!str) return; if(!str) return;
if(str[0]== '\0') { if(str[0]== '\0') {
my_free(_ALLOC_ID_, &xctx->infowindow_text); my_free(1277, &xctx->infowindow_text);
return; return;
} else { } else {
if(n == 3) { if(n == 3) {
my_strdup(_ALLOC_ID_, &xctx->infowindow_text, str); my_strdup(1278, &xctx->infowindow_text, str);
} else if(n == 2) { } else if(n == 2) {
if(xctx->infowindow_text && xctx->infowindow_text[0]) { if(xctx->infowindow_text && xctx->infowindow_text[0]) {
my_strcat(_ALLOC_ID_, &xctx->infowindow_text, "\n"); my_strcat(1279, &xctx->infowindow_text, "\n");
} }
my_strcat(_ALLOC_ID_, &xctx->infowindow_text, str); my_strcat(1280, &xctx->infowindow_text, str);
} }
} }
if(!has_x) return; if(!has_x) return;
@ -192,7 +192,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
dir = argv[5]; dir = argv[5];
if(!strcmp(dir, "inout") || !strcmp(dir, "out") ) flip = 1; if(!strcmp(dir, "inout") || !strcmp(dir, "out") ) flip = 1;
if(!strcmp(dir, "inout")) linecol = 7; if(!strcmp(dir, "inout")) linecol = 7;
my_mstrcat(_ALLOC_ID_, &prop, "name=", name, " dir=", dir, NULL); my_mstrcat(1281, &prop, "name=", name, " dir=", dir, NULL);
storeobject(-1, x - 2.5, y - 2.5, x + 2.5, y + 2.5, xRECT, PINLAYER, 0, prop); storeobject(-1, x - 2.5, y - 2.5, x + 2.5, y + 2.5, xRECT, PINLAYER, 0, prop);
if(flip) { if(flip) {
create_text(draw, x - 25, y - 5, 0, 1, name, NULL, 0.2, 0.2); create_text(draw, x - 25, y - 5, 0, 1, name, NULL, 0.2, 0.2);
@ -213,7 +213,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
xctx->draw_window = save; xctx->draw_window = save;
} }
my_free(_ALLOC_ID_, &prop); my_free(1282, &prop);
} else { } else {
unselect_all(1); unselect_all(1);
storeobject(-1, x - 2.5, y - 2.5, x + 2.5, y + 2.5, xRECT, PINLAYER, SELECTED, "name=XXX\ndir=inout"); storeobject(-1, x - 2.5, y - 2.5, x + 2.5, y + 2.5, xRECT, PINLAYER, SELECTED, "name=XXX\ndir=inout");
@ -332,7 +332,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
raw_read(f, &xctx->raw, "op", -1.0, -1.0); raw_read(f, &xctx->raw, "op", -1.0, -1.0);
if(level >= 0) { if(level >= 0) {
xctx->raw->level = level; xctx->raw->level = level;
my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[level]); my_strdup2(1283, &xctx->raw->schname, xctx->sch[level]);
} }
update_op(); update_op();
draw(); draw();
@ -465,15 +465,15 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
if(!stat(sympath, &buf)) { /* file exists */ if(!stat(sympath, &buf)) { /* file exists */
if(xctx->time_last_modify < buf.st_mtime) { if(xctx->time_last_modify < buf.st_mtime) {
my_mstrcat(_ALLOC_ID_, &res, "Warning: symbol ", sympath, " is newer than schematic\n", NULL); my_mstrcat(1284, &res, "Warning: symbol ", sympath, " is newer than schematic\n", NULL);
} }
} else { /* not found */ } else { /* not found */
my_mstrcat(_ALLOC_ID_, &res, "Warning: symbol ", sympath, " not found\n", NULL); my_mstrcat(1285, &res, "Warning: symbol ", sympath, " not found\n", NULL);
} }
my_mstrcat(_ALLOC_ID_, &res, "symbol ", my_itoa(i), " : ", sympath, "\n", NULL); my_mstrcat(1286, &res, "symbol ", my_itoa(i), " : ", sympath, "\n", NULL);
} }
Tcl_SetResult(interp, res, TCL_VOLATILE); Tcl_SetResult(interp, res, TCL_VOLATILE);
my_free(_ALLOC_ID_, &res); my_free(1287, &res);
} }
/* check_unique_names [1|0] /* check_unique_names [1|0]
@ -814,7 +814,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
display_hilights(what, &str); display_hilights(what, &str);
Tcl_SetResult(interp, str, TCL_VOLATILE); Tcl_SetResult(interp, str, TCL_VOLATILE);
my_free(_ALLOC_ID_, &str); my_free(1288, &str);
} }
/* draw_graph [n] [flags] /* draw_graph [n] [flags]
@ -978,7 +978,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
": UNSAVED data: want to exit?\""); ": UNSAVED data: want to exit?\"");
} }
if(force || !xctx->modified || !strcmp(tclresult(), "ok")) { if(force || !xctx->modified || !strcmp(tclresult(), "ok")) {
if(closewindow) tclvareval("exit ", exit_status, NULL); if(closewindow) {
char s[40];
my_snprintf(s, S(s), "exit %d", exit_status);
tcleval(s);
}
else clear_schematic(0, 0); else clear_schematic(0, 0);
} }
} }
@ -1005,7 +1009,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
": UNSAVED data: want to exit?\""); ": UNSAVED data: want to exit?\"");
} }
if(!has_x || force || !xctx->modified || !strcmp(tclresult(), "ok")) { if(!has_x || force || !xctx->modified || !strcmp(tclresult(), "ok")) {
if(closewindow) tclvareval("exit ", exit_status, NULL); if(closewindow) {
char s[40];
my_snprintf(s, S(s), "exit %d", exit_status);
tcleval(s);
}
else clear_schematic(0, 0); else clear_schematic(0, 0);
} }
} }
@ -1033,10 +1041,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
l = expandlabel(argv[2], &tmp); l = expandlabel(argv[2], &tmp);
llen = strlen(l); llen = strlen(l);
dbg(1, "l=%s\n", l ? l : "<NULL>"); dbg(1, "l=%s\n", l ? l : "<NULL>");
result = my_malloc(_ALLOC_ID_, llen + 30); result = my_malloc(1289, llen + 30);
my_snprintf(result, llen + 30, "%s %d", l, tmp); my_snprintf(result, llen + 30, "%s %d", l, tmp);
Tcl_SetResult(interp, result, TCL_VOLATILE); Tcl_SetResult(interp, result, TCL_VOLATILE);
my_free(_ALLOC_ID_, &result); my_free(1290, &result);
} }
} }
else { cmd_found = 0;} else { cmd_found = 0;}
@ -1770,7 +1778,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); Tcl_SetResult(interp, (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][n].prop_ptr, TCL_VOLATILE);
} else { } else {
tmp = 100 + strlen(argv[4]) + strlen(argv[5]); tmp = 100 + strlen(argv[4]) + strlen(argv[5]);
subtok = my_malloc(_ALLOC_ID_,tmp); subtok = my_malloc(1291,tmp);
my_snprintf(subtok, tmp, "%s(%s)", argv[5], argv[4]); my_snprintf(subtok, tmp, "%s(%s)", argv[5], argv[4]);
value = get_tok_value(xctx->inst[inst].prop_ptr,subtok,0); value = get_tok_value(xctx->inst[inst].prop_ptr,subtok,0);
if(!value[0]) { if(!value[0]) {
@ -1789,7 +1797,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
Tcl_SetResult(interp, (char *)value, TCL_VOLATILE); Tcl_SetResult(interp, (char *)value, TCL_VOLATILE);
} }
my_free(_ALLOC_ID_, &subtok); my_free(1292, &subtok);
} }
} }
/* xschem getprop symbol lm358.sym [type] */ /* xschem getprop symbol lm358.sym [type] */
@ -1877,9 +1885,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 < 4) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;}
if(argc == 5) t = atoi(argv[4]); if(argc == 5) t = atoi(argv[4]);
else t = 0; else t = 0;
my_strdup(_ALLOC_ID_, &s, get_tok_value(argv[2], argv[3], t)); my_strdup(1293, &s, get_tok_value(argv[2], argv[3], t));
Tcl_SetResult(interp, s, TCL_VOLATILE); Tcl_SetResult(interp, s, TCL_VOLATILE);
my_free(_ALLOC_ID_, &s); my_free(1294, &s);
} }
/* get_tok_size /* get_tok_size
@ -2330,11 +2338,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
char *instname = xctx->inst[i].instname ? xctx->inst[i].instname : ""; char *instname = xctx->inst[i].instname ? xctx->inst[i].instname : "";
char *type = (xctx->inst[i].ptr + xctx->sym)->type; char *type = (xctx->inst[i].ptr + xctx->sym)->type;
type = type ? type : ""; type = type ? type : "";
if(i > 0) my_mstrcat(_ALLOC_ID_, &s, "\n", NULL); if(i > 0) my_mstrcat(1295, &s, "\n", NULL);
my_mstrcat(_ALLOC_ID_, &s, "{", instname, "} {", name, "} {", type, "}", NULL); my_mstrcat(1296, &s, "{", instname, "} {", name, "} {", type, "}", NULL);
} }
Tcl_SetResult(interp, (char *)s, TCL_VOLATILE); Tcl_SetResult(interp, (char *)s, TCL_VOLATILE);
my_free(_ALLOC_ID_, &s); my_free(1297, &s);
} }
/* instance_net inst pin /* instance_net inst pin
* Return the name of the net attached to pin 'pin' of instance 'inst' * Return the name of the net attached to pin 'pin' of instance 'inst'
@ -2463,7 +2471,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
rct=symbol->rect[PINLAYER]; rct=symbol->rect[PINLAYER];
/* slotted devices: name= U1:2, pinnumber=2:5 */ /* slotted devices: name= U1:2, pinnumber=2:5 */
slot = -1; slot = -1;
tmpstr = my_malloc(_ALLOC_ID_, sizeof(xctx->inst[i].instname)); tmpstr = my_malloc(1298, sizeof(xctx->inst[i].instname));
if((ss=strchr(xctx->inst[i].instname, ':')) ) { if((ss=strchr(xctx->inst[i].instname, ':')) ) {
sscanf(ss+1, "%s", tmpstr); sscanf(ss+1, "%s", tmpstr);
if(isonlydigit(tmpstr)) { if(isonlydigit(tmpstr)) {
@ -2482,7 +2490,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
get_inst_pin_coord(i, p, &pinx0, &piny0); 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); 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); Tcl_SetResult(interp, num, TCL_VOLATILE);
my_free(_ALLOC_ID_, &tmpstr); my_free(1299, &tmpstr);
} }
/* instance_pins inst /* instance_pins inst
@ -2504,11 +2512,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
const char *pin; const char *pin;
pin = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "name",0); pin = get_tok_value((xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr, "name",0);
if(!pin[0]) pin = "--ERROR--"; if(!pin[0]) pin = "--ERROR--";
my_mstrcat(_ALLOC_ID_, &pins, "{", pin, "}", NULL); my_mstrcat(1300, &pins, "{", pin, "}", NULL);
if(p< no_of_pins-1) my_strcat(_ALLOC_ID_, &pins, " "); if(p< no_of_pins-1) my_strcat(1301, &pins, " ");
} }
Tcl_SetResult(interp, pins, TCL_VOLATILE); Tcl_SetResult(interp, pins, TCL_VOLATILE);
my_free(_ALLOC_ID_, &pins); my_free(1302, &pins);
} }
} }
@ -2555,16 +2563,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(!pin[0]) pin = "--ERROR--"; if(!pin[0]) pin = "--ERROR--";
if(xctx->inst[i].node[p] && !strcmp(xctx->inst[i].node[p], argv[2]) && 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 )) { !IS_LABEL_SH_OR_PIN( (xctx->inst[i].ptr+xctx->sym)->type )) {
my_mstrcat(_ALLOC_ID_, &pins, "{ {", xctx->inst[i].instname, "} {", pin, NULL); my_mstrcat(1303, &pins, "{ {", xctx->inst[i].instname, "} {", pin, NULL);
get_inst_pin_coord(i, p, &pinx0, &piny0); get_inst_pin_coord(i, p, &pinx0, &piny0);
my_strncpy(xx, dtoa(pinx0), S(xx)); my_strncpy(xx, dtoa(pinx0), S(xx));
my_strncpy(yy, dtoa(piny0), S(yy)); my_strncpy(yy, dtoa(piny0), S(yy));
my_mstrcat(_ALLOC_ID_, &pins, "} {", xx, "} {", yy, "} } ", NULL); my_mstrcat(1304, &pins, "} {", xx, "} {", yy, "} } ", NULL);
} }
} }
} }
Tcl_SetResult(interp, pins ? pins : "", TCL_VOLATILE); Tcl_SetResult(interp, pins ? pins : "", TCL_VOLATILE);
my_free(_ALLOC_ID_, &pins); my_free(1305, &pins);
} }
/* is_symgen symbol /* is_symgen symbol
@ -2645,7 +2653,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
hier_psprint(&res, 2); hier_psprint(&res, 2);
Tcl_SetResult(interp, res, TCL_VOLATILE); Tcl_SetResult(interp, res, TCL_VOLATILE);
my_free(_ALLOC_ID_, &res); my_free(1306, &res);
} }
/* list_hilights [sep | all | all_nets | all_inst] /* list_hilights [sep | all | all_nets | all_inst]
@ -2677,7 +2685,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(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
list_nets(&result); list_nets(&result);
Tcl_SetResult(interp, result, TCL_VOLATILE); Tcl_SetResult(interp, result, TCL_VOLATILE);
my_free(_ALLOC_ID_, &result); my_free(1307, &result);
} }
/* list_tokens str with_quotes /* list_tokens str with_quotes
@ -2751,7 +2759,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
dbg(1, "scheduler: undo_reset=%d\n", undo_reset); dbg(1, "scheduler: undo_reset=%d\n", undo_reset);
load_schematic(load_symbols, f, undo_reset, !force); load_schematic(load_symbols, f, undo_reset, !force);
tclvareval("update_recent_file {", f, "}", NULL); tclvareval("update_recent_file {", f, "}", NULL);
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch], "."); my_strdup(1308, &xctx->sch_path[xctx->currsch], ".");
if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]); if(xctx->portmap[xctx->currsch].table) str_hash_free(&xctx->portmap[xctx->currsch]);
str_hash_init(&xctx->portmap[xctx->currsch], HASHSIZE); str_hash_init(&xctx->portmap[xctx->currsch], HASHSIZE);
xctx->sch_path_hash[xctx->currsch] = 0; xctx->sch_path_hash[xctx->currsch] = 0;
@ -3044,14 +3052,14 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(argc > 5) { if(argc > 5) {
char *strcopy = NULL, *strptr = NULL, *saveptr = NULL, *tok; char *strcopy = NULL, *strptr = NULL, *saveptr = NULL, *tok;
my_strdup(_ALLOC_ID_, &strcopy, argv[2]); my_strdup(1309, &strcopy, argv[2]);
strptr = strcopy; strptr = strcopy;
while( (tok = my_strtok_r(strptr, argv[3], argv[4], atoi(argv[5]), &saveptr)) ) { while( (tok = my_strtok_r(strptr, argv[3], argv[4], atoi(argv[5]), &saveptr)) ) {
strptr = NULL; strptr = NULL;
Tcl_AppendResult(interp, "{", tok, "}\n", NULL); Tcl_AppendResult(interp, "{", tok, "}\n", NULL);
} }
my_free(_ALLOC_ID_, &strptr); my_free(1310, &strptr);
} }
} }
@ -3099,7 +3107,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int done_netlist = 0; int done_netlist = 0;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
yyparse_error = 0; yyparse_error = 0;
my_strdup(_ALLOC_ID_, &saveshow, tclgetvar("show_infowindow_after_netlist")); my_strdup(1311, &saveshow, tclgetvar("show_infowindow_after_netlist"));
if(argc <= 2 || (argc > 2 && strcmp(argv[2], "-erc"))) { /* xschem netlist NOT invoked from GUI */ if(argc <= 2 || (argc > 2 && strcmp(argv[2], "-erc"))) { /* xschem netlist NOT invoked from GUI */
tclsetvar("show_infowindow_after_netlist", "never"); tclsetvar("show_infowindow_after_netlist", "never");
} }
@ -3160,7 +3168,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE); Tcl_SetResult(interp, my_itoa(err), TCL_VOLATILE);
} }
} }
my_free(_ALLOC_ID_, &saveshow); my_free(1312, &saveshow);
} }
/* new_process [f] /* new_process [f]
@ -4189,9 +4197,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
xctx->prep_net_structs=0; xctx->prep_net_structs=0;
xctx->prep_hi_structs=0; xctx->prep_hi_structs=0;
} }
my_strdup(_ALLOC_ID_, &sym, tcl_hook2(symbol)); my_strdup(1313, &sym, tcl_hook2(symbol));
sym_number=match_symbol(sym); sym_number=match_symbol(sym);
my_free(_ALLOC_ID_, &sym); my_free(1314, &sym);
if(sym_number>=0) if(sym_number>=0)
{ {
prefix=(get_tok_value( (xctx->sym+sym_number)->templ , "name",0))[0]; /* get new symbol prefix */ prefix=(get_tok_value( (xctx->sym+sym_number)->templ , "name",0))[0]; /* get new symbol prefix */
@ -4200,23 +4208,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 */ 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* */ /* if number of pins is different we must delete these data *before* */
/* changing ysmbol, otherwise i might end up deleting non allocated data. */ /* changing ysmbol, otherwise i might end up deleting non allocated data. */
my_strdup2(_ALLOC_ID_, &xctx->inst[inst].name, rel_sym_path(symbol)); my_strdup2(1315, &xctx->inst[inst].name, rel_sym_path(symbol));
xctx->inst[inst].ptr=sym_number; xctx->inst[inst].ptr=sym_number;
my_strdup(_ALLOC_ID_, &name, xctx->inst[inst].instname); my_strdup(1316, &name, xctx->inst[inst].instname);
if(name && name[0] ) if(name && name[0] )
{ {
/* 20110325 only modify prefix if prefix not NUL */ /* 20110325 only modify prefix if prefix not NUL */
if(prefix) name[0]=(char)prefix; /* change prefix if changing symbol type; */ if(prefix) name[0]=(char)prefix; /* change prefix if changing symbol type; */
my_strdup(_ALLOC_ID_, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) ); my_strdup(1317, &ptr,subst_token(xctx->inst[inst].prop_ptr, "name", name) );
if(!fast) hash_names(-1, XINSERT); if(!fast) hash_names(-1, XINSERT);
hash_names(inst, XDELETE); hash_names(inst, XDELETE);
new_prop_string(inst, ptr, /* sets also inst[].instname */ new_prop_string(inst, ptr, /* sets also inst[].instname */
tclgetboolvar("disable_unique_names")); /* set new prop_ptr */ tclgetboolvar("disable_unique_names")); /* set new prop_ptr */
hash_names(inst, XINSERT); hash_names(inst, XINSERT);
set_inst_flags(&xctx->inst[inst]); set_inst_flags(&xctx->inst[inst]);
my_free(_ALLOC_ID_, &ptr); my_free(1318, &ptr);
} }
my_free(_ALLOC_ID_, &name); my_free(1319, &name);
set_modify(1); set_modify(1);
/* draw(); */ /* draw(); */
Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE); Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE);
@ -4260,21 +4268,21 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
hash_names(inst, XDELETE); hash_names(inst, XDELETE);
set_inst_prop(inst); set_inst_prop(inst);
my_strdup2(_ALLOC_ID_, &translated_sym, translate(inst, xctx->inst[inst].name)); my_strdup2(1320, &translated_sym, translate(inst, xctx->inst[inst].name));
sym_number=match_symbol(translated_sym); sym_number=match_symbol(translated_sym);
if(sym_number > 0) { if(sym_number > 0) {
delete_inst_node(inst); delete_inst_node(inst);
xctx->inst[inst].ptr=sym_number; xctx->inst[inst].ptr=sym_number;
} }
if(subst) my_free(_ALLOC_ID_, &subst); if(subst) my_free(1321, &subst);
set_inst_flags(&xctx->inst[inst]); set_inst_flags(&xctx->inst[inst]);
hash_names(inst, XINSERT); hash_names(inst, XINSERT);
/* new symbol bbox after prop changes (may change due to text length) */ /* 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); 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 */ set_modify(-2); /* reset floaters caches */
draw(); draw();
my_free(_ALLOC_ID_, &translated_sym); my_free(1322, &translated_sym);
Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE); Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE);
} }
@ -4294,7 +4302,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, "xschem reset_symbol: instance not found", TCL_STATIC); Tcl_SetResult(interp, "xschem reset_symbol: instance not found", TCL_STATIC);
return TCL_ERROR; return TCL_ERROR;
} else { } else {
my_strdup(_ALLOC_ID_, &xctx->inst[inst].name, argv[3]); my_strdup(1323, &xctx->inst[inst].name, argv[3]);
} }
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }
@ -4341,7 +4349,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
rn = resolved_net(net); rn = resolved_net(net);
Tcl_AppendResult(interp, rn, NULL); Tcl_AppendResult(interp, rn, NULL);
my_free(_ALLOC_ID_, &rn); my_free(1324, &rn);
} }
/* rotate [x0 y0] /* rotate [x0 y0]
@ -4765,7 +4773,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(exists) { if(exists) {
viewer = atoi(tclgetvar("sim(spicewave,default)")); viewer = atoi(tclgetvar("sim(spicewave,default)"));
my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer); my_snprintf(tcl_str, S(tcl_str), "sim(spicewave,%d,name)", viewer);
my_strdup(_ALLOC_ID_, &viewer_name, tclgetvar(tcl_str)); my_strdup(1325, &viewer_name, tclgetvar(tcl_str));
dbg(1, "send_to_viewer: viewer_name=%s\n", viewer_name); dbg(1, "send_to_viewer: viewer_name=%s\n", viewer_name);
if(strstr(viewer_name, "Gaw")) viewer=GAW; if(strstr(viewer_name, "Gaw")) viewer=GAW;
else if(strstr(viewer_name, "Bespice")) viewer=BESPICE; else if(strstr(viewer_name, "Bespice")) viewer=BESPICE;
@ -4773,7 +4781,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
hilight_net(viewer); hilight_net(viewer);
redraw_hilights(0); redraw_hilights(0);
} }
my_free(_ALLOC_ID_, &viewer_name); my_free(1326, &viewer_name);
} }
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }
@ -4836,13 +4844,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 */ 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;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &xctx->format, argv[3]); my_strdup(1327, &xctx->format, argv[3]);
} }
else if(!strcmp(argv[2], "header_text")) { /* set header metadata (used for license info) */ 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) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(!xctx->header_text || strcmp(xctx->header_text, argv[3])) { if(!xctx->header_text || strcmp(xctx->header_text, argv[3])) {
set_modify(1); xctx->push_undo(); set_modify(1); xctx->push_undo();
my_strdup2(_ALLOC_ID_, &xctx->header_text, argv[3]); my_strdup2(1328, &xctx->header_text, argv[3]);
} }
} }
else if(!strcmp(argv[2], "hide_symbols")) { /* set to 0,1,2 for various hiding level of symbols */ else if(!strcmp(argv[2], "hide_symbols")) { /* set to 0,1,2 for various hiding level of symbols */
@ -4858,7 +4866,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[2], "infowindow_text")) { /* ERC messages */ else if(!strcmp(argv[2], "infowindow_text")) { /* ERC messages */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &xctx->infowindow_text, argv[3]); my_strdup(1329, &xctx->infowindow_text, argv[3]);
} }
else if(!strcmp(argv[2], "intuitive_interface")) { /* ERC messages */ else if(!strcmp(argv[2], "intuitive_interface")) { /* ERC messages */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
@ -4908,7 +4916,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(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(n >= 0 && n <= xctx->currsch) { if(n >= 0 && n <= xctx->currsch) {
xctx->raw->level = atoi(argv[3]); xctx->raw->level = atoi(argv[3]);
my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[xctx->raw->level]); my_strdup2(1330, &xctx->raw->schname, xctx->sch[xctx->raw->level]);
Tcl_SetResult(interp, my_itoa(n), TCL_VOLATILE); Tcl_SetResult(interp, my_itoa(n), TCL_VOLATILE);
} else { } else {
Tcl_SetResult(interp, "-1", TCL_VOLATILE); Tcl_SetResult(interp, "-1", TCL_VOLATILE);
@ -4930,23 +4938,23 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
else if(!strcmp(argv[2], "schsymbolprop")) { /* set global symbol attribute string */ else if(!strcmp(argv[2], "schsymbolprop")) { /* set global symbol attribute string */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &xctx->schsymbolprop, argv[3]); my_strdup(1331, &xctx->schsymbolprop, argv[3]);
} }
else if(!strcmp(argv[2], "schprop")) { /* set schematic global spice attribute string */ else if(!strcmp(argv[2], "schprop")) { /* set schematic global spice attribute string */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &xctx->schprop, argv[3]); my_strdup(1332, &xctx->schprop, argv[3]);
} }
else if(!strcmp(argv[2], "schverilogprop")) { /* set schematic global verilog attribute string */ else if(!strcmp(argv[2], "schverilogprop")) { /* set schematic global verilog attribute string */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &xctx->schverilogprop, argv[3]); my_strdup(1333, &xctx->schverilogprop, argv[3]);
} }
else if(!strcmp(argv[2], "schvhdlprop")) { /* set schematic global vhdl attribute string */ else if(!strcmp(argv[2], "schvhdlprop")) { /* set schematic global vhdl attribute string */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &xctx->schvhdlprop, argv[3]); my_strdup(1334, &xctx->schvhdlprop, argv[3]);
} }
else if(!strcmp(argv[2], "schtedaxprop")) { /* set schematic global tedax attribute string */ else if(!strcmp(argv[2], "schtedaxprop")) { /* set schematic global tedax attribute string */
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &xctx->schtedaxprop, argv[3]); my_strdup(1335, &xctx->schtedaxprop, argv[3]);
} }
else if(!strcmp(argv[2], "text_svg")) { /* set to 1 to use svg <text> elements */ else if(!strcmp(argv[2], "text_svg")) { /* set to 1 to use svg <text> elements */
text_svg=atoi(argv[3]); text_svg=atoi(argv[3]);
@ -4980,10 +4988,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
char *s = NULL; char *s = NULL;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} 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;} if(argc < 5) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &s, argv[2]); my_strdup(1336, &s, argv[2]);
set_different_token(&s, argv[3], argv[4]); set_different_token(&s, argv[3], argv[4]);
Tcl_SetResult(interp, s, TCL_VOLATILE); Tcl_SetResult(interp, s, TCL_VOLATILE);
my_free(_ALLOC_ID_, &s); my_free(1337, &s);
} }
/* set_modify /* set_modify
@ -5068,28 +5076,28 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(argc > 5) { if(argc > 5) {
if(!strcmp(argv[4], "allprops")) { if(!strcmp(argv[4], "allprops")) {
hash_names(-1, XINSERT); hash_names(-1, XINSERT);
my_strdup2(_ALLOC_ID_, &subst, argv[5]); my_strdup2(1338, &subst, argv[5]);
} else { } else {
my_strdup2(_ALLOC_ID_, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5])); my_strdup2(1339, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], argv[5]));
} }
} else if(argc > 4) {/* assume argc == 5 , delete attribute */ } else if(argc > 4) {/* assume argc == 5 , delete attribute */
my_strdup2(_ALLOC_ID_, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], NULL)); my_strdup2(1340, &subst, subst_token(xctx->inst[inst].prop_ptr, argv[4], NULL));
} else if(argc > 3) { } else if(argc > 3) {
/* clear all instance prop_str */ /* clear all instance prop_str */
my_free(_ALLOC_ID_, &subst); my_free(1341, &subst);
} }
hash_names(inst, XDELETE); hash_names(inst, XDELETE);
new_prop_string(inst, subst, tclgetboolvar("disable_unique_names")); new_prop_string(inst, subst, tclgetboolvar("disable_unique_names"));
my_strdup2(_ALLOC_ID_, &translated_sym, translate(inst, xctx->inst[inst].name)); my_strdup2(1342, &translated_sym, translate(inst, xctx->inst[inst].name));
sym_number=match_symbol(translated_sym); sym_number=match_symbol(translated_sym);
if(sym_number > 0) { if(sym_number > 0) {
delete_inst_node(inst); delete_inst_node(inst);
xctx->inst[inst].ptr=sym_number; xctx->inst[inst].ptr=sym_number;
} }
if(subst) my_free(_ALLOC_ID_, &subst); if(subst) my_free(1343, &subst);
set_inst_flags(&xctx->inst[inst]); set_inst_flags(&xctx->inst[inst]);
hash_names(inst, XINSERT); hash_names(inst, XINSERT);
if(!fast) { if(!fast) {
@ -5098,7 +5106,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
set_modify(-2); /* reset floaters caches */ set_modify(-2); /* reset floaters caches */
draw(); draw();
} }
my_free(_ALLOC_ID_, &translated_sym); my_free(1344, &translated_sym);
Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE); Tcl_SetResult(interp, xctx->inst[inst].instname , TCL_VOLATILE);
} }
} else if(argc > 2 && !strcmp(argv[2], "symbol")) { } else if(argc > 2 && !strcmp(argv[2], "symbol")) {
@ -5118,9 +5126,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
} }
sym = &xctx->sym[i]; sym = &xctx->sym[i];
if(argc > 5) if(argc > 5)
my_strdup2(_ALLOC_ID_, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], argv[5])); my_strdup2(1345, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], argv[5]));
else else
my_strdup2(_ALLOC_ID_, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], NULL)); /* delete attr */ my_strdup2(1346, &sym->prop_ptr, subst_token(sym->prop_ptr, argv[4], NULL)); /* delete attr */
} else if(argc > 5 && !strcmp(argv[2], "rect")) { } else if(argc > 5 && !strcmp(argv[2], "rect")) {
/* 0 1 2 3 4 5 6 7 /* 0 1 2 3 4 5 6 7
@ -5180,14 +5188,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))) { if(strcmp(argv[6], get_tok_value(r->prop_ptr, argv[5], 0))) {
change_done = 1; change_done = 1;
if(fast == 3 || fast == 0) xctx->push_undo(); if(fast == 3 || fast == 0) xctx->push_undo();
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6])); my_strdup2(1347, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], argv[6]));
} }
} else { } else {
get_tok_value(r->prop_ptr, argv[5], 0); get_tok_value(r->prop_ptr, argv[5], 0);
if(xctx->tok_size) { if(xctx->tok_size) {
change_done = 1; change_done = 1;
if(fast == 3 || fast == 0) xctx->push_undo(); if(fast == 3 || fast == 0) xctx->push_undo();
my_strdup2(_ALLOC_ID_, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */ my_strdup2(1348, &r->prop_ptr, subst_token(r->prop_ptr, argv[5], NULL)); /* delete attr */
} }
} }
if(change_done) set_modify(1); if(change_done) set_modify(1);
@ -5245,7 +5253,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
t->yscale, t->rot, t->flip, t->hcenter, t->yscale, t->rot, t->flip, t->hcenter,
t->vcenter, t->x0, t->y0, t->vcenter, t->x0, t->y0,
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(1349, &estr);
bbox(ADD, xx1, yy1, xx2, yy2); bbox(ADD, xx1, yy1, xx2, yy2);
} }
/* verify if there is some difference */ /* verify if there is some difference */
@ -5253,19 +5261,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
if(strcmp(argv[5], t->txt_ptr)) { if(strcmp(argv[5], t->txt_ptr)) {
change_done = 1; change_done = 1;
if(fast == 3 || fast == 0) xctx->push_undo(); if(fast == 3 || fast == 0) xctx->push_undo();
my_strdup2(_ALLOC_ID_, &t->txt_ptr, argv[5]); my_strdup2(1350, &t->txt_ptr, argv[5]);
} }
} else if(strcmp(argv[5], get_tok_value(t->prop_ptr, argv[4], 0))) { } else if(strcmp(argv[5], get_tok_value(t->prop_ptr, argv[4], 0))) {
change_done = 1; change_done = 1;
if(fast == 3 || fast == 0) xctx->push_undo(); if(fast == 3 || fast == 0) xctx->push_undo();
my_strdup2(_ALLOC_ID_, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], argv[5])); my_strdup2(1351, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], argv[5]));
} }
} else if(argc > 4) { } else if(argc > 4) {
get_tok_value(t->prop_ptr, argv[4], 0); get_tok_value(t->prop_ptr, argv[4], 0);
if(xctx->tok_size) { if(xctx->tok_size) {
change_done = 1; change_done = 1;
if(fast == 3 || fast == 0) xctx->push_undo(); if(fast == 3 || fast == 0) xctx->push_undo();
my_strdup2(_ALLOC_ID_, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], NULL)); /* delete attr */ my_strdup2(1352, &t->prop_ptr, subst_token(t->prop_ptr, argv[4], NULL)); /* delete attr */
} }
} }
if(change_done) { if(change_done) {
@ -5277,7 +5285,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
t->yscale, t->rot, t->flip, t->hcenter, t->yscale, t->rot, t->flip, t->hcenter,
t->vcenter, t->x0, t->y0, t->vcenter, t->x0, t->y0,
&xx1,&yy1,&xx2,&yy2, &tmp, &dtmp); &xx1,&yy1,&xx2,&yy2, &tmp, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(1353, &estr);
if(!fast) bbox(ADD, xx1, yy1, xx2, yy2); if(!fast) bbox(ADD, xx1, yy1, xx2, yy2);
} }
if(!fast) { if(!fast) {
@ -5338,9 +5346,9 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
char *s=NULL; char *s=NULL;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} 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;} if(argc < 5) {Tcl_SetResult(interp, "Missing arguments", TCL_STATIC);return TCL_ERROR;}
my_strdup(_ALLOC_ID_, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "NULL") ? argv[4] : NULL)); my_strdup(1354, &s, subst_token(argv[2], argv[3], strcmp(argv[4], "NULL") ? argv[4] : NULL));
Tcl_SetResult(interp, s, TCL_VOLATILE); Tcl_SetResult(interp, s, TCL_VOLATILE);
my_free(_ALLOC_ID_, &s); my_free(1355, &s);
} }
/* symbol_in_new_window [new_process] /* symbol_in_new_window [new_process]
@ -5558,7 +5566,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
dbg(0, "%s\n----\n", s); dbg(0, "%s\n----\n", s);
Tcl_SetResult(interp, t, TCL_VOLATILE); Tcl_SetResult(interp, t, TCL_VOLATILE);
my_free(_ALLOC_ID_, &t); my_free(1356, &t);
} }
} }
@ -5655,10 +5663,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, "xschem translate: instance not found", TCL_STATIC); Tcl_SetResult(interp, "xschem translate: instance not found", TCL_STATIC);
return TCL_ERROR; return TCL_ERROR;
} }
my_strdup2(_ALLOC_ID_, &s, translate(i, argv[3])); my_strdup2(1357, &s, translate(i, argv[3]));
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
Tcl_SetResult(interp, s, TCL_VOLATILE); Tcl_SetResult(interp, s, TCL_VOLATILE);
my_free(_ALLOC_ID_, &s); my_free(1358, &s);
} }
} }
@ -5674,16 +5682,16 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int eat_escapes = 0; int eat_escapes = 0;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;} if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
if(argc > 3) eat_escapes = atoi(argv[3]); if(argc > 3) eat_escapes = atoi(argv[3]);
if(argc > 6) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], argv[6])); if(argc > 6) my_strdup2(1359, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], argv[6]));
else if(argc > 5) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], NULL)); else if(argc > 5) my_strdup2(1360, &s, translate3(argv[2], eat_escapes, argv[4], argv[5], NULL));
else if(argc > 4) my_strdup2(_ALLOC_ID_, &s, translate3(argv[2], eat_escapes, argv[4], NULL, NULL)); else if(argc > 4) my_strdup2(1361, &s, translate3(argv[2], eat_escapes, argv[4], NULL, NULL));
else { else {
Tcl_SetResult(interp, "xschem translate3: missing arguments", TCL_STATIC); Tcl_SetResult(interp, "xschem translate3: missing arguments", TCL_STATIC);
return TCL_ERROR; return TCL_ERROR;
} }
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
Tcl_SetResult(interp, s, TCL_VOLATILE); Tcl_SetResult(interp, s, TCL_VOLATILE);
my_free(_ALLOC_ID_, &s); my_free(1362, &s);
} }
/* trim_chars str sep /* trim_chars str sep
@ -5798,7 +5806,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(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
for(i = 0; i < xctx->texts; i++) for(i = 0; i < xctx->texts; i++)
if(xctx->text[i].flags & TEXT_FLOATER) { if(xctx->text[i].flags & TEXT_FLOATER) {
my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); /* clear floater cached value */ my_free(1363, &xctx->text[i].floater_ptr); /* clear floater cached value */
} }
for(i = 0; i < xctx->instances; ++i) { 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); symbol_bbox(i, &xctx->inst[i].x1, &xctx->inst[i].y1, &xctx->inst[i].x2, &xctx->inst[i].y2);
@ -5861,10 +5869,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int n = atoi(argv[2]); int n = atoi(argv[2]);
if(n > 0 && n < xctx->wires) { if(n > 0 && n < xctx->wires) {
xWire * const wire = xctx->wire; xWire * const wire = xctx->wire;
my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].x1), " ", NULL); my_mstrcat(1364, &r, dtoa(wire[n].x1), " ", NULL);
my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].y1), " ", NULL); my_mstrcat(1365, &r, dtoa(wire[n].y1), " ", NULL);
my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].x2), " ", NULL); my_mstrcat(1366, &r, dtoa(wire[n].x2), " ", NULL);
my_mstrcat(_ALLOC_ID_, &r, dtoa(wire[n].y2), NULL); my_mstrcat(1367, &r, dtoa(wire[n].y2), NULL);
Tcl_SetResult(interp, r, TCL_VOLATILE); Tcl_SetResult(interp, r, TCL_VOLATILE);
} }
} }
@ -6152,9 +6160,9 @@ int tclvareval(const char *script, ...)
va_list args; va_list args;
va_start(args, script); va_start(args, script);
size = my_strcat(_ALLOC_ID_, &str, script); size = my_strcat(1368, &str, script);
while( (p = va_arg(args, const char *)) ) { while( (p = va_arg(args, const char *)) ) {
size = my_strcat(_ALLOC_ID_, &str, p); size = my_strcat(1369, &str, p);
dbg(2, "tclvareval(): p=%s, str=%s, size=%d\n", p, str, size); 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 : "<NULL>", size); dbg(2, "tclvareval(): script=%s, str=%s, size=%d\n", script, str ? str : "<NULL>", size);
@ -6164,6 +6172,6 @@ int tclvareval(const char *script, ...)
dbg(0, "tclvareval(): error executing %s: %s\n", str, tclresult()); dbg(0, "tclvareval(): error executing %s: %s\n", str, tclresult());
Tcl_ResetResult(interp); Tcl_ResetResult(interp);
} }
my_free(_ALLOC_ID_, &str); my_free(1370, &str);
return return_code; return return_code;
} }

View File

@ -175,7 +175,7 @@ int select_dangling_nets(void)
char *type; char *type;
double x0, y0, x1, y1, x2, y2; double x0, y0, x1, y1, x2, y2;
table = my_calloc(_ALLOC_ID_, xctx->wires, sizeof(int)); table = my_calloc(1371, xctx->wires, sizeof(int));
hash_instances(); hash_instances();
hash_wires(); hash_wires();
@ -315,7 +315,7 @@ int select_dangling_nets(void)
xctx->need_reb_sel_arr = 1; xctx->need_reb_sel_arr = 1;
rebuild_selected_array(); rebuild_selected_array();
draw_selection(xctx->gc[SELLAYER], 0); draw_selection(xctx->gc[SELLAYER], 0);
my_free(_ALLOC_ID_, &table); my_free(1372, &table);
return ret; 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); 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: %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); dbg(1, "symbol bbox: text bbox: zoom=%g, lw=%g\n", xctx->zoom, xctx->lw);
my_free(_ALLOC_ID_, &estr); my_free(1373, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); 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 */ if(c == GRIDLAYER) xctx->graph_lastsel = -1; /* invalidate last selected graph */
++j; ++j;
my_free(_ALLOC_ID_, &xctx->rect[c][i].prop_ptr); my_free(1374, &xctx->rect[c][i].prop_ptr);
set_rect_extraptr(0, &xctx->rect[c][i]); set_rect_extraptr(0, &xctx->rect[c][i]);
deleted = 1; deleted = 1;
continue; continue;
@ -422,7 +422,7 @@ static void del_rect_line_arc_poly()
{ {
++j; ++j;
deleted = 1; deleted = 1;
my_free(_ALLOC_ID_, &xctx->line[c][i].prop_ptr); my_free(1375, &xctx->line[c][i].prop_ptr);
continue; continue;
} }
if(j) if(j)
@ -445,7 +445,7 @@ static void del_rect_line_arc_poly()
else 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, 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); &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2);
my_free(_ALLOC_ID_, &xctx->arc[c][i].prop_ptr); my_free(1376, &xctx->arc[c][i].prop_ptr);
deleted = 1; deleted = 1;
continue; 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]; if(k==0 || xctx->poly[c][i].y[k] > y2) y2 = xctx->poly[c][i].y[k];
} }
++j; ++j;
my_free(_ALLOC_ID_, &xctx->poly[c][i].prop_ptr); my_free(1377, &xctx->poly[c][i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->poly[c][i].x); my_free(1378, &xctx->poly[c][i].x);
my_free(_ALLOC_ID_, &xctx->poly[c][i].y); my_free(1379, &xctx->poly[c][i].y);
my_free(_ALLOC_ID_, &xctx->poly[c][i].selected_point); my_free(1380, &xctx->poly[c][i].selected_point);
/*fprintf(errfp, "bbox: %.16g %.16g %.16g %.16g\n", x1, y1, x2, y2); */ /*fprintf(errfp, "bbox: %.16g %.16g %.16g %.16g\n", x1, y1, x2, y2); */
deleted = 1; deleted = 1;
continue; continue;
@ -499,8 +499,8 @@ int delete_wires(int selected_flag)
if(xctx->wire[i].sel == selected_flag) { if(xctx->wire[i].sel == selected_flag) {
++j; ++j;
/* hash_wire(XDELETE, i, 0); */ /* can not be done since wire deletions change wire idexes in array */ /* hash_wire(XDELETE, i, 0); */ /* can not be done since wire deletions change wire idexes in array */
my_free(_ALLOC_ID_, &xctx->wire[i].prop_ptr); my_free(1381, &xctx->wire[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->wire[i].node); my_free(1382, &xctx->wire[i].node);
deleted = 1; deleted = 1;
continue; continue;
@ -546,11 +546,11 @@ void delete(int to_push_undo)
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
} }
#endif #endif
my_free(_ALLOC_ID_, &xctx->text[i].prop_ptr); my_free(1383, &xctx->text[i].prop_ptr);
my_free(_ALLOC_ID_, &xctx->text[i].font); my_free(1384, &xctx->text[i].font);
my_free(_ALLOC_ID_, &xctx->text[i].floater_instname); my_free(1385, &xctx->text[i].floater_instname);
my_free(_ALLOC_ID_, &xctx->text[i].floater_ptr); my_free(1386, &xctx->text[i].floater_ptr);
my_free(_ALLOC_ID_, &xctx->text[i].txt_ptr); my_free(1387, &xctx->text[i].txt_ptr);
deleted = 1; deleted = 1;
++j; ++j;
continue; continue;
@ -572,12 +572,12 @@ void delete(int to_push_undo)
deleted = 1; deleted = 1;
if(xctx->inst[i].prop_ptr != NULL) if(xctx->inst[i].prop_ptr != NULL)
{ {
my_free(_ALLOC_ID_, &xctx->inst[i].prop_ptr); my_free(1388, &xctx->inst[i].prop_ptr);
} }
delete_inst_node(i); delete_inst_node(i);
my_free(_ALLOC_ID_, &xctx->inst[i].name); my_free(1389, &xctx->inst[i].name);
my_free(_ALLOC_ID_, &xctx->inst[i].instname); my_free(1390, &xctx->inst[i].instname);
my_free(_ALLOC_ID_, &xctx->inst[i].lab); my_free(1391, &xctx->inst[i].lab);
++j; ++j;
continue; continue;
} }
@ -1346,7 +1346,7 @@ void select_inside(double x1,double y1, double x2, double y2, int sel) /*added u
xctx->text[i].hcenter, xctx->text[i].vcenter, xctx->text[i].hcenter, xctx->text[i].vcenter,
xctx->text[i].x0, xctx->text[i].y0, xctx->text[i].x0, xctx->text[i].y0,
&xx1,&yy1, &xx2,&yy2, &tmpint, &dtmp); &xx1,&yy1, &xx2,&yy2, &tmpint, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(1392, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
@ -1558,7 +1558,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].hcenter, xctx->text[i].vcenter,
xctx->text[i].x0, xctx->text[i].y0, xctx->text[i].x0, xctx->text[i].y0,
&xx1,&yy1, &xx2,&yy2, &tmpint, &dtmp); &xx1,&yy1, &xx2,&yy2, &tmpint, &dtmp);
my_free(_ALLOC_ID_, &estr); my_free(1393, &estr);
#if HAS_CAIRO==1 #if HAS_CAIRO==1
if(customfont) { if(customfont) {
cairo_restore(xctx->cairo_ctx); cairo_restore(xctx->cairo_ctx);
@ -1683,7 +1683,7 @@ int floaters_from_selected_inst()
set_modify(1); set_modify(1);
first = 0; first = 0;
} }
my_strdup2(_ALLOC_ID_, &xctx->inst[i].prop_ptr, my_strdup2(1394, &xctx->inst[i].prop_ptr,
subst_token(xctx->inst[i].prop_ptr, "hide_texts", "true")); subst_token(xctx->inst[i].prop_ptr, "hide_texts", "true"));
set_inst_flags(&xctx->inst[i]); set_inst_flags(&xctx->inst[i]);
for(t = 0; t < sym->texts; t++) { for(t = 0; t < sym->texts; t++) {

View File

@ -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); zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
if(what & 1) ps_draw(2, 1, 0); /* page */ if(what & 1) ps_draw(2, 1, 0); /* page */
if(what & 2) { /* print cellname */ if(what & 2) { /* print cellname */
my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); my_strcat(1395, res, hier_psprint_mtime(xctx->sch[xctx->currsch]));
my_strcat(_ALLOC_ID_, res, " {"); my_strcat(1396, res, " {");
my_strcat(_ALLOC_ID_, res, xctx->sch[xctx->currsch]); my_strcat(1397, res, xctx->sch[xctx->currsch]);
my_strcat(_ALLOC_ID_, res, "}\n"); my_strcat(1398, res, "}\n");
} }
dbg(1,"--> %s\n", get_cell(xctx->sch[xctx->currsch], 0) ); dbg(1,"--> %s\n", get_cell(xctx->sch[xctx->currsch], 0) );
unselect_all(1); 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 */ /* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(1399, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(1400, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;
subckt_name=NULL; subckt_name=NULL;
@ -83,13 +83,13 @@ void hier_psprint(char **res, int what) /* netlister driver */
int flag; int flag;
/* for printing we process also symbols that have *_ignore attribute */ /* 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 */ if(!xctx->sym[i].type || !xctx->sym[i].name || !xctx->sym[i].name[0]) continue; /* can not descend into */
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); my_strdup2(1401, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), ""));
if(what & 1) flag = check_lib(2, abs_path); /* noprint_libs */ if(what & 1) flag = check_lib(2, abs_path); /* noprint_libs */
else flag = check_lib(4, abs_path); /* nolist_libs */ else flag = check_lib(4, abs_path); /* nolist_libs */
if(flag && (!strcmp(xctx->sym[i].type, "subcircuit") || !strcmp(xctx->sym[i].type, "primitive"))) 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 */ /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); my_strdup(1402, &subckt_name, get_cell(xctx->sym[i].name, 0));
get_sch_from_sym(filename, xctx->sym + i, -1, 0); get_sch_from_sym(filename, xctx->sym + i, -1, 0);
if (str_hash_lookup(&subckt_table, filename, "", XLOOKUP)==NULL) if (str_hash_lookup(&subckt_table, filename, "", XLOOKUP)==NULL)
{ {
@ -110,10 +110,10 @@ void hier_psprint(char **res, int what) /* netlister driver */
zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97); zoom_full(0, 0, 1 + 2 * tclgetboolvar("zoom_full_center"), 0.97);
if(what & 1) ps_draw(2, 1, 0); /* page */ if(what & 1) ps_draw(2, 1, 0); /* page */
if(what & 2) { /* print cellname */ if(what & 2) { /* print cellname */
my_strcat(_ALLOC_ID_, res, hier_psprint_mtime(xctx->sch[xctx->currsch])); my_strcat(1403, res, hier_psprint_mtime(xctx->sch[xctx->currsch]));
my_strcat(_ALLOC_ID_, res, " {"); my_strcat(1404, res, " {");
my_strcat(_ALLOC_ID_, res, xctx->sch[xctx->currsch]); my_strcat(1405, res, xctx->sch[xctx->currsch]);
my_strcat(_ALLOC_ID_, res, "}\n"); my_strcat(1406, res, "}\n");
} }
dbg(1,"--> %s\n", get_cell(xctx->sch[xctx->currsch], 0) ); 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 *_block_netlist() may have loaded additional syms */ /* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */ /* get_additional_symbols(0); */
my_free(_ALLOC_ID_, &abs_path); my_free(1407, &abs_path);
str_hash_free(&subckt_table); str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name); my_free(1408, &subckt_name);
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(1409, &xctx->sch[xctx->currsch]);
xctx->currsch--; xctx->currsch--;
unselect_all(1); unselect_all(1);
remove_symbols(); remove_symbols();
@ -147,10 +147,10 @@ static char *model_name(const char *m)
char *ptr; char *ptr;
int n; int n;
size_t l = strlen(m) + 1; size_t l = strlen(m) + 1;
my_strdup(_ALLOC_ID_, &m_lower, m); my_strdup(1410, &m_lower, m);
strtolower(m_lower); strtolower(m_lower);
my_realloc(_ALLOC_ID_, &modelname, l); my_realloc(1411, &modelname, l);
my_realloc(_ALLOC_ID_, &model_name_result, l); my_realloc(1412, &model_name_result, l);
if((ptr = strstr(m_lower, ".subckt"))) { if((ptr = strstr(m_lower, ".subckt"))) {
n = sscanf(ptr, ".subckt %s %s", model_name_result, modelname); n = sscanf(ptr, ".subckt %s %s", model_name_result, modelname);
} else if((ptr = strstr(m_lower, ".model"))) { } 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); if(n<2) my_strncpy(model_name_result, m_lower, l);
else { else {
/* build a hash key value with no spaces to make device_model attributes with different spaces equivalent*/ /* build a hash key value with no spaces to make device_model attributes with different spaces equivalent*/
my_strcat(_ALLOC_ID_, &model_name_result, modelname); my_strcat(1413, &model_name_result, modelname);
} }
my_free(_ALLOC_ID_, &modelname); my_free(1414, &modelname);
my_free(_ALLOC_ID_, &m_lower); my_free(1415, &m_lower);
return model_name_result; return model_name_result;
} }
@ -224,21 +224,21 @@ static int spice_netlist(FILE *fd, int spice_stop )
fprintf(fd, "**** end_element\n"); fprintf(fd, "**** end_element\n");
} }
/* hash device_model attribute if any */ /* hash device_model attribute if any */
my_strdup2(_ALLOC_ID_, &val, get_tok_value(xctx->inst[i].prop_ptr, "device_model", 2)); my_strdup2(1416, &val, get_tok_value(xctx->inst[i].prop_ptr, "device_model", 2));
m = val; m = val;
if(strchr(val, '@')) m = translate(i, val); if(strchr(val, '@')) m = translate(i, val);
else m = tcl_hook2(m); else m = tcl_hook2(m);
if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT); if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT);
else { else {
my_strdup2(_ALLOC_ID_, &val, my_strdup2(1417, &val,
get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "device_model", 2)); get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "device_model", 2));
m = val; m = val;
if(strchr(val, '@')) m = translate(i, val); if(strchr(val, '@')) m = translate(i, val);
else m = tcl_hook2(m); else m = tcl_hook2(m);
if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT); if(m[0]) str_hash_lookup(&model_table, model_name(m), m, XINSERT);
} }
my_free(_ALLOC_ID_, &model_name_result); my_free(1418, &model_name_result);
my_free(_ALLOC_ID_, &val); my_free(1419, &val);
} }
} }
} }
@ -316,10 +316,10 @@ int global_spice_netlist(int global) /* netlister driver */
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
type = (xctx->inst[i].ptr+ xctx->sym)->type; type = (xctx->inst[i].ptr+ xctx->sym)->type;
my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); my_strdup(1420, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
if( type && !strcmp(type,"netlist_commands") ) { if( type && !strcmp(type,"netlist_commands") ) {
if(!place) { if(!place) {
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); my_strdup(1421, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
} }
if(place && !strcmp(place, "header" )) { if(place && !strcmp(place, "header" )) {
if(first == 0) fprintf(fd,"**** begin user header code\n"); if(first == 0) fprintf(fd,"**** begin user header code\n");
@ -344,7 +344,7 @@ int global_spice_netlist(int global) /* netlister driver */
pinnumber_list = sort_schematic_pins(&npins); /* sort pins according to sim_pinnumber attr */ pinnumber_list = sort_schematic_pins(&npins); /* sort pins according to sim_pinnumber attr */
/* print top subckt ipin/opins */ /* print top subckt ipin/opins */
my_strdup2(_ALLOC_ID_, &top_symbol_name, abs_sym_path(add_ext(xctx->current_name, ".sym"), "")); my_strdup2(1422, &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 */ 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); dbg(1, "found top level symbol %s\n", top_symbol_name);
load_sym_def(top_symbol_name, NULL); load_sym_def(top_symbol_name, NULL);
@ -360,7 +360,7 @@ int global_spice_netlist(int global) /* netlister driver */
} }
remove_symbol(xctx->symbols - 1); remove_symbol(xctx->symbols - 1);
} }
my_free(_ALLOC_ID_, &top_symbol_name); my_free(1423, &top_symbol_name);
if(found_top_symbol != 3) { if(found_top_symbol != 3) {
for(i=0;i<npins; ++i) { for(i=0;i<npins; ++i) {
int n = pinnumber_list[i].n; int n = pinnumber_list[i].n;
@ -369,7 +369,7 @@ int global_spice_netlist(int global) /* netlister driver */
fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)" ); fprintf(fd, " %s", str_tmp ? str_tmp : "(NULL)" );
} }
} }
my_free(_ALLOC_ID_, &pinnumber_list); my_free(1424, &pinnumber_list);
fprintf(fd,"\n"); fprintf(fd,"\n");
err |= spice_netlist(fd, 0); err |= spice_netlist(fd, 0);
@ -380,10 +380,10 @@ int global_spice_netlist(int global) /* netlister driver */
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
type = (xctx->inst[i].ptr+ xctx->sym)->type; type = (xctx->inst[i].ptr+ xctx->sym)->type;
my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); my_strdup(1425, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
if( type && !strcmp(type,"netlist_commands") ) { if( type && !strcmp(type,"netlist_commands") ) {
if(!place) { if(!place) {
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); my_strdup(1426, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
} }
if(!place || (strcmp(place, "end") && strcmp(place, "header")) ) { if(!place || (strcmp(place, "end") && strcmp(place, "header")) ) {
if(first == 0) fprintf(fd,"**** begin user architecture code\n"); if(first == 0) fprintf(fd,"**** begin user architecture code\n");
@ -424,7 +424,7 @@ int global_spice_netlist(int global) /* netlister driver */
/* warning if two symbols perfectly overlapped */ /* warning if two symbols perfectly overlapped */
err |= warning_overlapped_symbols(0); err |= warning_overlapped_symbols(0);
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */ /* preserve current level instance flags before descending hierarchy for netlisting, restore later */
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); stored_flags = my_calloc(1427, xctx->instances, sizeof(unsigned int));
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color; for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
if(global) if(global)
@ -433,7 +433,7 @@ int global_spice_netlist(int global) /* netlister driver */
int web_url = is_from_web(xctx->current_dirname); int web_url = is_from_web(xctx->current_dirname);
char *current_dirname_save = NULL; char *current_dirname_save = NULL;
my_strdup2(_ALLOC_ID_, &current_dirname_save, xctx->current_dirname); my_strdup2(1428, &current_dirname_save, xctx->current_dirname);
unselect_all(1); unselect_all(1);
/* ensure all unused symbols purged before descending hierarchy */ /* ensure all unused symbols purged before descending hierarchy */
if(!tclgetboolvar("keep_symbols")) remove_symbols(); if(!tclgetboolvar("keep_symbols")) remove_symbols();
@ -441,8 +441,8 @@ int global_spice_netlist(int global) /* netlister driver */
dbg(1, "global_spice_netlist(): invoking pop_undo(2, 0)\n"); dbg(1, "global_spice_netlist(): invoking pop_undo(2, 0)\n");
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(1429, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(1430, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;
subckt_name=NULL; subckt_name=NULL;
@ -457,11 +457,11 @@ int global_spice_netlist(int global) /* netlister driver */
* to resolve subschematic instances with model=@modp in format string, * 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 * modp will be first looked up in instance prop_ptr string, and if not found
* in parent symbol template string */ * in parent symbol template string */
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].templ, my_strdup(1431, &xctx->hier_attr[xctx->currsch - 1].templ,
tcl_hook2(xctx->sym[i].templ)); tcl_hook2(xctx->sym[i].templ));
my_strdup(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].prop_ptr, my_strdup(1432, &xctx->hier_attr[xctx->currsch - 1].prop_ptr,
tcl_hook2(xctx->sym[i].parent_prop_ptr)); tcl_hook2(xctx->sym[i].parent_prop_ptr));
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); my_strdup(1433, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{ {
if(!web_url) { if(!web_url) {
@ -469,7 +469,7 @@ int global_spice_netlist(int global) /* netlister driver */
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
} }
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); my_strdup(1434, &subckt_name, get_cell(xctx->sym[i].name, 0));
dbg(1, "global_spice_netlist(): subckt_name=%s\n", subckt_name); dbg(1, "global_spice_netlist(): subckt_name=%s\n", subckt_name);
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL)
{ {
@ -488,14 +488,14 @@ int global_spice_netlist(int global) /* netlister driver */
} }
} }
if(xctx->hier_attr[xctx->currsch - 1].templ) if(xctx->hier_attr[xctx->currsch - 1].templ)
my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].templ); my_free(1435, &xctx->hier_attr[xctx->currsch - 1].templ);
if(xctx->hier_attr[xctx->currsch - 1].prop_ptr) if(xctx->hier_attr[xctx->currsch - 1].prop_ptr)
my_free(_ALLOC_ID_, &xctx->hier_attr[xctx->currsch - 1].prop_ptr); my_free(1436, &xctx->hier_attr[xctx->currsch - 1].prop_ptr);
my_free(_ALLOC_ID_, &abs_path); my_free(1437, &abs_path);
/* get_additional_symbols(0); */ /* get_additional_symbols(0); */
my_free(_ALLOC_ID_, &subckt_name); my_free(1438, &subckt_name);
/*clear_drawing(); */ /*clear_drawing(); */
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(1439, &xctx->sch[xctx->currsch]);
xctx->currsch--; xctx->currsch--;
unselect_all(1); unselect_all(1);
dbg(1, "global_spice_netlist(): invoking pop_undo(0, 0)\n"); dbg(1, "global_spice_netlist(): invoking pop_undo(0, 0)\n");
@ -514,13 +514,13 @@ int global_spice_netlist(int global) /* netlister driver */
dbg(1, "spice_netlist(): invoke prepare_netlist_structs for %s\n", xctx->current_name); 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 */ err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
my_free(_ALLOC_ID_, &current_dirname_save); my_free(1440, &current_dirname_save);
} }
/* restore hilight flags from errors found analyzing top level before descending hierarchy */ /* restore hilight flags from errors found analyzing top level before descending hierarchy */
for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i];
propagate_hilights(1, 0, XINSERT_NOREPLACE); propagate_hilights(1, 0, XINSERT_NOREPLACE);
draw_hilight_net(1); draw_hilight_net(1);
my_free(_ALLOC_ID_, &stored_flags); my_free(1441, &stored_flags);
/* print globals nodes found in netlist 28032003 */ /* print globals nodes found in netlist 28032003 */
if(!split_f) { if(!split_f) {
@ -535,14 +535,14 @@ int global_spice_netlist(int global) /* netlister driver */
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
type = (xctx->inst[i].ptr+ xctx->sym)->type; type = (xctx->inst[i].ptr+ xctx->sym)->type;
my_strdup(_ALLOC_ID_, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0)); my_strdup(1442, &place,get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr,"place",0));
if( type && !strcmp(type,"netlist_commands") ) { if( type && !strcmp(type,"netlist_commands") ) {
if(place && !strcmp(place, "end" )) { if(place && !strcmp(place, "end" )) {
if(first == 0) fprintf(fd,"**** begin user architecture code\n"); if(first == 0) fprintf(fd,"**** begin user architecture code\n");
++first; ++first;
print_spice_element(fd, i) ; print_spice_element(fd, i) ;
} else { } else {
my_strdup(_ALLOC_ID_, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0)); my_strdup(1443, &place,get_tok_value(xctx->inst[i].prop_ptr,"place",0));
if(place && !strcmp(place, "end" )) { if(place && !strcmp(place, "end" )) {
if(first == 0) fprintf(fd,"**** begin user architecture code\n"); if(first == 0) fprintf(fd,"**** begin user architecture code\n");
++first; ++first;
@ -586,7 +586,7 @@ int global_spice_netlist(int global) /* netlister driver */
} }
if(!debug_var) xunlink(netl_filename); if(!debug_var) xunlink(netl_filename);
} }
my_free(_ALLOC_ID_, &place); my_free(1444, &place);
xctx->netlist_count = 0; xctx->netlist_count = 0;
tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */ tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */
exit_code = err ? 10 : 0; exit_code = err ? 10 : 0;
@ -623,7 +623,7 @@ int spice_block_netlist(FILE *fd, int i)
if(!strcmp(default_schematic, "ignore")) { if(!strcmp(default_schematic, "ignore")) {
return err; return err;
} }
my_strdup(_ALLOC_ID_, &name, tcl_hook2(xctx->sym[i].name)); my_strdup(1445, &name, tcl_hook2(xctx->sym[i].name));
dbg(1, "spice_block_netlist(): filename=%s\n", filename); dbg(1, "spice_block_netlist(): filename=%s\n", filename);
if(split_f) { if(split_f) {
@ -636,27 +636,27 @@ int spice_block_netlist(FILE *fd, int i)
fprintf(fd, "\n* expanding symbol: %s # of pins=%d\n", name,xctx->sym[i].rects[PINLAYER] ); 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, "")); 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, "")); else fprintf(fd, "** sym_path: %s\n", sanitized_abs_sym_path(name, ""));
my_strdup(_ALLOC_ID_, &sym_def, get_tok_value(xctx->sym[i].prop_ptr,"spice_sym_def",0)); my_strdup(1446, &sym_def, get_tok_value(xctx->sym[i].prop_ptr,"spice_sym_def",0));
if(sym_def) { if(sym_def) {
char *symname_attr = NULL; char *symname_attr = NULL;
char *templ = NULL; char *templ = NULL;
const char *translated_sym_def; const char *translated_sym_def;
my_strdup2(_ALLOC_ID_, &templ, get_tok_value(xctx->sym[i].prop_ptr, "template", 0)); my_strdup2(1447, &templ, get_tok_value(xctx->sym[i].prop_ptr, "template", 0));
my_mstrcat(_ALLOC_ID_, &symname_attr, "symname=", get_cell(name, 0), NULL); my_mstrcat(1448, &symname_attr, "symname=", get_cell(name, 0), NULL);
translated_sym_def = translate3(sym_def, 1, "", translated_sym_def = translate3(sym_def, 1, "",
templ, templ,
symname_attr); symname_attr);
my_free(_ALLOC_ID_, &templ); my_free(1449, &templ);
my_free(_ALLOC_ID_, &symname_attr); my_free(1450, &symname_attr);
fprintf(fd, "%s\n", translated_sym_def); fprintf(fd, "%s\n", translated_sym_def);
my_free(_ALLOC_ID_, &sym_def); my_free(1451, &sym_def);
} else { } else {
const char *s = sanitize(get_cell(name, 0)); const char *s = sanitize(get_cell(name, 0));
fprintf(fd, "** sch_path: %s\n", sanitized_abs_sym_path(filename, "")); fprintf(fd, "** sch_path: %s\n", sanitized_abs_sym_path(filename, ""));
fprintf(fd, ".subckt %s ", s); fprintf(fd, ".subckt %s ", s);
print_spice_subckt_nodes(fd, i); print_spice_subckt_nodes(fd, i);
my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); my_strdup(1452, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) );
/* this is now done in print_spice_subckt_nodes */ /* this is now done in print_spice_subckt_nodes */
/* /*
* fprintf(fd, "%s ", extra ? extra : "" ); * fprintf(fd, "%s ", extra ? extra : "" );
@ -664,7 +664,7 @@ int spice_block_netlist(FILE *fd, int i)
/* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */ /* 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)); fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra));
my_free(_ALLOC_ID_, &extra); my_free(1453, &extra);
fprintf(fd, "\n"); fprintf(fd, "\n");
spice_stop ? load_schematic(0,filename, 0, 1) : load_schematic(1,filename, 0, 1); spice_stop ? load_schematic(0,filename, 0, 1) : load_schematic(1,filename, 0, 1);
@ -691,7 +691,7 @@ int spice_block_netlist(FILE *fd, int i)
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
xctx->netlist_count++; xctx->netlist_count++;
my_free(_ALLOC_ID_, &name); my_free(1454, &name);
return err; return err;
} }
@ -729,12 +729,12 @@ Str_hashentry *str_hash_lookup(Str_hashtable *hashtable, const char *token, cons
if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */
{ {
s=sizeof( Str_hashentry ); s=sizeof( Str_hashentry );
entry=(Str_hashentry *)my_malloc(_ALLOC_ID_, s); entry=(Str_hashentry *)my_malloc(1455, s);
entry->next=NULL; entry->next=NULL;
entry->token=NULL; entry->token=NULL;
entry->value=NULL; entry->value=NULL;
my_strdup2(_ALLOC_ID_, &entry->token, token); my_strdup2(1456, &entry->token, token);
my_strdup2(_ALLOC_ID_, &entry->value, value); my_strdup2(1457, &entry->value, value);
entry->hash=hashcode; entry->hash=hashcode;
*preventry=entry; *preventry=entry;
} }
@ -745,13 +745,13 @@ Str_hashentry *str_hash_lookup(Str_hashtable *hashtable, const char *token, cons
if(what==XDELETE) /* remove token from the hash table ... */ if(what==XDELETE) /* remove token from the hash table ... */
{ {
saveptr=entry->next; saveptr=entry->next;
my_free(_ALLOC_ID_, &entry->token); my_free(1458, &entry->token);
my_free(_ALLOC_ID_, &entry->value); my_free(1459, &entry->value);
my_free(_ALLOC_ID_, &entry); my_free(1460, &entry);
*preventry=saveptr; *preventry=saveptr;
} }
else if(value && what == XINSERT ) { else if(value && what == XINSERT ) {
my_strdup2(_ALLOC_ID_, &entry->value, value); my_strdup2(1461, &entry->value, value);
} }
return entry; /* found matching entry, return the address */ return entry; /* found matching entry, return the address */
} }
@ -766,7 +766,7 @@ void str_hash_init(Str_hashtable *hashtable, int size)
dbg(0, "str_hash_init(): Warning hash table not empty, possible data leak\n"); dbg(0, "str_hash_init(): Warning hash table not empty, possible data leak\n");
} }
hashtable->size = size; hashtable->size = size;
hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Str_hashentry *)); hashtable->table = my_calloc(1462, size, sizeof(Str_hashentry *));
} }
static void str_hash_free_entry(Str_hashentry *entry) static void str_hash_free_entry(Str_hashentry *entry)
@ -774,9 +774,9 @@ static void str_hash_free_entry(Str_hashentry *entry)
Str_hashentry *tmp; Str_hashentry *tmp;
while( entry ) { while( entry ) {
tmp = entry -> next; tmp = entry -> next;
my_free(_ALLOC_ID_, &(entry->token)); my_free(1463, &(entry->token));
my_free(_ALLOC_ID_, &(entry->value)); my_free(1464, &(entry->value));
my_free(_ALLOC_ID_, &entry); my_free(1465, &entry);
entry = tmp; entry = tmp;
} }
} }
@ -792,7 +792,7 @@ void str_hash_free(Str_hashtable *hashtable)
str_hash_free_entry( table[i] ); str_hash_free_entry( table[i] );
table[i] = NULL; table[i] = NULL;
} }
if(hashtable->table) my_free(_ALLOC_ID_, &(hashtable->table)); if(hashtable->table) my_free(1466, &(hashtable->table));
hashtable->size = 0; hashtable->size = 0;
} }
} }
@ -830,10 +830,10 @@ Int_hashentry *int_hash_lookup(Int_hashtable *hashtable, const char *token, cons
if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */
{ {
s=sizeof( Int_hashentry ); s=sizeof( Int_hashentry );
entry=(Int_hashentry *)my_malloc(_ALLOC_ID_, s); entry=(Int_hashentry *)my_malloc(1467, s);
entry->next=NULL; entry->next=NULL;
entry->token=NULL; entry->token=NULL;
my_strdup2(_ALLOC_ID_, &entry->token, token); my_strdup2(1468, &entry->token, token);
entry->value = value; entry->value = value;
entry->hash=hashcode; entry->hash=hashcode;
*preventry=entry; *preventry=entry;
@ -845,8 +845,8 @@ Int_hashentry *int_hash_lookup(Int_hashtable *hashtable, const char *token, cons
if(what==XDELETE) /* remove token from the hash table ... */ if(what==XDELETE) /* remove token from the hash table ... */
{ {
saveptr=entry->next; saveptr=entry->next;
my_free(_ALLOC_ID_, &entry->token); my_free(1469, &entry->token);
my_free(_ALLOC_ID_, &entry); my_free(1470, &entry);
*preventry=saveptr; *preventry=saveptr;
} }
else if(what == XINSERT ) { else if(what == XINSERT ) {
@ -865,7 +865,7 @@ void int_hash_init(Int_hashtable *hashtable, int size)
dbg(0, "int_hash_init(): Warning hash table not empty, possible data leak\n"); dbg(0, "int_hash_init(): Warning hash table not empty, possible data leak\n");
} }
hashtable->size = size; hashtable->size = size;
hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Int_hashentry *)); hashtable->table = my_calloc(1471, size, sizeof(Int_hashentry *));
} }
static void int_hash_free_entry(Int_hashentry *entry) static void int_hash_free_entry(Int_hashentry *entry)
@ -873,8 +873,8 @@ static void int_hash_free_entry(Int_hashentry *entry)
Int_hashentry *tmp; Int_hashentry *tmp;
while( entry ) { while( entry ) {
tmp = entry -> next; tmp = entry -> next;
my_free(_ALLOC_ID_, &(entry->token)); my_free(1472, &(entry->token));
my_free(_ALLOC_ID_, &entry); my_free(1473, &entry);
entry = tmp; entry = tmp;
} }
} }
@ -890,7 +890,7 @@ void int_hash_free(Int_hashtable *hashtable)
int_hash_free_entry( table[i] ); int_hash_free_entry( table[i] );
table[i] = NULL; table[i] = NULL;
} }
my_free(_ALLOC_ID_, &(hashtable->table)); my_free(1474, &(hashtable->table));
hashtable->size = 0; hashtable->size = 0;
} }
} }
@ -930,10 +930,10 @@ Ptr_hashentry *ptr_hash_lookup(Ptr_hashtable *hashtable, const char *token, void
if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */ if(what==XINSERT || what == XINSERT_NOREPLACE) /* insert data */
{ {
s=sizeof( Ptr_hashentry ); s=sizeof( Ptr_hashentry );
entry=(Ptr_hashentry *)my_malloc(_ALLOC_ID_, s); entry=(Ptr_hashentry *)my_malloc(1475, s);
entry->next=NULL; entry->next=NULL;
entry->token=NULL; entry->token=NULL;
my_strdup2(_ALLOC_ID_, &entry->token, token); my_strdup2(1476, &entry->token, token);
entry->value = value; entry->value = value;
entry->hash=hashcode; entry->hash=hashcode;
*preventry=entry; *preventry=entry;
@ -945,8 +945,8 @@ Ptr_hashentry *ptr_hash_lookup(Ptr_hashtable *hashtable, const char *token, void
if(what==XDELETE) /* remove token from the hash table ... */ if(what==XDELETE) /* remove token from the hash table ... */
{ {
saveptr=entry->next; saveptr=entry->next;
my_free(_ALLOC_ID_, &entry->token); my_free(1477, &entry->token);
my_free(_ALLOC_ID_, &entry); my_free(1478, &entry);
*preventry=saveptr; *preventry=saveptr;
} }
else if(what == XINSERT ) { else if(what == XINSERT ) {
@ -965,7 +965,7 @@ void ptr_hash_init(Ptr_hashtable *hashtable, int size)
dbg(0, "ptr_hash_init(): Warning hash table not empty, possible data leak\n"); dbg(0, "ptr_hash_init(): Warning hash table not empty, possible data leak\n");
} }
hashtable->size = size; hashtable->size = size;
hashtable->table = my_calloc(_ALLOC_ID_, size, sizeof(Ptr_hashentry *)); hashtable->table = my_calloc(1479, size, sizeof(Ptr_hashentry *));
} }
static void ptr_hash_free_entry(Ptr_hashentry *entry) static void ptr_hash_free_entry(Ptr_hashentry *entry)
@ -973,8 +973,8 @@ static void ptr_hash_free_entry(Ptr_hashentry *entry)
Ptr_hashentry *tmp; Ptr_hashentry *tmp;
while( entry ) { while( entry ) {
tmp = entry -> next; tmp = entry -> next;
my_free(_ALLOC_ID_, &(entry->token)); my_free(1480, &(entry->token));
my_free(_ALLOC_ID_, &entry); my_free(1481, &entry);
entry = tmp; entry = tmp;
} }
} }
@ -990,7 +990,7 @@ void ptr_hash_free(Ptr_hashtable *hashtable)
ptr_hash_free_entry( table[i] ); ptr_hash_free_entry( table[i] );
table[i] = NULL; table[i] = NULL;
} }
my_free(_ALLOC_ID_, &(hashtable->table)); my_free(1482, &(hashtable->table));
hashtable->size = 0; hashtable->size = 0;
} }
} }

View File

@ -28,7 +28,7 @@ void check_wire_storage(void)
if(xctx->wires >= xctx->maxw) if(xctx->wires >= xctx->maxw)
{ {
xctx->maxw=(1+xctx->wires / CADMAXWIRES)*CADMAXWIRES; xctx->maxw=(1+xctx->wires / CADMAXWIRES)*CADMAXWIRES;
my_realloc(_ALLOC_ID_, &xctx->wire, sizeof(xWire)*xctx->maxw); my_realloc(1483, &xctx->wire, sizeof(xWire)*xctx->maxw);
} }
} }
@ -37,7 +37,7 @@ void check_selected_storage(void)
if(xctx->lastsel >= xctx->maxsel) if(xctx->lastsel >= xctx->maxsel)
{ {
xctx->maxsel=(1+xctx->lastsel / MAXGROUP) * MAXGROUP; xctx->maxsel=(1+xctx->lastsel / MAXGROUP) * MAXGROUP;
my_realloc(_ALLOC_ID_, &xctx->sel_array, sizeof(Selected)*xctx->maxsel); my_realloc(1484, &xctx->sel_array, sizeof(Selected)*xctx->maxsel);
} }
} }
@ -46,7 +46,7 @@ void check_text_storage(void)
if(xctx->texts >= xctx->maxt) if(xctx->texts >= xctx->maxt)
{ {
xctx->maxt=(1 + xctx->texts / CADMAXTEXT) * CADMAXTEXT; xctx->maxt=(1 + xctx->texts / CADMAXTEXT) * CADMAXTEXT;
my_realloc(_ALLOC_ID_, &xctx->text, sizeof(xText)*xctx->maxt); my_realloc(1485, &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", dbg(1, "check_symbol_storage(): more than maxs, %s\n",
xctx->sch[xctx->currsch] ); xctx->sch[xctx->currsch] );
xctx->maxs=(1 + xctx->symbols / ELEMDEF) * ELEMDEF; xctx->maxs=(1 + xctx->symbols / ELEMDEF) * ELEMDEF;
my_realloc(_ALLOC_ID_, &xctx->sym, sizeof(xSymbol)*xctx->maxs); my_realloc(1486, &xctx->sym, sizeof(xSymbol)*xctx->maxs);
} }
} }
@ -71,7 +71,7 @@ void check_inst_storage(void)
int i, old = xctx->maxi; int i, old = xctx->maxi;
xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST; xctx->maxi=(1 + xctx->instances / ELEMINST) * ELEMINST;
my_realloc(_ALLOC_ID_, &xctx->inst, sizeof(xInstance)*xctx->maxi); my_realloc(1487, &xctx->inst, sizeof(xInstance)*xctx->maxi);
#ifdef ZERO_REALLOC #ifdef ZERO_REALLOC
memset(xctx->inst + xctx->instances, 0, sizeof(xInstance) * (xctx->maxi - xctx->instances)); memset(xctx->inst + xctx->instances, 0, sizeof(xInstance) * (xctx->maxi - xctx->instances));
#endif #endif
@ -86,7 +86,7 @@ void check_arc_storage(int c)
if(xctx->arcs[c] >= xctx->maxa[c]) if(xctx->arcs[c] >= xctx->maxa[c])
{ {
xctx->maxa[c]=(1 + xctx->arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS; xctx->maxa[c]=(1 + xctx->arcs[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(_ALLOC_ID_, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]); my_realloc(1488, &xctx->arc[c], sizeof(xArc)*xctx->maxa[c]);
#ifdef ZERO_REALLOC #ifdef ZERO_REALLOC
memset(xctx->arc[c] + xctx->arcs[c], 0, sizeof(xArc) * (xctx->maxa[c] - xctx->arcs[c])); memset(xctx->arc[c] + xctx->arcs[c], 0, sizeof(xArc) * (xctx->maxa[c] - xctx->arcs[c]));
#endif #endif
@ -98,7 +98,7 @@ void check_box_storage(int c)
if(xctx->rects[c] >= xctx->maxr[c]) if(xctx->rects[c] >= xctx->maxr[c])
{ {
xctx->maxr[c]=(1 + xctx->rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS; xctx->maxr[c]=(1 + xctx->rects[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(_ALLOC_ID_, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]); my_realloc(1489, &xctx->rect[c], sizeof(xRect)*xctx->maxr[c]);
#ifdef ZERO_REALLOC #ifdef ZERO_REALLOC
memset(xctx->rect[c] + xctx->rects[c], 0, sizeof(xRect) * (xctx->maxr[c] - xctx->rects[c])); memset(xctx->rect[c] + xctx->rects[c], 0, sizeof(xRect) * (xctx->maxr[c] - xctx->rects[c]));
#endif #endif
@ -110,7 +110,7 @@ void check_line_storage(int c)
if(xctx->lines[c] >= xctx->maxl[c]) if(xctx->lines[c] >= xctx->maxl[c])
{ {
xctx->maxl[c]=(1 + xctx->lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS; xctx->maxl[c]=(1 + xctx->lines[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(_ALLOC_ID_, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]); my_realloc(1490, &xctx->line[c], sizeof(xLine)*xctx->maxl[c]);
#ifdef ZERO_REALLOC #ifdef ZERO_REALLOC
memset(xctx->line[c] + xctx->lines[c], 0, sizeof(xLine) * (xctx->maxl[c] - xctx->lines[c])); memset(xctx->line[c] + xctx->lines[c], 0, sizeof(xLine) * (xctx->maxl[c] - xctx->lines[c]));
#endif #endif
@ -122,7 +122,7 @@ void check_polygon_storage(int c)
if(xctx->polygons[c] >= xctx->maxp[c]) if(xctx->polygons[c] >= xctx->maxp[c])
{ {
xctx->maxp[c]=(1 + xctx->polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS; xctx->maxp[c]=(1 + xctx->polygons[c] / CADMAXOBJECTS) * CADMAXOBJECTS;
my_realloc(_ALLOC_ID_, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]); my_realloc(1491, &xctx->poly[c], sizeof(xPoly)*xctx->maxp[c]);
#ifdef ZERO_REALLOC #ifdef ZERO_REALLOC
memset(xctx->poly[c] + xctx->polygons[c], 0, sizeof(xPoly) * (xctx->maxp[c] - xctx->polygons[c])); memset(xctx->poly[c] + xctx->polygons[c], 0, sizeof(xPoly) * (xctx->maxp[c] - xctx->polygons[c]));
#endif #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].a = a;
xctx->arc[rectc][n].b = b; xctx->arc[rectc][n].b = b;
xctx->arc[rectc][n].prop_ptr = NULL; xctx->arc[rectc][n].prop_ptr = NULL;
my_strdup(_ALLOC_ID_, &xctx->arc[rectc][n].prop_ptr, prop_ptr); my_strdup(1492, &xctx->arc[rectc][n].prop_ptr, prop_ptr);
xctx->arc[rectc][n].sel = sel; xctx->arc[rectc][n].sel = sel;
if(sel == SELECTED) set_first_sel(ARC, n, rectc); 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].y=NULL;
xctx->poly[rectc][n].selected_point=NULL; xctx->poly[rectc][n].selected_point=NULL;
xctx->poly[rectc][n].prop_ptr=NULL; xctx->poly[rectc][n].prop_ptr=NULL;
xctx->poly[rectc][n].x= my_calloc(_ALLOC_ID_, points, sizeof(double)); xctx->poly[rectc][n].x= my_calloc(1493, points, sizeof(double));
xctx->poly[rectc][n].y= my_calloc(_ALLOC_ID_, points, sizeof(double)); xctx->poly[rectc][n].y= my_calloc(1494, points, sizeof(double));
xctx->poly[rectc][n].selected_point= my_calloc(_ALLOC_ID_, points, sizeof(unsigned short)); xctx->poly[rectc][n].selected_point= my_calloc(1495, points, sizeof(unsigned short));
my_strdup(_ALLOC_ID_, &xctx->poly[rectc][n].prop_ptr, prop_ptr); my_strdup(1496, &xctx->poly[rectc][n].prop_ptr, prop_ptr);
for(j=0;j<points; ++j) { for(j=0;j<points; ++j) {
xctx->poly[rectc][n].x[j] = x[j]; xctx->poly[rectc][n].x[j] = x[j];
xctx->poly[rectc][n].y[j] = y[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].y1=y1;
xctx->line[rectc][n].y2=y2; xctx->line[rectc][n].y2=y2;
xctx->line[rectc][n].prop_ptr=NULL; xctx->line[rectc][n].prop_ptr=NULL;
my_strdup(_ALLOC_ID_, &xctx->line[rectc][n].prop_ptr, prop_ptr); my_strdup(1497, &xctx->line[rectc][n].prop_ptr, prop_ptr);
xctx->line[rectc][n].sel=sel; xctx->line[rectc][n].sel=sel;
if(sel == SELECTED) set_first_sel(LINE, n, rectc); if(sel == SELECTED) set_first_sel(LINE, n, rectc);
if( prop_ptr && !strboolcmp(get_tok_value(prop_ptr, "bus", 0), "true") ) if( prop_ptr && !strboolcmp(get_tok_value(prop_ptr, "bus", 0), "true") )
@ -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].y2=y2;
xctx->rect[rectc][n].prop_ptr=NULL; xctx->rect[rectc][n].prop_ptr=NULL;
xctx->rect[rectc][n].extraptr=NULL; xctx->rect[rectc][n].extraptr=NULL;
my_strdup(_ALLOC_ID_, &xctx->rect[rectc][n].prop_ptr, prop_ptr); my_strdup(1498, &xctx->rect[rectc][n].prop_ptr, prop_ptr);
xctx->rect[rectc][n].sel=sel; xctx->rect[rectc][n].sel=sel;
if(sel == SELECTED) set_first_sel(xRECT, n, rectc); 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].node=NULL;
xctx->wire[n].end1=0; xctx->wire[n].end1=0;
xctx->wire[n].end2=0; xctx->wire[n].end2=0;
my_strdup(_ALLOC_ID_, &xctx->wire[n].prop_ptr, prop_ptr); my_strdup(1499, &xctx->wire[n].prop_ptr, prop_ptr);
if(prop_ptr && !strboolcmp(get_tok_value(prop_ptr,"bus",0), "true")) xctx->wire[n].bus=1; if(prop_ptr && !strboolcmp(get_tok_value(prop_ptr,"bus",0), "true")) xctx->wire[n].bus=1;
else xctx->wire[n].bus=0; else xctx->wire[n].bus=0;
xctx->wire[n].sel=sel; xctx->wire[n].sel=sel;

View File

@ -334,7 +334,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, text_bbox(estr, xscale, yscale, rot, flip, hcenter, vcenter, x,y,
&textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line); &textx1,&texty1,&textx2,&texty2, &no_of_lines, &longest_line);
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) { if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,textx1,texty1,textx2,texty2)) {
my_free(_ALLOC_ID_, &estr); my_free(1500, &estr);
return; return;
} }
if(hcenter) { if(hcenter) {
@ -358,7 +358,7 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i
if(rot == 3 && flip == 1 ) { x=textx1;} if(rot == 3 && flip == 1 ) { x=textx1;}
} }
llength=0; llength=0;
my_strdup2(_ALLOC_ID_, &sss, estr); my_strdup2(1501, &sss, estr);
tt=ss=sss; tt=ss=sss;
for(;;) { for(;;) {
c=*ss; c=*ss;
@ -376,8 +376,8 @@ static void svg_draw_string(int layer, const char *str, short rot, short flip, i
} }
++ss; ++ss;
} }
my_free(_ALLOC_ID_, &sss); my_free(1502, &sss);
my_free(_ALLOC_ID_, &estr); my_free(1503, &estr);
} }
@ -405,7 +405,7 @@ static void old_svg_draw_string(int layer, const char *str,
&rx1,&ry1,&rx2,&ry2, &no_of_lines, &longest_line); &rx1,&ry1,&rx2,&ry2, &no_of_lines, &longest_line);
#endif #endif
if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) { if(!textclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,rx1,ry1,rx2,ry2)) {
my_free(_ALLOC_ID_, &estr); my_free(1504, &estr);
return; return;
} }
x=rx1;y=ry1; x=rx1;y=ry1;
@ -436,7 +436,7 @@ static void old_svg_draw_string(int layer, const char *str,
} }
++pos; ++pos;
} }
my_free(_ALLOC_ID_, &estr); my_free(1505, &estr);
} }
@ -573,8 +573,8 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
polygon =&(symptr->poly[layer])[j]; polygon =&(symptr->poly[layer])[j];
{ /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */ { /* scope block so we declare some auxiliary arrays for coord transforms. 20171115 */
int k, bezier; int k, bezier;
double *x = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); double *x = my_malloc(1506, sizeof(double) * polygon->points);
double *y = my_malloc(_ALLOC_ID_, sizeof(double) * polygon->points); double *y = my_malloc(1507, sizeof(double) * polygon->points);
for(k=0;k<polygon->points; ++k) { for(k=0;k<polygon->points; ++k) {
ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]); ROTATION(rot, flip, 0.0,0.0,polygon->x[k],polygon->y[k],x[k],y[k]);
x[k]+= x0; x[k]+= x0;
@ -582,8 +582,8 @@ static void svg_draw_symbol(int c, int n,int layer,short tmp_flip, short rot,
} }
bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true"); bezier = !strboolcmp(get_tok_value(polygon->prop_ptr, "bezier", 0), "true");
svg_drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, polygon->dash, bezier); svg_drawpolygon(c, NOW, x, y, polygon->points, polygon->fill, polygon->dash, bezier);
my_free(_ALLOC_ID_, &x); my_free(1508, &x);
my_free(_ALLOC_ID_, &y); my_free(1509, &y);
} }
} }
for(j=0;j< symptr->arcs[layer]; ++j) { for(j=0;j< symptr->arcs[layer]; ++j) {
@ -744,7 +744,7 @@ void svg_draw(void)
else return; else return;
} }
svg_restore_lw(); svg_restore_lw();
svg_colors=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Svg_color)); svg_colors=my_calloc(1510, cadlayers, sizeof(Svg_color));
if(svg_colors==NULL){ if(svg_colors==NULL){
fprintf(errfp, "svg_draw(): calloc error\n"); fprintf(errfp, "svg_draw(): calloc error\n");
return; return;
@ -771,7 +771,7 @@ void svg_draw(void)
} }
my_strncpy(xctx->plotfile,"", S(xctx->plotfile)); my_strncpy(xctx->plotfile,"", S(xctx->plotfile));
unused_layer = my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); unused_layer = my_calloc(1511, cadlayers, sizeof(int));
#if 0 #if 0
* /* Determine used layers. Disabled since we want hilight colors */ * /* Determine used layers. Disabled since we want hilight colors */
* for(c=0;c<cadlayers; ++c) unused_layer[c] = 1; * for(c=0;c<cadlayers; ++c) unused_layer[c] = 1;
@ -976,8 +976,8 @@ void svg_draw(void)
fprintf(fd, "</svg>\n"); fprintf(fd, "</svg>\n");
fclose(fd); fclose(fd);
tclsetboolvar("draw_grid", old_grid); tclsetboolvar("draw_grid", old_grid);
my_free(_ALLOC_ID_, &svg_colors); my_free(1512, &svg_colors);
my_free(_ALLOC_ID_, &unused_layer); my_free(1513, &unused_layer);
Tcl_SetResult(interp,"",TCL_STATIC); Tcl_SetResult(interp,"",TCL_STATIC);
} }

View File

@ -37,7 +37,7 @@ static int tedax_netlist(FILE *fd, int tedax_stop )
for(i=0;i<xctx->instances; ++i) /* print first ipin/opin defs ... */ for(i=0;i<xctx->instances; ++i) /* print first ipin/opin defs ... */
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1514, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && IS_PIN(type) ) { if( type && IS_PIN(type) ) {
print_tedax_element(fd, i) ; /* this is the element line */ 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;i<xctx->instances; ++i) /* ... then print other lines */ for(i=0;i<xctx->instances; ++i) /* ... then print other lines */
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1515, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if(!strcmp(type,"noconn")) continue; if(!strcmp(type,"noconn")) continue;
if( type && !IS_LABEL_OR_PIN(type) ) { if( type && !IS_LABEL_OR_PIN(type) ) {
/* already done in global_tedax_netlist */ /* already done in global_tedax_netlist */
@ -63,7 +63,7 @@ static int tedax_netlist(FILE *fd, int tedax_stop )
} }
} }
} }
my_free(_ALLOC_ID_, &type); my_free(1516, &type);
} }
if(!tedax_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ if(!tedax_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */
return err; return err;
@ -97,7 +97,7 @@ static int tedax_block_netlist(FILE *fd, int i)
fprintf(fd, "begin netlist v1 %s\n",sanitize(get_cell(xctx->sym[i].name, 0))); fprintf(fd, "begin netlist v1 %s\n",sanitize(get_cell(xctx->sym[i].name, 0)));
print_tedax_subckt(fd, i); print_tedax_subckt(fd, i);
my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) ); my_strdup(1517, &extra, get_tok_value(xctx->sym[i].prop_ptr,"extra",0) );
/* this is now done in print_spice_subckt */ /* this is now done in print_spice_subckt */
/* /*
* fprintf(fd, "%s ", extra ? extra : "" ); * fprintf(fd, "%s ", extra ? extra : "" );
@ -105,7 +105,7 @@ static int tedax_block_netlist(FILE *fd, int i)
/* 20081206 new get_sym_template does not return token=value pairs where token listed in extra */ /* 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)); fprintf(fd, "%s", get_sym_template(xctx->sym[i].templ, extra));
my_free(_ALLOC_ID_, &extra); my_free(1518, &extra);
fprintf(fd, "\n"); fprintf(fd, "\n");
load_schematic(1,filename, 0, 1); load_schematic(1,filename, 0, 1);
get_additional_symbols(1); get_additional_symbols(1);
@ -190,7 +190,7 @@ int global_tedax_netlist(int global) /* netlister driver */
/* warning if two symbols perfectly overlapped */ /* warning if two symbols perfectly overlapped */
err |= warning_overlapped_symbols(0); err |= warning_overlapped_symbols(0);
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */ /* preserve current level instance flags before descending hierarchy for netlisting, restore later */
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); stored_flags = my_calloc(1519, xctx->instances, sizeof(unsigned int));
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color; for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
if(global) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */ if(global) /* was if(global) ... 20180901 no hierarchical tEDAx netlist for now */
@ -205,8 +205,8 @@ int global_tedax_netlist(int global) /* netlister driver */
/* reload data without popping undo stack, this populates embedded symbols if any */ /* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(1520, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(1521, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;
subckt_name=NULL; subckt_name=NULL;
@ -217,7 +217,7 @@ int global_tedax_netlist(int global) /* netlister driver */
if(xctx->sym[i].flags & (TEDAX_IGNORE | TEDAX_SHORT)) continue; if(xctx->sym[i].flags & (TEDAX_IGNORE | TEDAX_SHORT)) continue;
if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue; if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue;
if(!xctx->sym[i].type) continue; if(!xctx->sym[i].type) continue;
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); my_strdup2(1522, &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(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{ {
if(!web_url) { if(!web_url) {
@ -225,7 +225,7 @@ int global_tedax_netlist(int global) /* netlister driver */
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
} }
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); my_strdup(1523, &subckt_name, get_cell(xctx->sym[i].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) 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 /* 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) /* netlister driver */
} }
} }
} }
my_free(_ALLOC_ID_, &abs_path); my_free(1524, &abs_path);
/* can not free additional syms since *_block_netlist() may have loaded additional syms */ /* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */ /* get_additional_symbols(0); */
str_hash_free(&subckt_table); str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name); my_free(1525, &subckt_name);
/*clear_drawing(); */ /*clear_drawing(); */
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(1526, &xctx->sch[xctx->currsch]);
xctx->currsch--; xctx->currsch--;
unselect_all(1); unselect_all(1);
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */ /* 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) /* netlister driver */
err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */ err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
my_free(_ALLOC_ID_, &current_dirname_save); my_free(1527, &current_dirname_save);
} }
/* restore hilight flags from errors found analyzing top level before descending hierarchy */ /* restore hilight flags from errors found analyzing top level before descending hierarchy */
for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i];
propagate_hilights(1, 0, XINSERT_NOREPLACE); propagate_hilights(1, 0, XINSERT_NOREPLACE);
draw_hilight_net(1); draw_hilight_net(1);
my_free(_ALLOC_ID_, &stored_flags); my_free(1528, &stored_flags);
/* print globals nodes found in netlist 28032003 */ /* print globals nodes found in netlist 28032003 */
record_global_node(0,fd,NULL); record_global_node(0,fd,NULL);

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@ static int verilog_netlist(FILE *fd , int verilog_stop)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
dbg(2, "verilog_netlist(): into the netlisting loop\n"); dbg(2, "verilog_netlist(): into the netlisting loop\n");
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1976, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && if( type &&
( !IS_LABEL_SH_OR_PIN(type) && ( !IS_LABEL_SH_OR_PIN(type) &&
strcmp(type,"netlist_commands")&& strcmp(type,"netlist_commands")&&
@ -68,7 +68,7 @@ static int verilog_netlist(FILE *fd , int verilog_stop)
} }
} }
} }
my_free(_ALLOC_ID_, &type); my_free(1977, &type);
} }
dbg(1, "verilog_netlist(): end\n"); dbg(1, "verilog_netlist(): end\n");
if(!verilog_stop && !xctx->netlist_count) redraw_hilights(0); /*draw_hilight_net(1); */ if(!verilog_stop && !xctx->netlist_count) redraw_hilights(0); /*draw_hilight_net(1); */
@ -132,14 +132,14 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1978, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) ) if( type && (strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
{ {
str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr , fmt_attr, 2); str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr , fmt_attr, 2);
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format")) if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format"))
str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2); str_tmp = get_tok_value( (xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2);
my_strdup(_ALLOC_ID_, &tmp_string, str_tmp); my_strdup(1979, &tmp_string, str_tmp);
fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "(NULL)"); fprintf(fd, "%s\n", str_tmp ? translate(i, tmp_string) : "(NULL)");
} }
} }
@ -162,7 +162,7 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1980, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"opin"))==0) if( type && (strcmp(type,"opin"))==0)
{ {
if(tmp) fprintf(fd, " ,\n"); if(tmp) fprintf(fd, " ,\n");
@ -176,7 +176,7 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1981, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"iopin"))==0) if( type && (strcmp(type,"iopin"))==0)
{ {
if(tmp) fprintf(fd, " ,\n"); if(tmp) fprintf(fd, " ,\n");
@ -190,7 +190,7 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1982, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"ipin"))==0) if( type && (strcmp(type,"ipin"))==0)
{ {
if(tmp) fprintf(fd, " ,\n"); if(tmp) fprintf(fd, " ,\n");
@ -218,12 +218,12 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1983, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"opin"))==0) if( type && (strcmp(type,"opin"))==0)
{ {
my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); my_strdup(1984, &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)); my_strdup(1985, &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 */ if(!sig_type || sig_type[0]=='\0') my_strdup(1986, &sig_type,"wire"); /* 20070720 changed reg to wire */
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : "(NULL)"); fprintf(fd, " output %s ;\n", str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)"); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
@ -237,12 +237,12 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1987, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"iopin"))==0) if( type && (strcmp(type,"iopin"))==0)
{ {
my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); my_strdup(1988, &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)); my_strdup(1989, &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"); if(!sig_type || sig_type[0]=='\0') my_strdup(1990, &sig_type,"wire");
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : "(NULL)"); fprintf(fd, " inout %s ;\n", str_tmp ? str_tmp : "(NULL)");
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)"); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "(NULL)");
@ -256,12 +256,12 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1991, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"ipin"))==0) if( type && (strcmp(type,"ipin"))==0)
{ {
my_strdup(_ALLOC_ID_, &port_value,get_tok_value(xctx->inst[i].prop_ptr,"value",0)); my_strdup(1992, &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)); my_strdup(1993, &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"); if(!sig_type || sig_type[0]=='\0') my_strdup(1994, &sig_type,"wire");
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
fprintf(fd, " input %s ;\n", str_tmp ? str_tmp : "<NULL>"); fprintf(fd, " input %s ;\n", str_tmp ? str_tmp : "<NULL>");
fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "<NULL>"); fprintf(fd, " %s %s ", sig_type, str_tmp ? str_tmp : "<NULL>");
@ -278,7 +278,7 @@ int global_verilog_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) { for(i=0;i<xctx->instances; ++i) {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(1995, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if(type && !strcmp(type,"netlist_commands")) { if(type && !strcmp(type,"netlist_commands")) {
fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0));
} }
@ -307,7 +307,7 @@ int global_verilog_netlist(int global) /* netlister driver */
/* warning if two symbols perfectly overlapped */ /* warning if two symbols perfectly overlapped */
err |= warning_overlapped_symbols(0); err |= warning_overlapped_symbols(0);
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */ /* preserve current level instance flags before descending hierarchy for netlisting, restore later */
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); stored_flags = my_calloc(1996, xctx->instances, sizeof(unsigned int));
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color; for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
if(global) if(global)
@ -322,8 +322,8 @@ int global_verilog_netlist(int global) /* netlister driver */
/* reload data without popping undo stack, this populates embedded symbols if any */ /* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(1997, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(1998, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;
@ -335,14 +335,14 @@ int global_verilog_netlist(int global) /* netlister driver */
if(xctx->sym[i].flags & (VERILOG_IGNORE | VERILOG_SHORT)) continue; if(xctx->sym[i].flags & (VERILOG_IGNORE | VERILOG_SHORT)) continue;
if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue; if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue;
if(!xctx->sym[i].type) continue; if(!xctx->sym[i].type) continue;
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[i].name), "")); my_strdup2(1999, &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(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) {
if(!web_url) { if(!web_url) {
tclvareval("get_directory [list ", xctx->sch[xctx->currsch - 1], "]", NULL); tclvareval("get_directory [list ", xctx->sch[xctx->currsch - 1], "]", NULL);
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
} }
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); my_strdup(2000, &subckt_name, get_cell(xctx->sym[i].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) 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 /* 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) /* netlister driver */
} }
} }
} }
my_free(_ALLOC_ID_, &abs_path); my_free(2001, &abs_path);
/* can not free additional syms since *_block_netlist() may have loaded additional syms */ /* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */ /* get_additional_symbols(0); */
str_hash_free(&subckt_table); str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name); my_free(2002, &subckt_name);
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(2003, &xctx->sch[xctx->currsch]);
xctx->currsch--; xctx->currsch--;
unselect_all(1); unselect_all(1);
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */ /* 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) /* netlister driver */
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name)); 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 */ err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
my_free(_ALLOC_ID_, &current_dirname_save); my_free(2004, &current_dirname_save);
} }
/* restore hilight flags from errors found analyzing top level before descending hierarchy */ /* restore hilight flags from errors found analyzing top level before descending hierarchy */
for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i];
propagate_hilights(1, 0, XINSERT_NOREPLACE); propagate_hilights(1, 0, XINSERT_NOREPLACE);
draw_hilight_net(1); draw_hilight_net(1);
my_free(_ALLOC_ID_, &stored_flags); my_free(2005, &stored_flags);
dbg(1, "global_verilog_netlist(): starting awk on netlist!\n"); dbg(1, "global_verilog_netlist(): starting awk on netlist!\n");
if(!split_f) { if(!split_f) {
@ -402,10 +402,10 @@ int global_verilog_netlist(int global) /* netlister driver */
} }
if(debug_var == 0 ) xunlink(netl_filename); if(debug_var == 0 ) xunlink(netl_filename);
} }
my_free(_ALLOC_ID_, &sig_type); my_free(2006, &sig_type);
my_free(_ALLOC_ID_, &port_value); my_free(2007, &port_value);
my_free(_ALLOC_ID_, &tmp_string); my_free(2008, &tmp_string);
my_free(_ALLOC_ID_, &type); my_free(2009, &type);
xctx->netlist_count = 0; xctx->netlist_count = 0;
tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */ tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */
exit_code = err ? 10 : 0; exit_code = err ? 10 : 0;
@ -446,7 +446,7 @@ int verilog_block_netlist(FILE *fd, int i)
if(!strcmp(default_schematic, "ignore")) { if(!strcmp(default_schematic, "ignore")) {
return err; return err;
} }
my_strdup(_ALLOC_ID_, &name, tcl_hook2(xctx->sym[i].name)); my_strdup(2010, &name, tcl_hook2(xctx->sym[i].name));
if(split_f) { if(split_f) {
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
@ -466,8 +466,8 @@ int verilog_block_netlist(FILE *fd, int i)
} else { } else {
Int_hashtable table = {NULL, 0}; Int_hashtable table = {NULL, 0};
int_hash_init(&table, 37); int_hash_init(&table, 37);
my_strdup(_ALLOC_ID_, &extra, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0)); my_strdup(2011, &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)); my_strdup(2012, &extra2, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra", 0));
fprintf(fd, "// sch_path: %s\n", sanitized_abs_sym_path(filename, "")); fprintf(fd, "// sch_path: %s\n", sanitized_abs_sym_path(filename, ""));
verilog_stop? load_schematic(0,filename, 0, 1) : load_schematic(1,filename, 0, 1); verilog_stop? load_schematic(0,filename, 0, 1) : load_schematic(1,filename, 0, 1);
get_additional_symbols(1); get_additional_symbols(1);
@ -476,32 +476,32 @@ int verilog_block_netlist(FILE *fd, int i)
for(j=0;j<xctx->instances; ++j) for(j=0;j<xctx->instances; ++j)
{ {
if(skip_instance(j, 1, lvs_ignore)) continue; if(skip_instance(j, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[j].ptr+ xctx->sym)->type); my_strdup(2013, &type,(xctx->inst[j].ptr+ xctx->sym)->type);
if( type && ( strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) ) if( type && ( strcmp(type,"timescale")==0 || strcmp(type,"verilog_preprocessor")==0) )
{ {
str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, fmt_attr, 2); str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, fmt_attr, 2);
if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format")) if(!xctx->tok_size && strcmp(fmt_attr, "verilog_format"))
str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2); str_tmp = get_tok_value( (xctx->inst[j].ptr+ xctx->sym)->prop_ptr, "verilog_format", 2);
my_strdup(_ALLOC_ID_, &tmp_string, str_tmp); my_strdup(2014, &tmp_string, str_tmp);
fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "(NULL)"); fprintf(fd, "%s\n", str_tmp ? translate(j, tmp_string) : "(NULL)");
} }
} }
my_strdup(_ALLOC_ID_, &verilogprefix, my_strdup(2015, &verilogprefix,
get_tok_value(xctx->sym[i].prop_ptr, "verilogprefix", 0)); get_tok_value(xctx->sym[i].prop_ptr, "verilogprefix", 0));
if(verilogprefix) { if(verilogprefix) {
my_strdup(_ALLOC_ID_, &symname, verilogprefix); my_strdup(2016, &symname, verilogprefix);
my_strcat(_ALLOC_ID_, &symname, get_cell(xctx->sym[i].name, 0)); my_strcat(2017, &symname, get_cell(xctx->sym[i].name, 0));
} else { } else {
my_strdup(_ALLOC_ID_, &symname, get_cell(xctx->sym[i].name, 0)); my_strdup(2018, &symname, get_cell(xctx->sym[i].name, 0));
} }
my_free(_ALLOC_ID_, &verilogprefix); my_free(2019, &verilogprefix);
fprintf(fd, "module %s (\n", sanitize(symname)); fprintf(fd, "module %s (\n", sanitize(symname));
my_free(_ALLOC_ID_, &symname); my_free(2020, &symname);
/*print_generic(fd, "entity", i); */ /*print_generic(fd, "entity", i); */
dbg(1, "verilog_block_netlist(): entity ports\n"); dbg(1, "verilog_block_netlist(): entity ports\n");
@ -540,15 +540,15 @@ int verilog_block_netlist(FILE *fd, int i)
for(j=0;j<xctx->sym[i].rects[PINLAYER]; ++j) for(j=0;j<xctx->sym[i].rects[PINLAYER]; ++j)
{ {
if(strboolcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) { if(strboolcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_ignore",0), "true")) {
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value( my_strdup(2021, &sig_type,get_tok_value(
xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0)); xctx->sym[i].rect[PINLAYER][j].prop_ptr,"verilog_type",0));
my_strdup(_ALLOC_ID_, &port_value, my_strdup(2022, &port_value,
get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) );
my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); my_strdup(2023, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) );
if(strcmp(dir_tmp,"in")){ if(strcmp(dir_tmp,"in")){
if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); /* 20070720 changed reg to wire */ if(!sig_type || sig_type[0]=='\0') my_strdup(2024, &sig_type,"wire"); /* 20070720 changed reg to wire */
} else { } else {
if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"wire"); if(!sig_type || sig_type[0]=='\0') my_strdup(2025, &sig_type,"wire");
} }
str_tmp = get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"name",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(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) {
@ -565,7 +565,7 @@ int verilog_block_netlist(FILE *fd, int i)
if(extra2) { if(extra2) {
char *verilog_extra_dir = NULL; char *verilog_extra_dir = NULL;
const char *dir; const char *dir;
my_strdup2(_ALLOC_ID_, &verilog_extra_dir, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra_dir", 0)); my_strdup2(2026, &verilog_extra_dir, get_tok_value(xctx->sym[i].prop_ptr, "verilog_extra_dir", 0));
saveptr1 = NULL; saveptr1 = NULL;
for(extra_ptr = extra2; ; extra_ptr=NULL) { for(extra_ptr = extra2; ; extra_ptr=NULL) {
extra_token=my_strtok_r(extra_ptr, " ", "", 0, &saveptr1); extra_token=my_strtok_r(extra_ptr, " ", "", 0, &saveptr1);
@ -578,7 +578,7 @@ int verilog_block_netlist(FILE *fd, int i)
} }
fprintf(fd, " wire %s ;\n", extra_token); fprintf(fd, " wire %s ;\n", extra_token);
} }
my_free(_ALLOC_ID_, &verilog_extra_dir); my_free(2027, &verilog_extra_dir);
} }
dbg(1, "verilog_block_netlist(): netlisting %s\n", get_cell( xctx->sch[xctx->currsch], 0)); dbg(1, "verilog_block_netlist(): netlisting %s\n", get_cell( xctx->sch[xctx->currsch], 0));
err |= verilog_netlist(fd, verilog_stop); err |= verilog_netlist(fd, verilog_stop);
@ -588,7 +588,7 @@ int verilog_block_netlist(FILE *fd, int i)
if(xctx->netlist_count && if(xctx->netlist_count &&
!strboolcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; !strboolcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); my_strdup(2028, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
if(type && !strcmp(type,"netlist_commands")) { if(type && !strcmp(type,"netlist_commands")) {
fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0));
} }
@ -599,13 +599,13 @@ int verilog_block_netlist(FILE *fd, int i)
} }
fprintf(fd,"---- end user architecture code\n"); fprintf(fd,"---- end user architecture code\n");
fprintf(fd, "endmodule\n"); fprintf(fd, "endmodule\n");
my_free(_ALLOC_ID_, &dir_tmp); my_free(2029, &dir_tmp);
my_free(_ALLOC_ID_, &sig_type); my_free(2030, &sig_type);
my_free(_ALLOC_ID_, &port_value); my_free(2031, &port_value);
my_free(_ALLOC_ID_, &type); my_free(2032, &type);
my_free(_ALLOC_ID_, &tmp_string); my_free(2033, &tmp_string);
my_free(_ALLOC_ID_, &extra); my_free(2034, &extra);
my_free(_ALLOC_ID_, &extra2); my_free(2035, &extra2);
} /* if(!sym_def[0]) */ } /* if(!sym_def[0]) */
if(split_f) { if(split_f) {
int save; int save;
@ -620,7 +620,7 @@ int verilog_block_netlist(FILE *fd, int i)
if(debug_var==0) xunlink(netl_filename); if(debug_var==0) xunlink(netl_filename);
} }
xctx->netlist_count++; xctx->netlist_count++;
my_free(_ALLOC_ID_, &name); my_free(2036, &name);
return err; return err;
} }

View File

@ -56,7 +56,7 @@ static int vhdl_netlist(FILE *fd , int vhdl_stop)
for(l=0;l<xctx->instances; ++l) for(l=0;l<xctx->instances; ++l)
{ {
if(skip_instance(l, 1, lvs_ignore)) continue; if(skip_instance(l, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); my_strdup(2037, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"attributes"))==0) if( type && (strcmp(type,"attributes"))==0)
{ {
if(xctx->inst[l].prop_ptr) fprintf(fd, "\n%s\n", xctx->inst[l].prop_ptr); 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 */ { /* dont print elements with vhdl_ignore=true set in symbol */
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
dbg(2, "vhdl_netlist(): into the netlisting loop\n"); dbg(2, "vhdl_netlist(): into the netlisting loop\n");
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2038, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && if( type &&
( !IS_LABEL_SH_OR_PIN(type) && ( !IS_LABEL_SH_OR_PIN(type) &&
strcmp(type,"generic")&& strcmp(type,"generic")&&
@ -95,7 +95,7 @@ static int vhdl_netlist(FILE *fd , int vhdl_stop)
} }
} }
} }
if(type) my_free(_ALLOC_ID_, &type); if(type) my_free(2039, &type);
dbg(1, "vhdl_netlist(): end\n"); dbg(1, "vhdl_netlist(): end\n");
if(!vhdl_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */ if(!vhdl_stop && !xctx->netlist_count) redraw_hilights(0); /* draw_hilight_net(1); */
return err; return err;
@ -155,7 +155,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2040, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"package"))==0) if( type && (strcmp(type,"package"))==0)
{ {
if(xctx->inst[i].prop_ptr) { /* */ if(xctx->inst[i].prop_ptr) { /* */
@ -170,7 +170,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2041, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"use"))==0) if( type && (strcmp(type,"use"))==0)
{ {
if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr); if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr);
@ -235,9 +235,9 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); my_strdup(2042, &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"); if(!sig_type || sig_type[0]=='\0') my_strdup(2043, &sig_type,"std_logic");
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2044, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"opin"))==0) if( type && (strcmp(type,"opin"))==0)
{ {
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
@ -252,9 +252,9 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); my_strdup(2045, &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"); if(!sig_type || sig_type[0]=='\0') my_strdup(2046, &sig_type,"std_logic");
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2047, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"iopin"))==0) if( type && (strcmp(type,"iopin"))==0)
{ {
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
@ -269,9 +269,9 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value(xctx->inst[i].prop_ptr,"sig_type",0)); my_strdup(2048, &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"); if(!sig_type || sig_type[0]=='\0') my_strdup(2049, &sig_type,"std_logic");
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2050, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"ipin"))==0) if( type && (strcmp(type,"ipin"))==0)
{ {
str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : ""; str_tmp = xctx->inst[i].lab ? xctx->inst[i].lab : "";
@ -287,7 +287,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) for(i=0;i<xctx->instances; ++i)
{ {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2051, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"port_attributes"))==0) if( type && (strcmp(type,"port_attributes"))==0)
{ {
if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr); if(xctx->inst[i].prop_ptr) fprintf(fd, "%s\n", xctx->inst[i].prop_ptr);
@ -310,7 +310,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
if(lvs_ignore && (xctx->sym[j].flags & LVS_IGNORE)) continue; if(lvs_ignore && (xctx->sym[j].flags & LVS_IGNORE)) continue;
if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 && if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 &&
strcmp(xctx->sym[j].type,"subcircuit")!=0)) continue; strcmp(xctx->sym[j].type,"subcircuit")!=0)) continue;
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[j].name), "")); my_strdup(2052, &abs_path, abs_sym_path(tcl_hook2(xctx->sym[j].name), ""));
if(( if((
strcmp(xctx->sym[j].type,"subcircuit")==0 || strcmp(xctx->sym[j].type,"subcircuit")==0 ||
strcmp(xctx->sym[j].type,"primitive")==0 strcmp(xctx->sym[j].type,"primitive")==0
@ -318,7 +318,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
) )
{ {
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[j].name, 0)); my_strdup(2053, &subckt_name, get_cell(xctx->sym[j].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) { if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) {
Int_hashtable table = {NULL, 0}; Int_hashtable table = {NULL, 0};
str_hash_lookup(&subckt_table, subckt_name, "", XINSERT); str_hash_lookup(&subckt_table, subckt_name, "", XINSERT);
@ -331,12 +331,12 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->sym[j].rects[PINLAYER]; ++i) for(i=0;i<xctx->sym[j].rects[PINLAYER]; ++i)
{ {
if(strboolcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) { if(strboolcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) {
my_strdup(_ALLOC_ID_, &sig_type, my_strdup(2054, &sig_type,
get_tok_value( xctx->sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0)); get_tok_value( xctx->sym[j].rect[PINLAYER][i].prop_ptr,"sig_type",0));
my_strdup(_ALLOC_ID_, &port_value, my_strdup(2055, &port_value,
get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"value", 0) ); get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"value", 0) );
if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); if(!sig_type || sig_type[0]=='\0') my_strdup(2056, &sig_type,"std_logic");
my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][i].prop_ptr,"dir",0) ); my_strdup(2057, &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); 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(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) {
if(!tmp) fprintf(fd, "port (\n"); if(!tmp) fprintf(fd, "port (\n");
@ -346,7 +346,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
fprintf(fd," := %s", port_value); fprintf(fd," := %s", port_value);
tmp=1; tmp=1;
} }
my_free(_ALLOC_ID_, &dir_tmp); my_free(2058, &dir_tmp);
} }
} }
int_hash_free(&table); int_hash_free(&table);
@ -354,11 +354,11 @@ int global_vhdl_netlist(int global) /* netlister driver */
fprintf(fd, "end component ;\n\n"); fprintf(fd, "end component ;\n\n");
} }
} }
my_free(_ALLOC_ID_, &abs_path); my_free(2059, &abs_path);
} }
get_additional_symbols(0); get_additional_symbols(0);
str_hash_free(&subckt_table); str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name); my_free(2060, &subckt_name);
dbg(1, "global_vhdl_netlist(): netlisting top level\n"); dbg(1, "global_vhdl_netlist(): netlisting top level\n");
err |= vhdl_netlist(fd, 0); err |= vhdl_netlist(fd, 0);
@ -366,7 +366,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
for(i=0;i<xctx->instances; ++i) { for(i=0;i<xctx->instances; ++i) {
if(skip_instance(i, 1, lvs_ignore)) continue; if(skip_instance(i, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[i].ptr+ xctx->sym)->type); my_strdup(2061, &type,(xctx->inst[i].ptr+ xctx->sym)->type);
if(type && !strcmp(type,"netlist_commands")) { if(type && !strcmp(type,"netlist_commands")) {
fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0)); fprintf(fd, "%s\n", get_tok_value(xctx->inst[i].prop_ptr,"value", 0));
} }
@ -394,7 +394,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
/* warning if two symbols perfectly overlapped */ /* warning if two symbols perfectly overlapped */
err |= warning_overlapped_symbols(0); err |= warning_overlapped_symbols(0);
/* preserve current level instance flags before descending hierarchy for netlisting, restore later */ /* preserve current level instance flags before descending hierarchy for netlisting, restore later */
stored_flags = my_calloc(_ALLOC_ID_, xctx->instances, sizeof(unsigned int)); stored_flags = my_calloc(2062, xctx->instances, sizeof(unsigned int));
for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color; for(i=0;i<xctx->instances; ++i) stored_flags[i] = xctx->inst[i].color;
if(global) if(global)
@ -410,8 +410,8 @@ int global_vhdl_netlist(int global) /* netlister driver */
/* reload data without popping undo stack, this populates embedded symbols if any */ /* reload data without popping undo stack, this populates embedded symbols if any */
xctx->pop_undo(2, 0); xctx->pop_undo(2, 0);
/* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */ /* link_symbols_to_instances(-1); */ /* done in xctx->pop_undo() */
my_strdup(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]); my_strdup(2063, &xctx->sch_path[xctx->currsch+1], xctx->sch_path[xctx->currsch]);
my_strcat(_ALLOC_ID_, &xctx->sch_path[xctx->currsch+1], "->netlisting"); my_strcat(2064, &xctx->sch_path[xctx->currsch+1], "->netlisting");
xctx->sch_path_hash[xctx->currsch+1] = 0; xctx->sch_path_hash[xctx->currsch+1] = 0;
xctx->currsch++; xctx->currsch++;
@ -423,7 +423,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
if(xctx->sym[i].flags & (VHDL_IGNORE | VHDL_SHORT)) continue; if(xctx->sym[i].flags & (VHDL_IGNORE | VHDL_SHORT)) continue;
if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue; if(lvs_ignore && (xctx->sym[i].flags & LVS_IGNORE)) continue;
if(!xctx->sym[i].type) continue; if(!xctx->sym[i].type) continue;
my_strdup(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); my_strdup(2065, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path)) if(strcmp(xctx->sym[i].type,"subcircuit")==0 && check_lib(1, abs_path))
{ {
if(!web_url) { if(!web_url) {
@ -431,7 +431,7 @@ int global_vhdl_netlist(int global) /* netlister driver */
my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname)); my_strncpy(xctx->current_dirname, tclresult(), S(xctx->current_dirname));
} }
/* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */ /* xctx->sym can be SCH or SYM, use hash to avoid writing duplicate subckt */
my_strdup(_ALLOC_ID_, &subckt_name, get_cell(xctx->sym[i].name, 0)); my_strdup(2066, &subckt_name, get_cell(xctx->sym[i].name, 0));
if (str_hash_lookup(&subckt_table, subckt_name, "", XLOOKUP)==NULL) 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 /* do not insert symbols with default_schematic attribute set to ignore in hash since these symbols
@ -447,12 +447,12 @@ int global_vhdl_netlist(int global) /* netlister driver */
} }
} }
} }
my_free(_ALLOC_ID_, &abs_path); my_free(2067, &abs_path);
/* can not free additional syms since *_block_netlist() may have loaded additional syms */ /* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */ /* get_additional_symbols(0); */
str_hash_free(&subckt_table); str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name); my_free(2068, &subckt_name);
my_free(_ALLOC_ID_, &xctx->sch[xctx->currsch]); my_free(2069, &xctx->sch[xctx->currsch]);
xctx->currsch--; xctx->currsch--;
unselect_all(1); unselect_all(1);
/* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */ /* symbol vs schematic pin check, we do it here since now we have ALL symbols loaded */
@ -469,14 +469,14 @@ int global_vhdl_netlist(int global) /* netlister driver */
my_strncpy(xctx->current_name, rel_sym_path(xctx->sch[xctx->currsch]), S(xctx->current_name)); 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 */ err |= prepare_netlist_structs(1); /* so 'lab=...' attributes for unnamed nets are set */
if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets; if(!xctx->hilight_nets) xctx->hilight_nets = saved_hilight_nets;
my_free(_ALLOC_ID_, &current_dirname_save); my_free(2070, &current_dirname_save);
} }
/* restore hilight flags from errors found analyzing top level before descending hierarchy */ /* restore hilight flags from errors found analyzing top level before descending hierarchy */
for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i]; for(i=0;i<xctx->instances; ++i) if(!xctx->inst[i].color) xctx->inst[i].color = stored_flags[i];
propagate_hilights(1, 0, XINSERT_NOREPLACE); propagate_hilights(1, 0, XINSERT_NOREPLACE);
draw_hilight_net(1); draw_hilight_net(1);
my_free(_ALLOC_ID_, &stored_flags); my_free(2071, &stored_flags);
dbg(1, "global_vhdl_netlist(): starting awk on netlist!\n"); dbg(1, "global_vhdl_netlist(): starting awk on netlist!\n");
if(!split_f) { if(!split_f) {
fclose(fd); fclose(fd);
@ -490,9 +490,9 @@ int global_vhdl_netlist(int global) /* netlister driver */
} }
if(!debug_var) xunlink(netl_filename); if(!debug_var) xunlink(netl_filename);
} }
my_free(_ALLOC_ID_, &sig_type); my_free(2072, &sig_type);
my_free(_ALLOC_ID_, &type); my_free(2073, &type);
my_free(_ALLOC_ID_, &port_value); my_free(2074, &port_value);
xctx->netlist_count = 0; xctx->netlist_count = 0;
tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */ tclvareval("show_infotext ", my_itoa(err), NULL); /* critical error: force ERC window showing */
exit_code = err ? 10 : 0; exit_code = err ? 10 : 0;
@ -581,12 +581,12 @@ int vhdl_block_netlist(FILE *fd, int i)
for(j=0;j<xctx->sym[i].rects[PINLAYER]; ++j) for(j=0;j<xctx->sym[i].rects[PINLAYER]; ++j)
{ {
if(strboolcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) { if(strboolcmp(get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"vhdl_ignore",0), "true")) {
my_strdup(_ALLOC_ID_, &sig_type, my_strdup(2075, &sig_type,
get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0)); get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"sig_type",0));
my_strdup(_ALLOC_ID_, &port_value, my_strdup(2076, &port_value,
get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) ); get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"value", 0) );
if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); if(!sig_type || sig_type[0]=='\0') my_strdup(2077, &sig_type,"std_logic");
my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[i].rect[PINLAYER][j].prop_ptr,"dir",0) ); my_strdup(2078, &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); 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(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) {
if(tmp) fprintf(fd, " ;\n"); if(tmp) fprintf(fd, " ;\n");
@ -597,7 +597,7 @@ int vhdl_block_netlist(FILE *fd, int i)
fprintf(fd," := %s", port_value); fprintf(fd," := %s", port_value);
tmp=1; tmp=1;
} }
my_free(_ALLOC_ID_, &dir_tmp); my_free(2079, &dir_tmp);
} }
} }
int_hash_free(&table); int_hash_free(&table);
@ -607,7 +607,7 @@ int vhdl_block_netlist(FILE *fd, int i)
for(l=0;l<xctx->instances; ++l) for(l=0;l<xctx->instances; ++l)
{ {
if(skip_instance(l, 1, lvs_ignore)) continue; if(skip_instance(l, 1, lvs_ignore)) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); my_strdup(2080, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
if( type && (strcmp(type,"port_attributes"))==0) if( type && (strcmp(type,"port_attributes"))==0)
{ {
if(xctx->inst[l].prop_ptr) fprintf(fd, "%s\n", xctx->inst[l].prop_ptr); if(xctx->inst[l].prop_ptr) fprintf(fd, "%s\n", xctx->inst[l].prop_ptr);
@ -636,7 +636,7 @@ int vhdl_block_netlist(FILE *fd, int i)
if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 && if(!xctx->sym[j].type || (strcmp(xctx->sym[j].type,"primitive")!=0 &&
strcmp(xctx->sym[j].type,"subcircuit")!=0)) strcmp(xctx->sym[j].type,"subcircuit")!=0))
continue; continue;
my_strdup2(_ALLOC_ID_, &abs_path, abs_sym_path(xctx->sym[i].name, "")); my_strdup2(2081, &abs_path, abs_sym_path(xctx->sym[i].name, ""));
if(( strcmp(xctx->sym[j].type,"subcircuit")==0 || strcmp(xctx->sym[j].type,"primitive")==0) && if(( strcmp(xctx->sym[j].type,"subcircuit")==0 || strcmp(xctx->sym[j].type,"primitive")==0) &&
check_lib(1, abs_path) check_lib(1, abs_path)
) { ) {
@ -660,19 +660,19 @@ int vhdl_block_netlist(FILE *fd, int i)
for(k=0;k<xctx->sym[j].rects[PINLAYER]; ++k) for(k=0;k<xctx->sym[j].rects[PINLAYER]; ++k)
{ {
if(strboolcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) { if(strboolcmp(get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"vhdl_ignore",0), "true")) {
my_strdup(_ALLOC_ID_, &sig_type,get_tok_value( my_strdup(2082, &sig_type,get_tok_value(
xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0)); xctx->sym[j].rect[PINLAYER][k].prop_ptr,"sig_type",0));
my_strdup(_ALLOC_ID_, &port_value, my_strdup(2083, &port_value,
get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value", 0) ); get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"value", 0) );
if(!sig_type || sig_type[0]=='\0') my_strdup(_ALLOC_ID_, &sig_type,"std_logic"); if(!sig_type || sig_type[0]=='\0') my_strdup(2084, &sig_type,"std_logic");
my_strdup(_ALLOC_ID_, &dir_tmp, get_tok_value(xctx->sym[j].rect[PINLAYER][k].prop_ptr,"dir",0) ); my_strdup(2085, &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); 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(!int_hash_lookup(&table, str_tmp, 1, XINSERT_NOREPLACE)) {
if(!tmp) fprintf(fd, "port (\n"); if(!tmp) fprintf(fd, "port (\n");
if(tmp) fprintf(fd, " ;\n"); if(tmp) fprintf(fd, " ;\n");
fprintf(fd," %s : %s %s",str_tmp, dir_tmp ? dir_tmp : "<NULL>", sig_type); fprintf(fd," %s : %s %s",str_tmp, dir_tmp ? dir_tmp : "<NULL>", sig_type);
my_free(_ALLOC_ID_, &dir_tmp); my_free(2086, &dir_tmp);
if(port_value &&port_value[0]) fprintf(fd," := %s", port_value); if(port_value &&port_value[0]) fprintf(fd," := %s", port_value);
tmp=1; tmp=1;
} }
@ -685,7 +685,7 @@ int vhdl_block_netlist(FILE *fd, int i)
} /* for(j...) */ } /* for(j...) */
get_additional_symbols(0); get_additional_symbols(0);
} /* if(!vhdl_stop) */ } /* if(!vhdl_stop) */
my_free(_ALLOC_ID_, &abs_path); my_free(2087, &abs_path);
dbg(1, "vhdl_block_netlist(): netlisting %s\n", get_cell( xctx->sch[xctx->currsch], 0)); dbg(1, "vhdl_block_netlist(): netlisting %s\n", get_cell( xctx->sch[xctx->currsch], 0));
err |= vhdl_netlist(fd, vhdl_stop); err |= vhdl_netlist(fd, vhdl_stop);
fprintf(fd,"//// begin user architecture code\n"); fprintf(fd,"//// begin user architecture code\n");
@ -695,7 +695,7 @@ int vhdl_block_netlist(FILE *fd, int i)
if(xctx->netlist_count && if(xctx->netlist_count &&
!strboolcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue; !strboolcmp(get_tok_value(xctx->inst[l].prop_ptr, "only_toplevel", 0), "true")) continue;
my_strdup(_ALLOC_ID_, &type,(xctx->inst[l].ptr+ xctx->sym)->type); my_strdup(2088, &type,(xctx->inst[l].ptr+ xctx->sym)->type);
if(type && !strcmp(type,"netlist_commands")) { if(type && !strcmp(type,"netlist_commands")) {
fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0)); fprintf(fd, "%s\n", get_tok_value(xctx->inst[l].prop_ptr,"value", 0));
} }
@ -703,9 +703,9 @@ int vhdl_block_netlist(FILE *fd, int i)
if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop); if(xctx->schvhdlprop && xctx->schvhdlprop[0]) fprintf(fd, "%s\n", xctx->schvhdlprop);
fprintf(fd, "end arch_%s ;\n\n", sanitize(get_cell(xctx->sym[i].name, 0)) ); fprintf(fd, "end arch_%s ;\n\n", sanitize(get_cell(xctx->sym[i].name, 0)) );
my_free(_ALLOC_ID_, &sig_type); my_free(2089, &sig_type);
my_free(_ALLOC_ID_, &port_value); my_free(2090, &port_value);
my_free(_ALLOC_ID_, &type); my_free(2091, &type);
} /* if(!sym_def[0]) */ } /* if(!sym_def[0]) */
if(split_f) { if(split_f) {
int save; int save;

View File

@ -321,7 +321,7 @@ static void init_color_array(double dim, double dim_bg)
if(g>0xff) g=0xff; if(g>0xff) g=0xff;
if(b>0xff) b=0xff; if(b>0xff) b=0xff;
my_snprintf(s, S(s), "#%02x%02x%02x", r, g, b); my_snprintf(s, S(s), "#%02x%02x%02x", r, g, b);
my_strdup(_ALLOC_ID_, &xctx->color_array[i], s); my_strdup(2092, &xctx->color_array[i], s);
} }
} }
@ -375,54 +375,54 @@ static void free_xschem_data()
xctx->delete_undo(); xctx->delete_undo();
free_simdata(); free_simdata();
my_free(_ALLOC_ID_, &xctx->node_table); my_free(2093, &xctx->node_table);
my_free(_ALLOC_ID_, &xctx->hilight_table); my_free(2094, &xctx->hilight_table);
my_free(_ALLOC_ID_, &xctx->wire); my_free(2095, &xctx->wire);
my_free(_ALLOC_ID_, &xctx->text); my_free(2096, &xctx->text);
my_free(_ALLOC_ID_, &xctx->inst); my_free(2097, &xctx->inst);
for(i=0;i<cadlayers; ++i) { for(i=0;i<cadlayers; ++i) {
my_free(_ALLOC_ID_, &xctx->rect[i]); my_free(2098, &xctx->rect[i]);
my_free(_ALLOC_ID_, &xctx->line[i]); my_free(2099, &xctx->line[i]);
my_free(_ALLOC_ID_, &xctx->poly[i]); my_free(2100, &xctx->poly[i]);
my_free(_ALLOC_ID_, &xctx->arc[i]); my_free(2101, &xctx->arc[i]);
} }
my_free(_ALLOC_ID_, &xctx->sym); my_free(2102, &xctx->sym);
my_free(_ALLOC_ID_, &xctx->rect); my_free(2103, &xctx->rect);
my_free(_ALLOC_ID_, &xctx->line); my_free(2104, &xctx->line);
my_free(_ALLOC_ID_, &xctx->poly); my_free(2105, &xctx->poly);
my_free(_ALLOC_ID_, &xctx->arc); my_free(2106, &xctx->arc);
my_free(_ALLOC_ID_, &xctx->rects); my_free(2107, &xctx->rects);
my_free(_ALLOC_ID_, &xctx->polygons); my_free(2108, &xctx->polygons);
my_free(_ALLOC_ID_, &xctx->arcs); my_free(2109, &xctx->arcs);
my_free(_ALLOC_ID_, &xctx->lines); my_free(2110, &xctx->lines);
my_free(_ALLOC_ID_, &xctx->maxr); my_free(2111, &xctx->maxr);
my_free(_ALLOC_ID_, &xctx->maxp); my_free(2112, &xctx->maxp);
my_free(_ALLOC_ID_, &xctx->maxa); my_free(2113, &xctx->maxa);
my_free(_ALLOC_ID_, &xctx->maxl); my_free(2114, &xctx->maxl);
my_free(_ALLOC_ID_, &xctx->sel_array); my_free(2115, &xctx->sel_array);
for(i=0;i<CADMAXHIER; ++i) { for(i=0;i<CADMAXHIER; ++i) {
if(xctx->portmap[i].table) str_hash_free(&xctx->portmap[i]); if(xctx->portmap[i].table) str_hash_free(&xctx->portmap[i]);
if(xctx->sch[i]) my_free(_ALLOC_ID_, &xctx->sch[i]); if(xctx->sch[i]) my_free(2116, &xctx->sch[i]);
if(xctx->sch_path[i]) my_free(_ALLOC_ID_, &xctx->sch_path[i]); if(xctx->sch_path[i]) my_free(2117, &xctx->sch_path[i]);
if(xctx->hier_attr[i].templ) my_free(_ALLOC_ID_, &xctx->hier_attr[i].templ); if(xctx->hier_attr[i].templ) my_free(2118, &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].prop_ptr) my_free(2119, &xctx->hier_attr[i].prop_ptr);
if(xctx->hier_attr[i].symname) my_free(_ALLOC_ID_, &xctx->hier_attr[i].symname); if(xctx->hier_attr[i].symname) my_free(2120, &xctx->hier_attr[i].symname);
} }
my_free(_ALLOC_ID_, &xctx->gridpoint); my_free(2121, &xctx->gridpoint);
my_free(_ALLOC_ID_, &xctx->biggridpoint); my_free(2122, &xctx->biggridpoint);
my_free(_ALLOC_ID_, &xctx->gc); my_free(2123, &xctx->gc);
my_free(_ALLOC_ID_, &xctx->gcstipple); my_free(2124, &xctx->gcstipple);
for(i=0;i<cadlayers; ++i) my_free(_ALLOC_ID_, &xctx->color_array[i]); for(i=0;i<cadlayers; ++i) my_free(2125, &xctx->color_array[i]);
my_free(_ALLOC_ID_, &xctx->color_array); my_free(2126, &xctx->color_array);
my_free(_ALLOC_ID_, &xctx->enable_layer); my_free(2127, &xctx->enable_layer);
my_free(_ALLOC_ID_, &xctx->active_layer); my_free(2128, &xctx->active_layer);
my_free(_ALLOC_ID_, &xctx->top_path); my_free(2129, &xctx->top_path);
my_free(_ALLOC_ID_, &xctx->current_win_path); my_free(2130, &xctx->current_win_path);
my_free(_ALLOC_ID_, &xctx->fill_type); my_free(2131, &xctx->fill_type);
my_free(_ALLOC_ID_, &xctx->format); my_free(2132, &xctx->format);
my_free(_ALLOC_ID_, &xctx); my_free(2133, &xctx);
} }
void create_gc(void) void create_gc(void)
@ -452,7 +452,7 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
{ {
int i, j; int i, j;
xctx = my_calloc(_ALLOC_ID_, 1, sizeof(Xschem_ctx)); xctx = my_calloc(2134, 1, sizeof(Xschem_ctx));
xctx->cur_undo_ptr = 0; xctx->cur_undo_ptr = 0;
xctx->head_undo_ptr = 0; xctx->head_undo_ptr = 0;
xctx->tail_undo_ptr = 0; xctx->tail_undo_ptr = 0;
@ -539,12 +539,12 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
} }
} }
xctx->n_hash_objects = 0; xctx->n_hash_objects = 0;
xctx->node_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Node_hashentry *)); xctx->node_table = my_calloc(2135, HASHSIZE, sizeof(Node_hashentry *));
xctx->inst_name_table.table = NULL; xctx->inst_name_table.table = NULL;
xctx->inst_name_table.size = 0; xctx->inst_name_table.size = 0;
xctx->floater_inst_table.table = NULL; xctx->floater_inst_table.table = NULL;
xctx->floater_inst_table.size = 0; xctx->floater_inst_table.size = 0;
xctx->hilight_table = my_calloc(_ALLOC_ID_, HASHSIZE, sizeof(Hilight_hashentry *)); xctx->hilight_table = my_calloc(2136, HASHSIZE, sizeof(Hilight_hashentry *));
xctx->window = xctx->save_pixmap = 0; xctx->window = xctx->save_pixmap = 0;
xctx->xrect[0].width = xctx->xrect[0].height = xctx->xrect[0].x = xctx->xrect[0].y = 0; xctx->xrect[0].width = xctx->xrect[0].height = xctx->xrect[0].x = xctx->xrect[0].y = 0;
@ -598,21 +598,21 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->portmap[i].table = NULL; xctx->portmap[i].table = NULL;
xctx->portmap[i].size = 0; xctx->portmap[i].size = 0;
} }
my_strdup(_ALLOC_ID_, &xctx->sch_path[0],"."); my_strdup(2137, &xctx->sch_path[0],".");
xctx->sch_inst_number[0] = 1; xctx->sch_inst_number[0] = 1;
xctx->maxt=CADMAXTEXT; xctx->maxt=CADMAXTEXT;
xctx->maxw=CADMAXWIRES; xctx->maxw=CADMAXWIRES;
xctx->maxi=ELEMINST; xctx->maxi=ELEMINST;
xctx->maxs=ELEMDEF; xctx->maxs=ELEMDEF;
xctx->text=my_calloc(_ALLOC_ID_, xctx->maxt,sizeof(xText)); xctx->text=my_calloc(2138, xctx->maxt,sizeof(xText));
xctx->wire=my_calloc(_ALLOC_ID_, xctx->maxw,sizeof(xWire)); xctx->wire=my_calloc(2139, xctx->maxw,sizeof(xWire));
xctx->inst=my_calloc(_ALLOC_ID_, xctx->maxi , sizeof(xInstance) ); xctx->inst=my_calloc(2140, xctx->maxi , sizeof(xInstance) );
xctx->sym=my_calloc(_ALLOC_ID_, xctx->maxs , sizeof(xSymbol) ); xctx->sym=my_calloc(2141, xctx->maxs , sizeof(xSymbol) );
xctx->maxr=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->maxr=my_calloc(2142, cadlayers, sizeof(int));
xctx->maxa=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->maxa=my_calloc(2143, cadlayers, sizeof(int));
xctx->maxp=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->maxp=my_calloc(2144, cadlayers, sizeof(int));
xctx->maxl=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->maxl=my_calloc(2145, cadlayers, sizeof(int));
for(i=0;i<cadlayers; ++i) for(i=0;i<cadlayers; ++i)
{ {
xctx->maxr[i]=CADMAXOBJECTS; xctx->maxr[i]=CADMAXOBJECTS;
@ -620,28 +620,28 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->maxl[i]=CADMAXOBJECTS; xctx->maxl[i]=CADMAXOBJECTS;
xctx->maxa[i]=CADMAXOBJECTS; xctx->maxa[i]=CADMAXOBJECTS;
} }
xctx->rect=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xRect *)); xctx->rect=my_calloc(2146, cadlayers, sizeof(xRect *));
xctx->line=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xLine *)); xctx->line=my_calloc(2147, cadlayers, sizeof(xLine *));
xctx->poly=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xPoly *)); xctx->poly=my_calloc(2148, cadlayers, sizeof(xPoly *));
xctx->arc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(xArc *)); xctx->arc=my_calloc(2149, cadlayers, sizeof(xArc *));
for(i=0;i<cadlayers; ++i) for(i=0;i<cadlayers; ++i)
{ {
xctx->rect[i]=my_calloc(_ALLOC_ID_, xctx->maxr[i],sizeof(xRect)); xctx->rect[i]=my_calloc(2150, xctx->maxr[i],sizeof(xRect));
xctx->arc[i]=my_calloc(_ALLOC_ID_, xctx->maxa[i],sizeof(xArc)); xctx->arc[i]=my_calloc(2151, xctx->maxa[i],sizeof(xArc));
xctx->poly[i]=my_calloc(_ALLOC_ID_, xctx->maxp[i],sizeof(xPoly)); xctx->poly[i]=my_calloc(2152, xctx->maxp[i],sizeof(xPoly));
xctx->line[i]=my_calloc(_ALLOC_ID_, xctx->maxl[i],sizeof(xLine)); xctx->line[i]=my_calloc(2153, xctx->maxl[i],sizeof(xLine));
} }
xctx->rects=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->rects=my_calloc(2154, cadlayers, sizeof(int));
xctx->polygons=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->polygons=my_calloc(2155, cadlayers, sizeof(int));
xctx->arcs=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->arcs=my_calloc(2156, cadlayers, sizeof(int));
xctx->lines=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->lines=my_calloc(2157, cadlayers, sizeof(int));
xctx->maxsel=MAXGROUP; xctx->maxsel=MAXGROUP;
xctx->sel_array=my_calloc(_ALLOC_ID_, xctx->maxsel, sizeof(Selected)); xctx->sel_array=my_calloc(2158, xctx->maxsel, sizeof(Selected));
xctx->first_sel.n = -1; xctx->first_sel.n = -1;
xctx->first_sel.type = 0; xctx->first_sel.type = 0;
xctx->first_sel.col = 0; xctx->first_sel.col = 0;
xctx->biggridpoint=(XSegment*)my_calloc(_ALLOC_ID_, CADMAXGRIDPOINTS,sizeof(XSegment)); xctx->biggridpoint=(XSegment*)my_calloc(2159, CADMAXGRIDPOINTS,sizeof(XSegment));
xctx->gridpoint=(XPoint*)my_calloc(_ALLOC_ID_, CADMAXGRIDPOINTS,sizeof(XPoint)); xctx->gridpoint=(XPoint*)my_calloc(2160, CADMAXGRIDPOINTS,sizeof(XPoint));
xctx->enable_drill = 0; xctx->enable_drill = 0;
xctx->prev_set_modify = -1; xctx->prev_set_modify = -1;
xctx->prev_crossx = xctx->prev_crossy = 0.0; xctx->prev_crossx = xctx->prev_crossy = 0.0;
@ -669,22 +669,22 @@ static void alloc_xschem_data(const char *top_path, const char *win_path)
xctx->edit_sym_i = -1; xctx->edit_sym_i = -1;
xctx->netlist_commands = 0; xctx->netlist_commands = 0;
xctx->draw_pixmap = 1; xctx->draw_pixmap = 1;
xctx->gc=my_calloc(_ALLOC_ID_, cadlayers, sizeof(GC)); xctx->gc=my_calloc(2161, cadlayers, sizeof(GC));
xctx->gcstipple=my_calloc(_ALLOC_ID_, cadlayers, sizeof(GC)); xctx->gcstipple=my_calloc(2162, cadlayers, sizeof(GC));
xctx->color_array=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*)); xctx->color_array=my_calloc(2163, cadlayers, sizeof(char*));
xctx->enable_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->enable_layer=my_calloc(2164, cadlayers, sizeof(int));
xctx->crosshair_layer = TEXTLAYER; xctx->crosshair_layer = TEXTLAYER;
xctx->n_active_layers = 0; xctx->n_active_layers = 0;
xctx->active_layer=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->active_layer=my_calloc(2165, cadlayers, sizeof(int));
xctx->hide_symbols = 0; xctx->hide_symbols = 0;
xctx->netlist_type = CAD_SPICE_NETLIST; xctx->netlist_type = CAD_SPICE_NETLIST;
xctx->format = NULL; /* custom format string for netlist, otherwise use xctx->format = NULL; /* custom format string for netlist, otherwise use
* "format", "verilog_format", "vhdl_format", "tedax_format" */ * "format", "verilog_format", "vhdl_format", "tedax_format" */
xctx->top_path = NULL; xctx->top_path = NULL;
xctx->current_win_path = NULL; xctx->current_win_path = NULL;
my_strdup2(_ALLOC_ID_, &xctx->top_path, top_path); my_strdup2(2166, &xctx->top_path, top_path);
my_strdup2(_ALLOC_ID_, &xctx->current_win_path, win_path); my_strdup2(2167, &xctx->current_win_path, win_path);
xctx->fill_type=my_calloc(_ALLOC_ID_, cadlayers, sizeof(int)); xctx->fill_type=my_calloc(2168, cadlayers, sizeof(int));
xctx->case_insensitive = 0; xctx->case_insensitive = 0;
xctx->show_hidden_texts = 0; xctx->show_hidden_texts = 0;
xctx->x_strcmp = strcmp; xctx->x_strcmp = strcmp;
@ -755,7 +755,7 @@ int compare_schematics(const char *f)
/* HASH SCHEMATIC 1 */ /* HASH SCHEMATIC 1 */
for(i = 0; i < xctx->instances; ++i) { for(i = 0; i < xctx->instances; ++i) {
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
my_realloc(_ALLOC_ID_, &s, l); my_realloc(2169, &s, l);
my_snprintf(s, l, "C %s %g %g %d %d %s", tcl_hook2(xctx->inst[i].name), 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].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip,
xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
@ -764,7 +764,7 @@ int compare_schematics(const char *f)
for(i=0;i<xctx->wires; ++i) for(i=0;i<xctx->wires; ++i)
{ {
l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
my_realloc(_ALLOC_ID_, &s, l); my_realloc(2170, &s, l);
my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, 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); xctx->wire[i].x2, xctx->wire[i].y2);
int_hash_lookup(&table1, s, i, XINSERT_NOREPLACE); int_hash_lookup(&table1, s, i, XINSERT_NOREPLACE);
@ -817,7 +817,7 @@ int compare_schematics(const char *f)
/* HASH SCHEMATIC 2 , CHECK SCHEMATIC 2 WITH SCHEMATIC 1 */ /* HASH SCHEMATIC 2 , CHECK SCHEMATIC 2 WITH SCHEMATIC 1 */
for(i = 0; i < xctx->instances; ++i) { for(i = 0; i < xctx->instances; ++i) {
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
my_realloc(_ALLOC_ID_, &s, l); my_realloc(2171, &s, l);
my_snprintf(s, l, "C %s %g %g %d %d %s", tcl_hook2(xctx->inst[i].name), 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].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip,
xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
@ -835,7 +835,7 @@ int compare_schematics(const char *f)
for(i=0;i<xctx->wires; ++i) for(i=0;i<xctx->wires; ++i)
{ {
l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); l =1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
my_realloc(_ALLOC_ID_, &s, l); my_realloc(2172, &s, l);
my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, 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); xctx->wire[i].x2, xctx->wire[i].y2);
int_hash_lookup(&table2, s, i, XINSERT_NOREPLACE); int_hash_lookup(&table2, s, i, XINSERT_NOREPLACE);
@ -865,7 +865,7 @@ int compare_schematics(const char *f)
/* CHECK SCHEMATIC 1 WITH SCHEMATIC 2*/ /* CHECK SCHEMATIC 1 WITH SCHEMATIC 2*/
for(i = 0; i < xctx->instances; ++i) { for(i = 0; i < xctx->instances; ++i) {
l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); l = 1024 + strlen(xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
my_realloc(_ALLOC_ID_,&s, l); my_realloc(2173,&s, l);
my_snprintf(s, l, "C %s %g %g %d %d %s", tcl_hook2(xctx->inst[i].name), 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].x0, xctx->inst[i].y0, xctx->inst[i].rot, xctx->inst[i].flip,
xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : ""); xctx->inst[i].prop_ptr ? xctx->inst[i].prop_ptr : "");
@ -880,7 +880,7 @@ int compare_schematics(const char *f)
for(i=0;i<xctx->wires; ++i) for(i=0;i<xctx->wires; ++i)
{ {
l = 1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : ""); l = 1024 + strlen(xctx->wire[i].prop_ptr ? xctx->wire[i].prop_ptr : "");
my_realloc(_ALLOC_ID_, &s, l); my_realloc(2174, &s, l);
my_snprintf(s, l, "N %g %g %g %g", xctx->wire[i].x1, xctx->wire[i].y1, 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); xctx->wire[i].x2, xctx->wire[i].y2);
found = int_hash_lookup(&table2, s, i, XLOOKUP); found = int_hash_lookup(&table2, s, i, XLOOKUP);
@ -894,7 +894,7 @@ int compare_schematics(const char *f)
int_hash_free(&table2); int_hash_free(&table2);
rebuild_selected_array(); rebuild_selected_array();
draw_selection(xctx->gc[SELLAYER], 0); draw_selection(xctx->gc[SELLAYER], 0);
my_free(_ALLOC_ID_, &s); my_free(2175, &s);
return ret; return ret;
} }
@ -907,7 +907,7 @@ static void xwin_exit(void)
dbg(0, "xwin_exit() double call, doing nothing...\n"); dbg(0, "xwin_exit() double call, doing nothing...\n");
return; return;
} }
if(xctx->infowindow_text) my_free(_ALLOC_ID_, &xctx->infowindow_text); if(xctx->infowindow_text) my_free(2176, &xctx->infowindow_text);
if(has_x) new_schematic("destroy_all", "1", NULL, 1); if(has_x) new_schematic("destroy_all", "1", NULL, 1);
drawbezier(xctx->window, xctx->gc[0], 0, NULL, NULL, 0, 0); drawbezier(xctx->window, xctx->gc[0], 0, NULL, NULL, 0, 0);
delete_schematic_data(1); delete_schematic_data(1);
@ -926,18 +926,18 @@ static void xwin_exit(void)
#else #else
for(i = 0; i < cadlayers; ++i) Tk_FreePixmap(display, pixmap[i]); for(i = 0; i < cadlayers; ++i) Tk_FreePixmap(display, pixmap[i]);
#endif #endif
my_free(_ALLOC_ID_, &pixmap); my_free(2177, &pixmap);
} }
dbg(1, "xwin_exit(): clearing drawing data structures\n"); dbg(1, "xwin_exit(): clearing drawing data structures\n");
/* global context - graphic preferences/settings */ /* global context - graphic preferences/settings */
for(i=0;i<cadlayers; ++i) { for(i=0;i<cadlayers; ++i) {
my_free(_ALLOC_ID_, &pixdata[i]); my_free(2178, &pixdata[i]);
} }
my_free(_ALLOC_ID_, &pixdata); my_free(2179, &pixdata);
my_free(_ALLOC_ID_, &cli_opt_tcl_command); my_free(2180, &cli_opt_tcl_command);
my_free(_ALLOC_ID_, &cli_opt_preinit_command); my_free(2181, &cli_opt_preinit_command);
my_free(_ALLOC_ID_, &cli_opt_tcl_post_command); my_free(2182, &cli_opt_tcl_post_command);
clear_expandlabel_data(); clear_expandlabel_data();
get_sym_template(NULL, NULL); /* clear static data in function */ get_sym_template(NULL, NULL); /* clear static data in function */
list_tokens(NULL, 0); /* clear static data in function */ list_tokens(NULL, 0); /* clear static data in function */
@ -950,16 +950,16 @@ static void xwin_exit(void)
tcl_hook2(NULL); /* clear static data in function */ tcl_hook2(NULL); /* clear static data in function */
save_ascii_string(NULL, NULL, 0); /* clear static data in function */ save_ascii_string(NULL, NULL, 0); /* clear static data in function */
dbg(1, "xwin_exit(): removing font\n"); dbg(1, "xwin_exit(): removing font\n");
for(i=0;i<127; ++i) my_free(_ALLOC_ID_, &character[i]); for(i=0;i<127; ++i) my_free(2183, &character[i]);
dbg(1, "xwin_exit(): closed display\n"); dbg(1, "xwin_exit(): closed display\n");
my_strncpy(cli_opt_filename, "", S(cli_opt_filename)); my_strncpy(cli_opt_filename, "", S(cli_opt_filename));
my_free(_ALLOC_ID_, &xschem_executable); my_free(2184, &xschem_executable);
dbg(1, "xwin_exit(): deleted undo buffer\n"); dbg(1, "xwin_exit(): deleted undo buffer\n");
/* delete cmdline stuff */ /* delete cmdline stuff */
for(i = 0 ; i < cli_opt_argc; ++i) { for(i = 0 ; i < cli_opt_argc; ++i) {
my_free(_ALLOC_ID_, &cli_opt_argv[i]); my_free(2185, &cli_opt_argv[i]);
} }
my_free(_ALLOC_ID_, &cli_opt_argv); my_free(2186, &cli_opt_argv);
if(xschem_web_dirname[0]) tclvareval("file delete -force ", xschem_web_dirname, NULL); if(xschem_web_dirname[0]) tclvareval("file delete -force ", xschem_web_dirname, NULL);
if(errfp!=stderr) fclose(errfp); if(errfp!=stderr) fclose(errfp);
errfp=stderr; errfp=stderr;
@ -1232,7 +1232,7 @@ int preview_window(const char *what, const char *win_path, const char *fname)
if(current_file[i]) { if(current_file[i]) {
delete_schematic_data(1); delete_schematic_data(1);
} }
my_strdup(_ALLOC_ID_, &current_file[i], fname); my_strdup(2187, &current_file[i], fname);
xctx = NULL; /* reset for preview */ xctx = NULL; /* reset for preview */
alloc_xschem_data(save_xctx->top_path, save_xctx->current_win_path); /* alloc data into xctx */ alloc_xschem_data(save_xctx->top_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 */ init_pixdata(); /* populate xctx->fill_type array that is used in create_gc() to set fill styles */
@ -1267,7 +1267,7 @@ int preview_window(const char *what, const char *win_path, const char *fname)
delete_schematic_data(1); delete_schematic_data(1);
preview_xctx[i] = NULL; preview_xctx[i] = NULL;
} }
my_free(_ALLOC_ID_, &current_file[i]); my_free(2188, &current_file[i]);
xctx = save_xctx; /* restore schematic */ xctx = save_xctx; /* restore schematic */
save_xctx = NULL; save_xctx = NULL;
set_modify(-1); set_modify(-1);
@ -1804,14 +1804,14 @@ static void destroy_window(int *window_count, const char *win_path)
if(savectx == xctx) savectx = save_xctx[0]; if(savectx == xctx) savectx = save_xctx[0];
if(has_x) { if(has_x) {
tclvareval("winfo toplevel ", win_path, NULL); tclvareval("winfo toplevel ", win_path, NULL);
my_strdup2(_ALLOC_ID_, &toplevel, tclresult()); my_strdup2(2189, &toplevel, tclresult());
} }
delete_schematic_data(1); delete_schematic_data(1);
save_xctx[n] = NULL; save_xctx[n] = NULL;
if(has_x) { if(has_x) {
Tk_DestroyWindow(Tk_NameToWindow(interp, window_path[n], mainwindow)); Tk_DestroyWindow(Tk_NameToWindow(interp, window_path[n], mainwindow));
tclvareval("destroy ", toplevel, NULL); tclvareval("destroy ", toplevel, NULL);
my_free(_ALLOC_ID_, &toplevel); my_free(2190, &toplevel);
} }
my_strncpy(window_path[n], "", S(window_path[n])); my_strncpy(window_path[n], "", S(window_path[n]));
(*window_count)--; (*window_count)--;
@ -1920,7 +1920,7 @@ static void destroy_all_windows(int *window_count, int force)
char *toplevel = NULL; char *toplevel = NULL;
if(has_x) { if(has_x) {
tclvareval("winfo toplevel ", window_path[i], NULL); tclvareval("winfo toplevel ", window_path[i], NULL);
my_strdup2(_ALLOC_ID_, &toplevel, tclresult()); my_strdup2(2191, &toplevel, tclresult());
} }
delete_schematic_data(1); delete_schematic_data(1);
/* set saved ctx to main window if previous is about to be destroyed */ /* set saved ctx to main window if previous is about to be destroyed */
@ -1929,7 +1929,7 @@ static void destroy_all_windows(int *window_count, int force)
if(has_x) { if(has_x) {
Tk_DestroyWindow(Tk_NameToWindow(interp, window_path[i], mainwindow)); Tk_DestroyWindow(Tk_NameToWindow(interp, window_path[i], mainwindow));
tclvareval("destroy ", toplevel, NULL); tclvareval("destroy ", toplevel, NULL);
my_free(_ALLOC_ID_, &toplevel); my_free(2192, &toplevel);
} }
/* delete Tcl context of deleted schematic window */ /* delete Tcl context of deleted schematic window */
tclvareval("delete_ctx ", window_path[i], NULL); tclvareval("delete_ctx ", window_path[i], NULL);
@ -2402,22 +2402,22 @@ int Tcl_AppInit(Tcl_Interp *inter)
if (atoi(tclresult()) == 0) if (atoi(tclresult()) == 0)
{ {
running_in_src_dir = 1; /* no bin, so it's running in Visual studio source directory*/ running_in_src_dir = 1; /* no bin, so it's running in Visual studio source directory*/
my_strdup(_ALLOC_ID_, &up_hier, "../../.."); my_strdup(2193, &up_hier, "../../..");
} }
else my_strdup(_ALLOC_ID_, &up_hier, ".."); else my_strdup(2194, &up_hier, "..");
/* my_strcat(_ALLOC_ID_, &win_xschem_library_path, "."); */ /* my_strcat(2195, &win_xschem_library_path, "."); */
for (i = 0; i < WIN_XSCHEM_LIBRARY_PATH_NUM; ++i) { for (i = 0; i < WIN_XSCHEM_LIBRARY_PATH_NUM; ++i) {
my_snprintf(tmp, S(tmp),"%s/%s/%s", install_dir, up_hier, WIN_XSCHEM_LIBRARY_PATH[i]); my_snprintf(tmp, S(tmp),"%s/%s/%s", install_dir, up_hier, WIN_XSCHEM_LIBRARY_PATH[i]);
if (i > 0) my_strcat(_ALLOC_ID_, &win_xschem_library_path, "\;"); if (i > 0) my_strcat(2196, &win_xschem_library_path, "\;");
my_strcat(_ALLOC_ID_, &win_xschem_library_path, tmp); my_strcat(2197, &win_xschem_library_path, tmp);
} }
my_snprintf(tmp, S(tmp), "set tmp2 {%s}; " my_snprintf(tmp, S(tmp), "set tmp2 {%s}; "
"while {[regsub {([^/]*\\.*[^./]+[^/]*)/\\.\\./?} $tmp2 {} tmp2]} {}; ", win_xschem_library_path); "while {[regsub {([^/]*\\.*[^./]+[^/]*)/\\.\\./?} $tmp2 {} tmp2]} {}; ", win_xschem_library_path);
const char *result2 = tcleval(tmp); const char *result2 = tcleval(tmp);
const char *win_xschem_library_path_clean = tclgetvar("tmp2"); const char *win_xschem_library_path_clean = tclgetvar("tmp2");
tclsetvar("XSCHEM_LIBRARY_PATH", win_xschem_library_path_clean); tclsetvar("XSCHEM_LIBRARY_PATH", win_xschem_library_path_clean);
my_free(_ALLOC_ID_, &win_xschem_library_path); my_free(2198, &win_xschem_library_path);
my_free(_ALLOC_ID_, &up_hier); my_free(2199, &up_hier);
char *xschem_sharedir=NULL; char *xschem_sharedir=NULL;
if ((xschem_sharedir=getenv("XSCHEM_SHAREDIR")) != NULL) { if ((xschem_sharedir=getenv("XSCHEM_SHAREDIR")) != NULL) {
if (!stat(xschem_sharedir, &buf)) { if (!stat(xschem_sharedir, &buf)) {
@ -2616,7 +2616,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
/* */ /* */
/* resolve absolute pathname of xschem (argv[0]) for future usage */ /* resolve absolute pathname of xschem (argv[0]) for future usage */
my_strdup(_ALLOC_ID_, &xschem_executable, get_file_path(xschem_executable)); my_strdup(2200, &xschem_executable, get_file_path(xschem_executable));
dbg(1, "Tcl_AppInit(): resolved xschem_executable=%s\n", xschem_executable); dbg(1, "Tcl_AppInit(): resolved xschem_executable=%s\n", xschem_executable);
/* get xschem globals from tcl variables set in xschemrc/xschem.tcl */ /* get xschem globals from tcl variables set in xschemrc/xschem.tcl */
@ -2654,19 +2654,19 @@ int Tcl_AppInit(Tcl_Interp *inter)
} }
/* initialize current schematic name to empty string to avoid gazillion checks in the code for NULL */ /* initialize current schematic name to empty string to avoid gazillion checks in the code for NULL */
my_strdup2(_ALLOC_ID_, &xctx->sch[xctx->currsch], ""); my_strdup2(2201, &xctx->sch[xctx->currsch], "");
xctx->crosshair_layer = tclgetintvar("crosshair_layer"); xctx->crosshair_layer = tclgetintvar("crosshair_layer");
if(xctx->crosshair_layer < 0 ) xctx->crosshair_layer = 2; if(xctx->crosshair_layer < 0 ) xctx->crosshair_layer = 2;
if(xctx->crosshair_layer >= cadlayers ) xctx->crosshair_layer = 2; if(xctx->crosshair_layer >= cadlayers ) xctx->crosshair_layer = 2;
/* global context / graphic preferences/settings */ /* global context / graphic preferences/settings */
pixdata=my_calloc(_ALLOC_ID_, cadlayers, sizeof(char*)); pixdata=my_calloc(2202, cadlayers, sizeof(char*));
for(i=0;i<cadlayers; ++i) for(i=0;i<cadlayers; ++i)
{ {
pixdata[i]=my_calloc(_ALLOC_ID_, 32, sizeof(char)); pixdata[i]=my_calloc(2203, 32, sizeof(char));
} }
if(has_x) pixmap=my_calloc(_ALLOC_ID_, cadlayers, sizeof(Pixmap)); if(has_x) pixmap=my_calloc(2204, cadlayers, sizeof(Pixmap));
my_strncpy(xctx->plotfile, cli_opt_plotfile, S(xctx->plotfile)); my_strncpy(xctx->plotfile, cli_opt_plotfile, S(xctx->plotfile));
xctx->draw_window = tclgetintvar("draw_window"); xctx->draw_window = tclgetintvar("draw_window");
@ -3017,7 +3017,9 @@ int Tcl_AppInit(Tcl_Interp *inter)
tcleval("eval_postinit_commands"); tcleval("eval_postinit_commands");
if(cli_opt_quit) { if(cli_opt_quit) {
tclvareval("exit ", my_itoa(exit_code), NULL); char s[40];
my_snprintf(s, S(s), "exit %d", exit_code);
tcleval(s);
} }

View File

@ -415,7 +415,7 @@ do { \
register size_t __str_alloc_tmp__ = add; \ register size_t __str_alloc_tmp__ = add; \
if( __str_alloc_tmp__ >= *size) { \ if( __str_alloc_tmp__ >= *size) { \
*size = __str_alloc_tmp__ + CADCHUNKALLOC; \ *size = __str_alloc_tmp__ + CADCHUNKALLOC; \
my_realloc(_ALLOC_ID_, dest_string, *size); \ my_realloc(2205, dest_string, *size); \
} \ } \
} while(0) } while(0)