Ternary function was not recognized in R, C, or L lines
if no voltage or current node was part of the expression,
because then B-Source is not used.
In these cases now inp_fix_ternary_operator_str() is called explicitly.
tc1, tc2 were sometimes recognized falsely,
if part of a token e.g. tc1end.
R, C, and L models are never commented out,
because their names may be token no. 4 or 5 in an R, C, or L line,
and will not be recognized if 5.
INPevaluate() will now correctly evaluate a number if followed by ':'
(number may be part of the ternary function).
Bug ID: `Buffer overflow detected - ID: 3510521'
reported by Zsolt Makaró
The variable `mag3' sometimes seems to take
unexpected values
(for example log10 can be -Inf, which will be casted to 0x80000000)
and seems then to have overflown a buffer buf[LABEL_CHARS]
transform doit() into a true recursive version,
drop usage of global variables
reduce scope of many variables
cleanup and readability
FIXME,
an opportunity to plug a memory leak is visible now.
in response to the `ex-41.cir' test case
distilled from a Dietmar Warning Bug report in
"Subject: Re: subckt, param"
translate() is called recursively and depends on
`num of nodes' provided by numnodes().
numnodes() depends on availability of `su_numargs'.
But the processing allows non-processing of subckt instantiations
in inner recursions (which will be processed later)
which means `su_numargs' is not always available.
Simon Guan reported
Bug item #3509528, `Meas goes wrong when put in a while loop'
In a .control block a `let' variable was passed to the `measure' command.
The value of this variable would have been a plain integer,
yet it was converted internally to an internal ascii representation
with exponential representation (203 ==> 2.03e2)
and then processed by `ft_numparse()' where it was converted back to
double floating point.
Because the intermediate 2.03 has
no exact representation in the space of double floating point numbers
this conversion was lossy and resulted in a non-integer value.
This non-integer was then truncated towards minus infinity in com_measure
yielding an error of -1
This commit implements round to nearest in com_measure2
to avoid the problem.
FIXME,
the internal intermediate conversion of double floating point machine
values to ascii representations must be dropped,
or replaced with an exact/lossless ascii representation.
(for example GNU printf/scanf %a or 64bit hexadecimal representation)
this worked
.subckt psub a b p2 = {p1*2-1} p1 = 1
but this failed
.subckt psub a b p2 = { p1 * 2 - 1 } p1 = 1
thanks to Ivan Riis Nielsen for the report in Message
[Ngspice-devel] parsing problem (ngspice-24 tarball)