From af93d7967583a6cdfd9a9ae2fd3e304e12cf53a0 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 16 Apr 2016 13:55:53 +0200 Subject: [PATCH] ngspice/mifparse.h, ngspice/mifcmdat.t, reduce scope of these include files --- src/include/ngspice/ifsim.h | 3 +-- src/include/ngspice/mifcmdat.h | 4 ++-- src/include/ngspice/mifparse.h | 30 ++++++++++++++++++++++++------ src/include/ngspice/miftypes.h | 25 ++++++++----------------- src/xspice/mif/mifdelete.c | 4 ++++ 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/src/include/ngspice/ifsim.h b/src/include/ngspice/ifsim.h index 873e533b2..4d62605b8 100644 --- a/src/include/ngspice/ifsim.h +++ b/src/include/ngspice/ifsim.h @@ -11,8 +11,7 @@ Author: 1986 Thomas L. Quarles /* gtri - add - wbk - 10/11/90 - for structs referenced in IFdevice */ #ifdef XSPICE -#include "ngspice/mifparse.h" -#include "ngspice/mifcmdat.h" +#include "ngspice/miftypes.h" #endif /* gtri - end - wbk - 10/11/90 */ diff --git a/src/include/ngspice/mifcmdat.h b/src/include/ngspice/mifcmdat.h index 655445a68..389cd273c 100644 --- a/src/include/ngspice/mifcmdat.h +++ b/src/include/ngspice/mifcmdat.h @@ -357,7 +357,7 @@ typedef struct Mif_Inst_Var_Data_s { * The top level data structure passed to code models. */ -typedef struct Mif_Private_s { +struct Mif_Private { Mif_Circ_Data_t circuit; /* Information about the circuit */ int num_conn; /* Number of connections on this model */ @@ -367,7 +367,7 @@ typedef struct Mif_Private_s { int num_inst_var; /* Number of instance variables */ Mif_Inst_Var_Data_t **inst_var; /* Information about each inst variable */ -} Mif_Private_t; +}; diff --git a/src/include/ngspice/mifparse.h b/src/include/ngspice/mifparse.h index 6d5171593..fcd5e98e1 100644 --- a/src/include/ngspice/mifparse.h +++ b/src/include/ngspice/mifparse.h @@ -47,12 +47,30 @@ NON-STANDARD FEATURES #include "ngspice/miftypes.h" +/* + * Values of different types used by the parser. Note that this is a structure + * instead of a union because we need to do initializations in the ifspec.c files for + * the models and unions cannot be initialized in any useful way in C + * + */ + +struct Mif_Parse_Value { + + Mif_Boolean_t bvalue; /* For boolean values */ + int ivalue; /* For integer values */ + double rvalue; /* For real values */ + Mif_Complex_t cvalue; /* For complex values */ + char *svalue; /* For string values */ + +}; + + /* * Information about a connection used by the parser to error check input */ -typedef struct Mif_Conn_Info_s { +struct Mif_Conn_Info { char *name; /* Name of this connection */ char *description; /* Description of this connection */ @@ -69,7 +87,7 @@ typedef struct Mif_Conn_Info_s { int upper_bound; /* Array size upper bound */ Mif_Boolean_t null_allowed; /* True if null is allowed for this connection */ -} Mif_Conn_Info_t; +}; @@ -78,7 +96,7 @@ typedef struct Mif_Conn_Info_s { * Information about a parameter used by the parser to error check input */ -typedef struct Mif_Param_Info_s { +struct Mif_Param_Info { char *name; /* Name of this parameter */ char *description; /* Description of this parameter */ @@ -98,7 +116,7 @@ typedef struct Mif_Param_Info_s { int upper_bound; /* Array size upper bound */ Mif_Boolean_t null_allowed; /* True if null is allowed for this parameter */ -} Mif_Param_Info_t; +}; @@ -107,14 +125,14 @@ typedef struct Mif_Param_Info_s { * Information about an instance parameter used by the parser to error check input */ -typedef struct Mif_Inst_Var_Info_s { +struct Mif_Inst_Var_Info { char *name; /* Name of this instance var */ char *description; /* Description of this instance var */ Mif_Data_Type_t type; /* Is this a real, boolean, string, ... */ Mif_Boolean_t is_array; /* True if instance var is an array */ -} Mif_Inst_Var_Info_t; +}; #endif diff --git a/src/include/ngspice/miftypes.h b/src/include/ngspice/miftypes.h index 92c48ed4e..d7f1aac5b 100644 --- a/src/include/ngspice/miftypes.h +++ b/src/include/ngspice/miftypes.h @@ -205,23 +205,14 @@ typedef union { - -/* - * Values of different types used by the parser. Note that this is a structure - * instead of a union because we need to do initializations in the ifspec.c files for - * the models and unions cannot be initialized in any useful way in C - * - */ - -typedef struct { - - Mif_Boolean_t bvalue; /* For boolean values */ - int ivalue; /* For integer values */ - double rvalue; /* For real values */ - Mif_Complex_t cvalue; /* For complex values */ - char *svalue; /* For string values */ - -} Mif_Parse_Value_t; +/* types from mifparse.h */ +typedef struct Mif_Parse_Value Mif_Parse_Value_t; +typedef struct Mif_Conn_Info Mif_Conn_Info_t; +typedef struct Mif_Param_Info Mif_Param_Info_t; +typedef struct Mif_Inst_Var_Info Mif_Inst_Var_Info_t; + +/* types from mifcmdat.h */ +typedef struct Mif_Private Mif_Private_t; #endif diff --git a/src/xspice/mif/mifdelete.c b/src/xspice/mif/mifdelete.c index fd64c8be3..8c62b7a55 100644 --- a/src/xspice/mif/mifdelete.c +++ b/src/xspice/mif/mifdelete.c @@ -45,6 +45,10 @@ NON-STANDARD FEATURES #include "ngspice/mifproto.h" #include "ngspice/mifdefs.h" +#if defined(_MSC_VER) || defined(__MINGW32__) +#include "ngspice/mifparse.h" +#endif + #include "ngspice/suffix.h" #include "ngspice/devdefs.h"