1 //************************************************************************************************** 2 // TypeDefs.hpp * 3 // -------------- * 4 // Description : This header file mostly contains enumerated type definitions which may be used * 5 // anywhere in the application. * 6 // Started : 2007-09-06 * 7 // Last Update : 2015-04-06 * 8 // Copyright : (C) 2007 by MSWaters * 9 //************************************************************************************************** 10 11 //************************************************************************************************** 12 // * 13 // This program is free software; you can redistribute it and/or modify it under the * 14 // terms of the GNU General Public License as published by the Free Software Foundation; * 15 // either version 3 of the License, or (at your option) any later version. * 16 // * 17 //************************************************************************************************** 18 19 #ifndef TYPEDEFS_HPP 20 #define TYPEDEFS_HPP 21 22 // System Includes 23 24 #include <iostream> 25 #include <climits> 26 #include <cmath> 27 #include <cfloat> 28 29 // wxWidgets Includes 30 31 #include <wx/wx.h> 32 #include <wx/filename.h> 33 34 // External Variables 35 36 extern bool g_bDebug; // Declared in App_gSpiceUI.hpp 37 38 //************************************************************************************************** 39 // Temporary macro definitions to facilitate transition from wxWidgets library version 2.x to 3.x 40 41 #ifndef wxIMPLEMENT_APP 42 #define wxIMPLEMENT_APP(X) IMPLEMENT_APP(X) 43 #endif 44 45 #ifndef wxBEGIN_EVENT_TABLE 46 #define wxBEGIN_EVENT_TABLE(X,Y) BEGIN_EVENT_TABLE(X,Y) 47 #endif 48 49 #ifndef wxEND_EVENT_TABLE 50 #define wxEND_EVENT_TABLE( ) END_EVENT_TABLE( ) 51 #endif 52 53 #ifndef wxDECLARE_EVENT_TABLE 54 #define wxDECLARE_EVENT_TABLE( ) DECLARE_EVENT_TABLE( ) 55 #endif 56 57 //************************************************************************************************** 58 // Type definitions 59 60 #ifdef __BSD__ 61 typedef unsigned long ulong; 62 typedef unsigned int uint; 63 typedef unsigned char uchar; 64 #endif 65 66 typedef wxStaticText wxLabel; 67 68 //************************************************************************************************** 69 // Operating System specific macro declarations 70 71 #if defined(__WXOSX__) || defined(__BSD__) 72 #define EXP10(X) pow(10.0,X) 73 #define EXP10F(X) powf(10.0,X) 74 #else 75 #define EXP10(X) exp10(X) 76 #define EXP10F(X) exp10f(X) 77 #endif 78 79 //************************************************************************************************** 80 // Useful #defines 81 82 #define GUI_CTRL_HT 26 // The height of the PnlValue control in pixels 83 84 // The following #define values where determined using the test utility test_CnvtType 85 #define NOVAL_UINT UINT_MAX // UINT_MAX = 4294967295 86 #define NOVAL_ULNG ULONG_MAX // ULONG_MAX = 18446744073709551615 87 #define NOVAL_INT INT_MIN // INT_MIN = -2147483648 88 // INT_MAX = 2147483647 89 #define NOVAL_LNG LONG_MIN // LONG_MIN = -9223372036854775808 90 // LONG_MAX = 9223372036854775807 91 #define NOVAL_FLT FLT_MIN // FLT_MIN = 1.17549e-38 92 // FLT_MAX = 3.40282e+38 93 #define NOVAL_DBL DBL_MIN // DBL_MIN = 2.22507e-308 94 // DBL_MAX = 1.79769e+308 95 96 //************************************************************************************************** 97 // Fonts 98 99 #define FONT_NORM wxFont( 9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) 100 #define FONT_BOLD wxFont( 9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ) 101 #define FONT_SLANT wxFont( 9, wxFONTFAMILY_SWISS, wxFONTSTYLE_SLANT, wxFONTWEIGHT_LIGHT ) 102 #define FONT_MONO wxFont( 8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) 103 104 //************************************************************************************************** 105 // Binary file names 106 107 #define BIN_GNETLIST wxT("gnetlist") 108 #define BIN_GSCHEM wxT("gschem") 109 #define BIN_GWAVE wxT("gwave2") 110 #define BIN_GAW wxT("gaw") 111 #define BIN_GNUCAP wxT("gnucap") 112 #define BIN_NGSPICE wxT("ngspice") 113 114 //************************************************************************************************** 115 // Enumerated types 116 117 // Enumerated type for the various simulator engine types 118 enum eTypeSimEng 119 { 120 eSIMR_GNUCAP, // GNU-Cap 121 eSIMR_NGSPICE, // NG-Spice 122 123 eSIMR_NONE, // No simulation engine specified 124 125 eSIMR_FST = eSIMR_GNUCAP, 126 eSIMR_LST = eSIMR_NGSPICE 127 }; 128 129 // Enumerated type for the various waveform viewers types 130 enum eTypeView 131 { 132 eVIEW_GWAVE, // GWave 133 eVIEW_GAW, // Gaw 134 135 eVIEW_NONE, // No waveform viewer specified 136 137 eVIEW_FST = eVIEW_GWAVE, 138 eVIEW_LST = eVIEW_GAW 139 }; 140 141 // Enumerated type for the various command types which may be performed 142 enum eTypeCmd 143 { 144 eCMD_OP, // Quiescent operating point analysis 145 eCMD_DC, // DC analysis 146 eCMD_AC, // AC analysis 147 eCMD_TR, // Transient analysis 148 eCMD_FO, // Fourier analysis 149 eCMD_DI, // Distortion analysis 150 eCMD_NO, // Noise analysis 151 eCMD_PZ, // Pole-zero analysis 152 eCMD_SE, // Sensitivity analysis 153 eCMD_TF, // Transfer function analysis 154 155 eCMD_OPT, // OPTIONS command 156 eCMD_IC, // Initial conditions command 157 eCMD_PR, // PRINT command 158 eCMD_GEN, // GENERATOR command (GNU-Cap only) 159 160 eCMD_NONE, // No analysis specified 161 162 eCMD_FST = eCMD_OP, 163 eCMD_LST = eCMD_GEN, 164 165 eCMD_ANA_FST = eCMD_OP, 166 eCMD_ANA_LST = eCMD_TF 167 }; 168 169 // Enumerated type for the various components 170 enum eTypeCpnt 171 { 172 eCPNT_CAP, // Capacitor 173 eCPNT_RES, // Resistor 174 eCPNT_IND, // Inductor 175 eCPNT_CIND, // Coupled (Mutual) Inductors 176 eCPNT_DIODE, // Diode 177 eCPNT_BJT, // BJT (Bipolar Junction Transistor) 178 eCPNT_JFET, // JFET (Junction Field-Effect Transistor) 179 eCPNT_MOSFET, // MOSFET (Metal-Oxide Semiconductor Field-Effect Transistor) 180 eCPNT_MESFET, // MESFET (Metal–Semiconductor Field Effect Transistor) 181 eCPNT_VCVS, // Voltage Controlled Voltage Source 182 eCPNT_CCCS, // Current Controlled Current Source 183 eCPNT_VCCS, // Voltage Controlled Current Source 184 eCPNT_CCVS, // Current Controlled Voltage Source 185 eCPNT_TLINE, // Lossless Transmission Line 186 eCPNT_LTRA, // Lossy Transmission Line (LTRA) 187 eCPNT_URC, // Uniform Distributed RC Transmission Line (URC) 188 eCPNT_TXL, // Single Lossy Transmission Line (TXL) 189 eCPNT_CPL, // Coupled Multi-conductor Transmission Line (CPL) 190 eCPNT_ICS, // Independent Current Source 191 eCPNT_IVS, // Independent Voltage Source 192 eCPNT_NLDS, // Non-Linear Dependent Source 193 eCPNT_NLDCS, // Non-Linear Dependent Current Source 194 eCPNT_NLDVS, // Non-Linear Dependent Voltage Source 195 eCPNT_CCSW, // Current Controlled Switch 196 eCPNT_VCSW, // Voltage Controlled Switch 197 eCPNT_SUBCKT, // Sub-circuit 198 eCPNT_LOGIC, // Logic Device 199 eCPNT_STJ, // Super-conducting Tunnel Junction 200 201 eCPNT_NONE, // No component specified 202 203 eCPNT_FST = eCPNT_CAP, 204 eCPNT_LST = eCPNT_STJ 205 }; 206 207 // The various variable types 208 enum eTypeValue 209 { 210 eVALUE_BIN, // Binary 211 eVALUE_OCT, // Octal 212 eVALUE_HEX, // Hexadecimal 213 eVALUE_INT, // Integer 214 eVALUE_FLT, // Floating point 215 eVALUE_SCI, // Floating point (scientific notation) 216 eVALUE_ENG, // Floating point (engineering notation) 217 218 eVALUE_NONE, // No value type specified 219 220 eVALUE_FST = eVALUE_BIN, 221 eVALUE_LST = eVALUE_ENG 222 }; 223 224 // Enumerated type for the various types of units 225 enum eTypeUnits 226 { 227 eUNITS_CAP, // Capacitance 228 eUNITS_IND, // Inductance 229 eUNITS_RES, // Resistance 230 eUNITS_COND, // Conductance 231 eUNITS_VOLT, // Voltage 232 eUNITS_CURR, // Current 233 eUNITS_TIME, // Time 234 eUNITS_FREQ, // Frequency 235 eUNITS_CHRG, // Charge 236 eUNITS_PHAD, // Phase / angle in Degree 237 eUNITS_PHAR, // Phase / angle in Radian 238 eUNITS_TMPC, // Temperature in Celcius 239 eUNITS_TMPF, // Temperature in Fahrenheit 240 eUNITS_PCT, // Percentage 241 eUNITS_EXP, // Dimensionless (append an exponent) 242 243 eUNITS_NONE, // No units specified 244 245 eUNITS_FST = eUNITS_CAP, 246 eUNITS_LST = eUNITS_EXP 247 }; 248 249 // Enumerated type for the various parameters which may be determined by analysis 250 enum eTypeParam 251 { 252 ePARAM_VLT, // Node or component voltage 253 ePARAM_CUR, // Node or component current 254 ePARAM_PWR, // Node or component power 255 ePARAM_RES, // Input and output resistance 256 257 ePARAM_NONE, // No parameter specified 258 259 ePARAM_FST = ePARAM_VLT, 260 ePARAM_LST = ePARAM_RES 261 }; 262 263 // Enumerated type for the various sub-parameters which may be determined (AC analysis only) 264 enum eTypeCpxPt 265 { 266 eCPXPT_MAG, // Magnitude of the complex node or component parameter 267 eCPXPT_PHASE, // Phase of the complex node or component parameter 268 eCPXPT_REAL, // Real part of the complex node or component parameter 269 eCPXPT_IMAG, // Imaginary part of the complex node or component parameter 270 eCPXPT_MAGDB, // Convert the magnitude to dBV 271 272 eCPXPT_NONE, // No sub-parameter specified 273 274 eCPXPT_FST = eCPXPT_MAG, 275 eCPXPT_LST = eCPXPT_MAGDB 276 }; 277 278 // Enumerated type for the various step scale types 279 enum eTypeScale 280 { 281 eSCALE_LIN, // Linear 282 eSCALE_LOG, // Logarithmic 283 eSCALE_DEC, // Decimal 284 eSCALE_OCT, // Octal 285 286 eSCALE_NONE, // No step scale specified 287 288 eSCALE_FST = eSCALE_LIN, 289 eSCALE_LST = eSCALE_OCT 290 }; 291 292 // Enumerated type for the initial conditions for a transient analysis 293 enum eTypeInitC 294 { 295 eINITC_WARM, // Warm start 296 eINITC_UICS, // Use initial conditions 297 eINITC_COLD, // Cold start 298 299 eINITC_NONE, // No initial conditions specified 300 301 eINITC_FST = eINITC_WARM, 302 eINITC_LST = eINITC_COLD 303 }; 304 305 // Enumerated type for the temporary file management strategy 306 enum eTypeTmpFileMgt 307 { 308 eTFM_DELETE, // Automatically delete temporary files 309 eTFM_PROMPT, // Prompt the user before deleting temporary files 310 eTFM_KEEP, // Don't delete temporary files 311 312 eTFM_NONE, // No temporary file management strategy specified 313 314 eTFM_FST = eTFM_DELETE, 315 eTFM_LST = eTFM_KEEP 316 }; 317 318 //************************************************************************************************** 319 // Declare new array types (which are based on wxWidgets types) 320 321 WX_DECLARE_OBJARRAY( wxFileName, ArrayFileName ); 322 323 //************************************************************************************************** 324 325 #endif // TYPEDEFS_HPP 326