Jspice3
ifnewuid.c File Reference
#include "spice.h"
#include "ftedefs.h"
#include "inpdefs.h"
#include "iferrmsg.h"
#include "misc.h"
Include dependency graph for ifnewuid.c:

Go to the source code of this file.

Functions

int IFnewUid (GENERIC *ckt, IFuid *newuid, IFuid olduid, char *suffix, int type, GENERIC **nodedata)
 

Function Documentation

int IFnewUid ( GENERIC ckt,
IFuid newuid,
IFuid  olduid,
char *  suffix,
int  type,
GENERIC **  nodedata 
)

Definition at line 16 of file ifnewuid.c.

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 }
#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