Jspice3
sperror.c
Go to the documentation of this file.
1 /***************************************************************************
2 JSPICE3 adaptation of Spice3f2 - 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  1993 Stephen R. Whiteley
6 ****************************************************************************/
7 
8 /*
9  * provide the error message appropriate for the given error code
10  */
11 
12 #include "spice.h"
13 #include <stdio.h>
14 #include "cktdefs.h"
15 #include "sperror.h"
16 #include "util.h"
17 
18 #define MSG(a) \
19 val = MALLOC(2+strlen(a));\
20 if(val) {\
21  (void)strcpy(val,a);\
22  return(val);\
23 }\
24 (*(SPfrontEnd->IFerror))(ERR_PANIC,nomem,(IFuid *)NULL);\
25 return(NULL);
26 
27 
28 char *
30 int type;
31 {
32 
33 static char *unknownError = "Unknown error code";
34 static char *Pause = "Pause requested";
35 static char *intern = "Impossible error - can't occur";
36 static char *exists = "Device already exists, existing one being used";
37 static char *nodev = "No such device";
38 static char *noterm = "No such terminal on this device";
39 static char *nomod = "No such model";
40 static char *badparm = "No such parameter on this device";
41 static char *nomem = "Out of Memory";
42 static char *badmatrix = "Matrix can't be decomposed as is";
43 static char *singular = "Matrix is singular";
44 static char *iterlim = "Iteration limit reached";
45 static char *order = "Unsupported integration order";
46 static char *method = "Unsupported integration method";
47 static char *timestep = "Timestep too small";
48 static char *xmission = "transmission lines not supported by pole-zero";
49 static char *toobig = "magnitude overflow";
50 static char *isshort = "input or output shorted";
51 static char *inisout = "transfer function is 1";
52 static char *nodisto = "No distortion analysis: compiled with NODISTO opt";
53 static char *nonoise = "No noise analysis: compiled with NONOISE macro";
54 
55 char *val;
56 
57  switch(type) {
58  default:
59  MSG(unknownError)
60  case E_PAUSE:
61  MSG(Pause)
62  case OK:
63  return(NULL);
64  case E_INTERN:
65  MSG(intern)
66  case E_EXISTS:
67  MSG(exists)
68  case E_NODEV:
69  MSG(nodev)
70  case E_NOMOD:
71  MSG(nomod)
72  case E_NOTERM:
73  MSG(noterm)
74  case E_BADPARM:
75  MSG(badparm)
76  case E_NOMEM:
77  MSG(nomem)
78  case E_BADMATRIX:
79  MSG(badmatrix)
80  case E_SINGULAR:
81  MSG(singular)
82  case E_ITERLIM:
83  MSG(iterlim)
84  case E_ORDER:
85  MSG(order)
86  case E_METHOD:
87  MSG(method)
88  case E_TIMESTEP:
89  MSG(timestep)
90  case E_XMISSIONLINE:
91  MSG(xmission)
92  case E_MAGEXCEEDED:
93  MSG(toobig)
94  case E_SHORT:
95  MSG(isshort)
96  case E_INISOUT:
97  MSG(inisout)
98  case E_NODISTO:
99  MSG(nodisto)
100  case E_NONOISE:
101  MSG(nonoise)
102  }
103  /*NOTREACHED*/
104 }
105 
#define E_INTERN
Definition: sperror.h:15
#define E_PAUSE
Definition: iferrmsg.h:15
#define E_NODISTO
Definition: sperror.h:31
#define E_BADMATRIX
Definition: sperror.h:16
#define E_ORDER
Definition: sperror.h:19
char * SPerror(int type)
Definition: sperror.c:29
#define E_NODEV
Definition: iferrmsg.h:22
static int nodev()
Definition: display.c:476
#define E_BADPARM
Definition: iferrmsg.h:26
#define E_EXISTS
Definition: iferrmsg.h:20
#define E_SHORT
Definition: sperror.h:24
#define OK
Definition: iferrmsg.h:17
#define E_INISOUT
Definition: sperror.h:25
#define E_TIMESTEP
Definition: sperror.h:21
#define NULL
Definition: spdefs.h:121
Definition: types.c:18
#define E_NOMEM
Definition: iferrmsg.h:27
#define E_NOMOD
Definition: iferrmsg.h:23
#define E_XMISSIONLINE
Definition: sperror.h:22
#define E_NOTERM
Definition: iferrmsg.h:25
#define E_SINGULAR
Definition: sperror.h:17
#define E_ITERLIM
Definition: sperror.h:18
#define E_NONOISE
Definition: sperror.h:32
#define E_METHOD
Definition: sperror.h:20
#define E_MAGEXCEEDED
Definition: sperror.h:23
#define MSG(a)
Definition: sperror.c:18