Commit Graph

4498 Commits

Author SHA1 Message Date
rlar a6a3d884ee fix commit "mifsetup.c, MIFunsetup(), #1/3 delete broken code"
which silently dropped the
  here->initialized = MIF_FALSE
aspect of the MIFunsetup() function

which caused segfault in testcase
  examples/memristor/memristor_x.sp
2017-06-06 16:42:32 +02:00
Tim Edwards fd79197fc0 xspice/icm/digital, introduce d_genlut
a digital n-input x m-output look-up table gate
2017-05-01 22:11:24 +02:00
Tim Edwards 8ae3b84c7c xspice/icm/digital, introduce d_lut
a digital n-input look-up table gate
2017-05-01 22:11:04 +02:00
h_vogt 37fe5308d3 xspice/icm/table, introduce table2d/table3d
which allows to model devices based upon linear interpolation
2017-04-30 17:00:15 +02:00
rlar a7cc37b2e2 ifparm, fix numdev too 2017-04-19 19:18:13 +02:00
h_vogt cc8fb86411 diotemp.c, set lower limit of saturation current 'is' to epsmin 2017-04-19 18:57:20 +02:00
h_vogt c82ee9d949 introduce option "epsmin"
To define a minimum argument for some log() function invocations.
(most notably for the diode saturation current 'is')
2017-04-19 18:56:00 +02:00
dwarning 78cc48575b prevent warnings for double declared variables 2017-04-17 20:53:30 +02:00
rlar 2f329bd8b4 N_MXVLNTH, drop noise variable name limitation 2017-04-15 17:21:24 +02:00
h_vogt 306ada7dd0 inpcom.c, get_model_type(), use gettok_noparens() to extract model type
Takes care of model descriptions in parentheses like
  d(...)
2017-04-12 22:00:07 +02:00
h_vogt 1ffb957e6c inpcom.c, inp_fix_subckt_multiplier(), cleanup, using strchr() 2017-04-12 21:48:13 +02:00
rlar 2f1219811e src/spicelib/devices/*/*set.c, XXXunsetup(), reset local node variables unconditionally
and use a more robust test for local node numbers.

That is, transform this pattern :
  if (here->Node && ...) {
     CKTdltNNum(ckt, here->Node);
     here->Node = 0;
  }
into this :
  if (here->Node > 0 && ...)
     CKTdltNNum(ckt, here->Node);
  here->Node = 0;

The change of "!= 0" ==> "> 0" accounts for rare cases where "Node"
   might have been set to -1, (meaning "unconnected")
The unconditional execution of the zero assignment is for those cases
  where "Node" might have been assigned to some external or other local Node.
If so, the variable would not be set to zero, confusing the "guarding" if's
  in the corresponding XXXsetup() routine.

The Pattern to follow is:
  1) unset and delete *all* local Nodes in XXXunsetup()
  2) allocate all of them again in a re-invocation of XXXsetup(),
       exactly the same way as in the very first invocation.
2017-04-12 21:34:05 +02:00
rlar 00c743c37d src/spicelib/devices/*/*def*.h, declare external node variables const
for almost all other external nodes (notable exception "txl")
src/spicelib/devices/*/*def*.h, declare external node variables const

1) The compiler shall emit an error message if we still mess around
     with external node numbers.
2) To mark which elements of the instance struct are meant to be set
     externally when parsing the netlist

These "external" node variables are exclusively set via the
  overlay struct GENinstance, member GENnode[]

We shall not mess around with these "external" node variables
  because it would get rather difficult to avoid bugs considering
  re-invocation of the XXXsetup() routine.
This gets interesting for devices with optional ports,
  which get copied around depending on the amount of connected ports.
2017-04-12 21:34:02 +02:00
rlar 0e9576cb34 src/spicelib/devices/*/*set.c, missing CKTdltNNum() invocations, complex cases
All locally created nodes (CKTmk..() invocations in XXXsetup())
  must be deleted in XXXunsetup()

Otherwise CKTmk..() invocations during a following CKTsetup()
  will re-emit still used node numbers,
  thus accidentally shorting nodes.

This patch fixes the complex cases,
  which are external node variables (ports of the instance),
  which might be moved over to other external node variables
  to cope with optional port connections.
This is fixed by copying the node numbers to local shadow variables
  to avoid messing with the external nodes.
Otherwise a following CKTsetup() might again meddle with the external
  node variables, at least causing considerable confusion, probably causing
  hard to find bugs.
2017-04-12 21:34:00 +02:00
rlar c0921250b7 src/spicelib/devices/*/*set.c, missing CKTdltNNum() invocations, medium cases
All locally created nodes (CKTmk..() invocations in XXXsetup())
  must be deleted in XXXunsetup()

Otherwise CKTmk..() invocations during a following CKTsetup()
  will re-emit still used node numbers,
  thus accidentally shorting nodes.

This patch fixes a little bit more complex cases,
  which are local node variables which will start with value 0
  and eventually be set with the result of a CKTmk..() invocations,
  but might as well receive a node number from another node variable.
Here CKTdltNNum() must not be invoked if the node number is merely
  a copy from another node variable.
2017-04-12 21:33:59 +02:00
rlar 1fd14fa2ee src/spicelib/devices/*/*set.c, missing CKTdltNNum() invocations, simple cases
All locally created nodes (CKTmk..() invocations in XXXsetup())
  must be deleted in XXXunsetup()

Otherwise CKTmk..() invocations during a following CKTsetup()
  will re-emit still used node numbers,
  thus accidentally shorting nodes.

This patch fixes the simple cases,
  which are local node variables which will start with value 0
  and eventually be set with the result of a CKTmk..() invocation.
More complex cases evolve, if such a local variable might receive
  a node number which origins from another node, or the netlist itself.
2017-04-12 21:33:58 +02:00
rlar 0c86adf9af src/spicelib/devices/*/*set.c, XXXunsetup(), sort CKTdltNNum() invocations
Invoke CKTdltNNum() in reverse order of local node creation in XXXsetup()

This fixes a bug at least in mesa and hfet1,
  where already destroyed node variables have still been accessed
  in the guarding 'if' of a later CKTdltNNum() stanza.
Invoking them in revers order easily prevents such bugs,
  and improves readability.
2017-04-12 21:33:50 +02:00
rlar 7afb798a6f check for illegal DEVsetup() DEVunsetup() patterns.
Consider the following silent contracts:
1)
 CKTsetup() invocations must be separated by a CKTunsetup() invocation
 But CKTsetup() has an internal flag,
   which will prevent re-invocation of DEVsetup()
 But DEVsetup() will be called during sensitivity analysis,
   bypassing this precaution. It is fatal if this will
   cause another node allocation (CKTmk..()).
   This commit tries to detect such cases.
   (Note: many DEVsetup routines (all ?) have their CKTmk..() invocations
      guarded to avoid reallocation of local nodes,
      see commit f7f454c0a1
        bug fix, fix the guard for device generated internal nodes (via CKTmkVolt())
   )
   FIXME:
     DEVsetup() is seriously obfuscated by these guards.
     If would be far better, if the sensitivity analysis
       wouldn't sidestep into DEVsetup()
     consider a device local variant of the CKTisSetup flag
2)
 DEVunsetup() must delete all, each and every,
   local allocated node in DEVsetup()
 Otherwise CKTmk..() invocations in a following CKTsetup() will
   return duplicate node numbers, effectively shorting device nodes.
 This commit tries to detect incomplete CKTdltNNum() invocations.
3)
  DEVunsetup() must not delete a netlist node.
  This can easily happen in those devices which have optional ports,
    which have code in DEVsetup() which copies node numbers to
    local node variables.
  This commit tries to detect such errors.
2017-04-12 21:32:51 +02:00
h_vogt 69b235531e sharedspice.c, introduce csh variable "sharedmode"
to reflect whether running as shared library
2017-04-12 21:22:22 +02:00
h_vogt 0bf381e01d cpitf.c, for Windows, introduce csh variable "win_console"
to reflect whether this .exe is a "console" build
2017-04-12 21:11:13 +02:00
h_vogt 670880086f cpitf.c, MS Visual Studio, introduce csh variable "pg_config"
reflecting .exe compilation for
  32/64 bit
  with/without NGDEBUG
2017-04-12 21:01:57 +02:00
h_vogt d7a1899210 runcoms.c, rawfile.c, include filename in the 'ASCII/binary raw file' printout 2017-04-12 20:45:51 +02:00
rlar 926ba4baaf xspice/icm/analog/file_source/cfunc.mod, use CALLBACK
to free() locally allocated memory and fclose() a local filestream
2017-04-12 20:14:47 +02:00
rlar 58874cc65e xspice, implement "CALLBACK"
Allow to register a callback function in the cfunc.mod files,
  which will be invoked in MIFdestroy.
Usefull to "free" memory which has been allocated locally in a cfunc.mod file.
2017-04-12 20:02:35 +02:00
mhx 5f0f54761a xspice, analog/file_source, bug fix
The source code did not consider the possibility
  of more than one "tran" analysis invocations.

see "Bewildering problem with filesource block while sweeping"
https://sourceforge.net/p/ngspice/discussion/133842/thread/52949e23/
2017-04-12 20:01:14 +02:00
rlar 4872580221 mifsetup.c, MIFunsetup(), #3/3 now invoke CKTdltNNum() 2017-04-12 18:41:07 +02:00
rlar 9154f83c37 mifsetup.c, MIFunsetup(), #2/3 copy paste from MIFsetup() 2017-04-12 18:38:26 +02:00
rlar c68a0313bd mifsetup.c, MIFunsetup(), #1/3 delete broken code 2017-04-12 18:38:25 +02:00
dwarning 48262e5c0a extend safe operation area check (SOA) to polarity check for mosfets by additional parameters 2017-04-11 21:31:54 +02:00
rlar 46ab21dca9 inpcom.c, is_a_modelname(), don't accept "1E2" 2017-04-09 20:19:35 +02:00
h_vogt 847a09fd37 inpcom.c, get_number_terminals(), ignore "save" and "print" when CIDER 2017-04-09 18:33:12 +02:00
h_vogt e5d70d0821 gnuplot.c, bug fix, allow gnuplot with MINGW 2017-04-09 17:53:40 +02:00
rlar ccfcc056ad inpcom.c, bug fix, allow leading '_' in parameter identifiers 2017-04-09 15:38:15 +02:00
rlar c6896cf338 accept .para shortcut for .param 2017-04-09 15:37:46 +02:00
rlar 900bed550d string.c, #6/6, use skip_ws() and skip_back_ws() 2017-04-09 15:35:44 +02:00
rlar 0da47c644b string.c, #5/6, cleanup 2017-04-09 15:35:41 +02:00
rlar 5b23b54769 string.c, #4/6, cleanup token fetching 2017-04-09 15:35:38 +02:00
rlar c6a3438408 string.c, #3/6, cleanup 'return' 2017-04-09 15:35:35 +02:00
rlar ed13e8a15a string.c, #2/7, drop 'register' 2017-04-09 15:35:32 +02:00
rlar d48bec757c string.c, #1/6, whitespace 2017-04-09 15:35:29 +02:00
rlar fb1c6fc123 ifparm, #16/16, isrc.c, non grouped alias entry, change "c" from IP to IOPPR 2017-04-09 15:29:44 +02:00
rlar 762314b893 ifparm, #15/16, ind.c, missing IF_AC|IF_PRINCIPAL in alias entry, use IOPAPR 2017-04-09 15:29:43 +02:00
rlar d32a32bdc8 ifparm, #14/16, res.c, missing IF_ORQUERY|IF_REDUNDANT, introduce IOPQOR 2017-04-09 15:29:42 +02:00
rlar cefb65507f ifparm, #13/16, res.c, missing IF_SETQUERY in an alias entry, introduce IOPQR 2017-04-09 15:29:41 +02:00
rlar 8d3acddc7b ifparm, #12/16, res.c, missing IF_PRINCIPAL in an alias entry, introduce IOPPR 2017-04-09 15:29:40 +02:00
rlar 614eebe944 ifparm, #11/16, res.c, missing IF_CHKQUERY for some alias entries, introduce IOPZR 2017-04-09 15:29:40 +02:00
rlar ff00855397 ifparm, #10/16, jfet2.c, missing IF_REDUNDANT for some aliases, introduce PARAMR 2017-04-09 15:29:39 +02:00
rlar cee466b35e ifparm, #9/16, mes.c, "m" is an alias of "area", use IOPUR 2017-04-09 15:29:38 +02:00
rlar f0e2b43940 ifparm, #8/16, excess IF_REDUNDANT for some aliases, use IOP 2017-04-09 15:29:37 +02:00
rlar 102a6b7c77 ifparm, #7/16, missing IF_UNINTERESTING for some aliases, introduce IOPUR 2017-04-09 15:29:36 +02:00
rlar 4fc33eb656 ifparm, #6/16, missing IF_NONSENSE for some aliases, introduce IOPXR 2017-04-09 15:29:35 +02:00
rlar b56c2a2504 ifparm, #5/16, missing IF_AC for some aliases, introduce IOPAR 2017-04-09 15:29:34 +02:00
rlar eac26d741c ifparm, #4/16, missing IF_REDUNDANT for some aliases, introduce IOPAPR 2017-04-09 15:29:33 +02:00
rlar 445860f79a ifparm, #3/16, missing IF_REDUNDANT for some aliases, use IOPR 2017-04-09 15:29:32 +02:00
dwarning 115b52a899 ifparm, #2/16, missing IF_REDUNDANT, duplicates and descriptions 2017-04-09 15:29:30 +02:00
dwarning e0fcdc7457 ifparm, #1/16, missing IF_REDUNDANT for vth0/vtho in bsim models 2017-04-09 15:23:15 +02:00
rlar 1e6b809af8 introduce command "check_ifparm" to check consistency of the device IFparm sets
For developing purpose only, and bound to HAVE_TSEARCH, HAVE_TDESTROY

IFparm descriptors must obey certain contracts,
  1) aliases must be grouped together with their associated main descriptor,
       and all must have flag IF_REDUNDANT set
  2) there shall be no duplicated .id fields except for aliases.
  3) aliased entries shall have consistent .dataType fields

check_ifparm will traverse all IFparm sets and report violations
2017-04-09 14:40:51 +02:00
h_vogt cf9dbff890 inpcom.c, cleanup, use strchr() 2017-04-09 14:14:45 +02:00
rlar 2df8f433f8 inp.c, inp_parse_temper(), rewrite, using search_idenifier and find_assignment
try to make it more robust with regard to
  '!=' '<=' '=='         don't misinterpret as '='
  "atemperaticvariable"  don't misinterpret as 'temper'
  multiple temper in one expression
2017-04-09 14:14:36 +02:00
rlar 511389ad10 inpcom.c, introduce find_back_assignment() 2017-04-09 14:14:06 +02:00
rlar 5238f0b1cb inpcom.c, find_assignment(), const'ify and declare extern 2017-04-09 14:12:22 +02:00
rlar 4c44027cd2 inp.c, inp_parse_temper(), cleanup 2017-04-09 14:12:13 +02:00
rlar 2809ccaa13 shrink scope of expr_w_temper 2017-04-09 14:06:27 +02:00
rlar 872ceeedc7 inp_temper_compat(), return expr_w_temper 2017-04-09 14:06:15 +02:00
rlar 2c35eebb0b invoke in_parse_temper_trees() and inp_evaluate_temper() unconditionally 2017-04-09 14:06:02 +02:00
rlar e35429a222 inpcom.c, introduce rem_tlist() 2017-04-09 14:03:11 +02:00
rlar c600312d01 deploy devtlist/modtlist in struct circ 2017-04-09 13:59:53 +02:00
rlar 2a50316304 inp_parse_temper(), add modtlist_p/devtlist_p arguments 2017-04-09 13:59:46 +02:00
rlar f78d8e21f0 inp_parse_temper_trees(), add struct circ argument 2017-04-09 13:59:38 +02:00
rlar f2f2b3b09a inp_evaluate_temper(), add struct circ argument 2017-04-09 13:49:43 +02:00
rlar fa13e422cd inpcom.c, bug fix, always reset expr_w_temper 2017-04-09 13:49:32 +02:00
rlar 5513d8bdf3 inpcom.c, bug fix, expr_w_temper missing reset 2017-04-09 13:49:22 +02:00
rlar c920946c73 inp.c, bug fix, need to reset modtlist/devtlist unconditionally 2017-04-09 13:49:13 +02:00
rlar 12de713ff5 inp.c, bug fix, commit "allow 'temper' keyword in .param, .model and device instance lines ..."
don't overwrite struct pt_temper.expression,
  to allow free'ing this string.
2017-04-09 13:49:05 +02:00
h_vogt 648de2a001 cktdojob.c, add missing evaluation of TEMPER after new temperature is set
This is relevant for model and device parameters containing TEMPER.
2017-04-09 13:48:55 +02:00
h_vogt 67e06bb4ac winmain.c, bug fix, #315 ngspice under windows 10 shows exception on quit
https://sourceforge.net/p/ngspice/bugs/315/

longjmp() creates segfault under Windows 10 (VS and MINGW)
somewhere when MainWindowProc() is processing the WM_CLOSE message.

Instead of raising SIGINT, directly call cp_doquit().
return 0 if "askquit" is set and the user declines to "quit".
This continues the simulation, if still active.
2017-04-09 12:46:38 +02:00
dwarning 33c7740884 bsim4 model update according berkeley release - disclaimer change 2017-03-31 15:01:30 +02:00
dwarning 3f0096fd46 bsim4 model update according berkeley release - code change 2017-03-31 14:48:14 +02:00
rlar ab409ad62e protect vec_free() and free_pnode() macro for use in non braced blocks
if ()
  vec_free()
2017-03-25 19:54:40 +01:00
rlar c7811a76df ngspice/fteext.h, whitespace and spelling 2017-03-25 19:41:32 +01:00
rlar cc15853b4f ngspice/ftedefs.h, whitespace and spelling 2017-03-25 19:11:33 +01:00
h_vogt d84387d449 CIDER, use controlled_exit(1) instead of exit(1) 2017-03-25 18:44:00 +01:00
rlar 2142cfdcce subckt.c, cleanup 2017-03-25 18:17:08 +01:00
rlar 9b01dbae95 subckt.c, numnodes(), #4/4, drop 'buf' 2017-03-25 18:17:07 +01:00
rlar 66b8b3de54 subckt.c, numnodes(), #3/4, rename argument 'name' --> 'line' 2017-03-25 18:17:04 +01:00
rlar 7b6070e6b9 subckt.c, numnodes(), #2/4, cleanup 2017-03-25 18:00:43 +01:00
rlar b18c06c441 subckt.c, numnodes(), #1/4, cleanup 2017-03-25 18:00:41 +01:00
rlar 33788f7052 remove excessive inp_evaluate_temper() prototypes 2017-03-22 21:47:43 +01:00
rlar 0fb21eaf4a subckt.c, translate(), #8/8 whitespace and comments 2017-03-22 21:25:46 +01:00
rlar f19a6c6390 subckt.c, translate(), #7/8 cleanup 2017-03-22 21:25:46 +01:00
rlar 49947e0279 subckt.c, translate(), #6/8 cleanup 2017-03-22 21:25:46 +01:00
rlar 2a4c34c401 subckt.c, translate(), #5/8 trailing 's' is never used 2017-03-22 21:25:46 +01:00
rlar 7169ad4bfa subckt.c, translate(), #4/8 don't append trailing whitespace 2017-03-22 21:25:46 +01:00
rlar 1f31f73295 subckt.c, translate(), #3/8 simplify 2017-03-22 21:25:45 +01:00
rlar e40485b8a3 subckt.c, translate(), #2/8 cleanup 2017-03-22 21:25:45 +01:00
rlar 476c41f436 subckt.c, translate(), #1/8 cleanup 2017-03-22 21:25:45 +01:00
rlar 405c6f6f02 subckt.c, introduce translate_mod_name() 2017-03-22 21:25:45 +01:00
rlar db213fd8d2 subckt.c, devmodtranslate(), dupplicate code from above
and drop a redundant piece
2017-03-22 21:25:45 +01:00
rlar c653161666 subckt.c, introduce translate_inst_name()
to abstract the instance name translation during netlist flattening
2017-03-22 21:25:45 +01:00
rlar a54a535dd5 subckt.c, introduce translate_node_name() 2017-03-22 21:25:45 +01:00
rlar bab59844ff subckt.c, emphasize instance_name translation
When translating an instance_name in a subcircuit instance 'xfoo'
undconditionally express the exception for 'x' instances, which is:
  x42 --> xsub.x42
but for all others the first char (the devtype) is prepended
  r42 --> r.xsub.r42
2017-03-22 21:25:45 +01:00
rlar e3b3cc502a subckt.c, translate(), emphasize instance_name translation 2017-03-22 21:25:45 +01:00
rlar a03a57c9f9 subckt.c, emphasize token separator insertion 2017-03-22 21:25:44 +01:00
rlar 6b78ed4367 subckt.c, devmodtranslate(), rewrite using bxx_ facility 2017-03-22 21:25:44 +01:00
rlar 4d69002144 subckt.c, translate(), rewrite using bxx facility 2017-03-22 21:25:39 +01:00
rlar 13b6daae2f subckt.c, translate(), cleanup while() loop 2017-03-22 20:53:22 +01:00
rlar a5dd826d19 subckt.c, finishLine(), #9/9, unconditionally transform instance name in i() expressions 2017-03-22 20:53:14 +01:00
rlar dc092c4ebc subckt.c, finishLine(), #8/9, fuse two if's with the same conditional expr 2017-03-22 20:52:10 +01:00
rlar 99d788cd12 subckt.c, finishLine(), #7/9, drop condition which is always true 2017-03-22 20:50:59 +01:00
rlar 253cf5b75a subckt.c, finishLine(), #6/9, drop condition which is always false 2017-03-22 20:50:38 +01:00
rlar ff4805c023 subckt.c, finishLine(), #5/9, move/duplicate code behind if/else into the if/else 2017-03-22 20:49:53 +01:00
rlar 735e7700ce subckt.c, finishline(), #4/9, reorder 2017-03-21 20:27:20 +01:00
rlar 8ab28df4ec subckt.c, finishline(), #3/9, here *src === '(' 2017-03-21 20:27:19 +01:00
rlar 5d3896c388 subckt.c, finishline(), #2/9, rewrite 2017-03-21 20:27:18 +01:00
rlar 0502e83fba subckt.c, finishline(), #1/9, trivial cleanup 2017-03-21 20:27:17 +01:00
rlar f12ff5464e inpptree.c, PTdifferentiate(), cleanup, use a #define
to express the expressions arguments more readable
2017-03-19 21:06:49 +01:00
rlar d696aa8781 niconv.c, NIconvTest(), NaN in CKTrhs denotes non-convergence
emit a warning message, but only if ft_ngdebug is set
2017-03-19 20:38:41 +01:00
rlar dc6e1cb064 use strchr() instead of strstr() 2017-03-19 20:24:49 +01:00
rlar bd50814677 drop 'depreciated_skip..()' 2017-03-19 20:13:11 +01:00
rlar 7a42510cc0 const'ify some 'skip'ing functions 2017-03-19 20:12:25 +01:00
rlar 45ad60b738 rename gettok_nc() --> nexttok(), and functionalize it 2017-03-19 20:11:01 +01:00
rlar f338dfe27e subckt.c, undo a bogous hunk from commit "beautify code", Dec 16 2011 2017-03-19 20:07:34 +01:00
rlar f9019a5576 devices/*/*ld.c, bug fix, missing assignment to 'model' 2017-03-19 19:47:25 +01:00
mhx efb8214945 fix spelling, "too much" versus "too many" 2017-03-18 20:49:28 +01:00
rlar 889aaebfd7 inp2m.c, #7/7, whitepace cleanup 2017-03-18 20:44:21 +01:00
rlar 576e522d38 inp2m.c, #6/7, reorder code 2017-03-18 20:44:13 +01:00
rlar 73e76fd88a inp2m.c, #5/7, drop nname[] 2017-03-18 20:44:04 +01:00
rlar 74145c53a6 inp2m.c, #4/7, move code up into the for loop 2017-03-18 20:43:55 +01:00
rlar 5a95487ad7 inp2m.c, #3/7, simpify, move code down into the for loop 2017-03-18 20:43:46 +01:00
rlar 788c8f7067 inp2m.c, #2/7, simplify, move code down into for loop 2017-03-18 20:43:38 +01:00
rlar bef3fd1dd5 inp2m.c, #1/7, insist on a valid model, don't default to something
Emit an error message when unable to identify a valid modelname token.

If a default model is needed, then create one explicitly:
  m1 1 2 3 4 mosdefault
  .model mosdefault mos1()
2017-03-18 20:43:19 +01:00
rlar 80ef8b308d inp2m.c, do not restrict binning to four nodes
until now, for unknown reasons,
  the search for binned modelnames was restricted to
  instances with less than five nodes.
2017-03-18 20:18:11 +01:00
rlar 50c0424225 inp2q.c, inp2m.c, plug a memory leak 2017-03-18 20:15:39 +01:00
Francesco Lannutti 43f24d6f22 rewrite cktsens.c in terms of the 'SMP' matrix interface 2017-03-17 18:22:36 +01:00
rlar fb4f462388 SMPnewMatrix(), add 'size' to the function arguments 2017-03-17 18:12:48 +01:00
rlar 07d89b5fcd devices/**, unify structure member variables, ptr -> Ptr 2017-03-17 17:42:58 +01:00
rlar a6cb9d0d88 cplsetup.c, polish VECTOR_ALLOC and MATRIX_ALLOC
explicitly express the object type to be allocated
2017-03-17 17:37:24 +01:00
rlar 8c09761e6b adms, polish autogen.sh and configure.ac
Allow to override the admsXml executable when invoking
  autogen.sh and configure.ac

ADMSXML=/foo/bar/baz/admsXml ./autogen.sh --adms
ADMSXML=/foo/bar/baz/admsXml ./configure --enable-adms
alternatively (and more advertised)
./configure ADMSXML=/foo/bar/baz/admsXml --enable-adms

The generated Makefiles remember the given path.
A relative path doesn't make sense of course.
2017-03-12 19:34:37 +01:00
rlar 3ea412e7cd bug fix for commit "inp2q.c, #17/23, rewrite, using a 'for' loop" 2017-03-12 17:57:27 +01:00
rlar c3a92e2bb3 xspice, cleanup, move typedef over to the other ones 2017-03-12 12:18:09 +01:00
rlar 987952e57e adms/admst/ngspiceMODULEsetup.c.xml, adms, implement DEVunsetup()
Which is needed to release the allocated circuit nodes in
  the corresponding adms generated DEVsetup() routine.
This is required when invoking CKTsetup() more than once
  without an intervening "reset".
2017-03-12 10:43:32 +01:00
rlar 6ccccbe7c4 adms/admst/ngspiceMODULE.c.xml, fix the port name table
which will be exported from the model code to "spice" via
  struct IFdevice.terms
  struct IFdevice.numNames
  struct IFdevice.termNames
2017-03-12 10:41:52 +01:00
rlar ba6955a1aa inp2q.c, sanitise optional ports processing
Tie ports 4 and up to ground, iff not connected.

Actually, I think the model's DEVsetup routine should do this business,
  we should pass -1 to denote the fact of being unconnected
2017-03-11 21:11:32 +01:00
rlar 3ce3424a9c inp2q.c, #23/23, whitespace 2017-03-11 20:27:48 +01:00
rlar 9ad1a3033b inp2q.c, #22/23, drop #ifdef, model_numnodes() does care about this 2017-03-11 20:27:48 +01:00
rlar ac77e5b020 inp2q.c, #21/23, drop nname[] and model, use local 'token' instead 2017-03-11 20:27:47 +01:00
rlar 25fa9a4454 inp2q.c, #20/23, insist on a valid model, don't default to something
If a default model is needed, then create one explicitly:
 q1 1 2 3 npndefault
 .model npndefault npn()

Note:
  This code was buggy anyway because the last token,
    which turned out not to be a valid model name,
    was silently swallowed.
  Thus PARSECALL() didn't parse the whole thing.
2017-03-11 20:27:47 +01:00
rlar b85a07c62c inp2q.c, #19/23, rewrite, move code into the 'for' loop 2017-03-11 20:27:47 +01:00
rlar b1ccdd2184 inp2q.c, #18/23, rewrite, combine two 'for' loop's 2017-03-11 20:27:47 +01:00
rlar 807115c145 inp2q.c, #17/23, rewrite, using a 'for' loop 2017-03-11 20:27:47 +01:00
rlar 03d3e2ea12 inp2q.c, #16/23, emit a message and give up, if we couldn't find the modelname token
Thats a functional change of ngspice.

So far we did cook up a "default" model when we didn't find a model token.
But this was buggy anyway, because in such cases we silently dropped
  a token from beeing processed by PARSECALL()
Now, we emit a message, and skip this line alltogether.
2017-03-11 20:27:47 +01:00
rlar 83fb9353ef inp2q.c, #15/23, rewrite, fall into an empty 'else' body when !ADMS 2017-03-11 20:27:47 +01:00
rlar 0bf0021a63 inp2q.c, #14/23, rewrite, assign model a bit later when recognised 2017-03-11 20:27:47 +01:00
rlar ef37e92338 inp2q.c, #13/23, move code down 2017-03-11 20:27:47 +01:00
rlar d2d9bffed0 inp2q.c, #12/23, move code down
Note; here i==4 and nodeflag still was 4
2017-03-11 20:27:46 +01:00
rlar c8b1d18289 inp2q.c, #11/23, move code down
Note: here i==3 and nodeflag==4
2017-03-11 20:27:46 +01:00
rlar c5ce68728f inp2q.c, #10/23, use i to prepare for a loop 2017-03-11 20:27:46 +01:00
rlar a21a2fd1b0 inp2q.c, #9/23, drop some TRACE code 2017-03-11 20:27:46 +01:00
rlar 16c00730e4 inp2q.c, #8/23, use a 'for' loop
Note: the range of nodeflag still is {4,5}
2017-03-11 20:27:46 +01:00
rlar ffc943dfff inp2q.c, #7/23, use an array 2017-03-11 20:27:46 +01:00
rlar c82a9dd87e inp2q.c, #6/23, transform boolean expression
Note: both values range over {4,5}
Thus, this is a functional invariant transformation
2017-03-11 20:27:46 +01:00
rlar 27d93293f9 inp2q.c, #5/23, rewrite using a new function model_numnodes() 2017-03-11 20:27:46 +01:00
rlar b0fe181f12 inp2q.c, #4/23, transform boolean expression 2017-03-11 20:27:45 +01:00
rlar 042916ae88 inp2q.c, #3/23, renumber 'nodeflag'
range over {4,5} instead of {0,1}
2017-03-11 20:27:45 +01:00
rlar 9abcaa88ae inp2q.c, #2/23, parenthesises and linewrap 2017-03-11 20:27:42 +01:00
rlar c37ce079eb inp2q.c, #1/23, rewrite, early 'exit' and 'return' 2017-03-11 19:58:58 +01:00
rlar 40ca7d6db3 inp2m.c, #9/9c, cleanup 2017-03-07 21:54:42 +01:00
rlar eecd940af8 inp2m.c, #8/9c, drop valid_numnodes() 2017-03-07 21:54:33 +01:00
rlar 6edd684020 inp2m.c, #7/9c, rewrite valid_numnodes() using model_numnodes() 2017-03-07 21:54:23 +01:00
rlar 09fbc0ee97 inp2m.c, #6/9c, now fix model_numnodes()
to prevent instance struct storage beeing overwritten.
2017-03-07 21:54:13 +01:00
rlar 54f6bd8d56 inp2m.c, #5/9c, rewrite 2017-03-07 21:54:00 +01:00
rlar 01b75e08ab inp2m.c, #4/9c, rewrite using model_numnodes() 2017-03-07 21:53:50 +01:00
rlar 396441e1ea inp2m.c, #3/9c, abstraction, introduce model_numnodes()
Note:
  This commit does not change behaviour in any way,
    yet one can instantly see some sickness now.
  Some of the models definitely do not have 7 nodes,
  Actually we would like to fetch the number of terminals from
    struct IFdevice, slot terms or slot numNames
  But it turns out several models publish bogus values.
  For example "B4SOI", which has 7 nodes, but claims to have 8
2017-03-07 21:53:37 +01:00
rlar 3bb68fbd7a inp2m.c, #2/9c, rewrite using GENnode[] 2017-03-07 21:53:26 +01:00
rlar 81b5278674 inp2m.c, #1/9c, rename 'nodeflag' 2017-03-07 21:53:16 +01:00
rlar c89e7c8818 inp2m.c, #15/15b, collapse remaining code into a for loop 2017-03-05 17:23:20 +01:00
rlar 85236c08e6 inp2m.c, #14/15b, cleanup, drop empty blocks 2017-03-05 17:23:12 +01:00
rlar 8fa3afa4ae inp2m.c, #13/15b, rewrite, move common code to the end 2017-03-05 17:23:07 +01:00
rlar 3d6a2e2422 inp2m.c, #12/15b, unify, add code which won't be executed at all
actually, this most certainly unveils a bug in the original code,
  lacking invocation of INPgetModBin() when optional extra nodes come
  into play.
2017-03-05 17:23:03 +01:00
rlar 99136a16e7 inp2m.c, #11/15b, rewrite, use array expressions 2017-03-05 17:22:57 +01:00
rlar 7eb6006461 inp2m.c, #10/15b, use 'nodeflag' instead of literal values 2017-03-05 17:22:51 +01:00
rlar 7ab64775b8 inp2m.c, #9/15b, rewrite, use arrays for 'node' and 'mname' 2017-03-05 17:22:40 +01:00
rlar 395939d2f4 inp2m.c, #8/15b, unify, add two invocations without any effect 2017-03-05 17:22:02 +01:00
rlar 55c9c3a73b inp2m.c, #7/15b, cleanup some braces 2017-03-05 17:22:01 +01:00
rlar 7a1b65f045 inp2m.c, #6/15b, abstraction, introduce valid_numnodes() 2017-03-05 17:21:59 +01:00
rlar cff00524c2 inp2m.c, #5/15b, express some facts in comments for the following commits 2017-03-05 16:47:51 +01:00
rlar 0a95935e46 inp2m.c, #4/15b, unify code slightly 2017-03-05 16:47:14 +01:00
rlar f7b3f40c70 inp2m.c, #3/15b, set 'save' a little sooner 2017-03-05 16:46:39 +01:00
rlar 40c632f8a7 inp2m.c, #2/15b, drop TRACE code 2017-03-05 16:45:40 +01:00
rlar f9213e3fe4 inp2m.c, #1/15b, drop comments 2017-03-05 16:45:23 +01:00
rlar 6fde9353ea inp2m.c, #7/7, whitespace 2017-03-04 22:09:15 +01:00
rlar 11572fe9d0 inp2m.c, #6/7, polish comments 2017-03-04 19:16:11 +01:00
rlar f66d37463f inp2m.c, #5/7, renumber `nodeflag' 2017-03-04 19:16:11 +01:00
rlar 6a275a6bd9 inp2m.c, #4/7, rewrite 2017-03-04 19:16:11 +01:00
rlar 08b798c485 inp2m.c, #3/7, line wraps 2017-03-04 19:16:11 +01:00
rlar f23876e30c inp2m.c, #2/7, cleanup braces 2017-03-04 19:16:10 +01:00
rlar 80f58e98a8 inp2m.c, #1/7, cleanup comparisons 2017-03-04 19:16:10 +01:00
rlar a2347a28d6 inp2*.c, cleanup, drop redundant initialisation
which can be dropped to the recently fixed INPgetMod(), see
  inpgmod.c, INPgetMod(), bug fix, missing 'model' assignment

Note:
  there have been INPgetMod() invocations without initialisation,
    causing access to non-initialised memory with the unfixed INPgetMod()
2017-03-04 19:15:55 +01:00
rlar 56b2342df3 inpgmod.c, #15/15, whitespace 2017-03-04 18:47:19 +01:00
rlar fccdea429c inpgmod.c, #14/15, cleanup 2017-03-04 18:45:27 +01:00
rlar 0245f304ff inpgmod.c, #13/15, shortcut #if CIDER 2017-03-04 18:45:26 +01:00
rlar a8ffd52c42 inpgmod.c, #12/15, cleanup braces 2017-03-04 18:45:24 +01:00
rlar 627ed98464 inpgmod.c, #11/15, reduce scope and rewrite 2017-03-04 18:11:20 +01:00
rlar 66976d492e inpgmod.c, #10/15, reorder 'extern's 2017-03-04 18:11:14 +01:00
rlar 19e36dd4cb inpgmod.c, #9/15, drop trailing whitespace in messages 2017-03-04 18:11:13 +01:00
rlar 370420d00e inpgmod.c, #8/15, commute boolean expressions 2017-03-04 18:11:11 +01:00
rlar 4842cd39a7 inpgmod.c, #7/15, reduce scope and rewrite 2017-03-04 18:11:06 +01:00
rlar 3212b18115 inpgmod.c, #6/15, simplify return of boolean expressions 2017-03-04 18:11:05 +01:00
rlar 6ee483ed1d inpgmod.c, #5/15, simplify tprintf usage 2017-03-04 18:11:03 +01:00
rlar b329fd56fc inpgmod.c, #4/15, unify 'return' statements 2017-03-04 18:11:02 +01:00
rlar cdc8fbd192 inpgmod.c, #3/15, line wraps 2017-03-04 18:11:00 +01:00
rlar b0537a7e96 inpgmod.c, #2/15, polish comments 2017-03-04 18:10:57 +01:00
rlar 6cdd306fea inpgmod.c, #1/15, cleanup comparisons 2017-03-04 18:10:50 +01:00
rlar 5905ed26fa inpgmod.c, INPgetMod(), bug fix, missing 'model' assignment
'model' is a return value, and must always be assigned to.
NULL denotes the error case.
2017-03-04 17:16:03 +01:00
rlar c3275241a5 ckti2nod.c, cktbindnode.c, minor cleanup 2017-03-04 16:05:08 +01:00
rlar 239780ebef cleanup, use an array for struct GENinstance.GENnode 2017-03-04 16:04:32 +01:00
h_vogt 4eb32ab566 com_sysinfo.c, add recent Windows versions to info printout 2017-02-22 19:36:38 +01:00
h_vogt 7c06cb2d12 don't mess with WINVER
not necessairy for current Windows versions
2017-02-22 19:36:37 +01:00
h_vogt 78ea2e1523 winmain.c, remove of fcn 'read' in Windows 2017-02-22 19:36:34 +01:00
h_vogt 31dca54eba input.c, don't use read() in __MINGW32__ 2017-02-22 19:28:22 +01:00
rlar d9e7ab2759 input.c, simplify #ifdef for the broken visual studio _read()
If we have _MSC_VER so we have either CONSOLE HAS_WINGUI or SHARED_MODULE
If we have SHARED_MODULE, then we most certainly don't need
  the unbuffered read(), which isn't unbuffered on _MSC_VER anyway.
Thus _MSC_VER is sufficient.
2017-02-22 19:26:48 +01:00
rlar 1475df2aa4 input.c, try to work around microsofts broken _read()
concerning the visual sudio variant of the "console" build.

Their _read() returns 0 when a linfeed is read.
Ironically the linefeed seems to be stored into the buffer nontheless.

Because the filehandle is in linebuffered mode anyway,
  (the read won't return up until the terminating newline is entered)
we can just as well use getc(), which doesn't seem to suffer
  from the same problem in their implementation.
2017-02-22 19:25:01 +01:00
rlar 2bafe98f17 winmain.c, etc, cleanup 2017-02-22 18:50:40 +01:00
rlar 90a205d36d winmain.c, etc, whitespace cleanup 2017-02-22 18:50:03 +01:00
rlar 3a9ace82bb winmain.c, etc, cleanup, rewrite obfuscated symbols
substitute in the whole source code:

  "__stream"       -->    "stream"
  "__pos"          -->    "pos"
  "__s"            -->    "s"
  "__n"            -->    "n"
  "__c"            -->    "c"
  "__format"       -->    "format"
  "__ptr"          -->    "ptr"
  "__size"         -->    "size"
  "__path"         -->    "path"
  "__mode"         -->    "mode"
  "__offset"       -->    "offset"
  "__whence"       -->    "whence"
  "__arglist"      -->    "arglist"
  "__buf"          -->    "buf"
  "__fp"           -->    "fp"

  "f_c_l_o_s_e"    -->    "win_x_fclose"
  "f_e_o_f"        -->    "win_x_feof"
  "f_e_r_r_o_r"    -->    "win_x_ferror"
  "f_f_l_u_s_h"    -->    "win_x_fflush"
  "fg_e_t_c"       -->    "win_x_fgetc"
  "f_g_e_t_p_o_s"  -->    "win_x_fgetpos"
  "fg_e_t_s"       -->    "win_x_fgets"
  "fp_r_i_n_t_f"   -->    "win_x_fprintf"
  "fp_u_t_c"       -->    "win_x_fputc"
  "fp_u_t_char"    -->    "win_x_fputchar"
  "fp_u_t_s"       -->    "win_x_fputs"
  "f_r_e_a_d"      -->    "win_x_fread"
  "f_r_e_o_p_e_n"  -->    "win_x_freopen"
  "fs_c_a_n_f"     -->    "win_x_fscanf"
  "f_s_e_e_k"      -->    "win_x_fseek"
  "f_s_e_t_p_o_s"  -->    "win_x_fsetpos"
  "f_t_e_l_l"      -->    "win_x_ftell"
  "f_w_r_i_t_e"    -->    "win_x_fwrite"
  "g_e_t_c"        -->    "win_x_getc"
  "g_e_t_char"     -->    "win_x_getchar"
  "g_e_t_s"        -->    "win_x_gets"
  "p_e_r_r_o_r"    -->    "win_x_perror"
  "p_r_i_n_t_f"    -->    "win_x_printf"
  "p_u_t_c"        -->    "win_x_putc"
  "p_u_t_char"     -->    "win_x_putchar"
  "p_u_t_s"        -->    "win_x_puts"
  "r_e_a_d"        -->    "win_x_read"
  "s_c_a_n_f"      -->    "win_x_scanf"
  "ung_e_t_c"      -->    "win_x_ungetc"
  "vfp_r_i_n_t_f"  -->    "win_x_vfprintf"
  "vfs_c_a_n_f"    -->    "win_x_vfscanf"
  "vp_r_i_n_t_f"   -->    "win_x_vprintf"
  "vs_c_a_n_f"     -->    "win_x_vscanf"
2017-02-10 19:50:42 +01:00
rlar 93d040703d winmain.c, drop artefact "fgetchar", cleanup/emphasise disabled "freopen" 2017-02-10 18:44:44 +01:00
rlar 69537a7899 winmain.c, fs_c_a_n_f(), bug fix, and cleanup "minimise" 2017-02-09 22:06:07 +01:00
rlar b5ccfca24b implement option 'indverbosity' to control check of inductive systems
default is 2, maximum verbosity

option indverbosity=1
  can be used to prevent check for
    "incomplete set of couplings"

option indverbosity=0
  can be used to avoid the check altogether

set indverbosity=INTEGER
  or
.option indverbosity=INTEGER
  works as well
2017-01-02 20:03:25 +01:00
rlar 05ee2e0182 check for missing and duplicate K instances 2017-01-02 20:03:17 +01:00
Francesco Lannutti bf542f64d8 check for viable mutual inductor coefficients 2017-01-02 20:00:38 +01:00
rlar fc32837b44 muttemp.c, allow negative inductance 2016-12-03 20:32:26 +01:00
rlar 681903492b devices/ind/*, whitespace 2016-12-03 20:32:08 +01:00
rlar 24aee8bf2a devices/ind/*, cleanup 2016-12-03 20:28:06 +01:00
Francesco Lannutti 0c5196e773 signal_handler.c, ft_sigintr(), exit after three SIGINT requests 2016-11-01 20:33:13 +01:00
rlar 4778b48592 inpcom.c, inp_fix_inst_calls_for_numparam(), drop redundant condition `num_subckt_params == 0'
found_mult_param() can already cope with that
2016-11-01 11:56:48 +01:00
dwarning 24dbbc393d remove the ancient nobjthack option to fake 3-terminal bjt's 2016-11-01 11:56:48 +01:00
dwarning 6827495a75 correct the comment for 5-terminal bjt's in get_number_terminals 2016-11-01 11:56:48 +01:00
dwarning 1e880deff4 allow 5-terminal bjt's in subckt expansion 2016-11-01 11:56:48 +01:00
rlar 52a1a58e14 wlist.c, wl_find(), avoid crash when `string' argument is NULL 2016-11-01 11:56:47 +01:00
h_vogt e4e24f74e6 breakp2.c, copynode(), prevent segfault if missing ')'
invoking 'save' with an erronous node, for example
  save v(thing
This can happen unexpectedly for long 'save' lines,
  which will silently be truncated.
2016-11-01 11:56:25 +01:00
rlar 7fc6609821 breakp2.c, settrace(), cleanup #2/2 2016-11-01 11:06:45 +01:00
rlar 004e49aabf breakp2.c, settrace(), cleanup #1/2
"save" command,
  reduce complexity from O(2) to O(1)
2016-11-01 11:05:59 +01:00
rlar 939555115d variables, cp_vprint, fix a memory leak 2016-10-15 15:57:59 +02:00
rlar bc325b17c5 variables, lift plot_cur->pl_env up to the invoker of cp_usrvars() 2016-10-15 15:57:54 +02:00
rlar e0db4aa665 variables, cp_vprint(), reorder for similarity 2016-10-15 15:57:52 +02:00
rlar a33876ff59 variables, variables, cp_getvar, rewrite 2016-10-15 15:57:50 +02:00
rlar 97c5e1567f variables, cp_getvar(), beware of retval == NULL 2016-10-15 15:57:48 +02:00
rlar 20b666e2d5 variables, clean up 2016-10-15 15:57:45 +02:00
rlar b2fb4e20bf variables, drop 'found', use identity found == (*p != NULL) 2016-10-15 15:57:43 +02:00
rlar 0784f76e51 variables, cleanup the for loops 2016-10-15 15:57:40 +02:00