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

Re: gEDA-user: gnucap: sweep doesn't work as described



On Wednesday 24 May 2006 07:27, Karel Kulhavy wrote:
> "sweep  5   R14=1,100k   R15=100k,1
>
> This sequence of commands says to simultaneously sweep R14
> and R15 in 5 steps, in opposite directions, list the circuit
> and do an AC analysis for each step."
>
> with gnucap 2006.05.06 and 2005.08.07 it sweeps only R14 and
> R15 stays all the time at the same value.

Thanks for the bug report.

The fault and modify (alter) commands have the same problem.  
That is actually where the problem is.

The sweep command code is planned for complete replacement, so 
recent regression testing is not up to current standards.

You can fix it with the following patch:

in c_modify.cc:======
@@ -72,10 +73,12 @@
        faultbranch(brh, sweep_fix(cmd,brh));
        break;
       }
+      cmax = std::max(cmax, cmd.cursor());
       ++ci;
     }
     cmd.reset(cmax);
     if (mark == cmax) {
==========
or ....
add the line:
    cmax = std::max(cmax, cmd.cursor());
after line 75, which should contain a lone curly brace.

The problem is that the cursor is misplaced while parsing the 
line, looking for additional parts.

This module does not have proper regression tests, so it was 
missed.  It must have happened a long time ago, when a minor 
change was made to accommodate other changes.  No real changes 
have been made to this module in many years.

If you don't want to patch, you can work around it with the 
fault command:

gnucap> sweep 5
>>>fault  R14=1,100k
>>>fault  R15=100k,1
>>> (other stuff)
>>>go

You can use as many "fault" commands this way as you want.