replace gpl getopt by BSD getopt

This commit is contained in:
h_vogt 2009-04-12 21:08:18 +00:00
parent c9b58436f6
commit 6f4cdcac47
7 changed files with 338 additions and 307 deletions

View File

@ -1,11 +1,23 @@
2009-04-12 Holger Vogt
* spicenum.c, xpressn.c: dico and inst_dico not removed in nupa_done
* spicenum.c, xpressn.c: dico and inst_dico no longer removed in nupa_done
because they are needed in .measure
* lexical.c: size of arrays doubled in cp_lexer() to avoid "line too long"
message
* runcoms.c: enter do_measure() only if ft_curckt->ci_last_an has a value
(bug no. 2751855)
* winmain.c: winmessage() only if message not into log file
* windisp.c: WIN_Text() now uses True Type Fonts and may display text
vertically
* misc/getopt_long_bsd.c getopt_bsd.h: add a BSD version of getopt_long()
getopt.c, getopt1.c, getopt.h removed
* misc/makefile.am: add (remove) files
* configure.in: check for getopt.h and getopt_long(), if not found, use
internal functions in getopt_long_bsd.c
Replace package name ng-spice-rework with ngspice
Change version number to 19
* main.c: chosse proper getopt_long(), winmessage()
* visualc/vngspice.vcproj: files added (removed)
* visualc/include/config.h: new version 19
2009-04-10 Holger Vogt
* spicenum.c: memory leak removed

View File

@ -12,7 +12,7 @@ dnl Initialisation
dnl ---------------
dnl Initialisation of configure
AC_INIT(ng-spice-rework,18,ngspice-bugs@lists.sourceforge.net)
AC_INIT(ngspice,19,ngspice-bugs@lists.sourceforge.net)
dnl Unique file in the source directory
AC_CONFIG_SRCDIR([src/ngspice.c])
@ -643,8 +643,12 @@ fi
dnl Check for the dirname function:
AC_CHECK_FUNCS(dirname,,AC_CHECK_LIB(gen,dirname,AC_DEFINE(HAVE_DIRNAME,1,[Have dirname in libgen]) LIBS="$LIBS -lgen"))
# AC_CHECK_FUNC(getopt_long, getopt_long=true)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_FUNC(getopt_long, getopt_long=true)
# AM_CONDITIONAL(HAVE_GETOPT_LONG, test "$getopt_long" = "true")
if test "$getopt_long" = "true"; then
AC_DEFINE(HAVE_GETOPT_LONG,1,[Have fcn getopt_long()])
fi
# Expand the prefix variable (this is really annoying!)
if eval "test x$prefix = xNONE"; then

View File

@ -675,7 +675,7 @@ int WIN_Arc(int x0, int y0, int radius, double theta1, double theta2)
return 0;
}
/*
int WIN_Text_old( char * text, int x, int y, int degrees)
{
tpWindowData wd;
@ -688,7 +688,7 @@ int WIN_Text_old( char * text, int x, int y, int degrees)
return (0);
}
*/
int WIN_Text( char * text, int x, int y, int CentiDegrees)
{

View File

@ -58,7 +58,11 @@ extern int rl_catch_signals; /* missing from editline/readline.h */
#include "spicelib/devices/dev.h"
#include "spicelib/analysis/analysis.h"
#include "misc/ivars.h"
#include "misc/getopt.h"
#if defined(HAVE_GETOPT_LONG) && defined(HAVE_GETOPT_H)
#include <getopt.h>
#else
#include "misc/getopt_bsd.h"
#endif
#include "frontend/resource.h"
#include "frontend/variable.h"
#include "frontend/display.h" /* added by SDB to pick up Input() fcn */
@ -95,6 +99,7 @@ bool ft_setflag = FALSE; /* TRUE = Don't abort simulation after an interrupt.
char *ft_rawfile = "rawspice.raw";
#ifdef HAS_WINDOWS
extern void winmessage(char* new_msg);
bool oflag = FALSE; /* Output over redefined I/O functions */
FILE *flogp; /* hvogt 15.12.2001 */
#endif /* HAS_WINDOWS */
@ -335,6 +340,13 @@ struct dvec *EVTfindvec(char *node){
#endif /* SIMULATOR */
#ifndef HAS_WINDOWS
/* dummy of MS Windows message function */
void winmessage(char* new_msg) {
return;
}
#endif
char *hlp_filelist[] = { "ngspice", 0 };
@ -384,12 +396,18 @@ sp_shutdown(int exitval)
{
cleanvars();
#ifdef PARALLEL_ARCH
if (exitval == EXIT_BAD) {
{
Error("Fatal error in SPICE", -1);
} else {
PEND_();
}
#endif /* PARALLEL_ARCH */
#ifdef HAS_WINDOWS
if (exitval == EXIT_BAD)
winmessage("Fatal error in SPICE");
else
winmessage("Information during setup, see text window!");
#endif
exit (exitval);
}
@ -593,7 +611,7 @@ append_to_stream(FILE *dest, FILE *source)
static bool
read_initialisation_file(char * dir, char * name)
{
#ifndef HAVE_ASPRINTF
#ifndef HAVE_UNISTD_H
FILE * fp = NULL;
#endif /* not HAVE_ASPRINTF */
char * path;
@ -750,10 +768,10 @@ main(int argc, char **argv)
{"version", 0, 0, 'v'},
{"batch", 0, 0, 'b'},
{"autorun", 0, 0, 'a'},
{"circuitfile", 0, 0, 'c'},
{"circuitfile", 1, 0, 'c'},
{"interactive", 0, 0, 'i'},
{"no-spiceinit", 0, 0, 'n'},
{"output", 0, 0, 'o'},
{"output", 1, 0, 'o'},
{"completion", 0, 0, 'q'},
{"rawfile", 1, 0, 'r'},
{"server", 0, 0, 's'},
@ -793,7 +811,7 @@ main(int argc, char **argv)
case 'c': /* Circuit file */
if (optarg) {
if (!(circuit_file = fopen(optarg, "r"))) {
perror("circuit file not available");
perror(optarg);
sp_shutdown(EXIT_BAD);
}
istty = FALSE;
@ -848,7 +866,7 @@ main(int argc, char **argv)
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
} /* --- End of command line option processing --- */
} /* --- End of command line option processing (While(1)-loop) --- */
if (orflag) { /* -o option has been set */
com_version(NULL);
@ -1022,6 +1040,7 @@ bot:
if (optind == argc && !istty) {
append_to_stream(tempfile, stdin);
}
while (optind < argc) {
char *arg;
FILE *tp;
@ -1060,8 +1079,9 @@ bot:
perror("Could not delete temp file");
}
#endif
if (ft_batchmode && err)
if (ft_batchmode && err) {
sp_shutdown(EXIT_BAD);
}
} /* --- if (!ft_servermode && !ft_nutmeg) --- */
if (!gotone && ft_batchmode && !ft_nutmeg)

View File

@ -5,9 +5,8 @@ noinst_LTLIBRARIES = libmisc.la
libmisc_la_SOURCES = \
getopt1.c \
getopt.c \
getopt.h \
getopt_long_bsd.c \
getopt_bsd.h \
alloc.c \
alloc.h \
dup2.c \

View File

@ -460,22 +460,22 @@
/* #undef NOSQRT */
/* Name of package */
#define PACKAGE "ng-spice-rework"
#define PACKAGE "ngspice"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "ngspice-bugs@lists.sourceforge.net"
/* Define to the full name of this package. */
#define PACKAGE_NAME "ng-spice-rework"
#define PACKAGE_NAME "ngspice"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "ng-spice-rework 18"
#define PACKAGE_STRING "ngspice 19"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ng-spice-rework"
#define PACKAGE_TARNAME "ngspice"
/* Define to the version of this package. */
#define PACKAGE_VERSION "18"
#define PACKAGE_VERSION "19"
/* Define if we want predictor algorithm */
/* #undef PREDICTOR */
@ -530,7 +530,7 @@
/* #undef TM_IN_SYS_TIME */
/* Version number of package */
#define VERSION "18"
#define VERSION "19"
/* Define if we want spice2 sensitivity analysis */
/* #undef WANT_SENSE2 */

View File

@ -40,7 +40,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(ProjectDir)..\src\maths\poly&quot;;&quot;$(ProjectDir)..\src\frontend&quot;;&quot;$(ProjectDir)..\src\spicelib\devices&quot;;&quot;$(ProjectDir)..\src\include&quot;;&quot;$(ProjectDir)include&quot;"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;SIMULATOR"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;SIMULATOR;OUTDECK"
MinimalRebuild="true"
ExceptionHandling="0"
BasicRuntimeChecks="0"
@ -1076,7 +1076,7 @@
>
</File>
<File
RelativePath="..\src\misc\getopt.h"
RelativePath="..\src\misc\getopt_bsd.h"
>
</File>
<File
@ -4964,11 +4964,7 @@
>
</File>
<File
RelativePath="..\src\misc\getopt.c"
>
</File>
<File
RelativePath="..\src\misc\getopt1.c"
RelativePath="..\src\misc\getopt_long_bsd.c"
>
</File>
<File