[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: tragesym's wordswap option and spaces



Hi!

the template file says: "# wordswap swaps labels if the pin is on the
right side an looks like this: #   "PB1 (CLK)". That's useful for micro
controller port labels"

i would have expected, that it would look for a '(' and will swap
everything before (excluding trailing whitespace) with everything after
(including the '('). but it looks for tokens separated with spaces and
reverses the order of the tokens. example: "PD1 (AIN0, INT1)" will
become "INT1) (AIN0, PD1".

of course the name suggests what it really is intended for, but i think
the behavior i described is more useful, especially for
microcontrollers ;)

attached is a patch, that adds the behavior i would expect, e.g. "PD1
(AIN0, INT1)" would become "(AIN0, INT1) PD1".
to enable it the option wordswap has to be set to "bracket" instead of
"yes".

PS: tragesym also presets 400 as the distance between pins, which
should be 300 according to the symbol creation guidelines afaik.
-- 
regards, Stefan Tauner
170,179d169
< ## swaps a bracket term with the string before it and returns them space-separated
< ## does not check for well formedness.
< def swapbracket(str): 
<     list=str.partition("(")
<     ## if there is no (, do not modify
<     if len(list[2])==0:
<         return str
<     else:   
<         return list[1]+list[2]+" "+list[0].rstrip()
< 
468,469d457
<         elif o_wordswap=="bracket" and swap==1:
<             label=swapbracket(pin.label)

_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user