change atof to INPevaluate to allow 10p

This commit is contained in:
dwarning 2010-01-16 22:26:22 +00:00
parent 59f1c840a5
commit 13f737c32d
3 changed files with 220 additions and 222 deletions

View File

@ -5,7 +5,6 @@ Author: 1992 Charles Hough
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "ifsim.h" #include "ifsim.h"
#include "inpdefs.h" #include "inpdefs.h"
#include "inpmacs.h" #include "inpmacs.h"
@ -32,7 +31,7 @@ void **node1; /* the first node's node pointer */
void **node2; /* the second node's node pointer */ void **node2; /* the second node's node pointer */
void *groundnode; void *groundnode;
int error; /* error code temporary */ int error; /* error code temporary */
int error1; /* secondary error code temporary */ int error1=0; /* secondary error code temporary */
INPmodel *thismodel; /* pointer to model structure describing our model */ INPmodel *thismodel; /* pointer to model structure describing our model */
void *mdfast; /* pointer to the actual model */ void *mdfast; /* pointer to the actual model */
void *fast; /* pointer to the actual instance */ void *fast; /* pointer to the actual instance */

View File

@ -5,7 +5,6 @@ Author: 1992 Charles Hough
**********/ **********/
#include "ngspice.h" #include "ngspice.h"
#include <stdio.h>
#include "ifsim.h" #include "ifsim.h"
#include "inpdefs.h" #include "inpdefs.h"
#include "inpmacs.h" #include "inpmacs.h"
@ -20,7 +19,7 @@ INP2Y(
{ {
/* parse a txl card */ /* parse a txl card */
/* Yxxxx node1 node2 name */ /* Yxxxx node1 gnode node2 gnode name */
int mytype; /* the type to determine txl */ int mytype; /* the type to determine txl */
int mytype2; /* the type to determine cpl */ int mytype2; /* the type to determine cpl */
@ -39,7 +38,7 @@ void *node1; /* the first node's node pointer */
void *node2; /* the second node's node pointer */ void *node2; /* the second node's node pointer */
void *gnode1, *gnode2, *inode1, *inode2; void *gnode1, *gnode2, *inode1, *inode2;
int error; /* error code temporary */ int error; /* error code temporary */
int error1; /* secondary error code temporary */ int error1=0; /* secondary error code temporary */
INPmodel *thismodel; /* pointer to model structure describing our model */ INPmodel *thismodel; /* pointer to model structure describing our model */
void *mdfast; /* pointer to the actual model */ void *mdfast; /* pointer to the actual model */
void *fast; /* pointer to the actual instance */ void *fast; /* pointer to the actual instance */
@ -97,20 +96,20 @@ int lenvalgiven = 0;
while (*line != '\0') { while (*line != '\0') {
if (*buf == 'R' || *buf == 'r') { if (*buf == 'R' || *buf == 'r') {
INPgetTok(&line,&buf,1); INPgetTok(&line,&buf,1);
rval = atof(buf); rval = INPevaluate(&buf, &error1, 1);
} }
if ((strcmp(buf,"L") == 0) || (strcmp(buf,"l") == 0)) { if ((strcmp(buf,"L") == 0) || (strcmp(buf,"l") == 0)) {
INPgetTok(&line,&buf,1); INPgetTok(&line,&buf,1);
lval = atof(buf); lval = INPevaluate(&buf, &error1, 1);
} }
if ((strcmp(buf,"C") == 0) || (strcmp(buf,"c") == 0)) { if ((strcmp(buf,"C") == 0) || (strcmp(buf,"c") == 0)) {
INPgetTok(&line,&buf,1); INPgetTok(&line,&buf,1);
cval = atof(buf); cval = INPevaluate(&buf, &error1, 1);
} }
if (lenvalgiven == 0) { if (lenvalgiven == 0) {
if (strcmp(buf,"length")== 0) { if (strcmp(buf,"length")== 0) {
INPgetTok(&line,&buf,1); INPgetTok(&line,&buf,1);
lenval = atof(buf); lenval = INPevaluate(&buf, &error1, 1);
} }
} }
INPgetTok(&line,&buf,1); INPgetTok(&line,&buf,1);

View File

@ -20,11 +20,13 @@ char *INPdomodel(void *ckt, card * image, INPtables * tab)
char *modname; char *modname;
int type = -1; int type = -1;
int lev; int lev, error1=0;
char ver[100]; char ver[100];
char *typename; char *typename;
char *err = (char *) NULL; char *err = (char *) NULL;
char *line; char *line;
char *val;
double rval=0, lval=0;
line = image->line; line = image->line;
@ -464,17 +466,15 @@ char *INPdomodel(void *ckt, card * image, INPtables * tab)
/* -------- Check if model is a transmission line of some sort --------- */ /* -------- Check if model is a transmission line of some sort --------- */
else if(strcmp(typename,"txl") == 0) { else if(strcmp(typename,"txl") == 0) {
char *val;
double rval=0, lval=0;
INPgetTok(&line,&val,1); INPgetTok(&line,&val,1);
while (*line != '\0') { while (*line != '\0') {
if (*val == 'R' || *val == 'r') { if (*val == 'R' || *val == 'r') {
INPgetTok(&line,&val,1); INPgetTok(&line,&val,1);
rval = atof(val); rval = INPevaluate(&val, &error1, 1);
} }
if ((strcmp(val,"L") == 0) || (strcmp(val,"l") == 0)) { if ((strcmp(val,"L") == 0) || (strcmp(val,"l") == 0)) {
INPgetTok(&line,&val,1); INPgetTok(&line,&val,1);
lval = atof(val); lval = INPevaluate(&val, &error1, 1);
} }
INPgetTok(&line,&val,1); INPgetTok(&line,&val,1);
} }
@ -499,7 +499,7 @@ char *INPdomodel(void *ckt, card * image, INPtables * tab)
} }
/* -------- Check if model is a ???? --------- */ /* -------- Check if model is a coupled transmission line --------- */
else if(strcmp(typename,"cpl") == 0) { else if(strcmp(typename,"cpl") == 0) {
type = INPtypelook("CplLines"); type = INPtypelook("CplLines");
if(type < 0) { if(type < 0) {