Commit Graph

5501 Commits

Author SHA1 Message Date
Jim Monte 1b43d16594 Fixed access of freed memory when reporting an error. 2020-01-04 15:26:29 +01:00
Jim Monte 503af6ac00 Fixed several issues related to plotting and vector lifetimes and made ownership of vectors clearer. The issues in bugs 419, 423, 425, and 426 were related and were addressed here. 2020-01-04 15:25:31 +01:00
Jim Monte 10415875f4 Fixed "phantom vector" issue with plots and crash when plots are resized. See bugs #419 and #423 for details. Also several parameters were changed from char * to const char * in the plotting functions. 2020-01-04 15:25:15 +01:00
Jim Monte 8021566265 Fixed bug with 255 card deck entered using circbyline 2020-01-04 15:24:41 +01:00
Jim Monte 9f89ab705a Added error recovery when invalid foreach statement found 2020-01-04 15:24:05 +01:00
Jim Monte 6f8635550a Fixed memory leak when empty word found. 2020-01-04 15:23:52 +01:00
Jim Monte 3982458005 Fixed reporting of system information in Windows. 2020-01-04 15:11:38 +01:00
Jim Monte a968c5c2fd Made UI more consistent when comments are entered. 2020-01-04 15:09:16 +01:00
Jim Monte 4f79916a3e Cleaned up defintions of macro constants 2020-01-04 15:05:06 +01:00
Jim Monte be8bd7b40e Used Win32 function PathIsRelativeA() to identify an absolute path instead of checking the string since the system function may handle more cases (network shares, etc.). Also reviewed formatting that was done on inpcom.c by a code beautifier in an earlier commit. Nearly all of it was an improvement, but a few cases were reverted back to closer to the original form. One particular instance was comments where a list of steps was given one per line. 2020-01-04 15:04:49 +01:00
Jim Monte eddd2827ec Made checking for single-character words faster. The testing now also uses less memory and works for 8-bit characters, which would have previously caused buffer overruns. It is also more modular and has additional documentation. 2020-01-04 15:03:20 +01:00
Jim Monte 550d26b57a Used the new capabilities of ft_numparse() to allow the creation of variables and list items of type CP_NUM 2020-01-04 11:19:27 +01:00
Jim Monte 5a7257520d Made cp_enqvar() mode modular by adding a separate function to handle the case of a vector. Lists are more efficiently handled by moving common comparisons out of the loop over elements. The first argument of cp_enqvar() is changed from char * to const char * since the name of the variable being found is not altered by the function. 2020-01-04 11:19:21 +01:00
Jim Monte bb10b84045 Fixed buffer resizing, made string utilities more modular, and added several new utilities, some which do not require a null termination, potentially avoiding the need to copy a string. Also some substring utilities using the Rabin-Karp algorithm were added. 2020-01-04 11:19:16 +01:00
Jim Monte 814d1f07d6 Fixed locating vectors like V(node) 2020-01-04 11:19:08 +01:00
Jim Monte 713fad1664 Fixed potential infinite loop (until memory is exhausted) and added several utility functions for processing strings. 2020-01-04 11:18:37 +01:00
Jim Monte b4bbcb1497 Made ft_numparse() thread-safe (no internal static variables) and prepared to support ngspice variable type CP_NUM. 2020-01-04 11:17:54 +01:00
Holger Vogt 9bbde919e3 Fixed merge conflict. Also made readifile() static and removed an unnecessary string duplication there. 2020-01-04 11:17:45 +01:00
Jim Monte 4081013b13 Added no_histsubst option and related fixes 2020-01-04 11:09:14 +01:00
Jim Monte 3b5773fb84 Fixed usage of new dstring functions. Also added const to some parameters that did not change. 2020-01-04 11:03:45 +01:00
Jim Monte 70e6318915 If the prompt variable was set to a value that is not a string, memory that has been freed would be used when displaying the command prompt. This could lead to strange prompts and possible access violations, although it may appear to work OK if the freed memory has not been modified. This issue is fixed. Some useless duplications of strings when defining variables are also removed. 2020-01-04 10:24:44 +01:00
Jim Monte ada262488b The check for the scale vector was not comparing the name in a case-insensitive manner, so unlet Yes would delete the default yes scale vector, for example. That issue was corrected. The code was also made more modular and descriptive regarding the check for the scale vector. Also, the warning now prints the scale vector as it is stored to make clear that vector names are not case sensitive. 2020-01-04 10:23:54 +01:00
Jim Monte ba29c514f9 Cleaned up code to locate a vector in a plot by name. The code was made more modular, and special names like allv are handled more efficiently 2020-01-04 10:23:39 +01:00
Jim Monte 8285bd107a Fixed compiler warnings regarding type of argument passed 2020-01-04 10:23:06 +01:00
Jim Monte e969a05411 Added a macro R_MIN to define the minimum resistance value aS 0.01 and replaced the numeric value with the macro in the sourc code. 2020-01-04 10:22:50 +01:00
Jim Monte 9644f2ae4c Dynamic string (dstring) rework 2020-01-04 10:22:35 +01:00
Holger Vogt 146f94392d Remove memory leaks in cmpp.
Two small ones (a few bytes) are still there, difficult to assess.
2020-01-04 10:21:45 +01:00
Jim Monte e32991ae7a Minor fix to end-of-index processing of let command 2019-12-23 22:42:01 -05:00
Jim Monte 6eac11db97 File path built more efficiently and now allows an arbitrary length. Prevented strdup() of NULL if path too long. Similarly prevented fopen with a NULL file name. Added function to determine Windows absolute paths properly. Fixed numerous issues that were caused by including Windows system header due to conflicting names. Generally a CMPP_ prefix was added as a "namespace". Also used the standard C bool type instead of defining one. 2019-12-23 22:40:56 -05:00
Jim Monte 18c6a5a5ad Formatting and comments added 2019-12-23 01:16:10 -05:00
Jim Monte 8570089260 Removed unnecessary comparisons when lowercasing a string. 2019-12-23 01:03:35 -05:00
Jim Monte 10d0f18fb6 Modified calculation to determine when memory is nearly exhausted. Also changed prototypes of memory reporting functions to match their definitions. 2019-12-21 21:09:30 -05:00
Jim Monte e4966e0263 Restored command arguments accidentally deleted. 2019-12-21 15:39:24 -05:00
Jim Monte 5e879468e9 Rework of let command. Added support for slices as described in feature #69 and fixed several crashes and issues described in bugs #443, #444, #446, #447, and #448. 2019-12-18 23:25:03 -05:00
Jim Monte 5d788b8359 Added #include <stdio.h> to define FILE. 2019-12-17 15:41:00 -05:00
Jim Monte 3ddc4b986a Modified search for init file so that it searches both <HOME> and <USERPROFILE> if both are defined. 2019-12-17 01:44:36 -05:00
Jim Monte 9507c00d61 Added -D/--define option to define a variable from the command line. 2019-12-17 01:38:33 -05:00
Jim Monte 7381b8e72f Opened binary files for writing using "wb" in all cases 2019-12-16 14:53:40 -05:00
Jim Monte 52d0091859 Added basic help messages in addtion to reference to web pages 2019-12-16 01:40:25 -05:00
Jim Monte 091792351b Added conjugate function conj(). 2019-12-15 14:51:37 -05:00
Jim Monte b7d40636e5 Additional freeing of device-dependent information for bug #419 and related bugs. 2019-12-15 01:17:04 -05:00
Jim Monte 5e29293a0d Removed redundant macro 2019-12-15 00:13:50 -05:00
Jim Monte 6383959b71 Fixed resolution of ~ to home directory. (Bug #405) Also fixed potential buffer overruns in glob expansion 2019-12-14 01:13:13 -05:00
Jim Monte 1c61d2a699 Fixed checking for redirection tokens 2019-12-12 20:07:45 -05:00
Jim Monte fc696a294e Fixed access of freed memory when reporting an error. 2019-12-12 19:44:09 -05:00
Jim Monte 6335f12839 Fixed several issues related to plotting and vector lifetimes and made ownership of vectors clearer. The issues in bugs 419, 423, 425, and 426 were related and were addressed here. 2019-12-12 19:10:29 -05:00
Jim Monte 24f26a1dfe Fixed "phantom vector" issue with plots and crash when plots are resized. See bugs #419 and #423 for details. Also several parameters were changed from char * to const char * in the plotting functions. 2019-12-10 19:47:00 -05:00
Jim Monte 552845290b Fixed bug with 255 card deck entered using circbyline 2019-12-10 18:18:48 -05:00
Jim Monte 52b2bd1f23 Added error recovery when invalid foreach statement found 2019-12-10 15:44:57 -05:00
Jim Monte 37fa925871 Fixed memory leak when empty word found. 2019-12-10 15:22:19 -05:00
Jim Monte 3cbef48182 Fixed reporting of system information in Windows. 2019-12-10 01:27:14 -05:00
Jim Monte 01b8dd7d92 Merge branch 'pre-master' of ssh://git.code.sf.net/p/ngspice/ngspice into beta_jdm 2019-12-10 00:15:55 -05:00
Jim Monte 627dd3e8c5 Made UI more consistent when comments are entered. 2019-12-10 00:14:22 -05:00
Jim Monte 8a33161432 Cleaned up defintions of macro constants 2019-12-09 23:52:41 -05:00
Jim Monte 767ee1665a Used Win32 function PathIsRelativeA() to identify an absolute path instead of checking the string since the system function may handle more cases (network shares, etc.). Also reviewed formatting that was done on inpcom.c by a code beautifier in an earlier commit. Nearly all of it was an improvement, but a few cases were reverted back to closer to the original form. One particular instance was comments where a list of steps was given one per line. 2019-12-09 23:01:28 -05:00
Jim Monte 6792441f9d Clarified purpose of LOTS and NLOTS macros 2019-12-09 19:23:25 -05:00
Jim Monte b39e5d9507 Made checking for single-character words faster. The testing now also uses less memory and works for 8-bit characters, which would have previously caused buffer overruns. It is also more modular and has additional documentation. 2019-12-09 19:09:39 -05:00
Jim Monte b6f4637239 Used the new capabilities of ft_numparse() to allow the creation of variables and list items of type CP_NUM 2019-12-09 18:26:52 -05:00
Jim Monte 5260904aa4 Made cp_enqvar() mode modular by adding a separate function to handle the case of a vector. Lists are more efficiently handled by moving common comparisons out of the loop over elements. The first argument of cp_enqvar() is changed from char * to const char * since the name of the variable being found is not altered by the function. 2019-12-09 16:18:31 -05:00
Jim Monte 595c024968 Fixed buffer resizing, made string utilities more modular, and added several new utilities, some which do not require a null termination, potentially avoiding the need to copy a string. Also some substring utilities using the Rabin-Karp algorithm were added. 2019-12-09 00:27:03 -05:00
Jim Monte 8b8ffe36a6 Fixed locating vectors like V(node) 2019-12-08 23:42:49 -05:00
Holger Vogt d864bd750c plug a memory leak by CALLBACK,
deleting locally malloced memory
2019-12-07 14:53:08 +01:00
Jim Monte 7496060d80 Fixed potential infinite loop (until memory is exhausted) and added several utility functions for processing strings. 2019-12-06 19:39:08 -05:00
Jim Monte e6c14b3eb0 Made ft_numparse() thread-safe (no internal static variables) and prepared to support ngspice variable type CP_NUM. 2019-12-06 16:04:45 -05:00
Jim Monte 0ad9565ba7 Fixed merge conflict. Also made readifile() static and removed an unnecessary string duplication there. 2019-12-05 16:19:21 -05:00
Jim Monte aee1304ad4 Added no_histsubst option and related fixes 2019-12-05 14:38:57 -05:00
Jim Monte c86b7692f5 Fixed usage of new dstring functions. Also added const to some parameters that did not change. 2019-12-05 00:37:32 -05:00
Holger Vogt dd05e24677 prevent referencing a NULL pointer
free the loc pointer and NULL its origin STATIC_VAR (locdata)
(that translates to mif_private->inst_var[0]->element[0].pvalue)
2019-12-02 21:33:31 +01:00
Jim Monte 0dfba3b826 If the prompt variable was set to a value that is not a string, memory that has been freed would be used when displaying the command prompt. This could lead to strange prompts and possible access violations, although it may appear to work OK if the freed memory has not been modified. This issue is fixed. Some useless duplications of strings when defining variables are also removed. 2019-11-29 23:32:13 -05:00
Jim Monte 309b50d3a4 The check for the scale vector was not comparing the name in a case-insensitive manner, so unlet Yes would delete the default yes scale vector, for example. That issue was corrected. The code was also made more modular and descriptive regarding the check for the scale vector. Also, the warning now prints the scale vector as it is stored to make clear that vector names are not case sensitive. 2019-11-29 22:45:56 -05:00
Jim Monte 814ad11461 Cleaned up code to locate a vector in a plot by name. The code was made more modular, and special names like allv are handled more efficiently 2019-11-29 22:22:04 -05:00
Jim Monte 65014ebd27 Fixed compiler warnings regarding type of argument passed 2019-11-29 20:12:30 -05:00
Holger Vogt 4a8e669562 enable setting a variable from an input file
using the existing i/o redirection
2019-11-29 23:55:13 +01:00
Jim Monte 4523a30404 Merge branch 'pre-master' of ssh://git.code.sf.net/p/ngspice/ngspice into beta_jdm 2019-11-28 23:25:17 -05:00
Holger Vogt 9a77d22444 prevent crash if 0 length vector is assessed 2019-11-27 23:31:22 +01:00
Jim Monte 75cbbfa1a5 Added a macro R_MIN to define the minimum resistance value aS 0.01 and replaced the numeric value with the macro in the sourc code. 2019-11-27 10:44:15 -05:00
Jim Monte b87e6f4d2b Dynamic string (dstring) rework 2019-11-26 20:59:56 -05:00
Holger Vogt 78c4a51d2a allow 'dc TEMP 10 20 1' as well as 'dc temp 10 20 1' 2019-11-27 00:31:24 +01:00
Holger Vogt b7bd59c22c On Linux: allow calling gnuplot without invoking a terminal.
Reported by Terry Pilling
2019-11-24 12:40:28 +01:00
Holger Vogt ae460934fa Replace B source pwl by XSPICE PWL Controlled Source
that has smooth rounded and differentiable corners.
This is used in the replacem,ent operation evaluating
Exxx n1 n2 TABLE {expression} = (x0, y0) (x1, y1) (x2, y2)
2019-11-09 23:10:28 +01:00
Holger Vogt 1afb290536 Revert "Replace B source pwl by XSPICE PWL Controlled Source"
This reverts commit cf653ef33a.
2019-11-09 23:08:50 +01:00
Holger Vogt cf653ef33a Replace B source pwl by XSPICE PWL Controlled Source
that has smooth rounded and differentiable corners.
This is used in the replacem,ent operation evaluating
Exxx n1 n2 TABLE {expression} = (x0, y0) (x1, y1) (x2, y2)
2019-11-09 22:39:22 +01:00
Holger Vogt 5b2a9474fa Replace B source pwl by XSPICE PWL Controlled Source
that has smooth rounded and differentiable corners.
Microchip or On-Semi OpAmps that needed gmin and source
stepping for operating point calculation  now converge
without, others like MCP6001 that generally refused
to converge are o.k. now. Reason is the heavily used
Gxxx n1 n2 TABLE {expression} = (x0, y0) (x1, y1) (x2, y2)
from the OpAmp models.
2019-11-09 16:26:36 +01:00
Holger Vogt 87ebe9540b enable system info for Windows 10,
exclude function not existing in older SDKs
2019-11-06 22:18:12 +01:00
Holger Vogt dcb9aa26fe Replace deprecated GetVersionExA by version helper functions
Add new macro _MSC_PLATFORM_TOOLSET to check for toolset
2019-11-03 14:39:52 +01:00
Holger Vogt 2ec1214fac remove VS 'assignment within conditional expression' warning 2019-11-03 11:50:28 +01:00
Holger Vogt b43f629d5e remove 'unreachable code' warning 2019-11-03 11:14:20 +01:00
Holger Vogt c2eb86f44f remove 'potentially uninitialized' warning 2019-11-03 11:10:44 +01:00
Holger Vogt 530f414469 Revert "enable compiling with readline for macOS"
This reverts commit 11df2b7719.
2019-10-26 16:18:29 +02:00
Holger Vogt aa49874dc2 remove superfluous double parentheses 2019-10-26 16:17:21 +02:00
Holger Vogt 6074d2528f macOS: Do not use deprecated finite, but isfinite 2019-10-26 16:02:01 +02:00
Holger Vogt e9d6228c44 update for Linux 2019-10-19 20:23:32 +02:00
Holger Vogt 1de5cae0d2 fix for macOS 2019-10-19 19:36:13 +02:00
Holger Vogt 4fa37979ae Complete redesign of memory monitoring in resource.c.
Acquiring memory size is done by four functions
getMemorySize, getAvailableMemorySize, getPeakRSS,
and getCurrentRSS.
Time data are still obtained without code modifications.
2019-10-19 18:45:52 +02:00
Holger Vogt 32b265c92a tabs to spaces 2019-10-19 11:17:42 +02:00
Holger Vogt 555cf2a8f4 Add resource info on memory used and available for macOS 2019-10-18 23:52:55 +02:00
Holger Vogt b7b4e3badb safeguard against crash if instance lines are incomplete 2019-10-18 23:29:51 +02:00
Holger Vogt 60a3298c2e Make DEVNUM robust against double initialization. 2019-10-05 11:28:17 +02:00
Holger Vogt e0448b4f37 Better indentation of message 2019-10-04 15:25:00 +02:00
Holger Vogt 2776d935ee Better info in case of error
Initited by a patch from Bohdan Tkhir
2019-10-04 15:21:47 +02:00