4 changed files with 401 additions and 401 deletions
-
366src/frontend/signal_handler.c
-
340src/include/ngspice/wincolornames.h
-
20src/xspice/icm/table/support/gettokens.h
-
76src/xspice/icm/table/support/table_util.h
@ -1,183 +1,183 @@ |
|||||
/********** |
|
||||
Copyright 1990 Regents of the University of California. All rights reserved. |
|
||||
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group |
|
||||
**********/ |
|
||||
|
|
||||
/* |
|
||||
* The signal routines for spice 3 and nutmeg. |
|
||||
*/ |
|
||||
|
|
||||
#include "ngspice/ngspice.h" |
|
||||
#include "ngspice/ifsim.h" |
|
||||
#include "ngspice/iferrmsg.h" |
|
||||
#include "ngspice/cpdefs.h" |
|
||||
#include "ngspice/ftedefs.h" |
|
||||
#include "ngspice/ftedev.h" |
|
||||
#include <setjmp.h> |
|
||||
#include <signal.h> |
|
||||
#include "signal_handler.h" |
|
||||
#include "plotting/graf.h" |
|
||||
|
|
||||
#ifdef HAS_WINGUI |
|
||||
void winmessage(char* new_msg); |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_GNUREADLINE |
|
||||
/* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */ |
|
||||
/* from spice3f4 patch to ng-spice. jmr */ |
|
||||
#include <readline/readline.h> |
|
||||
#include <readline/history.h> |
|
||||
#endif |
|
||||
|
|
||||
#ifdef HAVE_BSDEDITLINE |
|
||||
/* SJB added edit line support 2005-05-05 */ |
|
||||
#include <editline/readline.h> |
|
||||
#endif /* HAVE_BSDEDITLINE */ |
|
||||
|
|
||||
JMP_BUF jbuf; |
|
||||
|
|
||||
/* The (void) signal handlers... SIGINT is the only one that gets reset (by |
|
||||
* cshpar) so it is global. They are ifdef BSD because of the sigmask |
|
||||
* stuff in sigstop. We set the interrupt flag and return if ft_setflag |
|
||||
* is TRUE. |
|
||||
*/ |
|
||||
|
|
||||
|
|
||||
/* The purpose of ft_sigintr_cleanup() is to handle all processing of asynchronous |
|
||||
* signals which require user process context. Some kernel services are not |
|
||||
* allowed to be called from asynchronous signal handlers. (e.g. mutexes) |
|
||||
*/ |
|
||||
|
|
||||
void |
|
||||
ft_sigintr_cleanup(void) |
|
||||
{ |
|
||||
gr_clean(); /* Clean up plot window */ |
|
||||
|
|
||||
/* sjb - what to do for editline??? |
|
||||
The following are not supported in editline */ |
|
||||
#if defined(HAVE_GNUREADLINE) |
|
||||
/* Clean up readline after catching signals */ |
|
||||
/* One or all of these might be superfluous */ |
|
||||
(void) rl_free_line_state(); |
|
||||
(void) rl_cleanup_after_signal(); |
|
||||
(void) rl_reset_after_signal(); |
|
||||
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */ |
|
||||
|
|
||||
/* To restore screen after an interrupt to a plot for instance */ |
|
||||
cp_interactive = TRUE; |
|
||||
cp_resetcontrol(TRUE); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/* invoke this function upon keyboard interrupt */ |
|
||||
RETSIGTYPE |
|
||||
ft_sigintr(void) |
|
||||
{ |
|
||||
static int interrupt_counter = 0; |
|
||||
|
|
||||
/* fprintf(cp_err, "Received interrupt. Handling it . . . . .\n"); */ |
|
||||
|
|
||||
/* Reinstall ft_signintr as the signal handler. */ |
|
||||
(void) signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr); |
|
||||
|
|
||||
if (ft_intrpt) { /* check to see if we're being interrupted repeatedly */ |
|
||||
fprintf(cp_err, "\nInterrupted again (ouch)\n"); |
|
||||
interrupt_counter++; |
|
||||
} else { |
|
||||
fprintf(cp_err, "\nInterrupted once . . .\n"); |
|
||||
ft_intrpt = TRUE; |
|
||||
interrupt_counter = 1; |
|
||||
} |
|
||||
|
|
||||
if (interrupt_counter >= 3) { |
|
||||
fprintf(cp_err, "\nKilling, since %d interrupts have been requested\n\n", interrupt_counter); |
|
||||
controlled_exit(1); |
|
||||
} |
|
||||
|
|
||||
if (ft_setflag) { |
|
||||
return; /* just return without aborting simulation if ft_setflag = TRUE */ |
|
||||
} |
|
||||
|
|
||||
/* here we jump to the start of command processing in main() after resetting everything. */ |
|
||||
LONGJMP(jbuf, 1); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sigfloat(int code) |
|
||||
{ |
|
||||
fperror("Error", code); |
|
||||
rewind(cp_out); |
|
||||
(void) signal(SIGFPE, (SIGNAL_FUNCTION) sigfloat); |
|
||||
LONGJMP(jbuf, 1); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/* This should give a new prompt if cshpar is waiting for input. */ |
|
||||
|
|
||||
#ifdef SIGTSTP |
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sigstop(void) |
|
||||
{ |
|
||||
gr_clean(); |
|
||||
cp_ccon(FALSE); |
|
||||
(void) signal(SIGTSTP, SIG_DFL); |
|
||||
(void) kill(getpid(), SIGTSTP); /* This should stop us */ |
|
||||
} |
|
||||
|
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sigcont(void) |
|
||||
{ |
|
||||
(void) signal(SIGTSTP, (SIGNAL_FUNCTION) sigstop); |
|
||||
if (cp_cwait) |
|
||||
LONGJMP(jbuf, 1); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
#endif |
|
||||
|
|
||||
|
|
||||
/* Special (void) signal handlers. */ |
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sigill(void) |
|
||||
{ |
|
||||
fprintf(cp_err, "\ninternal error -- illegal instruction\n"); |
|
||||
fatal(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sigbus(void) |
|
||||
{ |
|
||||
fprintf(cp_err, "\ninternal error -- bus error\n"); |
|
||||
fatal(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sigsegv(void) |
|
||||
{ |
|
||||
fprintf(cp_err, "\ninternal error -- segmentation violation\n"); |
|
||||
#ifdef HAS_WINGUI |
|
||||
winmessage("Fatal error in NGSPICE"); |
|
||||
#endif |
|
||||
fatal(); |
|
||||
} |
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sigsegvsh(void) |
|
||||
{ |
|
||||
fprintf(cp_err, "\ninternal error -- segmentation violation\n"); |
|
||||
controlled_exit(EXIT_SEGV); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
RETSIGTYPE |
|
||||
sig_sys(void) |
|
||||
{ |
|
||||
fprintf(cp_err, "\ninternal error -- bad argument to system call\n"); |
|
||||
fatal(); |
|
||||
} |
|
||||
|
/********** |
||||
|
Copyright 1990 Regents of the University of California. All rights reserved. |
||||
|
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group |
||||
|
**********/ |
||||
|
|
||||
|
/* |
||||
|
* The signal routines for spice 3 and nutmeg. |
||||
|
*/ |
||||
|
|
||||
|
#include "ngspice/ngspice.h" |
||||
|
#include "ngspice/ifsim.h" |
||||
|
#include "ngspice/iferrmsg.h" |
||||
|
#include "ngspice/cpdefs.h" |
||||
|
#include "ngspice/ftedefs.h" |
||||
|
#include "ngspice/ftedev.h" |
||||
|
#include <setjmp.h> |
||||
|
#include <signal.h> |
||||
|
#include "signal_handler.h" |
||||
|
#include "plotting/graf.h" |
||||
|
|
||||
|
#ifdef HAS_WINGUI |
||||
|
void winmessage(char* new_msg); |
||||
|
#endif |
||||
|
|
||||
|
#ifdef HAVE_GNUREADLINE |
||||
|
/* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */ |
||||
|
/* from spice3f4 patch to ng-spice. jmr */ |
||||
|
#include <readline/readline.h> |
||||
|
#include <readline/history.h> |
||||
|
#endif |
||||
|
|
||||
|
#ifdef HAVE_BSDEDITLINE |
||||
|
/* SJB added edit line support 2005-05-05 */ |
||||
|
#include <editline/readline.h> |
||||
|
#endif /* HAVE_BSDEDITLINE */ |
||||
|
|
||||
|
JMP_BUF jbuf; |
||||
|
|
||||
|
/* The (void) signal handlers... SIGINT is the only one that gets reset (by |
||||
|
* cshpar) so it is global. They are ifdef BSD because of the sigmask |
||||
|
* stuff in sigstop. We set the interrupt flag and return if ft_setflag |
||||
|
* is TRUE. |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
/* The purpose of ft_sigintr_cleanup() is to handle all processing of asynchronous |
||||
|
* signals which require user process context. Some kernel services are not |
||||
|
* allowed to be called from asynchronous signal handlers. (e.g. mutexes) |
||||
|
*/ |
||||
|
|
||||
|
void |
||||
|
ft_sigintr_cleanup(void) |
||||
|
{ |
||||
|
gr_clean(); /* Clean up plot window */ |
||||
|
|
||||
|
/* sjb - what to do for editline??? |
||||
|
The following are not supported in editline */ |
||||
|
#if defined(HAVE_GNUREADLINE) |
||||
|
/* Clean up readline after catching signals */ |
||||
|
/* One or all of these might be superfluous */ |
||||
|
(void) rl_free_line_state(); |
||||
|
(void) rl_cleanup_after_signal(); |
||||
|
(void) rl_reset_after_signal(); |
||||
|
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */ |
||||
|
|
||||
|
/* To restore screen after an interrupt to a plot for instance */ |
||||
|
cp_interactive = TRUE; |
||||
|
cp_resetcontrol(TRUE); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/* invoke this function upon keyboard interrupt */ |
||||
|
RETSIGTYPE |
||||
|
ft_sigintr(void) |
||||
|
{ |
||||
|
static int interrupt_counter = 0; |
||||
|
|
||||
|
/* fprintf(cp_err, "Received interrupt. Handling it . . . . .\n"); */ |
||||
|
|
||||
|
/* Reinstall ft_signintr as the signal handler. */ |
||||
|
(void) signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr); |
||||
|
|
||||
|
if (ft_intrpt) { /* check to see if we're being interrupted repeatedly */ |
||||
|
fprintf(cp_err, "\nInterrupted again (ouch)\n"); |
||||
|
interrupt_counter++; |
||||
|
} else { |
||||
|
fprintf(cp_err, "\nInterrupted once . . .\n"); |
||||
|
ft_intrpt = TRUE; |
||||
|
interrupt_counter = 1; |
||||
|
} |
||||
|
|
||||
|
if (interrupt_counter >= 3) { |
||||
|
fprintf(cp_err, "\nKilling, since %d interrupts have been requested\n\n", interrupt_counter); |
||||
|
controlled_exit(1); |
||||
|
} |
||||
|
|
||||
|
if (ft_setflag) { |
||||
|
return; /* just return without aborting simulation if ft_setflag = TRUE */ |
||||
|
} |
||||
|
|
||||
|
/* here we jump to the start of command processing in main() after resetting everything. */ |
||||
|
LONGJMP(jbuf, 1); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sigfloat(int code) |
||||
|
{ |
||||
|
fperror("Error", code); |
||||
|
rewind(cp_out); |
||||
|
(void) signal(SIGFPE, (SIGNAL_FUNCTION) sigfloat); |
||||
|
LONGJMP(jbuf, 1); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/* This should give a new prompt if cshpar is waiting for input. */ |
||||
|
|
||||
|
#ifdef SIGTSTP |
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sigstop(void) |
||||
|
{ |
||||
|
gr_clean(); |
||||
|
cp_ccon(FALSE); |
||||
|
(void) signal(SIGTSTP, SIG_DFL); |
||||
|
(void) kill(getpid(), SIGTSTP); /* This should stop us */ |
||||
|
} |
||||
|
|
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sigcont(void) |
||||
|
{ |
||||
|
(void) signal(SIGTSTP, (SIGNAL_FUNCTION) sigstop); |
||||
|
if (cp_cwait) |
||||
|
LONGJMP(jbuf, 1); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
#endif |
||||
|
|
||||
|
|
||||
|
/* Special (void) signal handlers. */ |
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sigill(void) |
||||
|
{ |
||||
|
fprintf(cp_err, "\ninternal error -- illegal instruction\n"); |
||||
|
fatal(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sigbus(void) |
||||
|
{ |
||||
|
fprintf(cp_err, "\ninternal error -- bus error\n"); |
||||
|
fatal(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sigsegv(void) |
||||
|
{ |
||||
|
fprintf(cp_err, "\ninternal error -- segmentation violation\n"); |
||||
|
#ifdef HAS_WINGUI |
||||
|
winmessage("Fatal error in NGSPICE"); |
||||
|
#endif |
||||
|
fatal(); |
||||
|
} |
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sigsegvsh(void) |
||||
|
{ |
||||
|
fprintf(cp_err, "\ninternal error -- segmentation violation\n"); |
||||
|
controlled_exit(EXIT_SEGV); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
RETSIGTYPE |
||||
|
sig_sys(void) |
||||
|
{ |
||||
|
fprintf(cp_err, "\ninternal error -- bad argument to system call\n"); |
||||
|
fatal(); |
||||
|
} |
||||
@ -1,170 +1,170 @@ |
|||||
/* list of available colors |
|
||||
according to |
|
||||
https://www.codeproject.com/Articles/1276/Naming-Common-Colors |
|
||||
*/ |
|
||||
|
|
||||
#if !defined(__ID_COLOR_NAMES_H) |
|
||||
#define __ID_COLOR_NAMES_H |
|
||||
|
|
||||
struct colortable { |
|
||||
COLORREF rgbc; |
|
||||
char name[32]; |
|
||||
int R; |
|
||||
int G; |
|
||||
int B; |
|
||||
}; |
|
||||
|
|
||||
static struct colortable ctable[] = { |
|
||||
{ 0, "AliceBlue ",240,248,255 }, |
|
||||
{ 0, "AntiqueWhite ",250,235,215 }, |
|
||||
{ 0, "Aqua ", 0,255,255 }, |
|
||||
{ 0, "Aquamarine ",127,255,212 }, |
|
||||
{ 0, "Azure ",240,255,255 }, |
|
||||
{ 0, "Beige ",245,245,220 }, |
|
||||
{ 0, "Bisque ",255,228,196 }, |
|
||||
{ 0, "Black ", 0, 0, 0 }, |
|
||||
{ 0, "BlanchedAlmond ",255,255,205 }, |
|
||||
{ 0, "Blue ", 0, 0,255 }, |
|
||||
{ 0, "BlueViolet ",138, 43,226 }, |
|
||||
{ 0, "Brown ",165, 42, 42 }, |
|
||||
{ 0, "Burlywood ",222,184,135 }, |
|
||||
{ 0, "CadetBlue ", 95,158,160 }, |
|
||||
{ 0, "Chartreuse ",127,255, 0 }, |
|
||||
{ 0, "Chocolate ",210,105, 30 }, |
|
||||
{ 0, "Coral ",255,127, 80 }, |
|
||||
{ 0, "CornflowerBlue ",100,149,237 }, |
|
||||
{ 0, "Cornsilk ",255,248,220 }, |
|
||||
{ 0, "Crimson ",220, 20, 60 }, |
|
||||
{ 0, "Cyan ", 0,255,255 }, |
|
||||
{ 0, "DarkBlue ", 0, 0,139 }, |
|
||||
{ 0, "DarkCyan ", 0,139,139 }, |
|
||||
{ 0, "DarkGoldenRod ",184,134, 11 }, |
|
||||
{ 0, "DarkGray ",169,169,169 }, |
|
||||
{ 0, "DarkGreen ", 0,100, 0 }, |
|
||||
{ 0, "DarkKhaki ",189,183,107 }, |
|
||||
{ 0, "DarkMagenta ",139, 0,139 }, |
|
||||
{ 0, "DarkOliveGreen ", 85,107, 47 }, |
|
||||
{ 0, "DarkOrange ",255,140, 0 }, |
|
||||
{ 0, "DarkOrchid ",153, 50,204 }, |
|
||||
{ 0, "DarkRed ",139, 0, 0 }, |
|
||||
{ 0, "DarkSalmon ",233,150,122 }, |
|
||||
{ 0, "DarkSeaGreen ",143,188,143 }, |
|
||||
{ 0, "DarkSlateBlue ", 72, 61,139 }, |
|
||||
{ 0, "DarkSlateGray ", 47, 79, 79 }, |
|
||||
{ 0, "DarkTurquoise ", 0,206,209 }, |
|
||||
{ 0, "DarkViolet ",148, 0,211 }, |
|
||||
{ 0, "DeepPink ",255, 20,147 }, |
|
||||
{ 0, "DeepSkyBlue ", 0,191,255 }, |
|
||||
{ 0, "DimGray ",105,105,105 }, |
|
||||
{ 0, "DodgerBlue ", 30,144,255 }, |
|
||||
{ 0, "FireBrick ",178, 34, 34 }, |
|
||||
{ 0, "FloralWhite ",255,250,240 }, |
|
||||
{ 0, "ForestGreen ", 34,139, 34 }, |
|
||||
{ 0, "Fuchsia ",255, 0,255 }, |
|
||||
{ 0, "Gainsboro ",220,220,220 }, |
|
||||
{ 0, "GhostWhite ",248,248,255 }, |
|
||||
{ 0, "Gold ",255,215, 0 }, |
|
||||
{ 0, "GoldenRod ",218,165, 32 }, |
|
||||
{ 0, "Gray ",127,127,127 }, |
|
||||
{ 0, "Green ", 0,255, 0 }, |
|
||||
{ 0, "GreenYellow ",173,255, 47 }, |
|
||||
{ 0, "HoneyDew ",240,255,240 }, |
|
||||
{ 0, "HotPink ",255,105,180 }, |
|
||||
{ 0, "IndianRed ",205, 92, 92 }, |
|
||||
{ 0, "Indigo ", 75, 0,130 }, |
|
||||
{ 0, "Ivory ",255,255,240 }, |
|
||||
{ 0, "Khaki ",240,230,140 }, |
|
||||
{ 0, "Lavender ",230,230,250 }, |
|
||||
{ 0, "LavenderBlush ",255,240,245 }, |
|
||||
{ 0, "Lawngreen ",124,252, 0 }, |
|
||||
{ 0, "LemonChiffon ",255,250,205 }, |
|
||||
{ 0, "LightBlue ",173,216,230 }, |
|
||||
{ 0, "LightCoral ",240,128,128 }, |
|
||||
{ 0, "LightCyan ",224,255,255 }, |
|
||||
{ 0, "LightGoldenRodYellow ",250,250,210 }, |
|
||||
{ 0, "LightGreen ",144,238,144 }, |
|
||||
{ 0, "LightGrey ",211,211,211 }, |
|
||||
{ 0, "LightPink ",255,182,193 }, |
|
||||
{ 0, "LightSalmon ",255,160,122 }, |
|
||||
{ 0, "LightSeaGreen ", 32,178,170 }, |
|
||||
{ 0, "LightSkyBlue ",135,206,250 }, |
|
||||
{ 0, "LightSlateGray ",119,136,153 }, |
|
||||
{ 0, "LightSteelBlue ",176,196,222 }, |
|
||||
{ 0, "Light Violet ",128, 0,255 }, |
|
||||
{ 0, "LightYellow ",255,255,224 }, |
|
||||
{ 0, "Lime ", 0,255, 0 }, |
|
||||
{ 0, "LimeGreen ", 50,205, 50 }, |
|
||||
{ 0, "Linen ",250,240,230 }, |
|
||||
{ 0, "Magenta ",255, 0,255 }, |
|
||||
{ 0, "Maroon ",128, 0, 0 }, |
|
||||
{ 0, "MediumAquamarine ",102,205,170 }, |
|
||||
{ 0, "MediumBlue ", 0, 0,205 }, |
|
||||
{ 0, "MediumOrchid ",186, 85,211 }, |
|
||||
{ 0, "MediumPurple ",147,112,219 }, |
|
||||
{ 0, "MediumSeaGreen ", 60,179,113 }, |
|
||||
{ 0, "MediumSlateBlue ",123,104,238 }, |
|
||||
{ 0, "MediumSpringGreen ", 0,250,154 }, |
|
||||
{ 0, "MediumTurquoise ", 72,209,204 }, |
|
||||
{ 0, "MediumVioletRed ",199, 21,133 }, |
|
||||
{ 0, "MidnightBlue ", 25, 25,112 }, |
|
||||
{ 0, "MintCream ",245,255,250 }, |
|
||||
{ 0, "MistyRose ",255,228,225 }, |
|
||||
{ 0, "Moccasin ",255,228,181 }, |
|
||||
{ 0, "NavajoWhite ",255,222,173 }, |
|
||||
{ 0, "Navy ", 0, 0,128 }, |
|
||||
{ 0, "Navyblue ",159,175,223 }, |
|
||||
{ 0, "OldLace ",253,245,230 }, |
|
||||
{ 0, "Olive ",128,128, 0 }, |
|
||||
{ 0, "OliveDrab ",107,142, 35 }, |
|
||||
{ 0, "Orange ",255,165, 0 }, |
|
||||
{ 0, "OrangeRed ",255, 69, 0 }, |
|
||||
{ 0, "Orchid ",218,112,214 }, |
|
||||
{ 0, "PaleGoldenRod ",238,232,170 }, |
|
||||
{ 0, "PaleGreen ",152,251,152 }, |
|
||||
{ 0, "PaleTurquoise ",175,238,238 }, |
|
||||
{ 0, "PaleVioletRed ",219,112,147 }, |
|
||||
{ 0, "PapayaWhip ",255,239,213 }, |
|
||||
{ 0, "PeachPuff ",255,218,185 }, |
|
||||
{ 0, "Peru ",205,133, 63 }, |
|
||||
{ 0, "Pink ",255,192,203 }, |
|
||||
{ 0, "Plum ",221,160,221 }, |
|
||||
{ 0, "PowderBlue ",176,224,230 }, |
|
||||
{ 0, "Purple ",128, 0,128 }, |
|
||||
{ 0, "Red ",255, 0, 0 }, |
|
||||
{ 0, "RosyBrown ",188,143,143 }, |
|
||||
{ 0, "RoyalBlue ", 65,105,225 }, |
|
||||
{ 0, "SaddleBrown ",139, 69, 19 }, |
|
||||
{ 0, "Salmon ",250,128,114 }, |
|
||||
{ 0, "SandyBrown ",244,164, 96 }, |
|
||||
{ 0, "SeaGreen ", 46,139, 87 }, |
|
||||
{ 0, "SeaShell ",255,245,238 }, |
|
||||
{ 0, "Sienna ",160, 82, 45 }, |
|
||||
{ 0, "Silver ",192,192,192 }, |
|
||||
{ 0, "SkyBlue ",135,206,235 }, |
|
||||
{ 0, "SlateBlue ",106, 90,205 }, |
|
||||
{ 0, "SlateGray ",112,128,144 }, |
|
||||
{ 0, "Snow ",255,250,250 }, |
|
||||
{ 0, "SpringGreen ", 0,255,127 }, |
|
||||
{ 0, "SteelBlue ", 70,130,180 }, |
|
||||
{ 0, "Tan ",210,180,140 }, |
|
||||
{ 0, "Teal ", 0,128,128 }, |
|
||||
{ 0, "Thistle ",216,191,216 }, |
|
||||
{ 0, "Tomato ",255, 99, 71 }, |
|
||||
{ 0, "Turquoise ", 64,224,208 }, |
|
||||
{ 0, "Violet ",238,130,238 }, |
|
||||
{ 0, "WebGreen ", 0,128, 0 }, |
|
||||
{ 0, "Wheat ",245,222,179 }, |
|
||||
{ 0, "White ",255,255,255 }, |
|
||||
{ 0, "WhiteSmoke ",245,245,245 }, |
|
||||
{ 0, "Yellow ",255,255, 0 }, |
|
||||
{ 0, "YellowGreen ",139,205, 50 } |
|
||||
}; |
|
||||
|
|
||||
char* stdcolornames[] = |
|
||||
{ |
|
||||
"black", "white", "green", "red", "blue", "yellow", "violet", |
|
||||
"azure", "orange", "brown", "light violet", "pink", |
|
||||
"white", "green", "red", "blue", "yellow", "violet", |
|
||||
"azure", "orange", "brown", "light violet", "pink" |
|
||||
}; |
|
||||
#endif // __ID_COLOR_NAMES |
|
||||
|
/* list of available colors |
||||
|
according to |
||||
|
https://www.codeproject.com/Articles/1276/Naming-Common-Colors |
||||
|
*/ |
||||
|
|
||||
|
#if !defined(__ID_COLOR_NAMES_H) |
||||
|
#define __ID_COLOR_NAMES_H |
||||
|
|
||||
|
struct colortable { |
||||
|
COLORREF rgbc; |
||||
|
char name[32]; |
||||
|
int R; |
||||
|
int G; |
||||
|
int B; |
||||
|
}; |
||||
|
|
||||
|
static struct colortable ctable[] = { |
||||
|
{ 0, "AliceBlue ",240,248,255 }, |
||||
|
{ 0, "AntiqueWhite ",250,235,215 }, |
||||
|
{ 0, "Aqua ", 0,255,255 }, |
||||
|
{ 0, "Aquamarine ",127,255,212 }, |
||||
|
{ 0, "Azure ",240,255,255 }, |
||||
|
{ 0, "Beige ",245,245,220 }, |
||||
|
{ 0, "Bisque ",255,228,196 }, |
||||
|
{ 0, "Black ", 0, 0, 0 }, |
||||
|
{ 0, "BlanchedAlmond ",255,255,205 }, |
||||
|
{ 0, "Blue ", 0, 0,255 }, |
||||
|
{ 0, "BlueViolet ",138, 43,226 }, |
||||
|
{ 0, "Brown ",165, 42, 42 }, |
||||
|
{ 0, "Burlywood ",222,184,135 }, |
||||
|
{ 0, "CadetBlue ", 95,158,160 }, |
||||
|
{ 0, "Chartreuse ",127,255, 0 }, |
||||
|
{ 0, "Chocolate ",210,105, 30 }, |
||||
|
{ 0, "Coral ",255,127, 80 }, |
||||
|
{ 0, "CornflowerBlue ",100,149,237 }, |
||||
|
{ 0, "Cornsilk ",255,248,220 }, |
||||
|
{ 0, "Crimson ",220, 20, 60 }, |
||||
|
{ 0, "Cyan ", 0,255,255 }, |
||||
|
{ 0, "DarkBlue ", 0, 0,139 }, |
||||
|
{ 0, "DarkCyan ", 0,139,139 }, |
||||
|
{ 0, "DarkGoldenRod ",184,134, 11 }, |
||||
|
{ 0, "DarkGray ",169,169,169 }, |
||||
|
{ 0, "DarkGreen ", 0,100, 0 }, |
||||
|
{ 0, "DarkKhaki ",189,183,107 }, |
||||
|
{ 0, "DarkMagenta ",139, 0,139 }, |
||||
|
{ 0, "DarkOliveGreen ", 85,107, 47 }, |
||||
|
{ 0, "DarkOrange ",255,140, 0 }, |
||||
|
{ 0, "DarkOrchid ",153, 50,204 }, |
||||
|
{ 0, "DarkRed ",139, 0, 0 }, |
||||
|
{ 0, "DarkSalmon ",233,150,122 }, |
||||
|
{ 0, "DarkSeaGreen ",143,188,143 }, |
||||
|
{ 0, "DarkSlateBlue ", 72, 61,139 }, |
||||
|
{ 0, "DarkSlateGray ", 47, 79, 79 }, |
||||
|
{ 0, "DarkTurquoise ", 0,206,209 }, |
||||
|
{ 0, "DarkViolet ",148, 0,211 }, |
||||
|
{ 0, "DeepPink ",255, 20,147 }, |
||||
|
{ 0, "DeepSkyBlue ", 0,191,255 }, |
||||
|
{ 0, "DimGray ",105,105,105 }, |
||||
|
{ 0, "DodgerBlue ", 30,144,255 }, |
||||
|
{ 0, "FireBrick ",178, 34, 34 }, |
||||
|
{ 0, "FloralWhite ",255,250,240 }, |
||||
|
{ 0, "ForestGreen ", 34,139, 34 }, |
||||
|
{ 0, "Fuchsia ",255, 0,255 }, |
||||
|
{ 0, "Gainsboro ",220,220,220 }, |
||||
|
{ 0, "GhostWhite ",248,248,255 }, |
||||
|
{ 0, "Gold ",255,215, 0 }, |
||||
|
{ 0, "GoldenRod ",218,165, 32 }, |
||||
|
{ 0, "Gray ",127,127,127 }, |
||||
|
{ 0, "Green ", 0,255, 0 }, |
||||
|
{ 0, "GreenYellow ",173,255, 47 }, |
||||
|
{ 0, "HoneyDew ",240,255,240 }, |
||||
|
{ 0, "HotPink ",255,105,180 }, |
||||
|
{ 0, "IndianRed ",205, 92, 92 }, |
||||
|
{ 0, "Indigo ", 75, 0,130 }, |
||||
|
{ 0, "Ivory ",255,255,240 }, |
||||
|
{ 0, "Khaki ",240,230,140 }, |
||||
|
{ 0, "Lavender ",230,230,250 }, |
||||
|
{ 0, "LavenderBlush ",255,240,245 }, |
||||
|
{ 0, "Lawngreen ",124,252, 0 }, |
||||
|
{ 0, "LemonChiffon ",255,250,205 }, |
||||
|
{ 0, "LightBlue ",173,216,230 }, |
||||
|
{ 0, "LightCoral ",240,128,128 }, |
||||
|
{ 0, "LightCyan ",224,255,255 }, |
||||
|
{ 0, "LightGoldenRodYellow ",250,250,210 }, |
||||
|
{ 0, "LightGreen ",144,238,144 }, |
||||
|
{ 0, "LightGrey ",211,211,211 }, |
||||
|
{ 0, "LightPink ",255,182,193 }, |
||||
|
{ 0, "LightSalmon ",255,160,122 }, |
||||
|
{ 0, "LightSeaGreen ", 32,178,170 }, |
||||
|
{ 0, "LightSkyBlue ",135,206,250 }, |
||||
|
{ 0, "LightSlateGray ",119,136,153 }, |
||||
|
{ 0, "LightSteelBlue ",176,196,222 }, |
||||
|
{ 0, "Light Violet ",128, 0,255 }, |
||||
|
{ 0, "LightYellow ",255,255,224 }, |
||||
|
{ 0, "Lime ", 0,255, 0 }, |
||||
|
{ 0, "LimeGreen ", 50,205, 50 }, |
||||
|
{ 0, "Linen ",250,240,230 }, |
||||
|
{ 0, "Magenta ",255, 0,255 }, |
||||
|
{ 0, "Maroon ",128, 0, 0 }, |
||||
|
{ 0, "MediumAquamarine ",102,205,170 }, |
||||
|
{ 0, "MediumBlue ", 0, 0,205 }, |
||||
|
{ 0, "MediumOrchid ",186, 85,211 }, |
||||
|
{ 0, "MediumPurple ",147,112,219 }, |
||||
|
{ 0, "MediumSeaGreen ", 60,179,113 }, |
||||
|
{ 0, "MediumSlateBlue ",123,104,238 }, |
||||
|
{ 0, "MediumSpringGreen ", 0,250,154 }, |
||||
|
{ 0, "MediumTurquoise ", 72,209,204 }, |
||||
|
{ 0, "MediumVioletRed ",199, 21,133 }, |
||||
|
{ 0, "MidnightBlue ", 25, 25,112 }, |
||||
|
{ 0, "MintCream ",245,255,250 }, |
||||
|
{ 0, "MistyRose ",255,228,225 }, |
||||
|
{ 0, "Moccasin ",255,228,181 }, |
||||
|
{ 0, "NavajoWhite ",255,222,173 }, |
||||
|
{ 0, "Navy ", 0, 0,128 }, |
||||
|
{ 0, "Navyblue ",159,175,223 }, |
||||
|
{ 0, "OldLace ",253,245,230 }, |
||||
|
{ 0, "Olive ",128,128, 0 }, |
||||
|
{ 0, "OliveDrab ",107,142, 35 }, |
||||
|
{ 0, "Orange ",255,165, 0 }, |
||||
|
{ 0, "OrangeRed ",255, 69, 0 }, |
||||
|
{ 0, "Orchid ",218,112,214 }, |
||||
|
{ 0, "PaleGoldenRod ",238,232,170 }, |
||||
|
{ 0, "PaleGreen ",152,251,152 }, |
||||
|
{ 0, "PaleTurquoise ",175,238,238 }, |
||||
|
{ 0, "PaleVioletRed ",219,112,147 }, |
||||
|
{ 0, "PapayaWhip ",255,239,213 }, |
||||
|
{ 0, "PeachPuff ",255,218,185 }, |
||||
|
{ 0, "Peru ",205,133, 63 }, |
||||
|
{ 0, "Pink ",255,192,203 }, |
||||
|
{ 0, "Plum ",221,160,221 }, |
||||
|
{ 0, "PowderBlue ",176,224,230 }, |
||||
|
{ 0, "Purple ",128, 0,128 }, |
||||
|
{ 0, "Red ",255, 0, 0 }, |
||||
|
{ 0, "RosyBrown ",188,143,143 }, |
||||
|
{ 0, "RoyalBlue ", 65,105,225 }, |
||||
|
{ 0, "SaddleBrown ",139, 69, 19 }, |
||||
|
{ 0, "Salmon ",250,128,114 }, |
||||
|
{ 0, "SandyBrown ",244,164, 96 }, |
||||
|
{ 0, "SeaGreen ", 46,139, 87 }, |
||||
|
{ 0, "SeaShell ",255,245,238 }, |
||||
|
{ 0, "Sienna ",160, 82, 45 }, |
||||
|
{ 0, "Silver ",192,192,192 }, |
||||
|
{ 0, "SkyBlue ",135,206,235 }, |
||||
|
{ 0, "SlateBlue ",106, 90,205 }, |
||||
|
{ 0, "SlateGray ",112,128,144 }, |
||||
|
{ 0, "Snow ",255,250,250 }, |
||||
|
{ 0, "SpringGreen ", 0,255,127 }, |
||||
|
{ 0, "SteelBlue ", 70,130,180 }, |
||||
|
{ 0, "Tan ",210,180,140 }, |
||||
|
{ 0, "Teal ", 0,128,128 }, |
||||
|
{ 0, "Thistle ",216,191,216 }, |
||||
|
{ 0, "Tomato ",255, 99, 71 }, |
||||
|
{ 0, "Turquoise ", 64,224,208 }, |
||||
|
{ 0, "Violet ",238,130,238 }, |
||||
|
{ 0, "WebGreen ", 0,128, 0 }, |
||||
|
{ 0, "Wheat ",245,222,179 }, |
||||
|
{ 0, "White ",255,255,255 }, |
||||
|
{ 0, "WhiteSmoke ",245,245,245 }, |
||||
|
{ 0, "Yellow ",255,255, 0 }, |
||||
|
{ 0, "YellowGreen ",139,205, 50 } |
||||
|
}; |
||||
|
|
||||
|
char* stdcolornames[] = |
||||
|
{ |
||||
|
"black", "white", "green", "red", "blue", "yellow", "violet", |
||||
|
"azure", "orange", "brown", "light violet", "pink", |
||||
|
"white", "green", "red", "blue", "yellow", "violet", |
||||
|
"azure", "orange", "brown", "light violet", "pink" |
||||
|
}; |
||||
|
#endif // __ID_COLOR_NAMES |
||||
@ -1,10 +1,10 @@ |
|||||
#ifndef gettokens_h_included |
|
||||
#define gettokens_h_included |
|
||||
|
|
||||
/* Type definition for each possible token returned. */ |
|
||||
typedef enum token_type_s { CNV_NO_TOK, CNV_STRING_TOK } Cnv_Token_Type_t; |
|
||||
|
|
||||
char * CNVget_token(char **s, Cnv_Token_Type_t *type); |
|
||||
char *CNVgettok(char **s); |
|
||||
int cnv_get_spice_value(char *str, double *p_value); |
|
||||
#endif /* gettokens_h_included */ |
|
||||
|
#ifndef gettokens_h_included |
||||
|
#define gettokens_h_included |
||||
|
|
||||
|
/* Type definition for each possible token returned. */ |
||||
|
typedef enum token_type_s { CNV_NO_TOK, CNV_STRING_TOK } Cnv_Token_Type_t; |
||||
|
|
||||
|
char * CNVget_token(char **s, Cnv_Token_Type_t *type); |
||||
|
char *CNVgettok(char **s); |
||||
|
int cnv_get_spice_value(char *str, double *p_value); |
||||
|
#endif /* gettokens_h_included */ |
||||
@ -1,38 +1,38 @@ |
|||||
#include "eno2.h" |
|
||||
#include "eno3.h" |
|
||||
|
|
||||
typedef struct { |
|
||||
int ix; /* size of array in x */ |
|
||||
int iy; /* size of array in y */ |
|
||||
int iz; /* size of array in z */ |
|
||||
|
|
||||
sf_eno3 newtable; /* the table, code borrowed from madagascar project */ |
|
||||
|
|
||||
/* Input values corresponding to each index. They define the value |
|
||||
* in the domain at each index value */ |
|
||||
double *xcol; /* array of doubles in x */ |
|
||||
double *ycol; /* array of doubles in y */ |
|
||||
double *zcol; /* array of doubles in z */ |
|
||||
|
|
||||
double ***table; /* f(xi, yj, zk) */ |
|
||||
} Table3_Data_t; |
|
||||
|
|
||||
void free_local_data(Table3_Data_t *loc); |
|
||||
|
|
||||
|
|
||||
Table3_Data_t *init_local_data(const char *filename, int order); |
|
||||
|
|
||||
/* Finds difference between column values */ |
|
||||
static inline double get_local_diff(int n, double *col, int ind) |
|
||||
{ |
|
||||
if (ind >= n - 1) { |
|
||||
return col[n - 1] - col[n - 2]; |
|
||||
} |
|
||||
if (ind <= 0) { |
|
||||
return col[1] - col[0]; |
|
||||
} |
|
||||
return 0.5 * (col[ind + 1] - col[ind - 1]); |
|
||||
} /* end of function get_local_diff */ |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
#include "eno2.h" |
||||
|
#include "eno3.h" |
||||
|
|
||||
|
typedef struct { |
||||
|
int ix; /* size of array in x */ |
||||
|
int iy; /* size of array in y */ |
||||
|
int iz; /* size of array in z */ |
||||
|
|
||||
|
sf_eno3 newtable; /* the table, code borrowed from madagascar project */ |
||||
|
|
||||
|
/* Input values corresponding to each index. They define the value |
||||
|
* in the domain at each index value */ |
||||
|
double *xcol; /* array of doubles in x */ |
||||
|
double *ycol; /* array of doubles in y */ |
||||
|
double *zcol; /* array of doubles in z */ |
||||
|
|
||||
|
double ***table; /* f(xi, yj, zk) */ |
||||
|
} Table3_Data_t; |
||||
|
|
||||
|
void free_local_data(Table3_Data_t *loc); |
||||
|
|
||||
|
|
||||
|
Table3_Data_t *init_local_data(const char *filename, int order); |
||||
|
|
||||
|
/* Finds difference between column values */ |
||||
|
static inline double get_local_diff(int n, double *col, int ind) |
||||
|
{ |
||||
|
if (ind >= n - 1) { |
||||
|
return col[n - 1] - col[n - 2]; |
||||
|
} |
||||
|
if (ind <= 0) { |
||||
|
return col[1] - col[0]; |
||||
|
} |
||||
|
return 0.5 * (col[ind + 1] - col[ind - 1]); |
||||
|
} /* end of function get_local_diff */ |
||||
|
|
||||
|
|
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue