From a57a381ea7acfe13fd912c231c7e1b46a95ef44c Mon Sep 17 00:00:00 2001 From: rlar Date: Tue, 6 Jul 2010 18:58:15 +0000 Subject: [PATCH] new include file "typedefs.h" for struct forward declarations --- ChangeLog | 12 ++++++++++++ src/include/cktdefs.h | 5 +++-- src/include/gendefs.h | 3 +-- src/include/graph.h | 2 +- src/include/ifsim.h | 15 ++++++--------- src/include/mifcmdat.h | 1 + src/include/ngspice.h | 1 + src/include/tfdefs.h | 3 +-- src/include/typedefs.h | 38 ++++++++++++++++++++++++++++++++++++++ 9 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 src/include/typedefs.h diff --git a/ChangeLog b/ChangeLog index 2c8d23dcb..553b30ecb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-07-06 Robert Larice + * src/include/typedefs.h : + new include file for struct forward declarations and for typedefs + * src/include/cktdefs.h , + * src/include/gendefs.h , + * src/include/graph.h , + * src/include/ifsim.h , + * src/include/mifcmdat.h , + * src/include/ngspice.h , + * src/include/tfdefs.h : + make use of the new include file. + 2010-07-06 Holger Vogt * defines.h: void fcn prototype instead of sighandler_t for MINGW, CYGWIN and MSC diff --git a/src/include/cktdefs.h b/src/include/cktdefs.h index b1d662ef3..a639baec0 100644 --- a/src/include/cktdefs.h +++ b/src/include/cktdefs.h @@ -7,6 +7,9 @@ #ifndef CKT #define CKT "CKTdefs.h $Revision$ on $Date$ " +#include "typedefs.h" + + /* gtri - evt - wbk - 5/20/91 - add event-driven and enhancements data */ #ifdef XSPICE #include "evt.h" @@ -30,8 +33,6 @@ extern int DEVmaxnum; /* Not sure if still used */ #include "pzdefs.h" #include "noisedef.h" -typedef struct CKTnode CKTnode; -typedef struct CKTcircuit CKTcircuit; struct CKTnode { diff --git a/src/include/gendefs.h b/src/include/gendefs.h index 8fff94d27..e62fab11e 100644 --- a/src/include/gendefs.h +++ b/src/include/gendefs.h @@ -6,10 +6,9 @@ Author: 1985 Thomas L. Quarles #ifndef GEN #define GEN +#include "typedefs.h" #include "ifsim.h" -typedef struct GENinstance GENinstance ; -typedef struct GENmodel GENmodel; /* definitions used to describe generic devices */ diff --git a/src/include/graph.h b/src/include/graph.h index ef949c961..9fb10d8e3 100644 --- a/src/include/graph.h +++ b/src/include/graph.h @@ -10,11 +10,11 @@ Author: 1988 Jeffrey M. Hsu #ifndef _GRAPH_H #define _GRAPH_H +#include "typedefs.h" #include "grid.h" #include "plot.h" #include "dvec.h" /* for struct dvec */ -typedef struct graph GRAPH; struct _keyed; diff --git a/src/include/ifsim.h b/src/include/ifsim.h index 09de1c7cb..093d909aa 100644 --- a/src/include/ifsim.h +++ b/src/include/ifsim.h @@ -6,6 +6,9 @@ Author: 1986 Thomas L. Quarles #ifndef IFSIMULATOR #define IFSIMULATOR +#include "typedefs.h" + + /* gtri - add - wbk - 10/11/90 - for structs referenced in IFdevice */ #ifdef XSPICE #include "mifparse.h" @@ -14,14 +17,6 @@ Author: 1986 Thomas L. Quarles /* gtri - end - wbk - 10/11/90 */ -typedef struct IFparm IFparm; -typedef union IFvalue IFvalue; -typedef struct IFparseTree IFparseTree; -typedef struct IFcomplex IFcomplex; -typedef struct IFdevice IFdevice; -typedef struct IFanalysis IFanalysis; -typedef struct IFsimulator IFsimulator; -typedef struct IFfrontEnd IFfrontEnd; /* @@ -66,7 +61,9 @@ struct IFparm { * */ -typedef char *IFuid; +/* moved to "typedefs.h" + * typedef char *IFuid; + */ /* diff --git a/src/include/mifcmdat.h b/src/include/mifcmdat.h index ea877455d..2a4d4d150 100755 --- a/src/include/mifcmdat.h +++ b/src/include/mifcmdat.h @@ -45,6 +45,7 @@ NON-STANDARD FEATURES =========================================================================== */ +#include "typedefs.h" #include "miftypes.h" diff --git a/src/include/ngspice.h b/src/include/ngspice.h index ca96d6782..21c343983 100644 --- a/src/include/ngspice.h +++ b/src/include/ngspice.h @@ -32,6 +32,7 @@ #include "macros.h" #include "bool.h" #include "complex.h" +#include "typedefs.h" #include #include diff --git a/src/include/tfdefs.h b/src/include/tfdefs.h index c4151c637..675e8021d 100644 --- a/src/include/tfdefs.h +++ b/src/include/tfdefs.h @@ -6,12 +6,11 @@ Author: 1985 Thomas L. Quarles #ifndef TF #define TF +#include "typedefs.h" #include "jobdefs.h" #include "tskdefs.h" #include "cktdefs.h" -typedef struct TFan TFan; - /* TFdefs.h - defs for transfer function analyses */ diff --git a/src/include/typedefs.h b/src/include/typedefs.h new file mode 100644 index 000000000..2f49c46bb --- /dev/null +++ b/src/include/typedefs.h @@ -0,0 +1,38 @@ +/* + * forward declaration of important structs + * and central typedefs which are not allowed to be repeated + */ + +#ifndef TYPEDEFS_H_INCLUDED +#define TYPEDEFS_H_INCLUDED + + +typedef struct CKTcircuit CKTcircuit; +typedef struct CKTnode CKTnode; + + +typedef struct GENinstance GENinstance; +typedef struct GENmodel GENmodel; + + +typedef struct IFparm IFparm; +typedef union IFvalue IFvalue; +typedef struct IFparseTree IFparseTree; +typedef struct IFcomplex IFcomplex; +typedef struct IFdevice IFdevice; +typedef struct IFanalysis IFanalysis; +typedef struct IFsimulator IFsimulator; +typedef struct IFfrontEnd IFfrontEnd; +typedef char *IFuid; + + +typedef struct TFan TFan; + + +typedef struct graph GRAPH; + + +struct dbcomm; + + +#endif