* main.c frontend/com_ahelp.c frontend/com_asciiplot.c

frontend/com_help.c frontend/com_plot.c frontend/com_set.c
	frontend/com_unset.c frontend/quote.c include/cpdefs.h
	include/defines.h include/wordlist.h maths/ni/niconv.c
	misc/Makefile.am parser/Makefile.am parser/numparse.c
	misc/wlist.c parser/wlist.c parser/wlist.h: Sorry for the big
	commit, I screwed up the last one.  See the ChangeLogs for an
	account of what changed.
This commit is contained in:
arno 2000-07-18 18:07:16 +00:00
parent 88adbcab30
commit 57dfb0f945
23 changed files with 157 additions and 136 deletions

View File

@ -1,3 +1,8 @@
2000-07-18 Arno W. Peters <A.W.Peters@ieee.org>
* main.c: Added the call to the initialization function of the
devices.
2000-07-07 Arno W. Peters <A.W.Peters@ieee.org>
* parser/cshpar.c: Separated out com_chdir(), com_echo(),

View File

@ -1,3 +1,10 @@
2000-07-18 Arno W. Peters <A.W.Peters@ieee.org>
* com_ahelp.c, com_help.c, com_plot.c, com_set.c, com_unset.c:
Updated header file includes.
* quote.c: Code formatting changes.
2000-07-16 Arno W. Peters <A.W.Peters@ieee.org>
* com_set.h: New header file.

View File

@ -1,4 +1,5 @@
#include <stdlib.h>
#include <config.h>
#include <ngspice.h>
#include <bool.h>
#include <wordlist.h>

View File

@ -1,4 +1,5 @@
#include <stddef.h>
#include <config.h>
#include <ngspice.h>
#include <bool.h>
#include <wordlist.h>

View File

@ -1,4 +1,5 @@
#include <stdlib.h>
#include <config.h>
#include <ngspice.h>
#include <macros.h>
#include <wordlist.h>

View File

@ -1,4 +1,5 @@
#include <stddef.h>
#include <config.h>
#include <ngspice.h>
#include <bool.h>
#include <wordlist.h>

View File

@ -1,5 +1,5 @@
#include <config.h>
#include <stddef.h>
#include <ngspice.h>
#include <bool.h>
#include <wordlist.h>

View File

@ -1,5 +1,5 @@
#include <config.h>
#include <stddef.h>
#include <ngspice.h>
#include <macros.h>
#include <bool.h>

View File

@ -20,7 +20,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
void
cp_wstrip(char *str)
{
char c, d;
char c, d;
if (str)
while ((c = *str)) { /* assign and test */

View File

@ -1,3 +1,13 @@
2000-07-18 Arno W. Peters <A.W.Peters@ieee.org>
* cpdefs.h: Moved quote() and strip() macro's to ...
* wordlist.h: ... here. Also added ANSI C prototypes for all
functions that manipulate wordlists.
* defines.h: Removed CAPZEROBYPASS, NEWCONV and CAPBYPASS as they
are no longer used in the code.
2000-05-22 Paolo Nenzi <p.nenzi@ieee.org>
* inpptree.h: Applied Widlok patch (u2 function).

View File

@ -91,14 +91,6 @@ struct alias {
#define CPC_BRR 004 /* Break word to right of character. */
#define CPC_BRL 010 /* Break word to left of character. */
/* For quoting individual characters. '' strings are all quoted, but `` and
* "" strings are maintained as single words with the quotes around them.
* Note that this won't work on non-ascii machines.
*/
#define quote(c) ((c) | 0200)
#define strip(c) ((c) & 0177)
#define CT_ALIASES 1
#define CT_LABEL 15

View File

@ -80,11 +80,6 @@
* #define-s that are always on
*/
#define CAPZEROBYPASS
#define NEWCONV
/* #define CAPBYPASS Internal use only */
/* On Unix the following should always be true, so they should jump out */
#define HAS_ASCII

View File

@ -11,18 +11,26 @@ struct wordlist {
typedef struct wordlist wordlist;
extern char **wl_mkvec();
extern char *wl_flatten();
extern int wl_length();
extern void wl_free();
extern void wl_print();
extern void wl_sort();
extern wordlist *wl_append();
extern wordlist *wl_build();
extern wordlist *wl_copy();
extern wordlist *wl_range();
extern wordlist *wl_nthelem();
extern wordlist *wl_reverse();
extern wordlist *wl_splice();
int wl_length(wordlist *wlist);
void wl_free(wordlist *wlist);
wordlist * wl_copy(wordlist *wlist);
wordlist * wl_splice(wordlist *elt, wordlist *list);
void wl_print(wordlist *wlist, FILE *fp);
wordlist * wl_build(char **v);
char ** wl_mkvec(wordlist *wl);
wordlist * wl_append(wordlist *wlist, wordlist *nwl);
wordlist * wl_reverse(wordlist *wl);
char * wl_flatten(wordlist *wl);
wordlist * wl_nthelem(int i, wordlist *wl);
void wl_sort(wordlist *wl);
wordlist * wl_range(wordlist *wl, int low, int up);
/* For quoting individual characters. '' strings are all quoted, but
* `` and "" strings are maintained as single words with the quotes
* around them. Note that this won't work on non-ascii machines. */
#define quote(c) ((c) | 0200)
#define strip(c) ((c) & 0177)
#endif

View File

@ -161,6 +161,7 @@ int DEVmaxnum = 0;
int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator)
{
#ifdef SIMULATOR
spice_init_devices();
SIMinfo.numDevices = DEVmaxnum = num_devices();
SIMinfo.devices = devices_ptr();
#endif /* SIMULATOR */

View File

@ -1,3 +1,8 @@
2000-07-18 Arno W. Peters <A.W.Peters@ieee.org>
* niconv.c: Removed NEWCONV. This symbol was defined by default,
adjusted the code to this reality.
1999-09-03 Emmanuel Rouat <emmanuel.rouat@wanadoo.fr>
* *.h: added header file for each .c file

View File

@ -59,12 +59,8 @@ NIconvTest(register CKTcircuit *ckt)
}
#ifdef NEWCONV
i = CKTconvTest(ckt);
if (i)
ckt->CKTtroubleNode = 0;
return(i);
#else /* NEWCONV */
return(0);
#endif /* NEWCONV */
}

View File

@ -1,9 +1,17 @@
2000-07-18 Arno W. Peters <A.W.Peters@ieee.org>
* Makefile.am: Added wlist.c.
* wlist.c: moved here from src/parser/wlist.c
2000-03-11 Paolo Nenzi <p.nenzi@ieee.org>
* missing_math.c: as Chris wrote:
In missing_math.c line 50: changed the preprocessor directive "#elif" to "#else" because the
elif must have a condition (ie. else if <condition>...).
Again seemingly no adverse side effects.
* missing_math.c: as Chris wrote:
In missing_math.c line 50: changed the preprocessor directive
"#elif" to "#else" because the elif must have a condition
(ie. else if <condition>...). Again seemingly no adverse side
effects.
1999-09-07 Arno <A.W.Peters@ieee.org>

View File

@ -22,7 +22,8 @@ libmisc_a_SOURCES = \
tilde.c \
tilde.h \
misc_time.c \
misc_time.h
misc_time.h \
wlist.c

View File

@ -3,31 +3,28 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
**********/
/*
*
* Wordlist manipulation stuff.
*/
/* Wordlist manipulation stuff. */
#include "ngspice.h"
#include "cpstd.h"
#include "wlist.h"
#include <config.h>
#include <ngspice.h>
#include <bool.h>
#include <wordlist.h>
/* Determine the length of a word list. */
int
wl_length(wordlist *wlist)
{
register int i = 0;
register wordlist *wl;
int i = 0;
wordlist *wl;
for (wl = wlist; wl; wl = wl->wl_next)
i++;
return (i);
}
/* Free the storage used by a word list. */
/* Free the storage used by a word list. */
void
wl_free(wordlist *wlist)
{
@ -41,12 +38,12 @@ wl_free(wordlist *wlist)
return;
}
/* Copy a wordlist and the words. */
/* Copy a wordlist and the words. */
wordlist *
wl_copy(wordlist *wlist)
{
register wordlist *wl, *nwl = NULL, *w = NULL;
wordlist *wl, *nwl = NULL, *w = NULL;
for (wl = wlist; wl; wl = wl->wl_next) {
if (nwl == NULL) {
@ -64,10 +61,9 @@ wl_copy(wordlist *wlist)
return (nwl);
}
/* Substitute a wordlist for one element of a wordlist, and return a pointer
* to the last element of the inserted list.
*/
/* Substitute a wordlist for one element of a wordlist, and return a
* pointer to the last element of the inserted list. */
wordlist *
wl_splice(wordlist *elt, wordlist *list)
{
@ -88,27 +84,42 @@ wl_splice(wordlist *elt, wordlist *list)
return (list);
}
/* Print a word list. (No \n at the end...) */
static void
printword(char *string, FILE *fp)
{
char *s;
if (string)
for (s = string; *s; s++)
putc((strip(*s)), fp);
return;
}
/* Print a word list. (No \n at the end...) */
void
wl_print(wordlist *wlist, FILE *fp)
{
wordlist *wl;
for (wl = wlist; wl; wl = wl->wl_next) {
cp_printword(wl->wl_word, fp);
printword(wl->wl_word, fp);
if (wl->wl_next)
(void) putc(' ', fp);
putc(' ', fp);
}
return;
}
/* Turn an array of char *'s into a wordlist. */
/* Turn an array of char *'s into a wordlist. */
wordlist *
wl_build(char **v)
{
wordlist *wlist, *wl = NULL, *cwl;
wordlist *wlist = NULL;
wordlist *wl = NULL;
wordlist *cwl;
while (*v) {
cwl = alloc(struct wordlist);
@ -142,8 +153,8 @@ wl_mkvec(wordlist *wl)
return (v);
}
/* Nconc two wordlists together. */
/* Nconc two wordlists together. */
wordlist *
wl_append(wordlist *wlist, wordlist *nwl)
{
@ -158,8 +169,8 @@ wl_append(wordlist *wlist, wordlist *nwl)
return (wlist);
}
/* Reverse a word list. */
/* Reverse a word list. */
wordlist *
wl_reverse(wordlist *wl)
{
@ -175,8 +186,8 @@ wl_reverse(wordlist *wl)
return (w);
}
/* Convert a wordlist into a string. */
/* Convert a wordlist into a string. */
char *
wl_flatten(wordlist *wl)
{
@ -198,14 +209,13 @@ wl_flatten(wordlist *wl)
return (buf);
}
/* Return the nth element of a wordlist, or the last one if n is too big.
* Numbering starts at 0...
*/
/* Return the nth element of a wordlist, or the last one if n is too
* big. Numbering starts at 0... */
wordlist *
wl_nthelem(register int i, wordlist *wl)
wl_nthelem(int i, wordlist *wl)
{
register wordlist *ww = wl;
wordlist *ww = wl;
while ((i-- > 0) && ww->wl_next)
ww = ww->wl_next;
@ -226,8 +236,8 @@ wlcomp(const void *a, const void *b)
void
wl_sort(wordlist *wl)
{
register int i = 0;
register wordlist *ww = wl;
int i = 0;
wordlist *ww = wl;
char **stuff;
for (i = 0; ww; i++)
@ -246,7 +256,6 @@ wl_sort(wordlist *wl)
/* Return a range of wordlist elements... */
wordlist *
wl_range(wordlist *wl, int low, int up)
{

View File

@ -1,23 +1,35 @@
2000-07-18 Arno W. Peters <A.W.Peters@ieee.org>
* numparse.c: Updates of header file includes. Some formatting
changes.
* wlist.c: Moved this file to src/misc/wlist.c
* Makefile.am: Removed wlist.c
2000-03-11 Paolo Nenzi <p.nenzi@ieee.org>
* numparse.c: as wrote in Chris Inbody patch:
In numparse.c line 17 changed the arg type of "num"
to double. This (so far :) seems to have had no adverse effect.
* numparse.c: as wrote in Chris Inbody patch: In numparse.c line
17 changed the arg type of "num" to double. This (so far :) seems
to have had no adverse effect.
2000-03-11 Paolo Nenzi <p.nenzi@ieee.org>
* history.c: applied Chris Inbody <cinbody@cowtown.net> patch. As he wrote:
I had some trouble running ng-spice in batch mode on a fairly repetitive job
(probably 10 - 20 commands repeated 256 times in a single session :), it was
giving me "mangled history" errors and then seg faulting.
[...]
In history.c line 425, added an exit(0) call to the else condition to prevent
seg fault upon generation of the history list error. On line 25, changed
cp_maxhistlength to 10000 vs 1000. The value of 10000 was enough to keep my
task from crashing but there may be a better way to do this,.. I didn't try
an arbitrarily high number because I'm not sure what effect it would have on
memory usage or progam size or speed. Maybe that's the best answer, just
bump the value to 1e6 or something that no one would ever approach.
* history.c: applied Chris Inbody <cinbody@cowtown.net> patch. He
wrote: I had some trouble running ng-spice in batch mode on a
fairly repetitive job (probably 10 - 20 commands repeated 256
times in a single session :), it was giving me "mangled history"
errors and then seg faulting.
[...] In history.c line 425, added an exit(0) call to the else
condition to prevent seg fault upon generation of the history list
error. On line 25, changed cp_maxhistlength to 10000 vs 1000. The
value of 10000 was enough to keep my task from crashing but there
may be a better way to do this,.. I didn't try an arbitrarily high
number because I'm not sure what effect it would have on memory
usage or progam size or speed. Maybe that's the best answer, just
bump the value to 1e6 or something that no one would ever
approach.
1999-09-07 Arno <A.W.Peters@ieee.org>
@ -67,12 +79,12 @@
* var2.c (vareval): removed test on HAS_GETPID
* unixcom.c: changed HAS_GETCWD in HAVE_GETCWD and HAS_GETWD into HAVE_GETWD
* unixcom.c: changed HAS_GETCWD in HAVE_GETCWD and HAS_GETWD into
HAVE_GETWD
* lexical.c:
* gloc.c:
* cshpar.c: changed HAS_GETPW in HAVE_PWD_H
(com_chdir): changed HAS_GETCWD in HAVE_GETCWD (and #included unistd.h)
* lexical.c, gloc.c, cshpar.c: changed HAS_GETPW in HAVE_PWD_H
(com_chdir): changed HAS_GETCWD in HAVE_GETCWD (and #included
unistd.h)
* std.c: changed HAS_QSORT in HAVE_QSORT
@ -86,10 +98,8 @@
* unixcom.c: changed HAS_VFORK in HAVE_VORK_H
* unixcom.c:
* complete.c:
* glob.c: HAVE_SYS_DIR_H and HAVE_DIRENT_H (instead of
HAS_BSDDIRS and HAS_SYSVDIRS)
* unixcom.c, complete.c, glob.c: HAVE_SYS_DIR_H and HAVE_DIRENT_H
(instead of HAS_BSDDIRS and HAS_SYSVDIRS)
* cshpar.c (com_shell): changed HAS_VFORK in HAVE_VORK_H

View File

@ -19,9 +19,7 @@ libparser_a_SOURCES = \
numparse.h \
std.c \
unixcom.c \
unixcom.h \
wlist.c \
wlist.h
unixcom.h
INCLUDES = -I$(top_srcdir)/src/include

View File

@ -3,18 +3,17 @@ Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
**********/
/*
* This routine parses a number.
*/
/* This routine parses a number. */
#include "ngspice.h"
#include "cpdefs.h"
#include <config.h>
#include <ngspice.h>
#include <bool.h>
#include "ftedefs.h"
#include "numparse.h"
static double
pow10( double num) /* Chris Inbody */
pow10(double num) /* Chris Inbody */
{
double d = 1.0;
@ -32,10 +31,9 @@ bool ft_strictnumparse = FALSE;
* is advanced to the end of the word. Returns NULL
* if no number can be found or if there are trailing characters when
* whole is TRUE.
*
* If ft_strictnumparse is TRUE, and whole is FALSE, the first of the
* trailing characters must be a '_'.
*/
* trailing characters must be a '_'. */
double *
ft_numparse(char **s, bool whole)
{

View File

@ -1,26 +0,0 @@
/*************
* Header file for wlist.c
* 1999 E. Rouat
************/
#ifndef WLIST_H_INCLUDED
#define WLIST_H_INCLUDED
int wl_length(wordlist *wlist);
void wl_free(wordlist *wlist);
wordlist * wl_copy(wordlist *wlist);
wordlist * wl_splice(wordlist *elt, wordlist *list);
void wl_print(wordlist *wlist, FILE *fp);
wordlist * wl_build(char **v);
char ** wl_mkvec(wordlist *wl);
wordlist * wl_append(wordlist *wlist, wordlist *nwl);
wordlist * wl_reverse(wordlist *wl);
char * wl_flatten(wordlist *wl);
wordlist * wl_nthelem(register int i, wordlist *wl);
void wl_sort(wordlist *wl);
wordlist * wl_range(wordlist *wl, int low, int up);
#endif