Jspice3
mutparse.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3e2 - Copyright (c) Stephen R. Whiteley 1992
3 Copyright 1990 Regents of the University of California. All rights reserved.
4 Authors: 1987 Thomas L. Quarles
5  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include <stdio.h>
10 #include "inpdefs.h"
11 #include "inpmacs.h"
12 
13 void
14 MUTparse(type,ckt,tabp,currentp)
15 
16 int type;
17 GENERIC *ckt;
18 GENERIC *tabp;
19 GENERIC *currentp;
20 {
21  /* mutual inductance parser */
22 
23  /* Kname Lname Lname <val> */
24 
25  INPtables *tab = (INPtables*)tabp;
26  card *current = (card*)currentp;
27 
28  char *line; /* the part of the current line left to parse */
29  char *name; /* the device's name */
30  int error; /* error code temporary */
31  GENERIC *fast; /* pointer to the actual instance */
32  IFvalue ptemp; /* a value structure to package resistance into */
33  IFvalue *parm; /* ptr to a value structure for function return values */
34  int waslead; /* flag to indicate that unlabeled number was found */
35  double leadval; /* actual value of unlabeled number */
36  IFuid uid; /* uid for default model */
37 
38  line = current->line;
39  INPgetTok(&line,&name,1);
40  INPinsert(&name,tab);
41 
42  if (!tab->defKmod) {
43  /* create deafult K model */
44  IFnewUid(ckt,&uid,(IFuid)NULL,"K",UID_MODEL,(GENERIC**)NULL);
45  IFC(newModel,(ckt,type,&(tab->defKmod),uid))
46  }
47  IFC(newInstance,(ckt,tab->defKmod,&fast,name))
48 
49  parm = INPgetValue(ckt,&line,IF_INSTANCE,tab);
50  GCA(INPpName,("inductor1",parm,ckt,type,fast))
51  parm = INPgetValue(ckt,&line,IF_INSTANCE,tab);
52  GCA(INPpName,("inductor2",parm,ckt,type,fast))
53 
54  PARSECALL((&line,ckt,type,fast,&leadval,&waslead,tab))
55  if (waslead) {
56  ptemp.rValue = leadval;
57  GCA(INPpName,("coefficient",&ptemp,ckt,type,fast))
58  }
59 }
int INPpName()
char * line
Definition: inpdefs.h:64
IFvalue * INPgetValue()
int IFnewUid()
Definition: inpdefs.h:62
#define UID_MODEL
Definition: ifsim.h:83
Definition: subckt.c:51
void MUTparse(int type, GENERIC *ckt, GENERIC *tabp, GENERIC *currentp)
Definition: mutparse.c:14
#define IF_INSTANCE
Definition: ifsim.h:112
double rValue
Definition: ifsim.h:233
int INPinsert()
Definition: fteinp.h:14
GENERIC * IFuid
Definition: ifsim.h:72
#define NULL
Definition: spdefs.h:121
Definition: types.c:18
#define GCA(func, args)
Definition: inpmacs.h:27
#define IFC(func, args)
Definition: inpmacs.h:19
#define PARSECALL(args)
Definition: inpmacs.h:42
GENERIC * defKmod
Definition: inpdefs.h:45
char GENERIC
Definition: ifsim.h:27
int INPgetTok()