fixed lot of conversion warnings/ bugs (int/double/size_t)

This commit is contained in:
Stefan Frederik 2022-04-27 13:18:45 +02:00
parent c09829c976
commit 23102433c2
17 changed files with 194 additions and 180 deletions

View File

@ -40,7 +40,8 @@ void here(double i)
unsigned int hash_file(const char *f, int skip_path_lines)
{
FILE *fd;
int n, i;
int i;
size_t n;
int cr = 0;
unsigned int h=5381;
char line[4096];
@ -1483,7 +1484,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
if(selected == 2 && xctx->hilight_nets) prepare_netlist_structs(0);
for(i=0;i<xctx->wires;i++)
{
int ov, y1, y2;
double ov, y1, y2;
if(selected == 1 && !xctx->wire[i].sel) continue;
if(selected == 2) {
/* const char *str;
@ -2375,7 +2376,7 @@ int text_bbox(const char *str, double xscale, double yscale,
}
my_free(1159, &s);
hh = hh*fext.height * cairo_font_line_spacing;
*cairo_longest_line = ww;
*cairo_longest_line = (int) ww;
*rx1=x1;*ry1=y1;
if(hcenter) {
@ -2432,7 +2433,7 @@ int text_bbox(const char *str,double xscale, double yscale,
w = length;
}
w *= (FONTWIDTH+FONTWHITESPACE)*xscale* tclgetdoublevar("nocairo_font_xscale");
*cairo_longest_line = w;
*cairo_longest_line = (int)w;
h *= (FONTHEIGHT+FONTDESCENT+FONTWHITESPACE)*yscale* tclgetdoublevar("nocairo_font_yscale");
*rx1=x1;*ry1=y1;
if( rot==0) *ry1-=nocairo_vert_correct;

View File

@ -26,7 +26,8 @@ static int waves_selected(int event, int key, int state, int button)
{
int i;
int is_inside = 0, skip = 0;
static int excl = STARTZOOM | STARTRECT | STARTLINE | STARTWIRE | STARTPAN | STARTSELECT | STARTMOVE | STARTCOPY;
static unsigned int excl = STARTZOOM | STARTRECT | STARTLINE | STARTWIRE |
STARTPAN | STARTSELECT | STARTMOVE | STARTCOPY;
if(xctx->ui_state & excl) skip = 1;
else if(state & Mod1Mask) skip = 1;
else if(event == MotionNotify && (state & Button2Mask)) skip = 1;
@ -248,7 +249,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
}
else if(event == -3 && button == Button1) {
if(!edit_wave_attributes(1, i, gr)) {
tclvareval("graph_edit_properties ", itoa(i), NULL);
tclvareval("graph_edit_properties ", my_itoa(i), NULL);
}
}
/* x cursor1 toggle */

View File

@ -98,8 +98,8 @@ void clip_xy_to_short(double x, double y, short *sx, short *sy)
r = 1.0;
}
}
*sx = x * r;
*sy = y * r;
*sx = (short) (x * r);
*sy = (short) (y * r);
}
/*

View File

@ -201,14 +201,14 @@ static void cairo_draw_string_line(cairo_t *c_ctx, char *s,
{
double ix, iy;
short rot1;
int line_delta;
double line_delta;
double lines;
double vc; /* 20171121 vert correct */
if(s==NULL) return;
if(llength==0) return;
line_delta = lineno*fontheight*cairo_font_line_spacing;
line_delta = (lineno*fontheight*cairo_font_line_spacing);
lines = (no_of_lines-1)*fontheight*cairo_font_line_spacing;
ix=X_TO_SCREEN(x);
@ -857,9 +857,9 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
XSetDashes(display, xctx->gc[c], 0, dash_arr, 2);
XSetLineAttributes (display, xctx->gc[c], INT_WIDTH(xctx->lw), xDashType, CapButt, JoinBevel);
}
if(xctx->draw_window) XDrawLine(display, xctx->window, xctx->gc[c], x1, y1, x2, y2);
if(xctx->draw_window) XDrawLine(display, xctx->window, xctx->gc[c], (int)x1, (int)y1, (int)x2, (int)y2);
if(xctx->draw_pixmap)
XDrawLine(display, xctx->save_pixmap, xctx->gc[c], x1, y1, x2, y2);
XDrawLine(display, xctx->save_pixmap, xctx->gc[c], (int)x1, (int)y1, (int)x2, (int)y2);
if(dash) {
XSetLineAttributes (display, xctx->gc[c], INT_WIDTH(xctx->lw), LineSolid, CapRound, JoinRound);
}
@ -882,8 +882,8 @@ void drawline(int c, int what, double linex1, double liney1, double linex2, doub
} else {
XSetLineAttributes (display, xctx->gc[c], INT_BUS_WIDTH(xctx->lw), LineSolid, CapRound, JoinRound);
}
if(xctx->draw_window) XDrawLine(display, xctx->window, xctx->gc[c], x1, y1, x2, y2);
if(xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, xctx->gc[c], x1, y1, x2, y2);
if(xctx->draw_window) XDrawLine(display, xctx->window, xctx->gc[c], (int)x1, (int)y1, (int)x2, (int)y2);
if(xctx->draw_pixmap) XDrawLine(display, xctx->save_pixmap, xctx->gc[c], (int)x1, (int)y1, (int)x2, (int)y2);
XSetLineAttributes (display, xctx->gc[c], INT_WIDTH(xctx->lw), LineSolid, CapRound , JoinRound);
}
}
@ -948,7 +948,7 @@ void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,dou
y2=Y_TO_SCREEN(liney2);
if( clip(&x1,&y1,&x2,&y2) )
{
XDrawLine(display, xctx->window, gc, x1, y1, x2, y2);
XDrawLine(display, xctx->window, gc, (int)x1, (int)y1, (int)x2, (int)y2);
}
}
else if(what & THICK)
@ -961,7 +961,7 @@ void drawtempline(GC gc, int what, double linex1,double liney1,double linex2,dou
{
XSetLineAttributes (display, gc, INT_BUS_WIDTH(xctx->lw), LineSolid, CapRound , JoinRound);
XDrawLine(display, xctx->window, gc, x1, y1, x2, y2);
XDrawLine(display, xctx->window, gc, (int)x1, (int)y1, (int)x2, (int)y2);
XSetLineAttributes (display, gc, INT_WIDTH(xctx->lw), LineSolid, CapRound , JoinRound);
}
}
@ -1009,8 +1009,8 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
xarc[i].y=(short)yy1;
xarc[i].width= (unsigned short)(xx2 - xx1);
xarc[i].height=(unsigned short)(yy2 - yy1);
xarc[i].angle1 = a*64;
xarc[i].angle2 = b*64;
xarc[i].angle1 = (int)(a*64);
xarc[i].angle2 = (int)(b*64);
i++;
}
}
@ -1027,7 +1027,8 @@ void drawtemparc(GC gc, int what, double x, double y, double r, double a, double
y2=Y_TO_SCREEN(y2);
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
{
XDrawArc(display, xctx->window, gc, xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
XDrawArc(display, xctx->window, gc, (int)xx1, (int)yy1, (int)(xx2-xx1), (int)(yy2-yy1),
(int)(a*64), (int)(b*64));
}
}
else if((what & END) && i)
@ -1103,8 +1104,8 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b
xarc[i].y=(short)yy1;
xarc[i].width =(unsigned short)(xx2 - xx1);
xarc[i].height=(unsigned short)(yy2 - yy1);
xarc[i].angle1 = a*64;
xarc[i].angle2 = b*64;
xarc[i].angle1 = (int)(a*64);
xarc[i].angle2 = (int)(b*64);
i++;
}
}
@ -1121,8 +1122,10 @@ void filledarc(int c, int what, double x, double y, double r, double a, double b
y2=Y_TO_SCREEN(y2);
if( rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) )
{
if(xctx->draw_window) XFillArc(display, xctx->window, xctx->gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
if(xctx->draw_pixmap) XFillArc(display, xctx->save_pixmap, xctx->gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
if(xctx->draw_window) XFillArc(display, xctx->window, xctx->gc[c], (int)xx1, (int)yy1,
(int)(xx2-xx1), (int)(yy2-yy1), (int)(a*64), (int)(b*64));
if(xctx->draw_pixmap) XFillArc(display, xctx->save_pixmap, xctx->gc[c], (int)xx1, (int)yy1,
(int)(xx2-xx1), (int)(yy2-yy1), (int)(a*64), (int)(b*64));
}
}
else if((what & END) && i)
@ -1167,8 +1170,8 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
xarc[i].y=(short)yy1;
xarc[i].width =(unsigned short)(xx2 - xx1);
xarc[i].height=(unsigned short)(yy2 - yy1);
xarc[i].angle1 = a*64;
xarc[i].angle2 = b*64;
xarc[i].angle1 = (int)(a*64);
xarc[i].angle2 = (int)(b*64);
i++;
}
}
@ -1196,18 +1199,22 @@ void drawarc(int c, int what, double x, double y, double r, double a, double b,
}
if(xctx->draw_window) {
XDrawArc(display, xctx->window, xctx->gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
XDrawArc(display, xctx->window, xctx->gc[c], (int)xx1, (int)yy1,
(int)(xx2-xx1), (int)(yy2-yy1), (int)(a*64), (int)(b*64));
}
if(xctx->draw_pixmap) {
XDrawArc(display, xctx->save_pixmap, xctx->gc[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
XDrawArc(display, xctx->save_pixmap, xctx->gc[c], (int)xx1, (int)yy1,
(int)(xx2-xx1), (int)(yy2-yy1), (int)(a*64), (int)(b*64));
}
if(xctx->fill_pattern && xctx->fill_type[c]){
if(arc_fill) {
if(xctx->draw_window)
XFillArc(display, xctx->window, xctx->gcstipple[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
XFillArc(display, xctx->window, xctx->gcstipple[c], (int)xx1, (int)yy1,
(int)(xx2-xx1), (int)(yy2-yy1), (int)(a*64), (int)(b*64));
if(xctx->draw_pixmap)
XFillArc(display, xctx->save_pixmap, xctx->gcstipple[c], xx1, yy1, xx2-xx1, yy2-yy1, a*64, b*64);
XFillArc(display, xctx->save_pixmap, xctx->gcstipple[c], (int)xx1, (int)yy1,
(int)(xx2-xx1), (int)(yy2-yy1), (int)(a*64), (int)(b*64));
}
}
if(dash) {
@ -1379,8 +1386,8 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil
}
} else {
/* preserve cache locality working on contiguous data */
for(i=0;i<points; i++) p[i].x = X_TO_SCREEN(x[i]);
for(i=0;i<points; i++) p[i].y = Y_TO_SCREEN(y[i]);
for(i=0;i<points; i++) p[i].x = (short)X_TO_SCREEN(x[i]);
for(i=0;i<points; i++) p[i].y = (short)Y_TO_SCREEN(y[i]);
}
if(dash) {
char dash_arr[2];
@ -1810,10 +1817,10 @@ static void draw_graph_points(int idx, int first, int last,
if(digital) {
yy = c + yy *s2;
/* Build poly y array. Translate from graph coordinates to screen coordinates */
point[poly_npoints].y = CLIP(DS_Y(yy), xctx->areay1, xctx->areay2);
point[poly_npoints].y = (short)CLIP(DS_Y(yy), xctx->areay1, xctx->areay2);
} else {
/* Build poly y array. Translate from graph coordinates to screen coordinates */
point[poly_npoints].y = CLIP(S_Y(yy), xctx->areay1, xctx->areay2);
point[poly_npoints].y = (short)CLIP(S_Y(yy), xctx->areay1, xctx->areay2);
}
poly_npoints++;
}
@ -1864,12 +1871,12 @@ static void draw_graph_grid(Graph_ctx *gr)
subwx = wx + deltax * (double)k / ((double)gr->subdivx + 1.0);
if(!axis_within_range(subwx, gr->gx1, gr->gx2)) continue;
if(axis_end(subwx, deltax, gr->gx2)) break;
drawline(GRIDLAYER, ADD, W_X(subwx), W_Y(gr->gy2), W_X(subwx), W_Y(gr->gy1), dash_sizey);
drawline(GRIDLAYER, ADD, W_X(subwx), W_Y(gr->gy2), W_X(subwx), W_Y(gr->gy1), (int)dash_sizey);
}
if(!axis_within_range(wx, gr->gx1, gr->gx2)) continue;
if(axis_end(wx, deltax, gr->gx2)) break;
/* swap order of gy1 and gy2 since grap y orientation is opposite to xorg orientation */
drawline(GRIDLAYER, ADD, W_X(wx), W_Y(gr->gy2), W_X(wx), W_Y(gr->gy1), dash_sizey);
drawline(GRIDLAYER, ADD, W_X(wx), W_Y(gr->gy2), W_X(wx), W_Y(gr->gy1), (int)dash_sizey);
drawline(GRIDLAYER, ADD, W_X(wx), W_Y(gr->gy1), W_X(wx), W_Y(gr->gy1) + mark_size, 0); /* axis marks */
/* X-axis labels */
if(xctx->graph_sim_type == 3)
@ -1892,11 +1899,11 @@ static void draw_graph_grid(Graph_ctx *gr)
double subwy = wy + k * deltay / (gr->subdivy + 1);
if(!axis_within_range(subwy, gr->gy1, gr->gy2)) continue;
if(axis_end(subwy, deltay, gr->gy2)) break;
drawline(GRIDLAYER, ADD, W_X(gr->gx1), W_Y(subwy), W_X(gr->gx2), W_Y(subwy), dash_sizex);
drawline(GRIDLAYER, ADD, W_X(gr->gx1), W_Y(subwy), W_X(gr->gx2), W_Y(subwy), (int)dash_sizex);
}
if(!axis_within_range(wy, gr->gy1, gr->gy2)) continue;
if(axis_end(wy, deltay, gr->gy2)) break;
drawline(GRIDLAYER, ADD, W_X(gr->gx1), W_Y(wy), W_X(gr->gx2), W_Y(wy), dash_sizex);
drawline(GRIDLAYER, ADD, W_X(gr->gx1), W_Y(wy), W_X(gr->gx2), W_Y(wy), (int)dash_sizex);
drawline(GRIDLAYER, ADD, W_X(gr->gx1) - mark_size, W_Y(wy), W_X(gr->gx1), W_Y(wy), 0); /* axis marks */
/* Y-axis labels */
draw_string(3, NOW, dtoa(wy * gr->unity), 0, 1, 0, 1, gr->x1 - mark_size - 5 * gr->txtsizey, W_Y(wy),
@ -2614,7 +2621,7 @@ void draw_graph(int i, const int flags, Graph_ctx *gr)
if(xx >= start && xx <= end) {
if(first == -1) first = p;
/* Build poly x array. Translate from graph coordinates to screen coords */
point[poly_npoints].x = S_X(xx);
point[poly_npoints].x = (int)S_X(xx);
if(dataset == -1 || dataset == sweepvar_wrap) {
if(measure_p == -1 && flags & 2 && cnt) { /* cursor1: show measurements on nodes in graph */
if(XSIGN(xx - xctx->graph_cursor1_x) != XSIGN(prev_x - xctx->graph_cursor1_x)) {
@ -2840,7 +2847,7 @@ void draw_image(int draw, xRect *r, double *x1, double *y1, double *x2, double *
size_t pngsize = 0;
char *pngdata = NULL;
FILE *fd;
filtersize = buf.st_size;
filtersize = (size_t)buf.st_size;
if(filtersize) {
fd = fopen(filename, "r");
if(fd) {
@ -2897,8 +2904,8 @@ void draw_image(int draw, xRect *r, double *x1, double *y1, double *x2, double *
scalex = xctx->mooz;
scaley = xctx->mooz;
} else { /* resize image to fit in rectangle */
rw = abs(*x2 - *x1);
rh = abs(*y2 - *y1);
rw = abs((int)(*x2 - *x1));
rh = abs((int)(*y2 - *y1));
scalex = rw/w * xctx->mooz;
scaley = rh/h * xctx->mooz;
}

View File

@ -108,7 +108,7 @@ size_t my_strdup(int id, char **dest, const char *src) /* empty source string --
}
/* 20171004 copy at most n chars, adding a null char at end */
void my_strndup(int id, char **dest, const char *src, int n) /* empty source string --> dest=NULL */
void my_strndup(int id, char **dest, const char *src, size_t n) /* empty source string --> dest=NULL */
{
if(*dest!=NULL) {
@ -142,7 +142,7 @@ void dbg(int level, char *fmt, ...)
}
#ifdef HAS_SNPRINTF
int my_snprintf(char *str, int size, const char *fmt, ...)
size_t my_snprintf(char *str, size_t size, const char *fmt, ...)
{
int size_of_print;
char s[200];
@ -165,11 +165,12 @@ int my_snprintf(char *str, int size, const char *fmt, ...)
this is a replacement for snprintf(), **however** it implements only
the bare minimum set of formatting used by XSCHEM
*/
int my_snprintf(char *string, int size, const char *format, ...)
size_t my_snprintf(char *string, size_t size, const char *format, ...)
{
va_list args;
const char *f, *fmt = NULL, *prev;
int overflow, format_spec, l, n = 0;
int overflow, format_spec;
size_t l, n = 0;
va_start(args, format);
@ -282,10 +283,10 @@ size_t my_strdup2(int id, char **dest, const char *src) /* 20150409 duplicates a
return 0;
}
char *itoa(int i)
char *my_itoa(int i)
{
static char s[30];
int n;
size_t n;
n = my_snprintf(s, S(s), "%d", i);
if(xctx) xctx->tok_size = n;
return s;
@ -294,7 +295,7 @@ char *itoa(int i)
char *dtoa(double i)
{
static char s[50];
int n;
size_t n;
n = my_snprintf(s, S(s), "%g", i);
if(xctx) xctx->tok_size = n;
return s;
@ -303,7 +304,7 @@ char *dtoa(double i)
char *dtoa_prec(double i)
{
static char s[50];
int n;
size_t n;
n = my_snprintf(s, S(s), "%.10e", i);
if(xctx) xctx->tok_size = n;
return s;
@ -471,12 +472,12 @@ int my_strncpy(char *d, const char *s, int n)
char *strtolower(char* s) {
char *p;
for(p=s; *p; p++) *p=tolower(*p);
for(p=s; *p; p++) *p=(char)tolower(*p);
return s;
}
char *strtoupper(char* s) {
char *p;
for(p=s; *p; p++) *p=toupper(*p);
for(p=s; *p; p++) *p=(char)toupper(*p);
return s;
}
@ -587,7 +588,7 @@ static void edit_line_property(void)
preserve = atoi(tclgetvar("preserve_unchanged_attrs"));
if(strcmp(tclgetvar("rcode"),"") )
{
int y1, y2;
double y1, y2;
xctx->push_undo();
set_modify(1);
bbox(START, 0.0 , 0.0 , 0.0 , 0.0);
@ -663,7 +664,7 @@ static void edit_wire_property(void)
}
bus_ptr = get_tok_value(xctx->wire[k].prop_ptr,"bus",0);
if(!strcmp(bus_ptr, "true")) {
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw) > cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->wire[k].y1 < xctx->wire[k].y2) { y1 = xctx->wire[k].y1-ov; y2 = xctx->wire[k].y2+ov; }
else { y1 = xctx->wire[k].y1+ov; y2 = xctx->wire[k].y2-ov; }
@ -671,7 +672,7 @@ static void edit_wire_property(void)
xctx->wire[k].bus=1;
} else {
if(oldbus){
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->wire[k].y1 < xctx->wire[k].y2) { y1 = xctx->wire[k].y1-ov; y2 = xctx->wire[k].y2+ov; }
else { y1 = xctx->wire[k].y1+ov; y2 = xctx->wire[k].y2-ov; }
@ -833,7 +834,8 @@ static void edit_text_property(int x)
int customfont;
#endif
int sel, k, text_changed, tmp;
int c,l, preserve, hsize, vsize, changesize=0;
int c,l, preserve, changesize=0;
double hsize, vsize;
double xx1,yy1,xx2,yy2;
double pcx,pcy; /* pin center 20070317 */
char property[1024];/* used for float 2 string conv (xscale and yscale) overflow safe */

View File

@ -32,11 +32,11 @@ void init_inst_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, doub
memset(ctx->instflag, 0, xctx->instances*sizeof(unsigned short));
}
/* calculate square 4 1st corner of drawing area */
ctx->x1a = floor(x1 / BOXSIZE) ;
ctx->y1a = floor(y1 / BOXSIZE) ;
ctx->x1a = (int)floor(x1 / BOXSIZE) ;
ctx->y1a = (int)floor(y1 / BOXSIZE) ;
/* calculate square 4 2nd corner of drawing area */
ctx->x2a = floor(x2 / BOXSIZE);
ctx->y2a = floor(y2 / BOXSIZE);
ctx->x2a = (int)floor(x2 / BOXSIZE);
ctx->y2a = (int)floor(y2 / BOXSIZE);
ctx->i = ctx->x1a;
ctx->j = ctx->y1a;
ctx->tmpi = ctx->i % NBOXES; if(ctx->tmpi < 0) ctx->tmpi += NBOXES;
@ -87,11 +87,11 @@ void init_wire_iterator(Iterator_ctx *ctx, double x1, double y1, double x2, doub
memset(ctx->wireflag, 0, xctx->wires*sizeof(unsigned short));
}
/* calculate square 4 1st corner of drawing area */
ctx->x1a = floor(x1 / BOXSIZE) ;
ctx->y1a = floor(y1 / BOXSIZE) ;
ctx->x1a = (int)floor(x1 / BOXSIZE) ;
ctx->y1a = (int)floor(y1 / BOXSIZE) ;
/* calculate square 4 2nd corner of drawing area */
ctx->x2a = floor(x2 / BOXSIZE);
ctx->y2a = floor(y2 / BOXSIZE);
ctx->x2a = (int)floor(x2 / BOXSIZE);
ctx->y2a = (int)floor(y2 / BOXSIZE);
ctx->i = ctx->x1a;
ctx->j = ctx->y1a;
ctx->tmpi = ctx->i % NBOXES; if(ctx->tmpi < 0) ctx->tmpi += NBOXES;

View File

@ -79,7 +79,6 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int
{
unsigned int hashcode, index;
Hilight_hashentry *entry, *saveptr, **preventry;
char *ptr;
int s ;
if(token==NULL) return NULL;
@ -93,8 +92,7 @@ static Hilight_hashentry *hilight_hash_lookup(const char *token, int value, int
int lenp = strlen(xctx->sch_path[xctx->currsch]) + 1;
if( what==XINSERT || what == XINSERT_NOREPLACE) { /* insert data */
s=sizeof( Hilight_hashentry );
ptr= my_malloc(137, s );
entry=(Hilight_hashentry *)ptr;
entry= (Hilight_hashentry *)my_malloc(137, s );
entry->next = NULL;
entry->token = my_malloc(778, lent);
memcpy(entry->token, token, lent);

View File

@ -562,14 +562,14 @@ void find_inst_to_be_redrawn(int what)
nentry = int_hash_lookup(xctx->node_redraw_table, xctx->wire[i].node, 0, XLOOKUP);
if(nentry) {
if(xctx->wire[i].bus){
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
dbg(1, "find_inst_to_be_redrawn(): 3 bboxing wire %d\n", i);
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
@ -624,7 +624,8 @@ void copy_objects(int what)
{
char *str = NULL; /* 20161122 overflow safe */
draw_selection(xctx->gctiled,0);
xctx->move_rot=xctx->move_flip=xctx->deltax=xctx->deltay=0;
xctx->move_rot = xctx->move_flip = 0;
xctx->deltax = xctx->deltay = 0.;
xctx->ui_state&=~STARTCOPY;
my_strdup(225, &str, user_conf_dir);
my_strcat(226, &str, "/.selection.sch");
@ -709,13 +710,13 @@ void copy_objects(int what)
l = xctx->wires -1;
if(xctx->wire[n].bus){
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->wire[l].y1 < xctx->wire[l].y2) { y1 = xctx->wire[l].y1-ov; y2 = xctx->wire[l].y2+ov; }
else { y1 = xctx->wire[l].y1+ov; y2 = xctx->wire[l].y2-ov; }
bbox(ADD, xctx->wire[l].x1-ov, y1 , xctx->wire[l].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->wire[l].y1 < xctx->wire[l].y2) { y1 = xctx->wire[l].y1-ov; y2 = xctx->wire[l].y2+ov; }
else { y1 = xctx->wire[l].y1+ov; y2 = xctx->wire[l].y2-ov; }
@ -769,14 +770,14 @@ void copy_objects(int what)
l = xctx->lines[c] - 1;
if(xctx->line[c][l].bus){
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->line[c][l].y1 < xctx->line[c][l].y2)
{ y1 = xctx->line[c][l].y1-ov; y2 = xctx->line[c][l].y2+ov; }
else { y1 = xctx->line[c][l].y1+ov; y2 = xctx->line[c][l].y2-ov; }
bbox(ADD, xctx->line[c][l].x1-ov, y1 , xctx->line[c][l].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->line[c][l].y1 < xctx->line[c][l].y2)
{ y1 = xctx->line[c][l].y1-ov; y2 = xctx->line[c][l].y2+ov; }
@ -1013,7 +1014,8 @@ void copy_objects(int what)
propagate_hilights(1, 1, XINSERT_NOREPLACE);
}
xctx->ui_state &= ~STARTCOPY;
xctx->x1=xctx->y_1=xctx->x2=xctx->y_2=xctx->move_rot=xctx->move_flip=xctx->deltax=xctx->deltay=0;
xctx->x1 = xctx->y_1 = xctx->x2 = xctx->y_2 = xctx->deltax = xctx->deltay = 0;
xctx->move_rot = xctx->move_flip = 0;
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);
@ -1056,7 +1058,8 @@ void move_objects(int what, int merge, double dx, double dy)
{
if(xctx->kissing) pop_undo(0, 0);
draw_selection(xctx->gctiled,0);
xctx->move_rot=xctx->move_flip=xctx->deltax=xctx->deltay=0;
xctx->move_rot=xctx->move_flip=0;
xctx->deltax=xctx->deltay=0.;
xctx->ui_state &= ~STARTMOVE;
update_symbol_bboxes(0, 0);
@ -1118,13 +1121,13 @@ void move_objects(int what, int merge, double dx, double dy)
if(k == 0) {
if(wire[n].bus){ /* bbox before move */
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(wire[n].y1 < wire[n].y2) { y1 = wire[n].y1-ov; y2 = wire[n].y2+ov; }
else { y1 = wire[n].y1+ov; y2 = wire[n].y2-ov; }
bbox(ADD, wire[n].x1-ov, y1 , wire[n].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(wire[n].y1 < wire[n].y2) { y1 = wire[n].y1-ov; y2 = wire[n].y2+ov; }
else { y1 = wire[n].y1+ov; y2 = wire[n].y2-ov; }
@ -1166,13 +1169,13 @@ void move_objects(int what, int merge, double dx, double dy)
wire[n].y2=xctx->ry2;
if(wire[n].bus){ /* bbox after move */
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(wire[n].y1 < wire[n].y2) { y1 = wire[n].y1-ov; y2 = wire[n].y2+ov; }
else { y1 = wire[n].y1+ov; y2 = wire[n].y2-ov; }
bbox(ADD, wire[n].x1-ov, y1 , wire[n].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(wire[n].y1 < wire[n].y2) { y1 = wire[n].y1-ov; y2 = wire[n].y2+ov; }
else { y1 = wire[n].y1+ov; y2 = wire[n].y2-ov; }
@ -1184,14 +1187,14 @@ void move_objects(int what, int merge, double dx, double dy)
case LINE:
if(c!=k) break;
if(xctx->line[c][n].bus){ /* bbox before move */
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->line[c][n].y1 < xctx->line[c][n].y2)
{ y1 = xctx->line[c][n].y1-ov; y2 = xctx->line[c][n].y2+ov; }
else { y1 = xctx->line[c][n].y1+ov; y2 = xctx->line[c][n].y2-ov; }
bbox(ADD, xctx->line[c][n].x1-ov, y1 , xctx->line[c][n].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->line[c][n].y1 < xctx->line[c][n].y2)
{ y1 = xctx->line[c][n].y1-ov; y2 = xctx->line[c][n].y2+ov; }
@ -1235,14 +1238,14 @@ void move_objects(int what, int merge, double dx, double dy)
line[c][n].y2=xctx->ry2;
if(xctx->line[c][n].bus){ /* bbox after move */
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->line[c][n].y1 < xctx->line[c][n].y2)
{ y1 = xctx->line[c][n].y1-ov; y2 = xctx->line[c][n].y2+ov; }
else { y1 = xctx->line[c][n].y1+ov; y2 = xctx->line[c][n].y2-ov; }
bbox(ADD, xctx->line[c][n].x1-ov, y1 , xctx->line[c][n].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->line[c][n].y1 < xctx->line[c][n].y2)
{ y1 = xctx->line[c][n].y1-ov; y2 = xctx->line[c][n].y2+ov; }
@ -1520,7 +1523,8 @@ void move_objects(int what, int merge, double dx, double dy)
xctx->ui_state &= ~STARTMOVE;
if(xctx->ui_state & STARTMERGE) xctx->ui_state |= SELECTION; /* leave selection state so objects can be deleted */
xctx->ui_state &= ~STARTMERGE;
xctx->x1=xctx->y_1=xctx->x2=xctx->y_2=xctx->move_rot=xctx->move_flip=xctx->deltax=xctx->deltay=0;
xctx->move_rot=xctx->move_flip=0;
xctx->x1=xctx->y_1=xctx->x2=xctx->y_2=xctx->deltax=xctx->deltay=0.;
bbox(SET , 0.0 , 0.0 , 0.0 , 0.0);
draw();
bbox(END , 0.0 , 0.0 , 0.0 , 0.0);

View File

@ -86,12 +86,12 @@ void hash_inst(int what, int n) /* 20171203 insert object bbox in spatial hash t
if( y2 < y1) { tmpd=y2;y2=y1;y1=tmpd;}
/* calculate square 4 1st bbox point of object[k] */
x1a=floor(x1/BOXSIZE);
y1a=floor(y1/BOXSIZE);
x1a=(int)floor(x1/BOXSIZE);
y1a=(int)floor(y1/BOXSIZE);
/* calculate square 4 2nd bbox point of object[k] */
x2a=floor(x2/BOXSIZE);
y2a=floor(y2/BOXSIZE);
x2a=(int)floor(x2/BOXSIZE);
y2a=(int)floor(y2/BOXSIZE);
/*loop thru all squares that intersect bbox of object[k] */
counti=0;
@ -228,9 +228,9 @@ void get_square(double x, double y, int *xx, int *yy)
{
int xa, xb, ya, yb;
xa=floor(x/BOXSIZE) ;
xa=(int)floor(x/BOXSIZE) ;
xb=xa % NBOXES; if(xb<0) xb+=NBOXES;
ya=floor(y/BOXSIZE) ;
ya=(int)floor(y/BOXSIZE) ;
yb=ya % NBOXES; if(yb<0) yb+=NBOXES;
*xx=xb;
@ -314,12 +314,12 @@ void hash_wire(int what, int n, int incremental)
if( y2 < y1) { tmpd=y2;y2=y1;y1=tmpd;}
/* calculate square 4 1st bbox point of wire[k] */
x1a=floor(x1/BOXSIZE) ;
y1a=floor(y1/BOXSIZE) ;
x1a=(int)floor(x1/BOXSIZE) ;
y1a=(int)floor(y1/BOXSIZE) ;
/* calculate square 4 2nd bbox point of wire[k] */
x2a=floor(x2/BOXSIZE);
y2a=floor(y2/BOXSIZE);
x2a=(int)floor(x2/BOXSIZE);
y2a=(int)floor(y2/BOXSIZE);
/*loop thru all squares that intersect bbox of wire[k] */
counti=0;
@ -476,12 +476,12 @@ static void wirecheck(int k) /* recursive routine */
/* ordered bbox */
RECTORDER(x1, y1, x2, y2);
/* calculate square 4 1st bbox point of wire[k] */
x1a=floor(x1/BOXSIZE) ;
y1a=floor(y1/BOXSIZE) ;
x1a=(int)floor(x1/BOXSIZE) ;
y1a=(int)floor(y1/BOXSIZE) ;
/* calculate square 4 2nd bbox point of wire[k] */
x2a=floor(x2/BOXSIZE);
y2a=floor(y2/BOXSIZE);
x2a=(int)floor(x2/BOXSIZE);
y2a=(int)floor(y2/BOXSIZE);
/*loop thru all squares that intersect bbox of wire[k] */
counti=0;

View File

@ -36,7 +36,6 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
{
unsigned int hashcode, index;
Node_hashentry *entry, *saveptr, **preventry;
char *ptr;
int s ;
Drivers d;
@ -59,8 +58,7 @@ static Node_hashentry *node_hash_lookup(const char *token, const char *dir,int w
if( what==XINSERT || what==XINSERT_NOREPLACE) /* insert data */
{
s=sizeof( Node_hashentry );
ptr= my_malloc(281, s );
entry=(Node_hashentry *)ptr;
entry=(Node_hashentry *)my_malloc(281, s);
entry->next = NULL;
entry->token = entry->sig_type = entry->verilog_type =
entry->value = entry->class = entry->orig_tok = NULL;

View File

@ -268,8 +268,8 @@ static void ps_draw_string_line(int layer, char *s, double x, double y, double s
{
double ix, iy;
short rot1;
unsigned char c;
int line_delta, offset;
unsigned char c, offset;
double line_delta;
double lines;
set_ps_colors(layer);
if(s==NULL) return;

View File

@ -252,15 +252,15 @@ static void read_binary_block(FILE *fd)
if(ac) {
for(v = 0; v < xctx->graph_nvars; v += 2) { /*AC analysis: calculate magnitude */
if( v == 0 ) /* log scale x */
xctx->graph_values[v][offset + p] = log10(sqrt( tmp[v] * tmp[v] + tmp[v + 1] * tmp[v + 1]));
xctx->graph_values[v][offset + p] = (float)log10(sqrt( tmp[v] * tmp[v] + tmp[v + 1] * tmp[v + 1]));
else /* dB */
xctx->graph_values[v][offset + p] = 20 * log10(sqrt(tmp[v] * tmp[v] + tmp[v + 1] * tmp[v + 1]));
xctx->graph_values[v][offset + p] = 20 * (float)log10(sqrt(tmp[v] * tmp[v] + tmp[v + 1] * tmp[v + 1]));
/* AC analysis: calculate phase */
xctx->graph_values[v + 1] [offset + p] = atan2(tmp[v + 1], tmp[v]) * 180.0 / XSCH_PI;
xctx->graph_values[v + 1] [offset + p] = (float)(atan2(tmp[v + 1], tmp[v]) * 180.0 / XSCH_PI);
}
}
else for(v = 0; v < xctx->graph_nvars; v++) {
xctx->graph_values[v][offset + p] = tmp[v];
xctx->graph_values[v][offset + p] = (float)tmp[v];
}
}
my_free(1406, &tmp);
@ -780,7 +780,7 @@ int plot_raw_custom_data(int sweep_idx, int first, int last, const char *expr)
} /* switch(...) */
} /* if(stackptr2 > 0) */
} /* for(i = 0; i < stackptr1; i++) */
y[p] = stack2[0];
y[p] = (float)stack2[0];
} /* for(p = first ...) */
ravg_store(0, 0, 0, 0, 0.0); /* clear data */
return xctx->graph_nvars;

View File

@ -569,7 +569,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"count_items"))
{
if(argc > 4) {
Tcl_SetResult(interp, itoa(count_items(argv[2], argv[3], argv[4])), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(count_items(argv[2], argv[3], argv[4])), TCL_VOLATILE);
}
cmd_found = 1;
}
@ -733,7 +733,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"expandlabel") && argc == 3)
{
int tmp, llen;
int tmp;
size_t llen;
char *result=NULL;
const char *l;
@ -811,7 +812,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
{
cmd_found = 1;
if(!strcmp(argv[2],"backlayer")) {
Tcl_SetResult(interp, itoa(BACKLAYER), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(BACKLAYER), TCL_VOLATILE);
}
else if(!strcmp(argv[2],"bbox_hilighted")) {
xRect boundbox;
@ -828,10 +829,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, res, TCL_VOLATILE);
}
else if(!strcmp(argv[2],"cadlayers")) {
Tcl_SetResult(interp, itoa(cadlayers), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(cadlayers), TCL_VOLATILE);
}
else if(!strcmp(argv[2], "case_insensitive")) {
Tcl_SetResult(interp, itoa(xctx->case_insensitive), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->case_insensitive), TCL_VOLATILE);
}
else if(!strcmp(argv[2], "color_ps")) {
if( color_ps != 0 )
@ -849,13 +850,13 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, xctx->current_win_path, TCL_VOLATILE);
}
else if(!strcmp(argv[2],"currsch")) {
Tcl_SetResult(interp, itoa(xctx->currsch),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->currsch),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"debug_var")) {
Tcl_SetResult(interp, itoa(debug_var),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(debug_var),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"draw_window")) {
Tcl_SetResult(interp, itoa(xctx->draw_window),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->draw_window),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"flat_netlist")) {
if( xctx->flat_netlist != 0 )
@ -864,10 +865,10 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"graph_lastsel")) {
Tcl_SetResult(interp, itoa(xctx->graph_lastsel),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->graph_lastsel),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"gridlayer")) {
Tcl_SetResult(interp, itoa(GRIDLAYER),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(GRIDLAYER),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"help")) {
if( help != 0 )
@ -876,11 +877,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"instances")) {
Tcl_SetResult(interp, itoa(xctx->instances), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->instances), TCL_VOLATILE);
}
else if(!strcmp(argv[2],"lastsel")) {
rebuild_selected_array();
Tcl_SetResult(interp, itoa(xctx->lastsel),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->lastsel),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"line_width")) {
Tcl_SetResult(interp, dtoa(xctx->lw), TCL_VOLATILE);
@ -916,19 +917,19 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"ntabs")) {
Tcl_SetResult(interp, itoa(new_schematic("ntabs", NULL, NULL)),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(new_schematic("ntabs", NULL, NULL)),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"pinlayer")) {
Tcl_SetResult(interp, itoa(PINLAYER),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(PINLAYER),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"rectcolor")) {
Tcl_SetResult(interp, itoa(xctx->rectcolor),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->rectcolor),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"sellayer")) {
Tcl_SetResult(interp, itoa(SELLAYER),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(SELLAYER),TCL_VOLATILE);
}
else if(!strcmp(argv[2],"semaphore")) {
Tcl_SetResult(interp, itoa(xctx->semaphore),TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(xctx->semaphore),TCL_VOLATILE);
}
#ifndef __unix__
else if(!strcmp(argv[2], "temp_dir")) {
@ -969,7 +970,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, "0",TCL_STATIC);
}
else if(!strcmp(argv[2],"textlayer")) {
Tcl_SetResult(interp, itoa(TEXTLAYER), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(TEXTLAYER), TCL_VOLATILE);
}
else if(!strcmp(argv[2],"top_path")) {
Tcl_SetResult(interp, xctx->top_path, TCL_VOLATILE);
@ -983,7 +984,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
Tcl_SetResult(interp, XSCHEM_VERSION, TCL_VOLATILE);
}
else if(!strcmp(argv[2],"wirelayer")) {
Tcl_SetResult(interp, itoa(WIRELAYER), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa(WIRELAYER), TCL_VOLATILE);
}
else if(!strcmp(argv[2],"xorigin")) {
char s[128];
@ -1030,7 +1031,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
/* 0 1 2 3 4 5 */
/* xschem getprop instance_pin X10 PLUS [pin_attr] */
/* xschem getprop instance_pin X10 1 [pin_attr] */
int inst, n=-1, tmp;
int inst, n=-1;
size_t tmp;
char *subtok=NULL;
const char *value=NULL;
if(argc != 6 && argc != 5) {
@ -1126,7 +1128,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"get_tok_size") )
{
Tcl_SetResult(interp, itoa((int)xctx->tok_size), TCL_VOLATILE);
Tcl_SetResult(interp, my_itoa((int)xctx->tok_size), TCL_VOLATILE);
}
else if(!strcmp(argv[1],"globals"))
@ -1558,7 +1560,8 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
else if(!strcmp(argv[1],"load") )
{
int load_symbols = 1, force = 0, i;
int load_symbols = 1, force = 0;
size_t i;
cmd_found = 1;
if(argc > 3) {
for(i = 3; i < argc; i++) {
@ -2049,7 +2052,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
int idx;
entry = int_hash_lookup(xctx->raw_table, argv[3], 0, XLOOKUP);
idx = entry ? entry->value : -1;
Tcl_AppendResult(interp, itoa(idx), NULL);
Tcl_AppendResult(interp, my_itoa(idx), NULL);
} else if(argc > 3 && !strcmp(argv[2], "values")) {
/* xschem raw_query values ldcp [dataset] */
int idx;
@ -2063,17 +2066,17 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
} else if(argc > 2 && !strcmp(argv[2], "datasets")) {
Tcl_AppendResult(interp, itoa(xctx->graph_datasets), NULL);
Tcl_AppendResult(interp, my_itoa(xctx->graph_datasets), NULL);
} else if(argc > 2 && !strcmp(argv[2], "points")) {
int dset = -1;
if(argc > 3) dset = atoi(argv[3]);
if(dset == -1) Tcl_AppendResult(interp, itoa(xctx->graph_allpoints), NULL);
if(dset == -1) Tcl_AppendResult(interp, my_itoa(xctx->graph_allpoints), NULL);
else {
if(dset >= 0 && dset < xctx->graph_datasets)
Tcl_AppendResult(interp, itoa(xctx->graph_npoints[dset]), NULL);
Tcl_AppendResult(interp, my_itoa(xctx->graph_npoints[dset]), NULL);
}
} else if(argc > 2 && !strcmp(argv[2], "vars")) {
Tcl_AppendResult(interp, itoa(xctx->graph_nvars), NULL);
Tcl_AppendResult(interp, my_itoa(xctx->graph_nvars), NULL);
} else if(argc > 2 && !strcmp(argv[2], "list")) {
for(i = 0 ; i < xctx->graph_nvars; i++) {
if(i > 0) Tcl_AppendResult(interp, "\n", NULL);
@ -3090,7 +3093,7 @@ int tclvareval(const char *script, ...)
while( (p = va_arg(args, const char *)) ) {
size = my_strcat(1380, &str, p);
}
return_code = Tcl_EvalEx(interp, str, size, TCL_EVAL_GLOBAL);
return_code = Tcl_EvalEx(interp, str, (int)size, TCL_EVAL_GLOBAL);
va_end(args);
if(return_code != TCL_OK) {
dbg(0, "tclvareval(): error executing %s: %s\n", str, tclresult());

View File

@ -236,7 +236,7 @@ static void del_rect_line_arc_poly(void)
{
j++;
if(xctx->line[c][i].bus){
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw);
if(xctx->line[c][i].y1 < xctx->line[c][i].y2) { y1 = xctx->line[c][i].y1-ov; y2 = xctx->line[c][i].y2+ov; }
else { y1 = xctx->line[c][i].y1+ov; y2 = xctx->line[c][i].y2-ov; }
@ -402,13 +402,13 @@ void delete(int to_push_undo)
if(xctx->wire[i].sel == SELECTED) {
j++;
if(xctx->wire[i].bus){
int ov, y1, y2;
double ov, y1, y2;
ov = INT_BUS_WIDTH(xctx->lw)> cadhalfdotsize ? INT_BUS_WIDTH(xctx->lw) : CADHALFDOTSIZE;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }
bbox(ADD, xctx->wire[i].x1-ov, y1 , xctx->wire[i].x2+ov , y2 );
} else {
int ov, y1, y2;
double ov, y1, y2;
ov = cadhalfdotsize;
if(xctx->wire[i].y1 < xctx->wire[i].y2) { y1 = xctx->wire[i].y1-ov; y2 = xctx->wire[i].y2+ov; }
else { y1 = xctx->wire[i].y1+ov; y2 = xctx->wire[i].y2-ov; }

View File

@ -191,7 +191,7 @@ static void svg_draw_string_line(int layer, char *s, double x, double y, double
{
double ix, iy;
short rot1;
int line_delta;
double line_delta;
double lines;
char col[20];
if(color_ps)

View File

@ -274,13 +274,13 @@ static void init_color_array(double dim, double dim_bg)
if(i == BACKLAYER) tmp_dim = dim_bg;
else tmp_dim = dim;
if(tmp_dim>=0.) {
r +=(51.-r/5.)*tmp_dim;
g +=(51.-g/5.)*tmp_dim;
b +=(51.-b/5.)*tmp_dim;
r +=(int)((51.-r/5.)*tmp_dim);
g +=(int)((51.-g/5.)*tmp_dim);
b +=(int)((51.-b/5.)*tmp_dim);
} else {
r +=(r/5.)*tmp_dim;
g +=(g/5.)*tmp_dim;
b +=(b/5.)*tmp_dim;
r +=(int)((r/5.)*tmp_dim);
g +=(int)((g/5.)*tmp_dim);
b +=(int)((b/5.)*tmp_dim);
}
/* fprintf(errfp, "init_color_array: colors: %.16g %.16g %.16g dim=%.16g c=%d\n", r, g, b, dim, i); */
if(r>0xff) r=0xff;
@ -1493,7 +1493,7 @@ void change_linewidth(double w)
changed=0;
/* choose line width automatically based on zoom */
if(w<0.) {
int cs;
double cs;
cs = tclgetdoublevar("cadsnap");
if(tclgetboolvar("change_lw")) {
xctx->lw=xctx->mooz * 0.09 * cs;

View File

@ -176,34 +176,34 @@ extern char win_temp_dir[PATH_MAX];
#define STARTWIRE 1 /* possible states, encoded in global 'rubber' */
#define STARTRECT 4
#define STARTLINE 8
#define SELECTION 16 /* signals that some objects are selected. */
#define STARTSELECT 32 /* used for drawing a selection rectangle */
#define STARTMOVE 64 /* used for move/copy operations */
#define STARTCOPY 128 /* used for move/copy operations */
#define STARTZOOM 256 /* used for move/copy operations */
#define STARTMERGE 512 /* used fpr merge schematic/symbol */
#define MENUSTARTWIRE 1024 /* start wire invoked from menu */
#define MENUSTARTLINE 2048 /* start line invoked from menu */
#define MENUSTARTRECT 4096 /* start rect invoked from menu */
#define MENUSTARTZOOM 8192 /* start zoom box invoked from menu */
#define STARTPAN 16384 /* new pan method with mouse button3 */
#define PLACE_TEXT 32768
#define MENUSTARTSNAPWIRE 65536 /* start wire invoked from menu, snap to pin variant 20171022 */
#define STARTPOLYGON 131072
#define MENUSTARTPOLYGON 262144
#define STARTARC 524288
#define MENUSTARTARC 1048576
#define MENUSTARTCIRCLE 2097152
#define PLACE_SYMBOL 4194304 /* used in move_objects after place_symbol to avoid storing intermediate undo state */
#define START_SYMPIN 8388608
#define GRAPHPAN 16777216
#define SELECTED 1 /* used in the .sel field for selected objs. */
#define SELECTED1 2 /* first point selected... */
#define SELECTED2 4 /* second point selected... */
#define SELECTED3 8
#define SELECTED4 16
#define STARTRECT 4U
#define STARTLINE 8U
#define SELECTION 16U /* signals that some objects are selected. */
#define STARTSELECT 32U /* used for drawing a selection rectangle */
#define STARTMOVE 64U /* used for move/copy operations */
#define STARTCOPY 128U /* used for move/copy operations */
#define STARTZOOM 256U /* used for move/copy operations */
#define STARTMERGE 512U /* used fpr merge schematic/symbol */
#define MENUSTARTWIRE 1024U /* start wire invoked from menu */
#define MENUSTARTLINE 2048U /* start line invoked from menu */
#define MENUSTARTRECT 4096U /* start rect invoked from menu */
#define MENUSTARTZOOM 8192U /* start zoom box invoked from menu */
#define STARTPAN 16384U /* new pan method with mouse button3 */
#define PLACE_TEXT 32768U
#define MENUSTARTSNAPWIRE 65536U /* start wire invoked from menu, snap to pin variant 20171022 */
#define STARTPOLYGON 131072U
#define MENUSTARTPOLYGON 262144U
#define STARTARC 524288U
#define MENUSTARTARC 1048576U
#define MENUSTARTCIRCLE 2097152U
#define PLACE_SYMBOL 4194304U /* used in move_objects after place_symbol to avoid storing intermediate undo state */
#define START_SYMPIN 8388608U
#define GRAPHPAN 16777216U
#define SELECTED 1U /* used in the .sel field for selected objs. */
#define SELECTED1 2U /* first point selected... */
#define SELECTED2 4U /* second point selected... */
#define SELECTED3 8U
#define SELECTED4 16U
#define WIRE 1 /* types of defined objects */
#define xRECT 2
@ -682,7 +682,7 @@ typedef struct
/* context struct for waveform graphs */
typedef struct {
int i; /* index number of container rectangle */
double digital;
int digital;
double rx1, ry1, rx2, ry2, rw, rh; /* container rectangle */
double sx1, sy1, sx2, sy2; /* screen coordinates of above */
/* graph box (smaller than rect container due to margins) */
@ -776,7 +776,7 @@ typedef struct {
int simdata_ninst;
int modified;
int semaphore;
int tok_size;
size_t tok_size;
char netlist_name[PATH_MAX];
int flat_netlist;
char current_dirname[PATH_MAX];
@ -1282,9 +1282,9 @@ extern void print_vhdl_element(FILE *fd, int inst);
extern void print_verilog_element(FILE *fd, int inst);
extern const char *get_tok_value(const char *s,const char *tok,int with_quotes);
extern const char *list_tokens(const char *s, int with_quotes);
extern int my_snprintf(char *str, int size, const char *fmt, ...);
extern size_t my_snprintf(char *str, size_t size, const char *fmt, ...);
extern size_t my_strdup(int id, char **dest, const char *src);
extern void my_strndup(int id, char **dest, const char *src, int n);
extern void my_strndup(int id, char **dest, const char *src, size_t n);
extern size_t my_strdup2(int id, char **dest, const char *src);
extern char *my_strtok_r(char *str, const char *delim, const char *quote, char **saveptr);
extern int my_strncpy(char *d, const char *s, int n);
@ -1298,7 +1298,7 @@ extern void *my_calloc(int id, size_t nmemb, size_t size);
extern void my_free(int id, void *ptr);
extern size_t my_strcat(int id, char **, const char *);
extern size_t my_mstrcat(int id, char **str, const char *append_str, ...);
extern char *itoa(int i);
extern char *my_itoa(int i);
extern char *dtoa(double i);
extern char *dtoa_prec(double i);
extern double my_round(double a);