Permalink
glenn-sab
Commits on Dec 17, 2020
-
passed the context to exeternal scripts
Scripts executed by the exec action now receive the current context. Also reverted the memory leak fix in s_slot.c to match the master branch as a better version of the fix lives on the mem_leak branch and having different versions in two places is bad.
-
-
Lots of formatting fixes and a few bugs
Found several bugs and some untested error cases so fixed/added those as well. Don't really recall them all. - Most things in gEDA/gaf are case-sensitive, so it makes sense to treat SAB arguments as case-sensitive, as well. Done with a caveat. Becasue of the special meaning of the 'none' context it was left as case-insensitive. All others are now case sensitive. - You don't need "nobase_" on your "example_DATA" target (you don't have files in subdirectories), but it doesn't hurt, either. Fixed it anyway - Header files (especially public ones) should only include those other header files which they minimally require in order to work. AFAICT, for "sab.h", this would be just "struct.h". Fixed. - Don't assign variables inside function calls unless you have a good reason to do so. Assigning from "strtok" inside "while" in sab.c is one of the few cases where this is ok (as the assignment can't be put on a separate line without hurting readability); most other cases are not. <sigh> Fixed as far as I know. The one in s_slot.c (part of my memory leak fix) will be fixed as part of the broader memory leak fixes on the master branch. - "TOPLEVEL *" variables are called "toplevel" (all lower-case) in the existing code, so it's a good idea to follow this convention for new code, as well. Fixed - gEDA/gaf Python code should reside within the "gaf" top-level package. You basically have two choices for organizing the SAB code: either (1) have individual sub-modules of gaf by placing the code files in "xorn/src/python/", then import "gaf.sab" and call "gaf.sab.process", or (2) group the SAB source as a sub-package by placing the code in "xorn/src/python/sab/", then import "gaf.sab.sab" and call "gaf.sab.sab.process" I'd go with the first option, but either way is okay. Went with option #1 - You are processing the "--sab-context" command-line argument in "netlist.py", so it is not necessary to process it in "gnetlist.in", as well. You can just pass it through unchanged. Fixed - User-visible messages should be wrapped in _("...") in order to be translatable. Fixed in python... - Since you use the tuple (order, action, parms) in multiple places, it may be worth defining a collections.namedtuple for that purpose. Done - Don't use something like 1000000000 as a special value. If you have to store the absence of a value in-band, use something that cannot ever occur as a valid value, like -1 or None. (And if you *really* have to use a magic value somewhere, please define it as a constant.) Fixed - In modify_refdes.py, the variable "refdes" is either a list or a string. Since the expression "'C' in ..." works in both cases, I suggest replacing "list(levels.upper())" with "levels.upper()". Done - You don't need types.StringType and types.ListType; "isinstance(..., str)" and "isinstance(..., list)" work just fine. Fixed as far as I know - Using "dir(m)" to determine whether a variable is defined in a module feels a bit too hacky. I'm not sure yet how I'd prefer this to be solved; if you absolutely have to make the code depend on whether or not there is such a variable, use it and catch an AttributeError. <sigh> Fixed...still makes my skin crawl - Instead of: ''.zfill(4 * indent).replace('0', ' ') you can just do: ' ' * indent Done -
-
sab would crash if there was nothing to do for the specified context.
-
Fixed a bunch (most? [maybe all? nah..]) of the formatting issues.
-
Changed SAB to non-verbose output, warnings are still issued. Fixed a potential problem by checking to make sure contexts are strings modified: xorn/src/sab/sab.py -
This patch shows how to convert an existing backend to enable SAB processing. The requirments: The identifier must be 'SAB_CONTEXT' The identifier must refer to a list of strings Generally a single line is all that is needed. modified: xorn/src/backend/gnet_partslist1.py
-
I forgot to update the README in the examples/SAB directory which had a TODO listed for the slotting issue addressed by the last commit. Also added the printout TODO. modified: examples/SAB/README
-
make gschem update the pin #s for bypass sab-param when changing slot
1. Added isolated SAB code. Given a component object the code extracts all the sab-param attributes and parses them (ignoring any that are malformed) producing a data structure. The contents of that data structure can then be modified. After modification the structure can be converted back into sab-param attributes which replace the source attributes. Any attributes that were ignored for being malformed are left untouched. Currently the only supported modification is to replace bypass pin #s. modified: libgeda/include/Makefile.am new file: libgeda/include/libgeda/sab.h modified: libgeda/src/Makefile.am new file: libgeda/src/sab.c 2. Add calls to the SAB system to s_slot_update_object so the bypass pin numbers are updated when the slot is changed. Note when manually changing the slot number the bypass pin changes are reflected in the sab-param shown in the schematic but not the one shown in the 'Attributes' panel. That one is updated if the component is deselected and then reselected causeing the panel to reload the attributes. This should certainly be fixed but right now I don't have the time to figure out where the change needs to be made. Also identified a memory leak so fixed that as well. modified: libgeda/src/s_slot.c TODO: Need to figure out how to have the sab-param attributes affect printout. I didn't do it because I really don't need it but mostly because I couldn't come up with good solutions to: 1) How to specify which context you are producing hardcopy for. 2) How to draw bypass connections on a device with more than two pins and/or where the pins are not directly across from each other. 3) How to handle exec actions in hardcopy. Maybe somebody smarter/more motivated than me can figure out a solution. Adding the SAB functionality to gschem was really only a convience item anyway.
-
Added optional component processing order because I saw an easy way t…
…o do it. 1. Added optional field to the sab-param attribute modified: xorn/src/sab/sab.py 2. Added test cases modified: examples/SAB/sab.sch 3. Updated README accordigly modified: examples/SAB/README
-
1. Added exec test cases, tweaked README, and yet more revision of test cases modified: examples/SAB/README modified: examples/SAB/sab.sch 2. Added test/example script modified: examples/SAB/Makefile.am new file: examples/SAB/modify_refdes.py 3. Since processing can now occur prior to netlist generation it may be useful to have a do nothing backend modified: xorn/src/backend/Makefile.am new file: xorn/src/backend/gnet_null.py 4. Implement exec action modified: xorn/src/sab/sab.py modified: xorn/src/sab/sab_utils.py
-
Implement bypass action and others
1. Broke out the utility functions so they can be more cleanly used by external scripts (exec to be added) modified: xorn/src/sab/Makefile.am modified: xorn/src/sab/sab.py new file: xorn/src/sab/sab_utils.py 2. Added/modified various test cases to sab.sch modified: examples/SAB/sab.sch 3. Implement the bypass action (modifications to sab_util.py) Note: bypass makes use of the gaf.netlist.net.merge_into function which appears to be undocumented, but worked very nicely.
-
Implement discard action, and more
1. Extend description of SAB markup modified: README 2. Add test cases to schematic modified: sab.sch 3. Fix a bug that caused gnetlist to pass an empty string as the sab-context modified: ../../xorn/src/command/gnetlist.in 4. Implement discard action modified: ../../xorn/src/sab/sab.py
-
1. add a new attribute 'sab-param' to the list of attributes in gschem modified: gschem/lib/system-gschemrc.scm 2. set 'sab-param=ab:discard' as the default for spice-title-1.sym modified: symbols/spice/spice-title-1.sym 3. add new parameter 'sab-context' to gnetlist w/ basic checks & pass it to xorn modified: xorn/src/command/gnetlist.in 4. add new package 'sab' to hold the SAB processing code modified: xorn/Makefile.am modified: xorn/configure.ac new file: xorn/src/sab/Makefile.am new file: xorn/src/sab/__init__.py new file: xorn/src/sab/sab.py 5. cause xorn-netlist to use --sab-context if provided, look for a context in the backend and call the SAB code if a context is avalable, passing the netlist and context list modified: xorn/src/command/netlist.py 6. add a description of SAB and a test-bed/example modified: configure.ac modified: examples/Makefile.am new file: examples/SAB/Makefile.am new file: examples/SAB/README new file: examples/SAB/sab.sch
Commits on Dec 16, 2020
-
-
-
-
-
-
-
-
gschem: Don't scroll log window unless realized
gtk_text_view_scroll_to_iter doesn't check if the text view has a layout; if it hasn't, an assertion in gtk_text_layout_get_iter_location is violated, and the program aborts. In order to avoid that, check if the text view is realized before trying to scroll it.
-
-
-