fold long lines

This commit is contained in:
Stefan Schippers 2020-11-17 01:29:47 +01:00
parent 1634414b11
commit 7a67663330
8 changed files with 53 additions and 50 deletions

View File

@ -197,11 +197,13 @@ void trim_wires(void)
xctx->wire[j].x1 = x0;
xctx->wire[j].y1 = y0;
hash_wire(XINSERT, xctx->wires, 0);
i--; /* redo current i iteration, since we break the 'j' loop due to changed wire hash table */
hash_wire(XDELETE, j, 0); /* rehash since endpoint x1, y1 changed */
hash_wire(XINSERT, j, 0);
xctx->wires++;
changed = 1;
i--; /* redo current i iteration, since we break the 'j' loop due to changed wire hash table */
break;
}
}

View File

@ -696,8 +696,10 @@ void drill_hilight(void)
propagate_str=get_tok_value(rct[j].prop_ptr, "propagate_to", 0);
if(propagate_str[0] && (entry=bus_hilight_lookup(netname, 0, XLOOKUP))) {
propagate = atoi(propagate_str);
my_strdup(144, &propagated_net, net_name(i, propagate, &mult, 1, 1)); /* get net to propagate hilight to...*/
propag_entry = bus_hilight_lookup(propagated_net, entry->value, XINSERT); /* add net to highlight list */
/* get net to propagate hilight to...*/
my_strdup(144, &propagated_net, net_name(i, propagate, &mult, 1, 1));
/* add net to highlight list */
propag_entry = bus_hilight_lookup(propagated_net, entry->value, XINSERT);
if(!propag_entry) {
found=1; /* keep looping until no more nets are found. */
}
@ -955,8 +957,9 @@ void select_hilight_net(void)
for(i=0;i<xctx->instances;i++) {
type = (xctx->inst[i].ptr+ xctx->sym)->type;
hilight_connected_inst = !strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true") ||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true");
hilight_connected_inst =
!strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true") ||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true");
if( xctx->inst[i].flags & 4) {
dbg(1, "draw_hilight_net(): instance %d flags &4 true\n", i);
xctx->inst[i].sel = SELECTED;
@ -1063,8 +1066,9 @@ void draw_hilight_net(int on_window)
type = (xctx->inst[i].ptr+ xctx->sym)->type;
hilight_connected_inst = !strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true") ||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true");
hilight_connected_inst =
!strcmp(get_tok_value((xctx->inst[i].ptr+ xctx->sym)->prop_ptr, "highlight", 0), "true") ||
!strcmp(get_tok_value(xctx->inst[i].prop_ptr, "highlight", 0), "true");
if( xctx->inst[i].flags & 4) {
dbg(1, "draw_hilight_net(): instance %d flags &4 true\n", i);
inst_color[i]=PINLAYER;

View File

@ -267,7 +267,8 @@ void push_undo(void)
uslot[slot].pptr[c][i].selected_point = my_malloc(189, points * sizeof(unsigned short));
memcpy(uslot[slot].pptr[c][i].x, xctx->poly[c][i].x, points * sizeof(double));
memcpy(uslot[slot].pptr[c][i].y, xctx->poly[c][i].y, points * sizeof(double));
memcpy(uslot[slot].pptr[c][i].selected_point, xctx->poly[c][i].selected_point, points * sizeof(unsigned short));
memcpy(uslot[slot].pptr[c][i].selected_point, xctx->poly[c][i].selected_point,
points * sizeof(unsigned short));
my_strdup(190, &uslot[slot].pptr[c][i].prop_ptr, xctx->poly[c][i].prop_ptr);
}
}
@ -378,7 +379,8 @@ void pop_undo(int redo)
my_realloc(212, &xctx->poly[c][i].selected_point, points * sizeof(unsigned short));
memcpy(xctx->poly[c][i].x, uslot[slot].pptr[c][i].x, points * sizeof(double));
memcpy(xctx->poly[c][i].y, uslot[slot].pptr[c][i].y, points * sizeof(double));
memcpy(xctx->poly[c][i].selected_point, uslot[slot].pptr[c][i].selected_point, points * sizeof(unsigned short));
memcpy(xctx->poly[c][i].selected_point, uslot[slot].pptr[c][i].selected_point,
points * sizeof(unsigned short));
}
}

View File

@ -203,7 +203,8 @@ void draw_selection(GC g, int interruptable)
{
case xTEXT:
if(rotatelocal) {
ROTATION(move_rot, move_flip, xctx->text[n].x0, xctx->text[n].y0, xctx->text[n].x0, xctx->text[n].y0, rx1,ry1);
ROTATION(move_rot, move_flip, xctx->text[n].x0, xctx->text[n].y0,
xctx->text[n].x0, xctx->text[n].y0, rx1,ry1);
} else {
ROTATION(move_rot, move_flip, x1, y_1, xctx->text[n].x0, xctx->text[n].y0, rx1,ry1);
}
@ -318,8 +319,10 @@ void draw_selection(GC g, int interruptable)
case WIRE:
if(rotatelocal) {
ROTATION(move_rot, move_flip, xctx->wire[n].x1, xctx->wire[n].y1, xctx->wire[n].x1, xctx->wire[n].y1, rx1,ry1);
ROTATION(move_rot, move_flip, xctx->wire[n].x1, xctx->wire[n].y1, xctx->wire[n].x2, xctx->wire[n].y2, rx2,ry2);
ROTATION(move_rot, move_flip, xctx->wire[n].x1, xctx->wire[n].y1,
xctx->wire[n].x1, xctx->wire[n].y1, rx1,ry1);
ROTATION(move_rot, move_flip, xctx->wire[n].x1, xctx->wire[n].y1,
xctx->wire[n].x2, xctx->wire[n].y2, rx2,ry2);
} else {
ROTATION(move_rot, move_flip, x1, y_1, xctx->wire[n].x1, xctx->wire[n].y1, rx1,ry1);
ROTATION(move_rot, move_flip, x1, y_1, xctx->wire[n].x2, xctx->wire[n].y2, rx2,ry2);
@ -414,7 +417,8 @@ void draw_selection(GC g, int interruptable)
break;
case ELEMENT:
if(rotatelocal) {
ROTATION(move_rot, move_flip, xctx->inst[n].x0, xctx->inst[n].y0, xctx->inst[n].x0, xctx->inst[n].y0, rx1,ry1);
ROTATION(move_rot, move_flip, xctx->inst[n].x0, xctx->inst[n].y0,
xctx->inst[n].x0, xctx->inst[n].y0, rx1,ry1);
} else {
ROTATION(move_rot, move_flip, x1, y_1, xctx->inst[n].x0, xctx->inst[n].y0, rx1,ry1);
}

View File

@ -24,21 +24,13 @@
static void instdelete(int n, int x, int y)
{
struct instentry *saveptr, **prevptr, *ptr;
struct instentry *saveptr, **prevptr;
prevptr = &insttable[x][y];
ptr = *prevptr;
while(ptr) {
if(ptr -> n == n) {
saveptr = ptr->next;
my_free(821, &ptr);
*prevptr = saveptr;
return;
}
prevptr = &ptr->next;
ptr = *prevptr;
}
while( (*prevptr)->n != n) prevptr = &(*prevptr)->next;
saveptr = (*prevptr)->next;
my_free(821, prevptr);
*prevptr = saveptr;
}
static void instinsert(int n, int x, int y)
@ -146,7 +138,6 @@ static void instpindelete(int n,int pin, int x, int y)
prevptr = &ptr->next;
ptr = *prevptr;
}
}
/* --pin coordinates-- -square coord- */
@ -187,23 +178,16 @@ static void del_inst_pin_table(void)
instpintable[i][j] = delinstpinentry(instpintable[i][j]);
}
static void wiredelete(int n, int x, int y)
{
struct wireentry *saveptr, **prevptr, *ptr;
struct wireentry *saveptr, **prevptr;
prevptr = &wiretable[x][y];
ptr = wiretable[x][y];
while(ptr) {
if(ptr -> n == n) {
saveptr = ptr->next;
my_free(825, &ptr);
*prevptr = saveptr;
return;
}
prevptr = &ptr->next;
ptr = ptr->next;
}
while( (*prevptr)->n != n) prevptr = &(*prevptr)->next;
saveptr = (*prevptr)->next;
my_free(825, prevptr);
*prevptr = saveptr;
}
static void wireinsert(int n, int x, int y)

View File

@ -533,7 +533,8 @@ static void load_inst(int k, FILE *fd)
my_strdup2(56, &xctx->inst[i].name, name);
dbg(1, "load_inst(): 2: name=%s\n", name);
if(fscanf(fd, "%lf %lf %d %d",&xctx->inst[i].x0, &xctx->inst[i].y0,&xctx->inst[i].rot, &xctx->inst[i].flip) < 4) {
if(fscanf(fd, "%lf %lf %d %d", &xctx->inst[i].x0, &xctx->inst[i].y0,
&xctx->inst[i].rot, &xctx->inst[i].flip) < 4) {
fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n");
read_line(fd, 0);
} else {

View File

@ -39,7 +39,8 @@ void global_tedax_netlist(int global) /* netlister driver */
record_global_node(2, NULL, NULL); /* delete list of global nodes */
netlist_count=0;
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d", netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
my_snprintf(netl_filename, S(netl_filename), "%s/.%s_%d",
netlist_dir, skip_dir(xctx->sch[xctx->currsch]), getpid());
fd=fopen(netl_filename, "w");
if(user_top_netl_name[0]) {

View File

@ -523,13 +523,15 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes)
if(c=='"') {
if((with_quotes & 1) || escape) result[value_pos++]=c;
}
else if( !quote || !((c == '\\') && (with_quotes & 2)) ) result[value_pos++]=c; /* skip unescaped backslashes */
else if( (c == '\\') && escape ) result[value_pos++]=c; /* 20170414 add escaped backslashes */
/* skip unescaped backslashes */
else if( !quote || !((c == '\\') && (with_quotes & 2)) ) result[value_pos++]=c;
else if( (c == '\\') && escape ) result[value_pos++]=c; /* add escaped backslashes */
} else if(state==TOK_ENDTOK || state==TOK_SEP) {
if(token_pos) {
token[token_pos]='\0';
if( !(cmp = strcmp(token,tok)) ) {
get_tok_size = token_pos; /* report back also token size, useful to check if requested token exists */
/* report back also token size, useful to check if requested token exists */
get_tok_size = token_pos;
}
dbg(2, "get_tok_value(): token=%s\n", token);
token_pos=0;
@ -537,7 +539,7 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes)
} else if(state==TOK_END) {
result[value_pos]='\0';
if( !cmp ) {
get_tok_value_size = value_pos; /* return also size so to avoid using strlen 20180926 */
get_tok_value_size = value_pos; /* return also size so to avoid using strlen */
return result;
}
value_pos=0;
@ -547,7 +549,7 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes)
if(c=='\0') {
result[0]='\0';
get_tok_size = 0;
get_tok_value_size = 0; /* return also size so to avoid using strlen 20180926 */
get_tok_value_size = 0; /* return also size so to avoid using strlen */
return result;
}
}
@ -969,6 +971,7 @@ void print_vhdl_element(FILE *fd, int inst)
int token_pos=0, value_pos=0;
int quote=0;
int escape=0;
xRect *pinptr;
if(get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->prop_ptr,"vhdl_format",2)[0] != '\0') {
print_vhdl_primitive(fd, inst);
@ -1089,9 +1092,10 @@ void print_vhdl_element(FILE *fd, int inst)
/* print port map */
fprintf(fd, "port map(\n" );
tmp=0;
pinptr = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER];
for(i=0;i<no_of_pins;i++)
{
if(strcmp(get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) {
if(strcmp(get_tok_value(pinptr[i].prop_ptr,"vhdl_ignore",0), "true")) {
if( (str_ptr = net_name(inst,i, &mult, 0, 1)) )
{
if(tmp) fprintf(fd, " ,\n");
@ -2891,8 +2895,9 @@ const char *translate2(struct Lcc *lcc, int level, char* s)
}
tmp = get_tok_value_size; /* strlen(value); */
STR_ALLOC(&result, tmp + 1 + result_pos, &size); /* +1 to add leading '$' */
/* prefix substituted token with a '$' so it will be recognized by translate() for last level translation with
instance placement prop_ptr attributes at drawing/netlisting time. */
/* prefix substituted token with a '$' so it will be recognized by translate()
* for last level translation with instance placement prop_ptr attributes at
* drawing/netlisting time. */
memcpy(result + result_pos , "$", 1);
memcpy(result + result_pos + 1 , value, tmp + 1);
result_pos += tmp + 1;