libreadline, input handling and multi-threading


To ng-spice-devel@ieee.ing.uniroma1.it, ng-spice-frontends@ieee.ing.uniroma1.it
From Erik de Castro Lopo <erikd@zip.com.au>
Date Mon, 24 Apr 2000 06:34:04 +0000
Delivered-To mailing list ng-spice-devel@ieee.ing.uniroma1.it
Mailing-List contact ng-spice-devel-help@ieee.ing.uniroma1.it; run by ezmlm
Organization Erik Conspiracy Secret Labs
Reply-To ng-spice-devel@ieee.ing.uniroma1.it
Sender erikd@zip.com.au

Hi all,

I'm addressing this to both lists as it is both a development and
a frontend issue. Apologies to everyone on both lists.

I've spent a couple of hours grafting GNU's libreadline onto the
front of ngspice. This allows full command line editing and command
line history (both current session and between sessions) just like
the bash shell. I've also modified the configure.in file so that this 
is only enabled if ngspice is configured with 
"./configure --enable-readline". It is not used by default.

There was only one small problem with this; it broke all the X11 output. 
It turns out that ngspice only tests for pending X events and dispatches 
them when spice is waiting for input (ie a keypress). As a workaround
to this, I added a pthread to handle the X events. Like the readline
library, the pthread library is linked in if configured with 
"--enable-readline".

These mods do not seem to have any negative effect on ngspice's
non-interactive mode.

Paolo Nenzi mentioned that he is working on a release ngspice-rework-11.
When he releases that, I will forward port my changes and submit a patch
against rework-11. This will also give me a bit more time to test and
clean up my code :-).

Secondly, ngspice being derived from spice3f4/5 is missing a model
which most other spices (esp. the commercial ones) seem to have. Many
companies release OPAMP models using a line containing something like :

    EREF 1 0 POLY(2) 8 0 5 0 (0,0.5,0.5)

when spice3f4/5 only accepts a line of this form:

    EXXXXXXX N+ N- NC+ NC- VALUE

Apparently the former is legal under spice2, xspice (Galtech) and most
of the commercial spice variants. I know this can be re-written as a
Bsource line, but it would be nice for ngspice to understand this syntax
which is so common in standard opamp models.

If nobody else is looking at this at the moment, I volunteer to take
a look at this.

Ciao,
Erik
-- 
+-------------------------------------------------+
     Erik de Castro Lopo     erikd@zip.com.au
+-------------------------------------------------+
"640K ought to be enough for anybody."  -- Bill Gates, 1981

Partial thread listing: