Stefan Schippers
08/21/2022, 9:41 PMalterparam vgs=$&vgs_act
Let me know if this works.
From section 17.1
of the `ngspice user manual`:
The csh-like scripting language is active in .control sections. It works on ‘strings’, and
does string substitution of ‘environment’ variables. You see the csh at work in ngspice
with set foo = "bar"; set baz = "bar$foo", and in if, repeat, for, ... constructs.
However, ngspice processes mainly numerical data, and support for this was not avail-
able in the c-sh implementation. Therefore, Berkeley implemented an additional type of
variables, with different syntax, to access double and complex double vectors (possibly of
length 1). This new variable type is modified with let, and can be used without special
syntax in places where a numerical expression is expected: let bar = 4 * 5; let zoo
= bar * 4 works. Unfortunately, occasionally one has to cross the boundary between the
numeric and the string domain. For this purpose the $& construct is available – it queries
a variable in the numerical let domain, and expands it to a c-sh string denoting the value.
This lets you do do something like set another = "this is $&bar". It is important
to remember that set can only operate on (c-sh) strings, and that let operates only on
numeric data. Convert from numeric to string with $&, and from string to numeric with
$.
There is a nice tutorial here.Belal Ali
08/24/2022, 3:48 AM