Jspice3
ifnewuid.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: 1985 Thomas L. Quarles
5  1992 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 #include "spice.h"
9 #include "ftedefs.h"
10 #include "inpdefs.h"
11 #include "iferrmsg.h"
12 #include "misc.h"
13 
14 
15 int
16 IFnewUid(ckt,newuid,olduid,suffix,type,nodedata)
17 
18 GENERIC *ckt;
19 IFuid *newuid;
20 IFuid olduid;
21 char *suffix;
22 int type;
23 GENERIC **nodedata;
24 {
25  char *newname;
26  int error;
27 
28  if (olduid) {
29  newname = (char *)
30  tmalloc(sizeof(char)*(strlen(suffix)+strlen((char*)olduid)+2));
31  /* 2 = '#' + '\0' */
32  sprintf(newname,"%s#%s",(char*)olduid,suffix);
33  }
34  else {
35  newname = (char *)tmalloc(sizeof(char)*
36  (strlen(suffix)+1)); /* 1 = '\0' */
37  sprintf(newname,"%s",suffix);
38  }
39 
40  switch (type) {
41  case UID_ANALYSIS:
42  case UID_TASK:
43  case UID_INSTANCE:
44  case UID_OTHER:
45  case UID_MODEL:
46  error = INPinsert(&newname,
48  if (error && error != E_EXISTS) return (error);
49  *newuid = (IFuid) newname;
50  break;
51 
52  case UID_SIGNAL:
53  error = INPmkTerm(ckt,&newname,
54  (INPtables *)ft_curckt->ci_symtab,nodedata);
55  if (error && error != E_EXISTS) return (error);
56  *newuid = (IFuid) newname;
57  return (error);
58 
59  default:
60  return (E_BADPARM);
61  }
62  return (OK);
63 }
int IFnewUid(GENERIC *ckt, IFuid *newuid, IFuid olduid, char *suffix, int type, GENERIC **nodedata)
Definition: ifnewuid.c:16
#define UID_TASK
Definition: ifsim.h:81
#define UID_MODEL
Definition: ifsim.h:83
#define E_BADPARM
Definition: iferrmsg.h:26
#define UID_SIGNAL
Definition: ifsim.h:84
#define E_EXISTS
Definition: iferrmsg.h:20
int INPmkTerm()
int INPinsert()
#define OK
Definition: iferrmsg.h:17
char * tmalloc()
GENERIC * IFuid
Definition: ifsim.h:72
Definition: types.c:18
struct circ * ft_curckt
Definition: main.c:184
#define UID_INSTANCE
Definition: ifsim.h:82
#define UID_OTHER
Definition: ifsim.h:85
char * ci_symtab
Definition: ftedefs.h:28
#define UID_ANALYSIS
Definition: ifsim.h:80
char GENERIC
Definition: ifsim.h:27