1 /*************
2  * Definitions header file
3  * 1999 E. Rouat
4  ************/
5 
6 /*
7  * This file will contain all #defines needed
8  * by ngspice code (in construction)
9  * It should only #define numeric constants, not macros.
10  */
11 
12 
13 #ifndef ngspice_DEFINES_H
14 #define ngspice_DEFINES_H
15 
16 /* Floating point and integral limits */
17 #include <float.h>
18 #include <limits.h>
19 
20 /*
21  * Physical constants (const.h)
22  */
23  /* For definitions of CHARGE, CONSTCtoK CONSTboltz, CONSTepsZero,
24   * CONSTepsSi02, CONSTmuZero, REFTEMP */
25 #include "ngspice/const.h"
26 
27 /* These constants are defined by GCC in math.h, but they are not part of
28  * the ANSI C standard. The #ifndefs will prevent warnings regarding macro
29  * redefinitions if this file is included AFTER math.h. However, if the
30  * order is reversed, the warnings will occur. Thus, they introduce a header
31  * order dependency. A better solution would be to rename the macros to
32  * something like NGM_* (ngspice math) throughout the source code. Then there
33  * would be no header ordering dependency. */
34 #ifndef M_PI
35 #define M_PI       CONSTpi
36 #endif
37 #ifndef M_E
38 #define M_E        CONSTnap
39 #endif
40 #ifndef M_LOG2E
41 #define M_LOG2E    CONSTlog2e
42 #endif
43 #ifndef M_LOG10E
44 #define M_LOG10E   CONSTlog10e
45 #endif
46 
47 /*
48  *  IEEE Floating point
49  */
50 
51 /* Largest exponent such that exp(MAX_EXP_ARG) <= DBL_MAX
52  * Actual max is ln(DBL_MAX) = 709.78. Unsure if there was any reason
53  * for setting the value lower */
54 #define MAX_EXP_ARG 709.0
55 
56 
57 
58 /* Standard initialisation file name */
59 #define INITSTR            ".spiceinit"
60 
61 /* Alternate initialisation file name */
62 #define ALT_INITSTR         "spice.rc"
63 
64 #if defined(__MINGW32__) || defined(_MSC_VER) || defined (HAS_WINGUI)
65 #define DIR_PATHSEP         "\\"
66 #define DIR_TERM            '\\'
67 #define DIR_PATHSEP_LINUX   "/"
68 #define DIR_TERM_LINUX      '/'
69 #define DIR_CWD             "."
70 
71 #define TEMPFORMAT          "%s%d.tmp"
72 #define TEMPFORMAT2         "%s%d_%d.tmp"
73 
74 /*
75 #define SYSTEM_PLOT5LPR     "lpr -P%s -g %s"
76 #define SYSTEM_PSLPR        "lpr -P%s %s"
77 #define SYSTEM_MAIL         "Mail -s \"%s (%s) Bug Report\" %s"
78 */
79 #else
80 
81 #define DIR_PATHSEP         "/"
82 #define DIR_TERM            '/'
83 #define DIR_CWD             "."
84 
85 #define TEMPFORMAT          "/tmp/%s%d"
86 #define TEMPFORMAT2         "/tmp/%s%d_%d"
87 #define SYSTEM_PLOT5LPR     "lpr -P%s -g %s"
88 #define SYSTEM_PSLPR        "lpr -P%s %s"
89 #define SYSTEM_MAIL         "Mail -s \"%s (%s) Bug Report\" %s"
90 
91 #endif
92 
93 /*
94  *  #define-s that are always on
95  */
96 
97 /* On Unix the following should always be true, so they should jump out */
98 
99 #define HAS_ASCII
100 #define HAS_TTY_
101 #define HAS_TIME_H
102 #define HAS_RLIMIT_
103 
104 
105 
106 #ifndef SIGNAL_FUNCTION
107 # ifdef HAVE_SIGHANDLER_T
108 #  define SIGNAL_FUNCTION sighandler_t
109 # elif HAVE_SIG_T
110 #  define SIGNAL_FUNCTION sig_t
111 # elif HAVE___SIGHANDLER_T
112 #  define SIGNAL_FUNCTION __sighandler_t
113 # else
114 #  define SIGNAL_FUNCTION RETSIGTYPE (*)(int)
115 # endif
116 #endif
117 
118 #define BSIZE_SP      512
119 #define LBSIZE_SP    4096
120 
121 
122 #define EXIT_NORMAL 0
123 #define EXIT_BAD    1
124 #define EXIT_INFO   2
125 #define EXIT_SEGV   3
126 
127 #define TRUE 1
128 #define FALSE 0
129 
130 /*
131 
132 #define DIR_PATHSEP	"/"
133 #define DIR_TERM	'/'
134 #define DIR_CWD		"."
135 
136 #define TEMPFORMAT	"/tmp/%s%d"
137 #define SYSTEM_PLOT5LPR	"lpr -P%s -g %s"
138 #define SYSTEM_PSLPR	"lpr -P%s %s"
139 #define SYSTEM_MAIL	"Mail -s \"%s (%s) Bug Report\" %s"
140 
141 */
142 
143 
144 
145 #endif
146 
147