From 57dfb0f9458e7d1202bcc56b0812b36104e2630d Mon Sep 17 00:00:00 2001 From: arno Date: Tue, 18 Jul 2000 18:07:16 +0000 Subject: [PATCH] * 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. --- src/ChangeLog | 5 +++ src/frontend/ChangeLog | 7 ++++ src/frontend/com_ahelp.c | 3 +- src/frontend/com_asciiplot.c | 3 +- src/frontend/com_help.c | 3 +- src/frontend/com_plot.c | 3 +- src/frontend/com_set.c | 2 +- src/frontend/com_unset.c | 2 +- src/frontend/quote.c | 2 +- src/include/ChangeLog | 10 +++++ src/include/cpdefs.h | 8 ---- src/include/defines.h | 5 --- src/include/wordlist.h | 34 ++++++++++------- src/main.c | 1 + src/maths/ni/ChangeLog | 5 +++ src/maths/ni/niconv.c | 4 -- src/misc/ChangeLog | 16 ++++++-- src/misc/Makefile.am | 3 +- src/{parser => misc}/wlist.c | 73 ++++++++++++++++++++---------------- src/parser/ChangeLog | 58 ++++++++++++++++------------ src/parser/Makefile.am | 4 +- src/parser/numparse.c | 16 ++++---- src/parser/wlist.h | 26 ------------- 23 files changed, 157 insertions(+), 136 deletions(-) rename src/{parser => misc}/wlist.c (87%) delete mode 100644 src/parser/wlist.h diff --git a/src/ChangeLog b/src/ChangeLog index 9b6253cc0..9917de57b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2000-07-18 Arno W. Peters + + * main.c: Added the call to the initialization function of the + devices. + 2000-07-07 Arno W. Peters * parser/cshpar.c: Separated out com_chdir(), com_echo(), diff --git a/src/frontend/ChangeLog b/src/frontend/ChangeLog index 30566cb01..6834b5933 100644 --- a/src/frontend/ChangeLog +++ b/src/frontend/ChangeLog @@ -1,3 +1,10 @@ +2000-07-18 Arno W. Peters + + * 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 * com_set.h: New header file. diff --git a/src/frontend/com_ahelp.c b/src/frontend/com_ahelp.c index 1a24bc938..1f06d1d7e 100644 --- a/src/frontend/com_ahelp.c +++ b/src/frontend/com_ahelp.c @@ -1,4 +1,5 @@ -#include +#include +#include #include #include diff --git a/src/frontend/com_asciiplot.c b/src/frontend/com_asciiplot.c index 8ae4fef8b..9576e1653 100644 --- a/src/frontend/com_asciiplot.c +++ b/src/frontend/com_asciiplot.c @@ -1,4 +1,5 @@ -#include +#include +#include #include #include diff --git a/src/frontend/com_help.c b/src/frontend/com_help.c index a734bbfbd..f341afd03 100644 --- a/src/frontend/com_help.c +++ b/src/frontend/com_help.c @@ -1,4 +1,5 @@ -#include +#include +#include #include #include diff --git a/src/frontend/com_plot.c b/src/frontend/com_plot.c index 27b613ac9..e1cf9b5ee 100644 --- a/src/frontend/com_plot.c +++ b/src/frontend/com_plot.c @@ -1,4 +1,5 @@ -#include +#include +#include #include #include diff --git a/src/frontend/com_set.c b/src/frontend/com_set.c index 00d81bfc5..9cc683d02 100644 --- a/src/frontend/com_set.c +++ b/src/frontend/com_set.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/src/frontend/com_unset.c b/src/frontend/com_unset.c index a7ea5fd6a..3f3d8d5a1 100644 --- a/src/frontend/com_unset.c +++ b/src/frontend/com_unset.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/src/frontend/quote.c b/src/frontend/quote.c index 6bf95f88c..e4d8641af 100644 --- a/src/frontend/quote.c +++ b/src/frontend/quote.c @@ -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 */ diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 216b4713f..dd168f333 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,13 @@ +2000-07-18 Arno W. Peters + + * 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 * inpptree.h: Applied Widlok patch (u2 function). diff --git a/src/include/cpdefs.h b/src/include/cpdefs.h index 2da52d533..550270640 100644 --- a/src/include/cpdefs.h +++ b/src/include/cpdefs.h @@ -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 diff --git a/src/include/defines.h b/src/include/defines.h index f519e467f..bea978a1e 100644 --- a/src/include/defines.h +++ b/src/include/defines.h @@ -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 diff --git a/src/include/wordlist.h b/src/include/wordlist.h index 8ec054f4a..49191784b 100644 --- a/src/include/wordlist.h +++ b/src/include/wordlist.h @@ -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 diff --git a/src/main.c b/src/main.c index d516c751d..9e5a241ec 100644 --- a/src/main.c +++ b/src/main.c @@ -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 */ diff --git a/src/maths/ni/ChangeLog b/src/maths/ni/ChangeLog index 97fb7914c..2f12d9a01 100644 --- a/src/maths/ni/ChangeLog +++ b/src/maths/ni/ChangeLog @@ -1,3 +1,8 @@ +2000-07-18 Arno W. Peters + + * niconv.c: Removed NEWCONV. This symbol was defined by default, + adjusted the code to this reality. + 1999-09-03 Emmanuel Rouat * *.h: added header file for each .c file diff --git a/src/maths/ni/niconv.c b/src/maths/ni/niconv.c index d85028914..ed293be81 100644 --- a/src/maths/ni/niconv.c +++ b/src/maths/ni/niconv.c @@ -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 */ } diff --git a/src/misc/ChangeLog b/src/misc/ChangeLog index 1fa6bbd2f..f79b36883 100644 --- a/src/misc/ChangeLog +++ b/src/misc/ChangeLog @@ -1,9 +1,17 @@ +2000-07-18 Arno W. Peters + + * Makefile.am: Added wlist.c. + + * wlist.c: moved here from src/parser/wlist.c + 2000-03-11 Paolo Nenzi - * 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 ...). - 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 ...). Again seemingly no adverse side + effects. 1999-09-07 Arno diff --git a/src/misc/Makefile.am b/src/misc/Makefile.am index cf15b9cae..866b54ed3 100644 --- a/src/misc/Makefile.am +++ b/src/misc/Makefile.am @@ -22,7 +22,8 @@ libmisc_a_SOURCES = \ tilde.c \ tilde.h \ misc_time.c \ - misc_time.h + misc_time.h \ + wlist.c diff --git a/src/parser/wlist.c b/src/misc/wlist.c similarity index 87% rename from src/parser/wlist.c rename to src/misc/wlist.c index cc28be1f0..f52be138e 100644 --- a/src/parser/wlist.c +++ b/src/misc/wlist.c @@ -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 +#include +#include +#include /* 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) { diff --git a/src/parser/ChangeLog b/src/parser/ChangeLog index 4a58b0104..54f144fd9 100644 --- a/src/parser/ChangeLog +++ b/src/parser/ChangeLog @@ -1,23 +1,35 @@ +2000-07-18 Arno W. Peters + + * 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 - * 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 - * history.c: applied Chris Inbody 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 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 @@ -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 diff --git a/src/parser/Makefile.am b/src/parser/Makefile.am index b0df1d149..b143119a5 100644 --- a/src/parser/Makefile.am +++ b/src/parser/Makefile.am @@ -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 diff --git a/src/parser/numparse.c b/src/parser/numparse.c index dd48320fa..ef4b2150e 100644 --- a/src/parser/numparse.c +++ b/src/parser/numparse.c @@ -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 +#include +#include #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) { diff --git a/src/parser/wlist.h b/src/parser/wlist.h deleted file mode 100644 index fcd38ca02..000000000 --- a/src/parser/wlist.h +++ /dev/null @@ -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