5 changed files with 260 additions and 256 deletions
-
5ChangeLog
-
326src/ciderlib/input/optionsc.c
-
172src/misc/getopt_bsd.h
-
12src/spicelib/devices/res/resask.c
-
1src/xspice/evt/evttermi.c
@ -1,163 +1,163 @@ |
|||
/********** |
|||
Copyright 1991 Regents of the University of California. All rights reserved. |
|||
Author: 1991 David A. Gates, U. C. Berkeley CAD Group |
|||
Modified: 2001 Paolo Nenzi |
|||
**********/ |
|||
|
|||
#include "ngspice.h" |
|||
#include "numcards.h" |
|||
#include "numgen.h" |
|||
#include "optndefs.h" |
|||
#include "devdefs.h" |
|||
#include "sperror.h" |
|||
#include "suffix.h" |
|||
|
|||
#define M_TO_CM 1.0e2 |
|||
#define M2_TO_CM2 (M_TO_CM * M_TO_CM) |
|||
#define UM_TO_CM 1.0e-4 |
|||
#define UM2_TO_CM2 (UM_TO_CM * UM_TO_CM) |
|||
|
|||
extern int OPTNnewCard(void**,void*); |
|||
extern int OPTNparam(int,IFvalue*,void*); |
|||
|
|||
|
|||
|
|||
IFparm OPTNpTable[] = { |
|||
/* Supported Types of Devices. Ideally should be automatically extracted */ |
|||
IP("resistor",OPTN_RESISTOR, IF_FLAG, "Resistor"), |
|||
IP("capacitor",OPTN_CAPACITOR, IF_FLAG, "Capacitor"), |
|||
IP("diode", OPTN_DIODE, IF_FLAG, "Diode"), |
|||
IP("bipolar", OPTN_BIPOLAR, IF_FLAG, "Bipolar Transistor"), |
|||
IP("bjt", OPTN_BIPOLAR, IF_FLAG, "Bipolar Transistor"), |
|||
IP("soibjt", OPTN_SOIBJT, IF_FLAG, "SOI Bipolar"), |
|||
IP("moscap", OPTN_MOSCAP, IF_FLAG, "MOS Capacitor"), |
|||
IP("mosfet", OPTN_MOSFET, IF_FLAG, "MOSFET"), |
|||
IP("soimos", OPTN_SOIMOS, IF_FLAG, "SOI MOSFET"), |
|||
IP("jfet", OPTN_JFET, IF_FLAG, "Junction FET"), |
|||
IP("mesfet", OPTN_MESFET, IF_FLAG, "MESFET"), |
|||
/* Various layout dimensions */ |
|||
IP("defa", OPTN_DEFA, IF_REAL, "Default Mask Area"), |
|||
IP("defw", OPTN_DEFW, IF_REAL, "Default Mask Width"), |
|||
IP("defl", OPTN_DEFL, IF_REAL, "Default Mask Length"), |
|||
IP("base.area",OPTN_BASE_AREA, IF_REAL, "1D BJT Base Area"), |
|||
IP("base.length",OPTN_BASE_LENGTH,IF_REAL, "1D BJT Base Length"), |
|||
IP("base.depth",OPTN_BASE_DEPTH, IF_REAL, "1D BJT Base Depth"), |
|||
/* Values */ |
|||
IP("tnom", OPTN_TNOM, IF_REAL, "Nominal Temperature"), |
|||
/* Device Initial Condition File */ |
|||
IP("ic.file", OPTN_IC_FILE, IF_STRING, "Initial condition file"), |
|||
IP("unique", OPTN_UNIQUE, IF_FLAG, "Generate unique filename") |
|||
}; |
|||
|
|||
IFcardInfo OPTNinfo = { |
|||
"options", |
|||
"Provide optional information and hints", |
|||
NUMELEMS(OPTNpTable), |
|||
OPTNpTable, |
|||
|
|||
OPTNnewCard, |
|||
OPTNparam, |
|||
NULL |
|||
}; |
|||
|
|||
int |
|||
OPTNnewCard(void **inCard, void *inModel) |
|||
{ |
|||
OPTNcard *tmpCard, *newCard; |
|||
GENnumModel *model = (GENnumModel *)inModel; |
|||
|
|||
tmpCard = model->GENoptions; |
|||
if (!tmpCard) { /* First in list */ |
|||
newCard = NEW( OPTNcard ); |
|||
if (!newCard) { |
|||
*inCard = (void *)NULL; |
|||
return(E_NOMEM); |
|||
} |
|||
newCard->OPTNnextCard = (OPTNcard *)NULL; |
|||
*inCard = (void *)newCard; |
|||
model->GENoptions = newCard; |
|||
} else { /* Only one card of this type allowed */ |
|||
*inCard = (void *)tmpCard; |
|||
} |
|||
return(OK); |
|||
} |
|||
|
|||
int |
|||
OPTNparam(int param, IFvalue *value, void *inCard) |
|||
{ |
|||
OPTNcard *card = (OPTNcard *)inCard; |
|||
|
|||
switch (param) { |
|||
case OPTN_RESISTOR: |
|||
card->OPTNdeviceType = OPTN_RESISTOR; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_CAPACITOR: |
|||
card->OPTNdeviceType = OPTN_CAPACITOR; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_DIODE: |
|||
card->OPTNdeviceType = OPTN_DIODE; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_MOSCAP: |
|||
card->OPTNdeviceType = OPTN_MOSCAP; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_BIPOLAR: |
|||
case OPTN_SOIBJT: /* XXX Treat SOI as normal */ |
|||
card->OPTNdeviceType = OPTN_BIPOLAR; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_MOSFET: |
|||
case OPTN_SOIMOS: /* XXX Treat SOI as normal */ |
|||
card->OPTNdeviceType = OPTN_MOSFET; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_JFET: |
|||
case OPTN_MESFET: /* XXX Treat MES as junction */ |
|||
card->OPTNdeviceType = OPTN_JFET; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_DEFA: |
|||
card->OPTNdefa = value->rValue * M2_TO_CM2; |
|||
card->OPTNdefaGiven = TRUE; |
|||
break; |
|||
case OPTN_DEFW: |
|||
card->OPTNdefw = value->rValue * M_TO_CM; |
|||
card->OPTNdefwGiven = TRUE; |
|||
break; |
|||
case OPTN_DEFL: |
|||
card->OPTNdefl = value->rValue * M_TO_CM; |
|||
card->OPTNdeflGiven = TRUE; |
|||
break; |
|||
case OPTN_BASE_AREA: |
|||
card->OPTNbaseArea = value->rValue; |
|||
card->OPTNbaseAreaGiven = TRUE; |
|||
break; |
|||
case OPTN_BASE_LENGTH: |
|||
card->OPTNbaseLength = value->rValue * UM_TO_CM; |
|||
card->OPTNbaseLengthGiven = TRUE; |
|||
break; |
|||
case OPTN_BASE_DEPTH: |
|||
card->OPTNbaseDepth = value->rValue * UM_TO_CM; |
|||
card->OPTNbaseDepthGiven = TRUE; |
|||
break; |
|||
case OPTN_TNOM: |
|||
card->OPTNtnom = value->rValue; |
|||
card->OPTNtnomGiven = TRUE; |
|||
break; |
|||
case OPTN_IC_FILE: |
|||
card->OPTNicFile = value->sValue; |
|||
card->OPTNicFileGiven = TRUE; |
|||
break; |
|||
case OPTN_UNIQUE: |
|||
card->OPTNunique = value->iValue; |
|||
card->OPTNuniqueGiven = TRUE; |
|||
break; |
|||
default: |
|||
return(E_BADPARM); |
|||
break; |
|||
} |
|||
return(OK); |
|||
} |
|||
/********** |
|||
Copyright 1991 Regents of the University of California. All rights reserved. |
|||
Author: 1991 David A. Gates, U. C. Berkeley CAD Group |
|||
Modified: 2001 Paolo Nenzi |
|||
**********/ |
|||
|
|||
#include "ngspice.h" |
|||
#include "numcards.h" |
|||
#include "numgen.h" |
|||
#include "optndefs.h" |
|||
#include "devdefs.h" |
|||
#include "sperror.h" |
|||
#include "suffix.h" |
|||
|
|||
#define M_TO_CM 1.0e2 |
|||
#define M2_TO_CM2 (M_TO_CM * M_TO_CM) |
|||
#define UM_TO_CM 1.0e-4 |
|||
#define UM2_TO_CM2 (UM_TO_CM * UM_TO_CM) |
|||
|
|||
extern int OPTNnewCard(void**,void*); |
|||
extern int OPTNparam(int,IFvalue*,void*); |
|||
|
|||
|
|||
|
|||
IFparm OPTNpTable[] = { |
|||
/* Supported Types of Devices. Ideally should be automatically extracted */ |
|||
IP("resistor",OPTN_RESISTOR, IF_FLAG, "Resistor"), |
|||
IP("capacitor",OPTN_CAPACITOR, IF_FLAG, "Capacitor"), |
|||
IP("diode", OPTN_DIODE, IF_FLAG, "Diode"), |
|||
IP("bipolar", OPTN_BIPOLAR, IF_FLAG, "Bipolar Transistor"), |
|||
IP("bjt", OPTN_BIPOLAR, IF_FLAG, "Bipolar Transistor"), |
|||
IP("soibjt", OPTN_SOIBJT, IF_FLAG, "SOI Bipolar"), |
|||
IP("moscap", OPTN_MOSCAP, IF_FLAG, "MOS Capacitor"), |
|||
IP("mosfet", OPTN_MOSFET, IF_FLAG, "MOSFET"), |
|||
IP("soimos", OPTN_SOIMOS, IF_FLAG, "SOI MOSFET"), |
|||
IP("jfet", OPTN_JFET, IF_FLAG, "Junction FET"), |
|||
IP("mesfet", OPTN_MESFET, IF_FLAG, "MESFET"), |
|||
/* Various layout dimensions */ |
|||
IP("defa", OPTN_DEFA, IF_REAL, "Default Mask Area"), |
|||
IP("defw", OPTN_DEFW, IF_REAL, "Default Mask Width"), |
|||
IP("defl", OPTN_DEFL, IF_REAL, "Default Mask Length"), |
|||
IP("base.area",OPTN_BASE_AREA, IF_REAL, "1D BJT Base Area"), |
|||
IP("base.length",OPTN_BASE_LENGTH,IF_REAL, "1D BJT Base Length"), |
|||
IP("base.depth",OPTN_BASE_DEPTH, IF_REAL, "1D BJT Base Depth"), |
|||
/* Values */ |
|||
IP("tnom", OPTN_TNOM, IF_REAL, "Nominal Temperature"), |
|||
/* Device Initial Condition File */ |
|||
IP("ic.file", OPTN_IC_FILE, IF_STRING, "Initial condition file"), |
|||
IP("unique", OPTN_UNIQUE, IF_FLAG, "Generate unique filename") |
|||
}; |
|||
|
|||
IFcardInfo OPTNinfo = { |
|||
"options", |
|||
"Provide optional information and hints", |
|||
NUMELEMS(OPTNpTable), |
|||
OPTNpTable, |
|||
|
|||
OPTNnewCard, |
|||
OPTNparam, |
|||
NULL |
|||
}; |
|||
|
|||
int |
|||
OPTNnewCard(void **inCard, void *inModel) |
|||
{ |
|||
OPTNcard *tmpCard, *newCard; |
|||
GENnumModel *model = (GENnumModel *)inModel; |
|||
|
|||
tmpCard = model->GENoptions; |
|||
if (!tmpCard) { /* First in list */ |
|||
newCard = NEW( OPTNcard ); |
|||
if (!newCard) { |
|||
*inCard = (void *)NULL; |
|||
return(E_NOMEM); |
|||
} |
|||
newCard->OPTNnextCard = (OPTNcard *)NULL; |
|||
*inCard = (void *)newCard; |
|||
model->GENoptions = newCard; |
|||
} else { /* Only one card of this type allowed */ |
|||
*inCard = (void *)tmpCard; |
|||
} |
|||
return(OK); |
|||
} |
|||
|
|||
int |
|||
OPTNparam(int param, IFvalue *value, void *inCard) |
|||
{ |
|||
OPTNcard *card = (OPTNcard *)inCard; |
|||
|
|||
switch (param) { |
|||
case OPTN_RESISTOR: |
|||
card->OPTNdeviceType = OPTN_RESISTOR; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_CAPACITOR: |
|||
card->OPTNdeviceType = OPTN_CAPACITOR; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_DIODE: |
|||
card->OPTNdeviceType = OPTN_DIODE; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_MOSCAP: |
|||
card->OPTNdeviceType = OPTN_MOSCAP; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_BIPOLAR: |
|||
case OPTN_SOIBJT: /* XXX Treat SOI as normal */ |
|||
card->OPTNdeviceType = OPTN_BIPOLAR; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_MOSFET: |
|||
case OPTN_SOIMOS: /* XXX Treat SOI as normal */ |
|||
card->OPTNdeviceType = OPTN_MOSFET; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_JFET: |
|||
case OPTN_MESFET: /* XXX Treat MES as junction */ |
|||
card->OPTNdeviceType = OPTN_JFET; |
|||
card->OPTNdeviceTypeGiven = TRUE; |
|||
break; |
|||
case OPTN_DEFA: |
|||
card->OPTNdefa = value->rValue * M2_TO_CM2; |
|||
card->OPTNdefaGiven = TRUE; |
|||
break; |
|||
case OPTN_DEFW: |
|||
card->OPTNdefw = value->rValue * M_TO_CM; |
|||
card->OPTNdefwGiven = TRUE; |
|||
break; |
|||
case OPTN_DEFL: |
|||
card->OPTNdefl = value->rValue * M_TO_CM; |
|||
card->OPTNdeflGiven = TRUE; |
|||
break; |
|||
case OPTN_BASE_AREA: |
|||
card->OPTNbaseArea = value->rValue; |
|||
card->OPTNbaseAreaGiven = TRUE; |
|||
break; |
|||
case OPTN_BASE_LENGTH: |
|||
card->OPTNbaseLength = value->rValue * UM_TO_CM; |
|||
card->OPTNbaseLengthGiven = TRUE; |
|||
break; |
|||
case OPTN_BASE_DEPTH: |
|||
card->OPTNbaseDepth = value->rValue * UM_TO_CM; |
|||
card->OPTNbaseDepthGiven = TRUE; |
|||
break; |
|||
case OPTN_TNOM: |
|||
card->OPTNtnom = value->rValue; |
|||
card->OPTNtnomGiven = TRUE; |
|||
break; |
|||
case OPTN_IC_FILE: |
|||
card->OPTNicFile = value->sValue; |
|||
card->OPTNicFileGiven = TRUE; |
|||
break; |
|||
case OPTN_UNIQUE: |
|||
card->OPTNunique = value->iValue; |
|||
card->OPTNuniqueGiven = TRUE; |
|||
break; |
|||
default: |
|||
return(E_BADPARM); |
|||
break; |
|||
} |
|||
return(OK); |
|||
} |
|||
@ -1,86 +1,86 @@ |
|||
/* |
|||
* Copyright (c) 1987, 1993, 1994, 1996 |
|||
* The Regents of the University of California. All rights reserved. |
|||
* |
|||
* Redistribution and use in source and binary forms, with or without |
|||
* modification, are permitted provided that the following conditions |
|||
* are met: |
|||
* 1. Redistributions of source code must retain the above copyright |
|||
* notice, this list of conditions and the following disclaimer. |
|||
* 2. Redistributions in binary form must reproduce the above copyright |
|||
* notice, this list of conditions and the following disclaimer in the |
|||
* documentation and/or other materials provided with the distribution. |
|||
* 3. All advertising materials mentioning features or use of this software |
|||
* must display the following acknowledgement: |
|||
* This product includes software developed by the University of |
|||
* California, Berkeley and its contributors. |
|||
* 4. Neither the name of the University nor the names of its contributors |
|||
* may be used to endorse or promote products derived from this software |
|||
* without specific prior written permission. |
|||
* |
|||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|||
* SUCH DAMAGE. |
|||
*/ |
|||
|
|||
/* from MINGW gcc 345, H. Vogt 04/10/09 */ |
|||
|
|||
#ifndef __GETOPT_BSD_H__ |
|||
#define __GETOPT_BSD_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
extern int opterr; /* if error message should be printed */ |
|||
extern int optind; /* index into parent argv vector */ |
|||
extern int optopt; /* character checked for validity */ |
|||
extern int optreset; /* reset getopt */ |
|||
extern char *optarg; /* argument associated with option */ |
|||
|
|||
int getopt (int, char * const *, const char *); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __GETOPT_H__ */ |
|||
|
|||
#ifndef __UNISTD_GETOPT__ |
|||
#ifndef __GETOPT_LONG_BSD_H__ |
|||
#define __GETOPT_LONG_BSD_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
struct option { |
|||
const char *name; |
|||
int has_arg; |
|||
int *flag; |
|||
int val; |
|||
}; |
|||
|
|||
int getopt_long (int, char *const *, const char *, const struct option *, int *); |
|||
#ifndef HAVE_DECL_GETOPT |
|||
#define HAVE_DECL_GETOPT 1 |
|||
#endif |
|||
|
|||
#define no_argument 0 |
|||
#define required_argument 1 |
|||
#define optional_argument 2 |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __GETOPT_LONG_H__ */ |
|||
#endif /* __UNISTD_GETOPT__ */ |
|||
/* |
|||
* Copyright (c) 1987, 1993, 1994, 1996 |
|||
* The Regents of the University of California. All rights reserved. |
|||
* |
|||
* Redistribution and use in source and binary forms, with or without |
|||
* modification, are permitted provided that the following conditions |
|||
* are met: |
|||
* 1. Redistributions of source code must retain the above copyright |
|||
* notice, this list of conditions and the following disclaimer. |
|||
* 2. Redistributions in binary form must reproduce the above copyright |
|||
* notice, this list of conditions and the following disclaimer in the |
|||
* documentation and/or other materials provided with the distribution. |
|||
* 3. All advertising materials mentioning features or use of this software |
|||
* must display the following acknowledgement: |
|||
* This product includes software developed by the University of |
|||
* California, Berkeley and its contributors. |
|||
* 4. Neither the name of the University nor the names of its contributors |
|||
* may be used to endorse or promote products derived from this software |
|||
* without specific prior written permission. |
|||
* |
|||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
|||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
|||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
|||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
|||
* SUCH DAMAGE. |
|||
*/ |
|||
|
|||
/* from MINGW gcc 345, H. Vogt 04/10/09 */ |
|||
|
|||
#ifndef __GETOPT_BSD_H__ |
|||
#define __GETOPT_BSD_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
extern int opterr; /* if error message should be printed */ |
|||
extern int optind; /* index into parent argv vector */ |
|||
extern int optopt; /* character checked for validity */ |
|||
extern int optreset; /* reset getopt */ |
|||
extern char *optarg; /* argument associated with option */ |
|||
|
|||
int getopt (int, char * const *, const char *); |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __GETOPT_H__ */ |
|||
|
|||
#ifndef __UNISTD_GETOPT__ |
|||
#ifndef __GETOPT_LONG_BSD_H__ |
|||
#define __GETOPT_LONG_BSD_H__ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
struct option { |
|||
const char *name; |
|||
int has_arg; |
|||
int *flag; |
|||
int val; |
|||
}; |
|||
|
|||
int getopt_long (int, char *const *, const char *, const struct option *, int *); |
|||
#ifndef HAVE_DECL_GETOPT |
|||
#define HAVE_DECL_GETOPT 1 |
|||
#endif |
|||
|
|||
#define no_argument 0 |
|||
#define required_argument 1 |
|||
#define optional_argument 2 |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __GETOPT_LONG_H__ */ |
|||
#endif /* __UNISTD_GETOPT__ */ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue