Commit Graph

5545 Commits

Author SHA1 Message Date
Jim Monte 69c6fd72da Resolution of merge conflicts with pre-master. 2020-02-22 01:04:18 -05:00
Jim Monte e8546ac087 Manual resolution of some differences with pre-master. 2020-02-21 14:18:19 -05:00
Jim Monte 887b48b9d5 Undid versioning for code models and mutex protection for their memory allocations. 2020-02-20 01:54:26 -05:00
Holger Vogt c094b12d3d Zero fp, this fixes bug no #475 2020-02-19 23:43:23 +01:00
Jim Monte d3150377b0 Made descriptions of invalid interpolation cases more descriptive and fixed a memory leak 2020-02-19 15:28:34 +01:00
dwarning 9c89e480a6 partially revert commit b4bbcb149 for spec analysis functionality 2020-02-17 09:56:05 +01:00
dwarning d61af96eb4 more meaningful warning if vector can't interpolate 2020-02-17 09:20:09 +01:00
Jim Monte 9ff5363ea8 Fixed compiler warnings related to redundant redeclarations. 2020-02-15 00:58:00 -05:00
Holger Vogt f5b8de12b8 remove unreachable code warning, add const 2020-02-14 23:01:35 +01:00
Holger Vogt 871677e809 Fixed compiler warnings related to const, unreachable code, and an empty translation unit. 2020-02-14 22:52:09 +01:00
Jim Monte 3e079a96c8 Fixed compiler warnings related to const, unreachable code, and an empty translation unit. 2020-02-14 15:20:28 -05:00
Jim Monte 38fb2e205f Fixed incorrect type of variable ch_cur. It was from const char * but should have been const char. 2020-02-14 19:41:26 +01:00
Holger Vogt 9b4944df33 make path to dstring.c independent from build directory 2020-02-14 19:37:19 +01:00
Holger Vogt ed95f46259 Revert "correct the path to dstring.c"
This reverts commit 28002be150.
2020-02-14 19:35:30 +01:00
Jim Monte 8db3f9d5a7 Fixed incorrect type of variable ch_cur. It was from const char * but should have been const char. 2020-02-14 13:23:48 -05:00
Holger Vogt 94960da207 prevent false freeing of vector 2020-02-13 21:32:02 +01:00
dwarning 28002be150 correct the path to dstring.c 2020-02-13 18:43:04 +01:00
dwarning 0c69374876 no wrapper cp_globmatch needed 2020-02-13 18:21:34 +01:00
Vogt bb61c0ba1e just use strcmp instead of wrapper function 2020-02-13 16:56:13 +01:00
Holger Vogt 6ce9003d3d update to cmpp by J. Monte 2020-02-12 23:13:08 +01:00
Jim Monte e4c6789bc3 Jim Monte's update to cmpp 2020-02-12 22:55:44 +01:00
Holger Vogt ef6c8abb6c Fix of buffer overrun in interpolation at endpoint of interval.
Made cfunc.mod for tables more modular.
Prevented buffer overrun when building file name.
Added error checking for allocation failures in many locations.
Made binary search for interpolation more efficient.
2020-02-12 22:48:16 +01:00
Jim Monte 1d86e5a9c7 fixed singluar/plural agreement in an error message generated by the let command 2020-02-12 22:40:53 +01:00
Jim Monte 2035442a9f fixed path created by ngdirname in Windows. Also added const to parameters whose arguments do not change and fixed some potential buffer overruns. 2020-02-12 22:40:46 +01:00
Jim Monte 33bb874678 Add const to some parameters, made function static 2020-02-12 22:40:32 +01:00
Jim Monte aee256e211 Fix of buffer overrun in interpolation at endpoint of interval. Made cfunc.mod for tables more modular. Prevented buffer overrun when building file name. Added error checking for allocation failures in many locations. Made binary search for interpolation more efficient. 2020-02-12 22:33:52 +01:00
Jim Monte 46b6ab8994 Added support for DSTRING in code modules with makefile builds 2020-02-12 22:32:25 +01:00
Jim Monte 4e51060684 Clarified error message 2020-02-12 22:32:18 +01:00
Jim Monte 31c7b69d39 Fixed compile warning about signed/unsigned comparison. 2020-02-12 22:31:55 +01:00
Jim Monte 5652afc87d Gave structure defining Mif_Complex_t a name so that it could be forward referenced. 2020-02-12 22:31:46 +01:00
Jim Monte 60ad18d263 Formatting and added comments 2020-02-12 22:31:35 +01:00
Jim Monte 8afb9635c1 Formatting 2020-02-12 22:31:20 +01:00
Jim Monte 8ead6c1b77 Minor fix to end-of-index processing of let command 2020-02-12 22:27:29 +01:00
Jim Monte 344fa243bd 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. 2020-02-12 22:27:13 +01:00
Jim Monte affa528cb5 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. 2020-02-12 22:14:51 +01:00
Jim Monte 4392ccc520 Formatting and comments added 2020-02-12 22:10:12 +01:00
Jim Monte 6385c7a900 Removed unnecessary comparisons when lowercasing a string. 2020-02-12 22:09:39 +01:00
Jim Monte faf01c0376 Modified calculation to determine when memory is nearly exhausted. Also changed prototypes of memory reporting functions to match their definitions. 2020-02-12 22:07:07 +01:00
dwarning 8a6f431f4b simplify beta derivation 2020-02-11 10:48:38 +01:00
dwarning 9889f0f277 alternative temperature model for extrinsic resistances and subthreshold range 2020-02-03 20:40:36 +01:00
Holger Vogt a46bb7b108 In VDMOS device, if instance parameter tnodeout is set,
check for exactly five nodes
2020-02-02 17:50:06 +01:00
Jim Monte de14c3d896 fixed singluar/plural agreement in an error message generated by the let command 2020-01-31 01:01:17 -05:00
Jim Monte 163b29a814 fixed path created by ngdirname in Windows. Also added const to parameters whose arguments do not change and fixed some potential buffer overruns. 2020-01-31 00:39:27 -05:00
Jim Monte d3426c7041 Add const to some parameters, made function static 2020-01-29 21:06:22 -05:00
Jim Monte 48bdcb01d0 Fixed comment 2020-01-29 02:24:42 -05:00
Jim Monte d33b31b3a9 Minor merge issues 2020-01-29 01:42:37 -05:00
Jim Monte da9bcc050f Merge branch 'pre-master' of ssh://git.code.sf.net/p/ngspice/ngspice into beta_jdm
Fixed some uses of const

Changed dstring to use allocations that are serialized by mutex when
needed
but can fail without terminating the program. Also changed calls to free()
to
use a replacement (txfree()) that will serialize when necessary.

Removed flag fields from Model_Info_t and Node_Info_t since they were no
longer required.

Reverted OK back to 0 in cmpp. There were issues with OK conflicting with
another macro definition of OK due to a header inclusion.

Added functions for writing new code model and UDN information.

Added function output_paths_from_lst_file() to extract paths in more
general
lst format.

Used new function fbget() in cmpp to get data from lst file.

Made reomval of trailing slash in cmpp an inline function for modularity.

Removed restrictions on line length and related items in cmpp by
dynamically
resizizng as required.

Reduced the number of allocation calls when storing model info and
user-defined type information in cmpp while reading lst files by doubling
the
size when resizing rather than increasing the size by 1. Also added checks
for
failure that were not present. These things were also done for
user-defined
types, which are processed in a similar way.

Fixed potential buffer overrun in cmpp function read_model_names() while
building the path. Also the path name is built more efficiently by
maintining
the current location in the output string instead of repeatedly finding it
via
strcat(). These things were also done for the corresponding function for
user-defined nodes.

To support versioning, a group of "filebuf" functions were written to get
the
path names and version numbers from a .lst file having a more flexible
format.

Added checks for failure in cmpp function read_model_names() while setting
the
name of the model and the function.

Developed a more modular and efficient method of testing for duplicate
SPICE
models, etc. in cmpp. Instead of nested for loops, the items are compared
in a
sorted order, so that a single pass needs to be done. This method also
avoids
the need of several flag variables that are used to check if a duplicate
is
being found multiple times. A related functions test_for_duplicates() was
written to perform a generic test of any of the uniquness conditions
checked,
along with a sort function and functions to report errors.

In cmpp, function fopen_cmpp was changed into a function that generates
the
file name but does not open the file (gen_filename()) followed by a
standard
fopen. This change prevented error messages from fopen_cmpp() from causing
an
access violation of the name of the file was not allocated properly. It
also
separtes the input file name from the output file name, so it is clearer
what
is being freed when the output file name is freed at the end of the
function.

Added checks for failure of fclose() in several places. Often a small file
is
not written at all on disk until fclose is called.

Added a function to write version 2 code model info into cminfo2.h. A
similar
function was written for udninfo.h.

Wrote functions to free Model_Info_t and Node_Info_t structures.

Added checks to all output file operations to ensure that the files that
are
generated are correct. This change involved adding tests to the individual
functions outputting data and adding return codes and checks of them in
functions doing output.

Combined several small file outputs into larger ones while adjusting the
format of the text being ouptut to keep the clarity of what is being
written
while reducing the number of function calls.

In functions like cmpp function dta_type_to_str(), strings were returned
directly instead of making a copy that was not necessary. This change
eliminated the copy, made the functions thread safe, and eliminated
allocations. The allocations were not checked for failure, so the change
also
prevented problems associated with failures of these allocations.

In value_to_string(), the elimination of the allocation and copy were not
possible due to retain the value of the string, but the allocation was
checked
for failure where it was not and the resize was also checked.

In integer_to_str(), a buffer size was used that was a function of the
size of
the data to fill it rather than an unrelated size that was most likely too
large. Also due to the reduced size, a stack-based buffer was used.

Fixed a bug in table-generator-b4-2d.sp where the plot names are incorrect
if
the script is called from a running instance of ngspice that has already
created some plot names that would cause conflicts. Also commented this
issue.

Added functions to the structure communicating between ngspice and code
models
to support required memory functions so that the code models, which are
running in the same address space, will have serialized allocations when
that
is required.

Reorganized memory allocations to allow for "raw" allocations that are
serialized when required. Essentially the allocation functions were
decomposed
into part that does not require serialization and part that does. Aside
from
exposing the "raw" allocations, this change made the functions clearer and
fixed an issue where free was being called without mutex protection when
it
would be required. Also, tstrdup() and tstrdup_raw() were written so that
serialization would be available in strdup(). If the other allocation
functions require serialization, then strdup() does also. There were some
issues fixed with the "garbage collect" versions of the allocation
functions.

moved src/misc/alloc.h to src/include/ngspice/alloc.h. This change was
done
because one of the builds (only MinGW) was having problems finding it in
one
case. The others were searching the include path while MinGW was using the
path of the including file as its base. While that issue may have been
corrected, this change was beneficial because there were many files
including
alloc.h through a long path of ../.. from include. As part of this change,
those includes were fixed also.

Loading code models and user-defined types was enhanced to handle
versioning.
Additionally, the copying of error messages along with a potential buffer
overrun was completely eliminated by using the string directly. Following
the
use, a macro FEEE_DLERR_MSG(msg) was added to free the string in Windows.
In
other OS where dlerror() does not require its string to be freed, the
macro
expands to nothing.

In cm_analog_alloc() the number of doubles required was corrected.

Fixed Maiefile.am to include new files.

Fixed the macro definition of strdup in Windows so that it will not
confilct
with the definition provided when CRT memory debugging is used.

Updated usage message for cmpp to provide information about the -p flag.

Added diagnostic messages when running cmpp if the macro DEBUG_CMPP is
enabled. These were entirely removed from the mainline code flow except
for a
single macro PRINT_CMPP_INFO(argc, argv)

Changed free functions in rm_ifs_table from txfree() to a regular free()
since
cmpp does not ever require mutex serialization. Also, its allocations are
done
using standard malloc(), calloc(), and realloc(), so free() is more
appropriate.

Modified change_extension() so that it will append a dot plus the new
extension
in the case where the original file does not have an extension. This case
is
not used in cmpp, but it seems more correct since the new extension being
supplied does not come with a leading dot.

Added check in call to change_extension() for failure.

Added function vprint_error() to cmpp/util.c and defined print_eror in
terms
of vprint_error(). The intent was to be able to call vprint_error()
directly.
Subsequent changes to the code removed the call to vprint_error(), but the
function was left since it is a useful utility function.

Modified src/xspice/icm/GNUmakefile.in to use cmpp -p to obtain a path
list.

Converted all code models supplied with ngspice to
1) Use the "talloc" functions so that their allocations will be serialized
    when necesary
    2) Check for allocation failure in all cases
    3) Free resources on exit
    4) Supply version information in the corresponding .lst file

    Modified icm/dlmain.c to include version 2 information.

    visualc/make-install-vngspiced.bat was changed in two ways. First sime
    actions
    were preceeded by checks to avoid error messages if they were
    unconditionally
    performed. Seond, code models were copied to a second location besides
    the
    destination used by a "production" ngspice. This second location along
    with an
    spinit file to use them allows debugging of multiple versions of
    ngspice
    concurrently.

    visualc/xspice/aux-cfunc.bat was modified to print additional
    diagnostic
    messages during a build, much like the compiler outputs file names.
    Also, cmpp
    -p was made the method to get the list of directories. Finally, the
    actions of
    visualc/xspice/aux-udnfunc.bat were added to aux-cfunc.bat since that
    file was
    already doing two of the three actions, and calling aux-udnfunc.bat
    alone or
    in the wrong order would cause an error. aux-udnfunc.bat was commented
    out and
    probably should be removed at some later time.
2020-01-28 23:56:07 -05:00
Holger Vogt 51be270f06 enable local or global statistical values for B source
pre_set statlocal
(or set statlocal in spinit or .spiceinit) will be setting a
different random number for evaluating the value of fcn agauss
etc. in each B line, e.g. if this line appears in a subcircuit,
all expanded B lines will have different values. If not set,
each B line will use the same random number for agauss evaluation.
2020-01-26 12:11:31 +01:00
Holger Vogt 2cbf2e3ac1 allow again single letter vector names 2020-01-26 09:04:53 +01:00
dwarning 24b70c8682 prevent program crash by misusing thermal model 2020-01-26 08:35:30 +01:00