RTimothyEdwards / XCircuit

XCircuit circuit drawing and schematic capture tool
GNU General Public License v2.0
110 stars 24 forks source link

Patch for label anchoring and LaTeX mode #4

Closed agustincampeny closed 4 years ago

agustincampeny commented 4 years ago

XCircuit has been my primary schematic drawing tool since I started studying EE, and everything has been smooth except for LaTeX mode, which has never worked for me.

A couple days ago I got into the source files and found a problem in the following bit of code:

https://github.com/RTimothyEdwards/XCircuit/blob/18dc343fefeaa941f0ca224a5c97067914ae3cb2/tclxcircuit.c#L4468-L4478

As you can see there, jval only gets assigned when there are no extra arguments in the TCL command, as in $label latex, which returns the current value for the selected label. The problem is that when I try to set the value running $label latex 1, then jval is never assigned, and it's value is undefined, so the comparison in line 4475 is never true.

This problem replicates to adjacent functions that use the getanchoring() function.

I was able to fix this and also made some improvements in the LaTeX file generation routine in the functions.c source file, which fixed the problem completely.

Hoping this could be of use for others, maybe I can share my patches or make a pull request.

For context my operating system is MacOS 10.14.6, and i'm running the MacPorts version of XCircuit 3.10.17. From what I remember this issue was also present in Linux, but I'm not sure if it was solved.

RTimothyEdwards commented 4 years ago

Sounds good! Please make a pull request, and I'll update the distribution.

RTimothyEdwards commented 4 years ago

Thanks for the pull request. Sorry for the delay in responding; I was working on an imminent chip tape-out full time for the past two days. Since the weekend promises to be cold and windy, I can take care of pull requests instead of doing yardwork. . .

RTimothyEdwards commented 4 years ago

The distribution has been updated, thanks!