From 39cd1a77ed1cfc34e673341f9e98d61e8ebcc9d4 Mon Sep 17 00:00:00 2001 From: Stefan Schippers Date: Sat, 3 Oct 2020 04:33:52 +0200 Subject: [PATCH] fix a regression in delete(): instance hash was not updated. removed some redundant drawing in copy operations --- src/.save.swp | Bin 4096 -> 0 bytes src/callback.c | 2 +- src/improvement.txt | 194 -------------------------------------------- src/move.c | 31 ++++--- src/select.c | 12 ++- 5 files changed, 29 insertions(+), 210 deletions(-) delete mode 100644 src/.save.swp delete mode 100644 src/improvement.txt diff --git a/src/.save.swp b/src/.save.swp deleted file mode 100644 index b14c2ea97c74f4a163f9d658f3d2ac49e7bbd135..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmYc?2=nw+u+TGN00IFJ0Rabv85oL_GcpSbQj1|?xai!(s?5CfL|oEv@j94+`V~M{ zYOZckYC*n!Nl|HDwtjI@vVL)5St?xdC}T7PMnizgA;8OEY-DHvGE`YfQ9)QJl*;Ch i8aEmOqaiRF0;3@?8UmvsFd71*Aut*OqaiSuLjVBBju~SB diff --git a/src/callback.c b/src/callback.c index 2322d450..bf122079 100644 --- a/src/callback.c +++ b/src/callback.c @@ -139,7 +139,7 @@ int callback(int event, int mx, int my, KeySym key, mousey=Y_TO_XSCHEM(my); mousex_snap=ROUND(mousex / cadsnap) * cadsnap; mousey_snap=ROUND(mousey / cadsnap) * cadsnap; - if(lastselected > 1) my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s", + my_snprintf(str, S(str), "mouse = %.16g %.16g - selected: %d path: %s", mousex_snap, mousey_snap, lastselected, sch_path[currentsch] ); statusmsg(str,1); switch(event) diff --git a/src/improvement.txt b/src/improvement.txt deleted file mode 100644 index e0eed896..00000000 --- a/src/improvement.txt +++ /dev/null @@ -1,194 +0,0 @@ -- make currentsch++ safe (check bounds) -- erich converters: - https://github.com/erichVK5/translate2coralEDA - -- info on devmapping: - http://www.delorie.com/pcb/pin-mapping.html - http://repo.hu/projects/cschem/design/07_devmap.html - http://wiki.friendlyarm.com/wiki/images/f/fd/Schematic_NanoPi-NEO-V1.4-1801-20180320.pdf - -- global=1 attribute for global pins (vdd.sym, gnd.sym etc ) should be 'global=true' --done-- - to be consistent with all other boolean attributes. - - -Igor2 -Stefan, here's the concept: svn://repo.hu/openhw/projects/lab/tester -far from finished, so please don't yet redraw -Vuokko, yes, as usual -Igor2 -Stefan, the tricky idea is: 74374 is edge triggered, it reads the input and latches it to the output on an edge of clk -so the firmware would do 3 things: -it would set the frist 8 outputs on PA0..7 and do an edge for U2 - it will be ignored by U3 because it gets clk inverted -then it would set the second 8 outputs on PA0..7 and invert the clk signal, so U3 would latch in the input, U2 ignoring it -and the third thing is after this: without changing the clock, it would set PA0..7 to analog input and run 8 ADC conversionns loading 8 values -for each of the 4 input channels, I have 2 opamp channels -one does the level shift in a way that -5..+5V input ends up as 0..1.1V output (the ADC needs this level) -the other converts 0..15 in to 0..1.1V -so this is "range selection" -for small signals I will have about 10/1024 V resolution, that is about 0.01V (+- adc errors) -I'll need to use the small signal range for negative voltages -for large signal, above +5V, I need to use the other adc input, where I have 15/1024, about 0.015V resolution and no shift -@jmp_ghli -(SVN) pcb-rnd rev: 22511 by blinken | [lesstif] -Fix: dlg_test crash, check at tree rendering if the model list is empty.| -Igor2 -Stefan, the tricky part is that I can achieve all 16 output channels and 4 input channels with range selection using only 9 pins, which allows me to use this small MCU -Igor2 -(normally this isn't worth it, it's usually cheaper to buy a bigger MCU with more pins, but I have tons of recycled 74374s and 4 chan opamps, so those are for free for me) -Igor2 -I don't yet know if it really works, it's only a concept at the moment -stefan -Igor2, reading slowly ( in a meeting now :)) -tnx 4 now -Igor2 -when you are back, there is one more interesting thing to observe: -for the output driver ICs, I used large, per package symbols while for input opamps I used slotted symbols -the reason is that the output doesn't have any extra parts around it, so splitting it up would only clutter the drawing -on input side I have a lot of resistors around each opamp, so slotted makes more sense, makes the drawing more readable -stefan -so for output you uswe x1 packages while for inputs you use xn slotted devs? -iiuc -Igor2 -yes -on the same sch -so it's really per case specific -when we have the slots grouped and it's really just a ladder of all-in-all-out, it's usually better to go for non-slotted -so a good rich lib has both slotted and non-slotted for these kind of ICs - - -- allow any filename, do not enforce/assume .sch /.sym extension --done-- in 1.1 file format - -- documentation: tutorial on xschem libraries --done-- - -- add 'devmap=devfile' attribute: netlister will look for mapfile for - symbol attributes. this will allow to reverse / change connecions naming etc - - - - - -- external program that can be used to change pinnumber mapping - xschem sends symbol on stdin to devmap program, devmap spits out new - symbol, xschem reads it from stdout - -- display one UI box per key=value pairs in edit property -- documentation: style guide for symbols -- add the possibility of referencing a 'golden' symbol from where to pick up - attributes -- separate grid off / axes off -- make bindings to external apps (simulators, viewers) more customizable -- free all static (char *) variabled declared in functions before leaving - -- remove cairo code and still use ttf fonts ? (--> Igor2) -- add 'cut poly' command to transform a poly line into segments (lines) -- remove polygon points that become coincident after a stretch operation -- allow repositioning of symbol text at instance level. -- experiment SDL graphics - ------ - -- rotate/flip objects as they are selected without requiring a move operation --done-- -- easy navigate between library directories when placing a symbol --done-- -- allow components with duplicate names, do not enforce auto-rename --done-- -- documentation: tutorial on xschem slotting (tedax) --done-- -- propagate $PREFIX actual location to manpages --done-- -- add option to create netlist in specified output directory --done-- -- specify output file in --png, --postscript, --svg --> --plotfile --done-- -- make first load of schematics/symbols appear with correct line widths --done-- -- version number in sch/sym files --done-- -- more symbols --done-- - - lm358, slotted so(8) - - 2n7002 sot23 -- '.' in pathlist search path should be the directory of the containing schematic, not the xschem xwd --done-- -- add '*' in window title /icon title when file modified --done-- -- integrate ngspice --done-- -- change the way to change layer colors - (ctrl-menu click is not working for many users) --done-- -- save only one copy of embedded symbols. --done-- -- allow 'token = value' in property strings (allow spaces around '=') --done-- -- update svgdraw for arcs/circles --done-- -- make color changes made by the user persistent (~/.xschem/colors) --done-- -- 'About' dialog box --done-- -- change window / icon title to 'xschem - ' --done-- -- color picker to allow change layer colors --done-- -- update psprint for arcs/circles --done-- -- print png/pdf/svg to rename to export --done-- -- ctrl-Q to exit app --done-- -- c89 --done-- -- long option names, version info, update help (xschem -h, xschem --version, xschem --help) --done-- -- L 200 200 300 300 {} crashes xschem (no layer #) --done-- -- C {} ..... {} crashes xschem (empty sym reference) --done-- -- display connecting dots when drawing nets --done-- -- make menus ordered so moving with arrow will go in a predictable way --done-- -- circles/arcs --done-- -- standard pathname resolution --done-- -- implement tcl command 'xschem setprop ... ' --done-- -- undo files and other temp files in /tmp --done-- -- undo/redo: remove direct unix calls pipe() and fork() and use popen. much simpler & portable --done-- -- modify polygon drawing primitive to handle open/close polygons --done-- -- add requirements for libcairo2-dev and libfl-dev in documentation --done-- -- embedded symbols in schematic --done-- -- allow mouse click repeat last command as option -- done for wires and lines -- -- manhattan route when drawing wires -- done for lines and wires -- -- display connection dots --done-- -- command to break wires at intersections and instance pins --done-- - -about popen/pclose - -ok. And what is your suggestion to replace popen/pclose? well in old checkins of xschem i was using pipe/fork/execlp/dup2 and friends, i thought using popen/pclose was more portable :-( -Igor2 -the only real portable thing is system -we can detect popen -if here's no popen we can detect pipe+fork+dup and that can give a trivial replacement -(the reason why pipe+fork+dup should not _always_ be used instead of popen is mainly windows: you do have popen there but no fork or pipe) -you don't need dup2, it's just a convenience call, plain old dup can do what you need -(it's a bit hackish) -stefan -ok i was asking because i knew dup2 was not portable, but out of the box i dont know how to replace it -Igor2 -easy: -dup uses the lowes available fd -so you just need to close/dup in the right order -stefan -but in't this exposed to race conditionas? -conditions* -may be not an issue n xschem -Igor2 -if you don't use threads: no -stefan -ok -perfect -Igor2 -or at elast you shouldn't: -- start threads before finishing the dup's -stefan -i do not . -Igor2 -- or if you do start threads, you should keep file operations in one -warning: -tcl does use threads in some situations, whether you want it or not -but -the normal recipe is this: -fork(); if you are in child: series of close/dup -(in the parent you don't need dup/dup2 anyway, arbitrary file descriptors are fine) -then after you finished all the close/dup magic in the child, you exec() -between the fork and the exec there's no therading -stefan -ok -Igor2 -by the exec you have all the fds sorted, so the new process can do whatever it wants to -* stefan copying this text , heehhe -Igor2 -if you work on this: -just assume a #define for popen, something like HAS_POPEN -and another for fork -stefan -ok -Igor2 -close and dup are pretty much portable -just add them in your generated config.h, so you can experiment -stefan -ok -thank you -Igor2 -if you start using any new posix/modern-bsd call, just invent a HAS for it -when you already know what you need detected, just drop me a mail and I'll add the detection (usually in a morning coding slot) diff --git a/src/move.c b/src/move.c index 422e2942..bbefb7b4 100644 --- a/src/move.c +++ b/src/move.c @@ -475,7 +475,7 @@ void find_inst_to_be_redrawn(const char *node) void copy_objects(int what) { int c, i, n, k; - Box tmp; + /* Box tmp; */ double angle; int newpropcnt; double tmpx, tmpy; @@ -485,7 +485,7 @@ void copy_objects(int what) /* 20171112 */ #ifdef HAS_CAIRO char *textfont; - int customfont; /* 20181009 */ + /* int customfont; */ #endif if(what & BEGIN) @@ -546,14 +546,17 @@ void copy_objects(int what) prepared_hash_wires=0; if(show_pin_net_names) find_inst_hash_clear(); /* calculate copied symbols bboxes before actually doing the move */ + + /* for(i=0;i cadhalfdotsize ? bus_width : CADHALFDOTSIZE; if(wire[n].y1 < wire[n].y2) { y1 = wire[n].y1-ov; y2 = wire[n].y2+ov; } @@ -574,6 +578,7 @@ void copy_objects(int what) else { y1 = wire[n].y1+ov; y2 = wire[n].y2-ov; } bbox(ADD, wire[n].x1-ov, y1 , wire[n].x2+ov , y2 ); } + */ if(rotatelocal) { ROTATION(wire[n].x1, wire[n].y1, wire[n].x1, wire[n].y1, rx1,ry1); ROTATION(wire[n].x1, wire[n].y1, wire[n].x2, wire[n].y2, rx2,ry2); @@ -620,7 +625,7 @@ void copy_objects(int what) { case LINE: if(c!=k) break; - bbox(ADD, line[c][n].x1, line[c][n].y1, line[c][n].x2, line[c][n].y2); /* 20181009 */ + /* bbox(ADD, line[c][n].x1, line[c][n].y1, line[c][n].x2, line[c][n].y2) */ if(rotatelocal) { ROTATION(line[c][n].x1, line[c][n].y1, line[c][n].x1, line[c][n].y1, rx1,ry1); ROTATION(line[c][n].x1, line[c][n].y1, line[c][n].x2, line[c][n].y2, rx2,ry2); @@ -658,15 +663,17 @@ void copy_objects(int what) case POLYGON: /* 20171115 */ if(c!=k) break; { - double bx1, by1, bx2, by2; + /* double bx1, by1, bx2, by2; */ double *x = my_malloc(227, sizeof(double) *polygon[c][n].points); double *y = my_malloc(228, sizeof(double) *polygon[c][n].points); int j; for(j=0; j bx2) bx2 = polygon[c][n].x[j]; if(j==0 || polygon[c][n].y[j] > by2) by2 = polygon[c][n].y[j]; + */ if( polygon[c][n].sel==SELECTED || polygon[c][n].selected_point[j]) { if(rotatelocal) { ROTATION(polygon[c][n].x[0], polygon[c][n].y[0], polygon[c][n].x[j], polygon[c][n].y[j], rx1,ry1); @@ -679,8 +686,8 @@ void copy_objects(int what) x[j] = polygon[c][n].x[j]; y[j] = polygon[c][n].y[j]; } - bbox(ADD, bx1, by1, bx2, by2); /* 20181009 */ } + /* bbox(ADD, bx1, by1, bx2, by2); */ drawpolygon(k, NOW, x, y, polygon[c][n].points, polygon[c][n].fill, polygon[c][n].dash); /* 20180914 added fill */ selectedgroup[i].n=lastpolygon[c]; store_polygon(-1, x, y, polygon[c][n].points, c, polygon[c][n].sel, polygon[c][n].prop_ptr); @@ -691,10 +698,11 @@ void copy_objects(int what) break; case ARC: if(c!=k) break; + /* arc_bbox(arc[c][n].x, arc[c][n].y, arc[c][n].r, arc[c][n].a, arc[c][n].b, &tmp.x1, &tmp.y1, &tmp.x2, &tmp.y2); bbox(ADD, tmp.x1, tmp.y1, tmp.x2, tmp.y2); - + */ if(rotatelocal) { /* rotate center wrt itself: do nothing */ rx1 = arc[c][n].x; @@ -722,7 +730,7 @@ void copy_objects(int what) case xRECT: if(c!=k) break; - bbox(ADD, rect[c][n].x1, rect[c][n].y1, rect[c][n].x2, rect[c][n].y2); /* 20181009 */ + /* bbox(ADD, rect[c][n].x1, rect[c][n].y1, rect[c][n].x2, rect[c][n].y2); */ if(rotatelocal) { ROTATION(rect[c][n].x1, rect[c][n].y1, rect[c][n].x1, rect[c][n].y1, rx1,ry1); ROTATION(rect[c][n].x1, rect[c][n].y1, rect[c][n].x2, rect[c][n].y2, rx2,ry2); @@ -742,7 +750,7 @@ void copy_objects(int what) case xTEXT: if(k!=TEXTLAYER) break; check_text_storage(); - /* 20181009 */ + /* #ifdef HAS_CAIRO customfont = set_text_custom_font(&textelement[n]); #endif @@ -754,7 +762,7 @@ void copy_objects(int what) if(customfont) cairo_restore(ctx); #endif bbox(ADD, rx1, ry1, rx2, ry2 ); - + */ if(rotatelocal) { ROTATION(textelement[n].x0, textelement[n].y0, textelement[n].x0, textelement[n].y0, rx1,ry1); } else { @@ -903,7 +911,6 @@ void copy_objects(int what) find_inst_to_be_redrawn(wire[n].node); } } - /* draw_symbol(ADD,k, n,k, 0, 0, 0.0, 0.0); */ } filledrect(k, END, 0.0, 0.0, 0.0, 0.0); diff --git a/src/select.c b/src/select.c index 93090ca6..aa3c7c71 100644 --- a/src/select.c +++ b/src/select.c @@ -221,8 +221,11 @@ void delete(void) /* first calculate bbox, because symbol_bbox() needs translate (@#0:net_name) which needs prepare_netlist_structs * which needs a consistent inst_ptr[] data structure */ + + /* does not seem to be needed prepared_netlist_structs=0; prepared_hilight_structs=0; + */ if(show_pin_net_names) { find_inst_hash_clear(); prepare_netlist_structs(0); @@ -246,15 +249,16 @@ void delete(void) - + /* already done above for(i=0;i