diff --git a/src/actions.c b/src/actions.c index 71716c3c..cdbb67f8 100644 --- a/src/actions.c +++ b/src/actions.c @@ -725,7 +725,7 @@ void attach_labels_to_inst() /* offloaded from callback.c 20171005 */ xSymbol *symbol; int npin, i, j; double x0,y0, pinx0, piny0; - int flip, rot, rot1 ; + short flip, rot, rot1 ; xRect *rct; char *labname=NULL; char *prop=NULL; /* 20161122 overflow safe */ @@ -930,7 +930,7 @@ void place_net_label(int type) /* first_call: set to 1 on first invocation for a given set of symbols (same prefix) */ /* set to 0 on next calls, this speeds up searching for unique names in prop string */ /* returns 1 if symbol successfully placed, 0 otherwise */ -int place_symbol(int pos, const char *symbol_name, double x, double y, int rot, int flip, +int place_symbol(int pos, const char *symbol_name, double x, double y, short rot, short flip, const char *inst_props, int draw_sym, int first_call) /* if symbol_name is a valid string load specified cell and */ /* use the given params, otherwise query user */ @@ -2143,7 +2143,7 @@ void new_polygon(int what) #ifdef HAS_CAIRO int text_bbox(const char *str, double xscale, double yscale, - int rot, int flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, + short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, double *rx2, double *ry2) { int c=0; @@ -2226,11 +2226,11 @@ int text_bbox(const char *str, double xscale, double yscale, return 1; } int text_bbox_nocairo(const char * str,double xscale, double yscale, - int rot, int flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, + short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, double *rx2, double *ry2) #else int text_bbox(const char * str,double xscale, double yscale, - int rot, int flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, + short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, double *rx2, double *ry2) #endif { diff --git a/src/check.c b/src/check.c index 9cc2baff..de12ff63 100644 --- a/src/check.c +++ b/src/check.c @@ -377,7 +377,8 @@ void trim_wires(void) void break_wires_at_pins(void) { - int k, i, j, r, rects, rot, flip, sqx, sqy; + int k, i, j, r, rects, sqx, sqy; + short rot, flip; struct wireentry *wptr; xRect *rct; double x0, y0, rx1, ry1; diff --git a/src/draw.c b/src/draw.c index 7690fd5e..c894ba73 100644 --- a/src/draw.c +++ b/src/draw.c @@ -266,17 +266,15 @@ int set_text_custom_font(xText *txt) #ifdef HAS_CAIRO static void cairo_draw_string_line(cairo_t *c_ctx, char *s, - double x, double y, int rot, int flip, + double x, double y, short rot, short flip, int lineno, double fontheight, double fontascent, double fontdescent, int llength) { double ix, iy; - int rot1; + short rot1; int line_delta; int line_offset; double lines; double vc; /* 20171121 vert correct */ - /*int rx1, ry1, rx2, ry2, save_rot, save_flip; */ - /* GC gcclear; */ if(s==NULL) return; if(llength==0) return; @@ -311,7 +309,7 @@ static void cairo_draw_string_line(cairo_t *c_ctx, char *s, } /* CAIRO version */ -void draw_string(int layer, int what, const char *str, int rot, int flip, int hcenter, int vcenter, +void draw_string(int layer, int what, const char *str, short rot, short flip, int hcenter, int vcenter, double x, double y, double xscale, double yscale) { char *tt, *ss, *sss=NULL; @@ -388,7 +386,7 @@ void draw_string(int layer, int what, const char *str, int rot, int flip, int hc #else /* !HAS_CAIRO */ /* no CAIRO version */ -void draw_string(int layer, int what, const char *str, int rot, int flip, int hcenter, int vcenter, +void draw_string(int layer, int what, const char *str, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double xscale, double yscale) { double a=0.0,yy; @@ -449,7 +447,7 @@ void draw_string(int layer, int what, const char *str, int rot, int flip, int hc #endif /* HAS_CAIRO */ -void draw_temp_string(GC gctext, int what, const char *str, int rot, int flip, int hcenter, int vcenter, +void draw_temp_string(GC gctext, int what, const char *str, short rot, short flip, int hcenter, int vcenter, double x1,double y1, double xscale, double yscale) { if(!has_x) return; @@ -458,13 +456,13 @@ void draw_temp_string(GC gctext, int what, const char *str, int rot, int flip, i drawtemprect(gctext,what, textx1,texty1,textx2,texty2); } -void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot, +void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot, double xoffset, double yoffset) /* draws current layer only, should be called within */ { /* a "for(i=0;i #include "xschem.h" -static int rot = 0, flip = 0; +static short rot = 0, flip = 0; char *my_strtok_r(char *str, const char *delim, char **saveptr) { diff --git a/src/findnet.c b/src/findnet.c index c70045f8..6dde465c 100644 --- a/src/findnet.c +++ b/src/findnet.c @@ -113,7 +113,7 @@ void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y) int i, j, no_of_pin_rects; double x0, x1, x2, y0, y1, y2, xx, yy, dist, min_dist_x=0, min_dist_y=0; xRect box; - int rot, flip; + short rot, flip; char *type=NULL; distance = DBL_MAX; @@ -271,7 +271,7 @@ void find_closest_element(double mx,double my) void find_closest_text(double mx,double my) { - int rot,flip; + short rot,flip; double xx1,xx2,yy1,yy2; int i,r=-1; double threshold = CADWIREMINDIST * CADWIREMINDIST * cadgrid * cadgrid / 400; diff --git a/src/move.c b/src/move.c index 524ce47b..71bc3941 100644 --- a/src/move.c +++ b/src/move.c @@ -22,12 +22,12 @@ #include "xschem.h" static double rx1, rx2, ry1, ry2; -static int move_rot = 0; -static int move_flip = 0; +static short move_rot = 0; +static short move_flip = 0; static double x1=0.0, y_1=0.0, x2=0.0, y_2=0.0, deltax = 0.0, deltay = 0.0; /* static int i,c,n,k; */ static int lastsel; -static int rotatelocal=0; +static short rotatelocal=0; void rebuild_selected_array() /* can be used only if new selected set is lower */ @@ -169,9 +169,10 @@ void check_collapsing_objects() } } -void update_symbol_bboxes(int rot, int flip) +void update_symbol_bboxes(short rot, short flip) { - int i, n, save_flip, save_rot; + int i, n; + short save_flip, save_rot; for(i=0;iinst[i].ptr+ xctx->sym)->rects[PINLAYER] ; @@ -624,8 +625,8 @@ void prepare_netlist_structs(int for_netlist) char tmp_str[30]; /* overflow safe */ char nn[PATH_MAX+30]; double x0, y0; - int rot = 0; - int flip = 0; + short rot = 0; + short flip = 0; int sqx, sqy; int port; int touches=0; @@ -1062,6 +1063,7 @@ int sym_vs_sch_pins() double tmpd; FILE *fd; int tmpi; + short tmps; int endfile; char tag[1]; char filename[PATH_MAX]; @@ -1131,7 +1133,7 @@ int sym_vs_sch_pins() break; case 'T': load_ascii_string(&tmp,fd); - if(fscanf(fd, "%lf %lf %d %d %lf %lf ", &tmpd, &tmpd, &tmpi, &tmpi, &tmpd, &tmpd) < 6 ) { + if(fscanf(fd, "%lf %lf %hd %hd %lf %lf ", &tmpd, &tmpd, &tmps, &tmps, &tmpd, &tmpd) < 6 ) { fprintf(errfp,"WARNING: missing fields for TEXT object, ignoring\n"); read_line(fd, 0); break; @@ -1147,7 +1149,7 @@ int sym_vs_sch_pins() my_strncpy(name, add_ext(name, ".sym"), S(name)); } - if(fscanf(fd, "%lf %lf %d %d", &tmpd, &tmpd, &tmpi, &tmpi) < 4) { + if(fscanf(fd, "%lf %lf %hd %hd", &tmpd, &tmpd, &tmps, &tmps) < 4) { fprintf(errfp,"sym_vs_sch_pins() WARNING: missing fields for INST object, filename=%s\n", filename); read_line(fd, 0); diff --git a/src/paste.c b/src/paste.c index 79fd769e..6311ac64 100644 --- a/src/paste.c +++ b/src/paste.c @@ -34,7 +34,7 @@ void merge_text(FILE *fd) i=xctx->texts; xctx->text[i].txt_ptr=NULL; load_ascii_string(&xctx->text[i].txt_ptr,fd); - fscanf(fd, "%lf %lf %d %d %lf %lf ", + fscanf(fd, "%lf %lf %hd %hd %lf %lf ", &xctx->text[i].x0, &xctx->text[i].y0, &xctx->text[i].rot, &xctx->text[i].flip, &xctx->text[i].xscale, &xctx->text[i].yscale); @@ -206,7 +206,7 @@ void merge_inst(int k,FILE *fd) ptr=xctx->inst; ptr[i].name=NULL; load_ascii_string(&ptr[i].name,fd); - if(fscanf(fd, "%lf %lf %d %d",&ptr[i].x0, &ptr[i].y0,&ptr[i].rot, &ptr[i].flip) < 4) { + if(fscanf(fd, "%lf %lf %hd %hd",&ptr[i].x0, &ptr[i].y0,&ptr[i].rot, &ptr[i].flip) < 4) { fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n"); read_line(fd, 0); return; diff --git a/src/psprint.c b/src/psprint.c index 45a4f636..e6c2cadb 100644 --- a/src/psprint.c +++ b/src/psprint.c @@ -201,7 +201,7 @@ static void ps_drawline(int gc, double linex1,double liney1,double linex2,double } static void ps_draw_string(int gctext, const char *str, - int rot, int flip, int hcenter, int vcenter, + short rot, short flip, int hcenter, int vcenter, double x1,double y1, double xscale, double yscale) @@ -283,13 +283,13 @@ static void ps_drawgrid() -static void ps_draw_symbol(int n,int layer,int tmp_flip, int rot, - double xoffset, double yoffset) +static void ps_draw_symbol(int n,int layer, short tmp_flip, short rot, double xoffset, double yoffset) /* draws current layer only, should be called within */ { /* a "for(i=0;itext; fprintf(fd, "T "); save_ascii_string(ptr[i].txt_ptr,fd); - fprintf(fd, " %.16g %.16g %d %d %.16g %.16g ", + fprintf(fd, " %.16g %.16g %hd %hd %.16g %.16g ", ptr[i].x0, ptr[i].y0, ptr[i].rot, ptr[i].flip, ptr[i].xscale, ptr[i].yscale); save_ascii_string(ptr[i].prop_ptr,fd); @@ -282,7 +282,7 @@ void save_inst(FILE *fd) save_ascii_string(rel_sym_path(ptr[i].name), fd); } my_free(882, &tmp); - fprintf(fd, " %.16g %.16g %d %d ",ptr[i].x0, ptr[i].y0, ptr[i].rot, ptr[i].flip ); + fprintf(fd, " %.16g %.16g %hd %hd ",ptr[i].x0, ptr[i].y0, ptr[i].rot, ptr[i].flip ); save_ascii_string(ptr[i].prop_ptr,fd); fputc('\n' ,fd); if( !strcmp(get_tok_value(ptr[i].prop_ptr, "embed", 0), "true") ) { @@ -319,7 +319,7 @@ void save_text(FILE *fd) { fprintf(fd, "T "); save_ascii_string(ptr[i].txt_ptr,fd); - fprintf(fd, " %.16g %.16g %d %d %.16g %.16g ", + fprintf(fd, " %.16g %.16g %hd %hd %.16g %.16g ", ptr[i].x0, ptr[i].y0, ptr[i].rot, ptr[i].flip, ptr[i].xscale, ptr[i].yscale); save_ascii_string(ptr[i].prop_ptr,fd); @@ -460,7 +460,7 @@ static void load_text(FILE *fd) i=xctx->texts; xctx->text[i].txt_ptr=NULL; load_ascii_string(&xctx->text[i].txt_ptr,fd); - if(fscanf(fd, "%lf %lf %d %d %lf %lf ", + if(fscanf(fd, "%lf %lf %hd %hd %lf %lf ", &xctx->text[i].x0, &xctx->text[i].y0, &xctx->text[i].rot, &xctx->text[i].flip, &xctx->text[i].xscale, &xctx->text[i].yscale)<6) { @@ -539,7 +539,7 @@ 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, + if(fscanf(fd, "%lf %lf %hd %hd", &xctx->inst[i].x0, &xctx->inst[i].y0, &xctx->inst[i].rot, &xctx->inst[i].flip) < 4) { fprintf(errfp,"WARNING: missing fields for INSTANCE object, ignoring.\n"); read_line(fd, 0); @@ -1511,7 +1511,7 @@ int load_sym_def(const char *name, FILE *embed_fd) static int recursion_counter=0; struct Lcc *lcc; /* size = level */ FILE *fd_tmp; - int rot,flip; + short rot,flip; double angle; double rx1,ry1,rx2,ry2; int incremented_level=0; @@ -1523,7 +1523,7 @@ int load_sym_def(const char *name, FILE *embed_fd) char *aux_ptr=NULL; char *prop_ptr=NULL, *symtype=NULL; double inst_x0, inst_y0; - int inst_rot, inst_flip; + short inst_rot, inst_flip; char *symname = NULL; char tag[1]; int *lastl = my_malloc(333, cadlayers * sizeof(lastl)); @@ -1811,7 +1811,7 @@ int load_sym_def(const char *name, FILE *embed_fd) tt[i].txt_ptr=NULL; tt[i].font=NULL; load_ascii_string(&tt[i].txt_ptr, lcc[level].fd); - fscanf(lcc[level].fd, "%lf %lf %d %d %lf %lf ",&tt[i].x0, &tt[i].y0, &tt[i].rot, + fscanf(lcc[level].fd, "%lf %lf %hd %hd %lf %lf ",&tt[i].x0, &tt[i].y0, &tt[i].rot, &tt[i].flip, &tt[i].xscale, &tt[i].yscale); if (level>0) { const char* tmp = translate2(lcc, level, tt[i].txt_ptr); @@ -1878,7 +1878,7 @@ int load_sym_def(const char *name, FILE *embed_fd) case 'C': load_ascii_string(&symname, lcc[level].fd); dbg(1, "l_s_d(): C line: symname=%s\n", symname); - if (fscanf(lcc[level].fd, "%lf %lf %d %d", &inst_x0, &inst_y0, &inst_rot, &inst_flip) < 4) { + if (fscanf(lcc[level].fd, "%lf %lf %hd %hd", &inst_x0, &inst_y0, &inst_rot, &inst_flip) < 4) { fprintf(errfp, "WARNING: missing fields for COMPONENT object, ignoring\n"); read_line(lcc[level].fd, 0); continue; @@ -1968,7 +1968,7 @@ int load_sym_def(const char *name, FILE *embed_fd) lcc[level].flip = inst_flip; /* calculate LCC sub-schematic x0, y0, rotation and flip */ if (level > 1) { - int rot, flip; + short rot, flip; static int map[4]={0,3,2,1}; flip = lcc[level-1].flip; @@ -2347,7 +2347,7 @@ void save_selection(int what) case xTEXT: fprintf(fd, "T "); save_ascii_string(xctx->text[n].txt_ptr,fd); - fprintf(fd, " %.16g %.16g %d %d %.16g %.16g ", + fprintf(fd, " %.16g %.16g %hd %hd %.16g %.16g ", xctx->text[n].x0, xctx->text[n].y0, xctx->text[n].rot, xctx->text[n].flip, xctx->text[n].xscale, xctx->text[n].yscale); save_ascii_string(xctx->text[n].prop_ptr,fd); @@ -2395,7 +2395,7 @@ void save_selection(int what) case ELEMENT: fprintf(fd, "C "); save_ascii_string(xctx->inst[n].name,fd); - fprintf(fd, " %.16g %.16g %d %d ",xctx->inst[n].x0, xctx->inst[n].y0, + fprintf(fd, " %.16g %.16g %hd %hd ",xctx->inst[n].x0, xctx->inst[n].y0, xctx->inst[n].rot, xctx->inst[n].flip ); save_ascii_string(xctx->inst[n].prop_ptr,fd); fputc('\n' ,fd); diff --git a/src/scheduler.c b/src/scheduler.c index 9b2e90bd..c8247c63 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1047,8 +1047,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg else if(!strcmp(argv[1],"instance_net")) { - /* xschem instance_net inst pin */ - int no_of_pins, i, p, mult; + /* xschem instance_net inst pin */ + int no_of_pins, i, p, multip; const char *str_ptr=NULL; if( argc <4) { @@ -1063,7 +1063,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg no_of_pins= (xctx->inst[i].ptr+ xctx->sym)->rects[PINLAYER]; for(p=0;pinst[i].ptr+ xctx->sym)->rect[PINLAYER][p].prop_ptr,"name",0), argv[3])) { - str_ptr = net_name(i,p,&mult, 0, 1); + str_ptr = net_name(i,p,&multip, 0, 1); break; } } /* /20171029 */ @@ -1117,7 +1117,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg * returns pin_name x y */ xSymbol *symbol; xRect *rct; - int flip, rot; + short flip, rot; double x0,y0, pinx0, piny0; char num[60]; int p, i, no_of_pins, slot; @@ -1213,7 +1213,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg /* xschem instances_to_net PLUS */ xSymbol *symbol; xRect *rct; - int flip, rot; + short flip, rot; double x0,y0, pinx0, piny0; char num[40]; diff --git a/src/select.c b/src/select.c index 029afc6c..b32b17ae 100644 --- a/src/select.c +++ b/src/select.c @@ -22,8 +22,8 @@ #include "xschem.h" -static int select_rot = 0; -static int select_flip = 0; +static short select_rot = 0; +static short select_flip = 0; static double xx1,yy1,xx2,yy2; @@ -33,10 +33,10 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2) int j; xText text; const char *tmp_txt; - int rot,flip; + short rot,flip; double x0, y0 ; double text_x0, text_y0; - int sym_rot, sym_flip; + short sym_rot, sym_flip; double xx1,yy1,xx2,yy2; diff --git a/src/spice_netlist.c b/src/spice_netlist.c index 8ea1cd9d..27400761 100644 --- a/src/spice_netlist.c +++ b/src/spice_netlist.c @@ -31,7 +31,7 @@ void global_spice_netlist(int global) /* netlister driver */ int first; FILE *fd; const char *str_tmp; - int mult; + int multip; unsigned int *stored_flags; int i, save_ok; char *type=NULL; @@ -100,7 +100,7 @@ void global_spice_netlist(int global) /* netlister driver */ continue; } if( type && IS_PIN(type)) { - str_tmp = expandlabel ( get_tok_value(xctx->inst[i].prop_ptr,"lab",0) ,&mult); + str_tmp = expandlabel ( get_tok_value(xctx->inst[i].prop_ptr,"lab",0) ,&multip); dbg(1, "global_spice_netlist(): |%s|\n", get_tok_value(xctx->inst[i].prop_ptr,"lab",0)); /*must handle invalid node names */ @@ -311,7 +311,7 @@ void spice_block_netlist(FILE *fd, int i) char filename[PATH_MAX]; const char *str_tmp; /* int j; */ - /* int mult; */ + /* int multip; */ char *extra=NULL; if(!strcmp( get_tok_value(xctx->sym[i].prop_ptr,"spice_stop",0),"true") ) @@ -458,15 +458,15 @@ static unsigned int str_hash(const char *tok) */ struct hashentry *str_hash_lookup(struct hashentry **table, const char *token, const char *value, int what) { - unsigned int hashcode, index; + unsigned int hashcode, idx; struct hashentry *entry, *saveptr, **preventry; int s ; if(token==NULL) return NULL; hashcode=str_hash(token); - index=hashcode % HASHSIZE; - entry=table[index]; - preventry=&table[index]; + idx=hashcode % HASHSIZE; + entry=table[idx]; + preventry=&table[idx]; while(1) { if( !entry ) /* empty slot */ @@ -545,15 +545,15 @@ void free_hash(struct hashentry **table) */ struct int_hashentry *int_hash_lookup(struct int_hashentry **table, const char *token, const int value, int what) { - unsigned int hashcode, index; + unsigned int hashcode, idx; struct int_hashentry *entry, *saveptr, **preventry; int s ; if(token==NULL) return NULL; hashcode=str_hash(token); - index=hashcode % HASHSIZE; - entry=table[index]; - preventry=&table[index]; + idx=hashcode % HASHSIZE; + entry=table[idx]; + preventry=&table[idx]; while(1) { if( !entry ) /* empty slot */ diff --git a/src/svgdraw.c b/src/svgdraw.c index 2b2fcaab..e6e6fd49 100644 --- a/src/svgdraw.c +++ b/src/svgdraw.c @@ -184,11 +184,11 @@ static void svg_drawline(int gc, int bus, double linex1,double liney1,double lin static double textx1,textx2,texty1,texty2; -static void svg_draw_string_line(int layer, char *s, double x, double y, double size, int rot, int flip, +static void svg_draw_string_line(int layer, char *s, double x, double y, double size, short rot, short flip, int lineno, double fontheight, double fontascent, double fontdescent, int llength) { double ix, iy; - int rot1; + short rot1; int line_delta; int line_offset; double lines; @@ -243,7 +243,7 @@ static void svg_draw_string_line(int layer, char *s, double x, double y, double fprintf(fd, "\n"); } -static void svg_draw_string(int layer, const char *str, int rot, int flip, int hcenter, int vcenter, +static void svg_draw_string(int layer, const char *str, short rot, short flip, int hcenter, int vcenter, double x,double y, double xscale, double yscale) { char *tt, *ss, *sss=NULL; @@ -305,7 +305,7 @@ static void svg_draw_string(int layer, const char *str, int rot, int flip, int h static void old_svg_draw_string(int layer, const char *str, - int rot, int flip, int hcenter, int vcenter, + short rot, short flip, int hcenter, int vcenter, double x,double y, double xscale, double yscale) { @@ -381,13 +381,14 @@ static void svg_drawgrid() -static void svg_draw_symbol(int n,int layer,int tmp_flip, int rot, +static void svg_draw_symbol(int n,int layer,short tmp_flip, short rot, double xoffset, double yoffset) /* draws current layer only, should be called within */ { /* a "for(i=0;iinstances;i++) { if(xctx->inst[i].instname && xctx->inst[i].instname[0]) { - my_strdup(118, &expanded_instname, expandlabel(xctx->inst[i].instname, &mult)); + my_strdup(118, &expanded_instname, expandlabel(xctx->inst[i].instname, &multip)); comma_pos = 0; - for(j =0; j< mult; j++) { + for(j =0; j< multip; j++) { if(j == 0) start = expanded_instname; else start = comma_pos; comma_pos = strchr(start, ','); @@ -976,7 +976,7 @@ int count_labels(char *s) void print_vhdl_element(FILE *fd, int inst) { - int i=0, mult, tmp, tmp1; + int i=0, multip, tmp, tmp1; const char *str_ptr; register int c, state=TOK_BEGIN, space; const char *lab; @@ -1113,7 +1113,7 @@ void print_vhdl_element(FILE *fd, int inst) for(i=0;i %s", @@ -1335,7 +1335,7 @@ void print_verilog_param(FILE *fd, int symbol) void print_tedax_subckt(FILE *fd, int symbol) { - int i=0, mult; + int i=0, multip; const char *str_ptr=NULL; register int c, state=TOK_BEGIN, space; char *format=NULL,*s, *token=NULL; @@ -1392,7 +1392,7 @@ void print_tedax_subckt(FILE *fd, int symbol) { if(strcmp(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"spice_ignore",0), "true")) { str_ptr= - expandlabel(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0), &mult); + expandlabel(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0), &multip); fprintf(fd, "%s ", str_ptr); } } @@ -1404,7 +1404,7 @@ void print_tedax_subckt(FILE *fd, int symbol) if(!strcmp(get_tok_value(prop, "name",0), token + 2)) break; } if(isym[symbol].rect[PINLAYER][pin_number].prop_ptr,"spice_ignore",0), "true")) { str_ptr = get_tok_value(xctx->sym[symbol].rect[PINLAYER][pin_number].prop_ptr,"name",0); - fprintf(fd, "%s ", expandlabel(str_ptr, &mult)); + fprintf(fd, "%s ", expandlabel(str_ptr, &multip)); } } } @@ -1443,7 +1443,7 @@ void print_tedax_subckt(FILE *fd, int symbol) void print_spice_subckt(FILE *fd, int symbol) { - int i=0, mult; + int i=0, multip; const char *str_ptr=NULL; register int c, state=TOK_BEGIN, space; char *format=NULL,*s, *token=NULL; @@ -1500,7 +1500,7 @@ void print_spice_subckt(FILE *fd, int symbol) { if(strcmp(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"spice_ignore",0), "true")) { str_ptr= - expandlabel(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0), &mult); + expandlabel(get_tok_value(xctx->sym[symbol].rect[PINLAYER][i].prop_ptr,"name",0), &multip); fprintf(fd, "%s ", str_ptr); } } @@ -1512,7 +1512,7 @@ void print_spice_subckt(FILE *fd, int symbol) if(!strcmp(get_tok_value(prop, "name",0), token + 2)) break; } if(isym[symbol].rect[PINLAYER][pin_number].prop_ptr,"spice_ignore",0), "true")) { str_ptr = get_tok_value(xctx->sym[symbol].rect[PINLAYER][pin_number].prop_ptr,"name",0); - fprintf(fd, "%s ", expandlabel(str_ptr, &mult)); + fprintf(fd, "%s ", expandlabel(str_ptr, &multip)); } } } @@ -1550,7 +1550,7 @@ void print_spice_subckt(FILE *fd, int symbol) void print_spice_element(FILE *fd, int inst) { - int i=0, mult, tmp; + int i=0, multip, tmp; const char *str_ptr=NULL; register int c, state=TOK_BEGIN, space; char *template=NULL,*format=NULL,*s, *name=NULL, *token=NULL; @@ -1711,12 +1711,12 @@ void print_spice_element(FILE *fd, int inst) { char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr; if(strcmp(get_tok_value(prop, "spice_ignore", 0), "true")) { - str_ptr = net_name(inst,i, &mult, 0, 1); + str_ptr = net_name(inst,i, &multip, 0, 1); tmp = strlen(str_ptr) +100 ; /* always make room for some extra chars * so 1-char writes to result do not need reallocs */ STR_ALLOC(&result, tmp + result_pos, &size); - result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", mult, str_ptr); + result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", multip, str_ptr); } } } @@ -1725,12 +1725,12 @@ void print_spice_element(FILE *fd, int inst) char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr; if (!strcmp( get_tok_value(prop,"name",0), token+2)) { if(strcmp(get_tok_value(prop,"spice_ignore",0), "true")) { - str_ptr = net_name(inst,i, &mult, 0, 1); + str_ptr = net_name(inst,i, &multip, 0, 1); tmp = strlen(str_ptr) +100 ; /* always make room for some extra chars * so 1-char writes to result do not need reallocs */ STR_ALLOC(&result, tmp + result_pos, &size); - result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", mult, str_ptr); + result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", multip, str_ptr); } break; } @@ -1744,12 +1744,12 @@ void print_spice_element(FILE *fd, int inst) char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][pin_number].prop_ptr; si = get_tok_value(prop, "spice_ignore",0); if(strcmp(si, "true")) { - str_ptr = net_name(inst,pin_number, &mult, 0, 1); + str_ptr = net_name(inst,pin_number, &multip, 0, 1); tmp = strlen(str_ptr) +100 ; /* always make room for some extra chars * so 1-char writes to result do not need reallocs */ STR_ALLOC(&result, tmp + result_pos, &size); - result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", mult, str_ptr); + result_pos += my_snprintf(result + result_pos, tmp, "?%d %s ", multip, str_ptr); } } } @@ -1834,7 +1834,7 @@ void print_spice_element(FILE *fd, int inst) void print_tedax_element(FILE *fd, int inst) { - int i=0, mult; + int i=0, multip; const char *str_ptr=NULL; register int c, state=TOK_BEGIN, space; char *template=NULL,*format=NULL,*s, *name=NULL, *token=NULL; @@ -1927,7 +1927,7 @@ void print_tedax_element(FILE *fd, int inst) get_tok_value((xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr,"pinnumber",0)); } if(!get_tok_size) my_strdup(501, &pinnumber, "--UNDEF--"); - tmp = net_name(inst,i, &mult, 0, 1); + tmp = net_name(inst,i, &multip, 0, 1); if(tmp && strcmp(tmp, "__UNCONNECTED_PIN__")) { fprintf(fd, "conn %s %s %s %s %d\n", name, @@ -2030,9 +2030,9 @@ void print_tedax_element(FILE *fd, int inst) { /* and node number: m1 n1 m2 n2 .... */ for(i=0;i %s\n", name, str_ptr); */ - fprintf(fd, "?%d %s ", mult, str_ptr); + fprintf(fd, "?%d %s ", multip, str_ptr); } } else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */ @@ -2042,7 +2042,7 @@ void print_tedax_element(FILE *fd, int inst) token+2 ) ) { - str_ptr = net_name(inst,i, &mult, 0, 1); + str_ptr = net_name(inst,i, &multip, 0, 1); fprintf(fd, "%s", str_ptr); break; } @@ -2090,7 +2090,7 @@ void print_tedax_element(FILE *fd, int inst) /* @#n --> return net name attached to pin of index 'n' */ pin_number = atoi(token+2); if(pin_number < no_of_pins) { - str_ptr = net_name(inst,pin_number, &mult, 0, 1); + str_ptr = net_name(inst,pin_number, &multip, 0, 1); fprintf(fd, "%s", str_ptr); } } @@ -2147,7 +2147,7 @@ void print_tedax_element(FILE *fd, int inst) */ void print_verilog_element(FILE *fd, int inst) { - int i=0, mult, tmp; + int i=0, multip, tmp; const char *str_ptr; const char *lab; char *name=NULL; @@ -2261,10 +2261,10 @@ void print_verilog_element(FILE *fd, int inst) { xSymbol *ptr = xctx->inst[inst].ptr+ xctx->sym; if(strcmp(get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"verilog_ignore",0), "true")) { - if( (str_ptr = net_name(inst,i, &mult, 0, 1)) ) + if( (str_ptr = net_name(inst,i, &multip, 0, 1)) ) { if(tmp) fprintf(fd,"\n"); - fprintf(fd, " ?%d %s %s ", mult, + fprintf(fd, " ?%d %s %s ", multip, get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"name",0), str_ptr); tmp=1; @@ -2281,7 +2281,7 @@ void print_verilog_element(FILE *fd, int inst) } -const char *net_name(int i, int j, int *mult, int hash_prefix_unnamed_net, int erc) +const char *net_name(int i, int j, int *multip, int hash_prefix_unnamed_net, int erc) { int tmp; char errstr[2048]; @@ -2291,35 +2291,35 @@ const char *net_name(int i, int j, int *mult, int hash_prefix_unnamed_net, int e { if((xctx->inst[i].node[j])[0] == '#') /* unnamed net */ { - /* get unnamed node multiplicity ( minimum mult found in circuit) */ - *mult = get_unnamed_node(3, 0, atoi((xctx->inst[i].node[j])+4) ); - dbg(2, "net_name(): node = %s n=%d mult=%d\n", - xctx->inst[i].node[j], atoi(xctx->inst[i].node[j]), *mult); + /* get unnamed node multiplicity ( minimum multip found in circuit) */ + *multip = get_unnamed_node(3, 0, atoi((xctx->inst[i].node[j])+4) ); + dbg(2, "net_name(): node = %s n=%d multip=%d\n", + xctx->inst[i].node[j], atoi(xctx->inst[i].node[j]), *multip); if(hash_prefix_unnamed_net) { - if(*mult>1) /* unnamed is a bus */ - my_snprintf(str_node, S(str_node), "%s[%d:0]", (xctx->inst[i].node[j]), *mult-1); + if(*multip>1) /* unnamed is a bus */ + my_snprintf(str_node, S(str_node), "%s[%d:0]", (xctx->inst[i].node[j]), *multip-1); else my_snprintf(str_node, S(str_node), "%s", (xctx->inst[i].node[j]) ); } else { - if(*mult>1) /* unnamed is a bus */ - my_snprintf(str_node, S(str_node), "%s[%d:0]", (xctx->inst[i].node[j])+1, *mult-1); + if(*multip>1) /* unnamed is a bus */ + my_snprintf(str_node, S(str_node), "%s[%d:0]", (xctx->inst[i].node[j])+1, *multip-1); else my_snprintf(str_node, S(str_node), "%s", (xctx->inst[i].node[j])+1 ); } expandlabel(get_tok_value( /* remove quotes --. */ - (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0), mult); + (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0), multip); return expandlabel(str_node, &tmp); } else { expandlabel(get_tok_value( /* remove quotes --. */ - (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0), mult); + (xctx->inst[i].ptr+ xctx->sym)->rect[PINLAYER][j].prop_ptr,"name",0), multip); return expandlabel(xctx->inst[i].node[j], &tmp); } } else { - *mult=1; + *multip=1; if(erc) { my_snprintf(errstr, S(errstr), "Warning: unconnected pin, Inst idx: %d, Pin idx: %d Inst:%s\n", @@ -2337,7 +2337,7 @@ const char *net_name(int i, int j, int *mult, int hash_prefix_unnamed_net, int e void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 */ { - int i=0, mult, tmp; + int i=0, multip, tmp; const char *str_ptr; register int c, state=TOK_BEGIN, space; const char *lab; @@ -2447,7 +2447,7 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 * { char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr; if(strcmp(get_tok_value(prop,"vhdl_ignore",0), "true")) { - str_ptr = net_name(inst,i, &mult, 0, 1); + str_ptr = net_name(inst,i, &multip, 0, 1); fprintf(fd, "----pin(%s) ", str_ptr); } } @@ -2457,7 +2457,7 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 * xSymbol *ptr = xctx->inst[inst].ptr+ xctx->sym; if(!strcmp( get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"name",0), token+2)) { if(strcmp(get_tok_value(ptr->rect[PINLAYER][i].prop_ptr,"vhdl_ignore",0), "true")) { - str_ptr = net_name(inst,i, &mult, 0, 1); + str_ptr = net_name(inst,i, &multip, 0, 1); fprintf(fd, "----pin(%s) ", str_ptr); } break; @@ -2470,7 +2470,7 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 * if(pin_number < no_of_pins) { char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][pin_number].prop_ptr; if(strcmp(get_tok_value(prop,"vhdl_ignore",0), "true")) { - str_ptr = net_name(inst,pin_number, &mult, 0, 1); + str_ptr = net_name(inst,pin_number, &multip, 0, 1); fprintf(fd, "----pin(%s) ", str_ptr); } } @@ -2510,7 +2510,7 @@ void print_vhdl_primitive(FILE *fd, int inst) /* netlist primitives, 20071217 * /* print verilog element if verilog_format is specified */ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primitives, 15112003 */ { - int i=0, mult, tmp; + int i=0, multip, tmp; const char *str_ptr; register int c, state=TOK_BEGIN, space; const char *lab; @@ -2621,7 +2621,7 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti { char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr; if(strcmp(get_tok_value(prop, "verilog_ignore",0), "true")) { - str_ptr = net_name(inst,i, &mult, 0, 1); + str_ptr = net_name(inst,i, &multip, 0, 1); fprintf(fd, "----pin(%s) ", str_ptr); } } @@ -2631,7 +2631,7 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr; if(!strcmp( get_tok_value(prop,"name",0), token+2)) { if(strcmp(get_tok_value(prop, "verilog_ignore",0), "true")) { - str_ptr = net_name(inst,i, &mult, 0, 1); + str_ptr = net_name(inst,i, &multip, 0, 1); fprintf(fd, "----pin(%s) ", str_ptr); } break; @@ -2646,7 +2646,7 @@ void print_verilog_primitive(FILE *fd, int inst) /* netlist switch level primiti char *prop = (xctx->inst[inst].ptr+ xctx->sym)->rect[PINLAYER][pin_number].prop_ptr; vi = get_tok_value(prop,"verilog_ignore",0); if(strcmp(vi, "true")) { - str_ptr = net_name(inst,pin_number, &mult, 0, 1); + str_ptr = net_name(inst,pin_number, &multip, 0, 1); fprintf(fd, "----pin(%s) ", str_ptr); } } @@ -2822,14 +2822,14 @@ const char *translate(int inst, const char* s) memcpy(result+result_pos,tmp_sym_name, tmp+1); result_pos+=tmp; } else if(token[0]=='@' && token[1]=='@') { /* recognize single pins 15112003 */ - int i, mult; + int i, multip; int no_of_pins= (xctx->inst[inst].ptr+ xctx->sym)->rects[PINLAYER]; prepare_netlist_structs(0); for(i=0;iinst[inst].ptr+ xctx->sym)->rect[PINLAYER][i].prop_ptr; if (!strcmp( get_tok_value(prop,"name",0), token+2)) { if(strcmp(get_tok_value(prop,"spice_ignore",0), "true")) { - const char *str_ptr = net_name(inst,i, &mult, 0, 0); + const char *str_ptr = net_name(inst,i, &multip, 0, 0); tmp = strlen(str_ptr) +100 ; STR_ALLOC(&result, tmp + result_pos, &size); result_pos += my_snprintf(result + result_pos, tmp, "%s", str_ptr); diff --git a/src/xinit.c b/src/xinit.c index 021fd13f..232c161a 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -209,7 +209,7 @@ unsigned int find_best_color(char colorname[]) int i; double distance=10000000000.0, dist, r, g, b, red, green, blue; double deltar,deltag,deltab; - unsigned int index; + unsigned int idx; #ifdef __unix__ if( XAllocNamedColor(display, colormap, colorname, &xcolor_exact, &xcolor) ==0 ) #else @@ -232,7 +232,7 @@ unsigned int find_best_color(char colorname[]) "find_best_color(): Server failed to allocate requested color, finding substitute\n"); XLookupColor(display, colormap, colorname, &xcolor_exact, &xcolor); red = xcolor.red; green = xcolor.green; blue = xcolor.blue; - index=0; + idx=0; for(i = 0;i<=255; i++) { r = xcolor_array[i].red ; g = xcolor_array[i].green ; b = xcolor_array[i].blue; @@ -240,7 +240,7 @@ unsigned int find_best_color(char colorname[]) dist = deltar*deltar + deltag*deltag + deltab*deltab; if( dist <= distance ) { - index = i; + idx = i; distance = dist; } } @@ -249,13 +249,13 @@ unsigned int find_best_color(char colorname[]) { /*XLookupColor(display, colormap, colorname, &xcolor_exact, &xcolor); */ #ifdef __unix__ - index = xcolor.pixel; + idx = xcolor.pixel; #else - index = xc->pixel; + idx = xc->pixel; #endif } - return index; + return idx; } diff --git a/src/xschem.h b/src/xschem.h index 5b8c4439..2dd1b1af 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -340,7 +340,7 @@ typedef struct short sel; char *node; char *prop_ptr; - int bus; /* 20171201 cache here wire "bus" property, to avoid too many get_tok_value() calls */ + short bus; /* 20171201 cache here wire "bus" property, to avoid too many get_tok_value() calls */ } xWire; typedef struct @@ -351,8 +351,8 @@ typedef struct double y2; unsigned short sel; char *prop_ptr; - int dash; - int bus; + short dash; + short bus; } xLine; typedef struct @@ -363,7 +363,7 @@ typedef struct double y2; unsigned short sel; char *prop_ptr; - int dash; + short dash; } xRect; typedef struct @@ -376,8 +376,8 @@ typedef struct unsigned short *selected_point; unsigned short sel; char *prop_ptr; - int fill; - int dash; + short fill; + short dash; } xPoly; typedef struct @@ -389,24 +389,24 @@ typedef struct double b; /* arc angle */ unsigned short sel; char *prop_ptr; - int fill; - int dash; + short fill; + short dash; } xArc; typedef struct { char *txt_ptr; double x0,y0; - int rot; - int flip; - int sel; + short rot; + short flip; + short sel; double xscale; double yscale; char *prop_ptr; - int layer; /* 20171201 for cairo */ - int hcenter, vcenter; + short layer; /* 20171201 for cairo */ + short hcenter, vcenter; char *font; /* 20171201 for cairo */ - int flags; + short flags; } xText; typedef struct @@ -429,7 +429,7 @@ typedef struct char *prop_ptr; char *type; char *templ; - unsigned int flags; /* currently only used for embedded symbols (EMBEDDED) */ + short flags; /* currently only used for embedded symbols (EMBEDDED) */ } xSymbol; typedef struct @@ -446,10 +446,10 @@ typedef struct double yy1; double xx2; double yy2; - int rot; - int flip; - int sel; - int flags; /* bit 0: skip field, bit 1: flag for different textlayer for pin/labels + short rot; + short flip; + short sel; + short flags; /* bit 0: skip field, bit 1: flag for different textlayer for pin/labels * bit 2 : hilight flag. */ char *prop_ptr; @@ -546,8 +546,8 @@ typedef struct { struct Lcc { /* used for symbols containing schematics as instances (LCC, Local Custom Cell) */ double x0; double y0; - int rot; - int flip; + short rot; + short flip; FILE *fd; char *prop_ptr; char *symname; @@ -797,7 +797,7 @@ extern void arc_bbox(double x, double y, double r, double a, double b, double *b extern void bbox(int what,double x1,double y1, double x2, double y2); extern int set_text_custom_font(xText *txt); extern int text_bbox(const char * str,double xscale, double yscale, - int rot, int flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, + short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, double *rx2, double *ry2); @@ -811,7 +811,7 @@ extern void hash_instances(void); /* 20171203 insert instance bbox in spatial h #ifdef HAS_CAIRO extern int text_bbox_nocairo(const char * str,double xscale, double yscale, - int rot, int flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, + short rot, short flip, int hcenter, int vcenter, double x1,double y1, double *rx1, double *ry1, double *rx2, double *ry2); #endif @@ -836,10 +836,10 @@ extern Selected find_closest_obj(double mx,double my); extern void find_closest_net_or_symbol_pin(double mx,double my, double *x, double *y); extern void drawline(int c, int what, double x1,double y1,double x2,double y2, int dash); -extern void draw_string(int layer,int what, const char *str, int rot, int flip, int hcenter, int vcenter, +extern void draw_string(int layer,int what, const char *str, short rot, short flip, int hcenter, int vcenter, double x1, double y1, double xscale, double yscale); extern void draw_symbol(int what,int c, int n,int layer, - int tmp_flip, int tmp_rot, double xoffset, double yoffset); + short tmp_flip, short tmp_rot, double xoffset, double yoffset); extern void drawrect(int c, int what, double rectx1,double recty1, double rectx2,double recty2, int dash); extern void filledrect(int c, int what, double rectx1,double recty1, @@ -856,8 +856,8 @@ extern void filledarc(int c, int what, double x, double y, double r, double a, d extern void drawtemppolygon(GC gc, int what, double *x, double *y, int points); extern void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fill, int dash); extern void draw_temp_symbol(int what, GC gc, int n,int layer, - int tmp_flip, int tmp_rot, double xoffset, double yoffset); -extern void draw_temp_string(GC gc,int what, const char *str, int rot, int flip, int hcenter, int vcenter, + short tmp_flip, short tmp_rot, double xoffset, double yoffset); +extern void draw_temp_string(GC gc,int what, const char *str, short rot, short flip, int hcenter, int vcenter, double x1, double y1, double xscale, double yscale); @@ -908,7 +908,7 @@ extern void remove_symbol(int i); extern void clear_drawing(void); extern int load_sym_def(const char name[], FILE *embed_fd); extern void descend_symbol(void); -extern int place_symbol(int pos, const char *symbol_name, double x, double y, int rot, int flip, +extern int place_symbol(int pos, const char *symbol_name, double x, double y, short rot, short flip, const char *inst_props, int draw_sym, int first_call); extern void place_net_label(int type); extern void attach_labels_to_inst(void); diff --git a/xschem_library/examples/cmos_example.sch b/xschem_library/examples/cmos_example.sch index 122cb370..0f7b5444 100644 --- a/xschem_library/examples/cmos_example.sch +++ b/xschem_library/examples/cmos_example.sch @@ -106,7 +106,7 @@ let cap = cap + 2e-12 end * op write cmos_example.raw - +plot all.diffout .endc ** ngspice