Line endings from \r\n to \n

This commit is contained in:
Holger Vogt 2020-12-28 22:59:29 +01:00
parent 893521d92d
commit 45b60dbf96
4 changed files with 401 additions and 401 deletions

View File

@ -1,183 +1,183 @@
/********** /**********
Copyright 1990 Regents of the University of California. All rights reserved. Copyright 1990 Regents of the University of California. All rights reserved.
Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
**********/ **********/
/* /*
* The signal routines for spice 3 and nutmeg. * The signal routines for spice 3 and nutmeg.
*/ */
#include "ngspice/ngspice.h" #include "ngspice/ngspice.h"
#include "ngspice/ifsim.h" #include "ngspice/ifsim.h"
#include "ngspice/iferrmsg.h" #include "ngspice/iferrmsg.h"
#include "ngspice/cpdefs.h" #include "ngspice/cpdefs.h"
#include "ngspice/ftedefs.h" #include "ngspice/ftedefs.h"
#include "ngspice/ftedev.h" #include "ngspice/ftedev.h"
#include <setjmp.h> #include <setjmp.h>
#include <signal.h> #include <signal.h>
#include "signal_handler.h" #include "signal_handler.h"
#include "plotting/graf.h" #include "plotting/graf.h"
#ifdef HAS_WINGUI #ifdef HAS_WINGUI
void winmessage(char* new_msg); void winmessage(char* new_msg);
#endif #endif
#ifdef HAVE_GNUREADLINE #ifdef HAVE_GNUREADLINE
/* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */ /* Added GNU Readline Support 11/3/97 -- Andrew Veliath <veliaa@rpi.edu> */
/* from spice3f4 patch to ng-spice. jmr */ /* from spice3f4 patch to ng-spice. jmr */
#include <readline/readline.h> #include <readline/readline.h>
#include <readline/history.h> #include <readline/history.h>
#endif #endif
#ifdef HAVE_BSDEDITLINE #ifdef HAVE_BSDEDITLINE
/* SJB added edit line support 2005-05-05 */ /* SJB added edit line support 2005-05-05 */
#include <editline/readline.h> #include <editline/readline.h>
#endif /* HAVE_BSDEDITLINE */ #endif /* HAVE_BSDEDITLINE */
JMP_BUF jbuf; JMP_BUF jbuf;
/* The (void) signal handlers... SIGINT is the only one that gets reset (by /* 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 * 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 * stuff in sigstop. We set the interrupt flag and return if ft_setflag
* is TRUE. * is TRUE.
*/ */
/* The purpose of ft_sigintr_cleanup() is to handle all processing of asynchronous /* The purpose of ft_sigintr_cleanup() is to handle all processing of asynchronous
* signals which require user process context. Some kernel services are not * signals which require user process context. Some kernel services are not
* allowed to be called from asynchronous signal handlers. (e.g. mutexes) * allowed to be called from asynchronous signal handlers. (e.g. mutexes)
*/ */
void void
ft_sigintr_cleanup(void) ft_sigintr_cleanup(void)
{ {
gr_clean(); /* Clean up plot window */ gr_clean(); /* Clean up plot window */
/* sjb - what to do for editline??? /* sjb - what to do for editline???
The following are not supported in editline */ The following are not supported in editline */
#if defined(HAVE_GNUREADLINE) #if defined(HAVE_GNUREADLINE)
/* Clean up readline after catching signals */ /* Clean up readline after catching signals */
/* One or all of these might be superfluous */ /* One or all of these might be superfluous */
(void) rl_free_line_state(); (void) rl_free_line_state();
(void) rl_cleanup_after_signal(); (void) rl_cleanup_after_signal();
(void) rl_reset_after_signal(); (void) rl_reset_after_signal();
#endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */ #endif /* defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE) */
/* To restore screen after an interrupt to a plot for instance */ /* To restore screen after an interrupt to a plot for instance */
cp_interactive = TRUE; cp_interactive = TRUE;
cp_resetcontrol(TRUE); cp_resetcontrol(TRUE);
} }
/* invoke this function upon keyboard interrupt */ /* invoke this function upon keyboard interrupt */
RETSIGTYPE RETSIGTYPE
ft_sigintr(void) ft_sigintr(void)
{ {
static int interrupt_counter = 0; static int interrupt_counter = 0;
/* fprintf(cp_err, "Received interrupt. Handling it . . . . .\n"); */ /* fprintf(cp_err, "Received interrupt. Handling it . . . . .\n"); */
/* Reinstall ft_signintr as the signal handler. */ /* Reinstall ft_signintr as the signal handler. */
(void) signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr); (void) signal(SIGINT, (SIGNAL_FUNCTION) ft_sigintr);
if (ft_intrpt) { /* check to see if we're being interrupted repeatedly */ if (ft_intrpt) { /* check to see if we're being interrupted repeatedly */
fprintf(cp_err, "\nInterrupted again (ouch)\n"); fprintf(cp_err, "\nInterrupted again (ouch)\n");
interrupt_counter++; interrupt_counter++;
} else { } else {
fprintf(cp_err, "\nInterrupted once . . .\n"); fprintf(cp_err, "\nInterrupted once . . .\n");
ft_intrpt = TRUE; ft_intrpt = TRUE;
interrupt_counter = 1; interrupt_counter = 1;
} }
if (interrupt_counter >= 3) { if (interrupt_counter >= 3) {
fprintf(cp_err, "\nKilling, since %d interrupts have been requested\n\n", interrupt_counter); fprintf(cp_err, "\nKilling, since %d interrupts have been requested\n\n", interrupt_counter);
controlled_exit(1); controlled_exit(1);
} }
if (ft_setflag) { if (ft_setflag) {
return; /* just return without aborting simulation if ft_setflag = TRUE */ return; /* just return without aborting simulation if ft_setflag = TRUE */
} }
/* here we jump to the start of command processing in main() after resetting everything. */ /* here we jump to the start of command processing in main() after resetting everything. */
LONGJMP(jbuf, 1); LONGJMP(jbuf, 1);
} }
RETSIGTYPE RETSIGTYPE
sigfloat(int code) sigfloat(int code)
{ {
fperror("Error", code); fperror("Error", code);
rewind(cp_out); rewind(cp_out);
(void) signal(SIGFPE, (SIGNAL_FUNCTION) sigfloat); (void) signal(SIGFPE, (SIGNAL_FUNCTION) sigfloat);
LONGJMP(jbuf, 1); LONGJMP(jbuf, 1);
} }
/* This should give a new prompt if cshpar is waiting for input. */ /* This should give a new prompt if cshpar is waiting for input. */
#ifdef SIGTSTP #ifdef SIGTSTP
RETSIGTYPE RETSIGTYPE
sigstop(void) sigstop(void)
{ {
gr_clean(); gr_clean();
cp_ccon(FALSE); cp_ccon(FALSE);
(void) signal(SIGTSTP, SIG_DFL); (void) signal(SIGTSTP, SIG_DFL);
(void) kill(getpid(), SIGTSTP); /* This should stop us */ (void) kill(getpid(), SIGTSTP); /* This should stop us */
} }
RETSIGTYPE RETSIGTYPE
sigcont(void) sigcont(void)
{ {
(void) signal(SIGTSTP, (SIGNAL_FUNCTION) sigstop); (void) signal(SIGTSTP, (SIGNAL_FUNCTION) sigstop);
if (cp_cwait) if (cp_cwait)
LONGJMP(jbuf, 1); LONGJMP(jbuf, 1);
} }
#endif #endif
/* Special (void) signal handlers. */ /* Special (void) signal handlers. */
RETSIGTYPE RETSIGTYPE
sigill(void) sigill(void)
{ {
fprintf(cp_err, "\ninternal error -- illegal instruction\n"); fprintf(cp_err, "\ninternal error -- illegal instruction\n");
fatal(); fatal();
} }
RETSIGTYPE RETSIGTYPE
sigbus(void) sigbus(void)
{ {
fprintf(cp_err, "\ninternal error -- bus error\n"); fprintf(cp_err, "\ninternal error -- bus error\n");
fatal(); fatal();
} }
RETSIGTYPE RETSIGTYPE
sigsegv(void) sigsegv(void)
{ {
fprintf(cp_err, "\ninternal error -- segmentation violation\n"); fprintf(cp_err, "\ninternal error -- segmentation violation\n");
#ifdef HAS_WINGUI #ifdef HAS_WINGUI
winmessage("Fatal error in NGSPICE"); winmessage("Fatal error in NGSPICE");
#endif #endif
fatal(); fatal();
} }
RETSIGTYPE RETSIGTYPE
sigsegvsh(void) sigsegvsh(void)
{ {
fprintf(cp_err, "\ninternal error -- segmentation violation\n"); fprintf(cp_err, "\ninternal error -- segmentation violation\n");
controlled_exit(EXIT_SEGV); controlled_exit(EXIT_SEGV);
} }
RETSIGTYPE RETSIGTYPE
sig_sys(void) sig_sys(void)
{ {
fprintf(cp_err, "\ninternal error -- bad argument to system call\n"); fprintf(cp_err, "\ninternal error -- bad argument to system call\n");
fatal(); fatal();
} }

View File

@ -1,170 +1,170 @@
/* list of available colors /* list of available colors
according to according to
https://www.codeproject.com/Articles/1276/Naming-Common-Colors https://www.codeproject.com/Articles/1276/Naming-Common-Colors
*/ */
#if !defined(__ID_COLOR_NAMES_H) #if !defined(__ID_COLOR_NAMES_H)
#define __ID_COLOR_NAMES_H #define __ID_COLOR_NAMES_H
struct colortable { struct colortable {
COLORREF rgbc; COLORREF rgbc;
char name[32]; char name[32];
int R; int R;
int G; int G;
int B; int B;
}; };
static struct colortable ctable[] = { static struct colortable ctable[] = {
{ 0, "AliceBlue ",240,248,255 }, { 0, "AliceBlue ",240,248,255 },
{ 0, "AntiqueWhite ",250,235,215 }, { 0, "AntiqueWhite ",250,235,215 },
{ 0, "Aqua ", 0,255,255 }, { 0, "Aqua ", 0,255,255 },
{ 0, "Aquamarine ",127,255,212 }, { 0, "Aquamarine ",127,255,212 },
{ 0, "Azure ",240,255,255 }, { 0, "Azure ",240,255,255 },
{ 0, "Beige ",245,245,220 }, { 0, "Beige ",245,245,220 },
{ 0, "Bisque ",255,228,196 }, { 0, "Bisque ",255,228,196 },
{ 0, "Black ", 0, 0, 0 }, { 0, "Black ", 0, 0, 0 },
{ 0, "BlanchedAlmond ",255,255,205 }, { 0, "BlanchedAlmond ",255,255,205 },
{ 0, "Blue ", 0, 0,255 }, { 0, "Blue ", 0, 0,255 },
{ 0, "BlueViolet ",138, 43,226 }, { 0, "BlueViolet ",138, 43,226 },
{ 0, "Brown ",165, 42, 42 }, { 0, "Brown ",165, 42, 42 },
{ 0, "Burlywood ",222,184,135 }, { 0, "Burlywood ",222,184,135 },
{ 0, "CadetBlue ", 95,158,160 }, { 0, "CadetBlue ", 95,158,160 },
{ 0, "Chartreuse ",127,255, 0 }, { 0, "Chartreuse ",127,255, 0 },
{ 0, "Chocolate ",210,105, 30 }, { 0, "Chocolate ",210,105, 30 },
{ 0, "Coral ",255,127, 80 }, { 0, "Coral ",255,127, 80 },
{ 0, "CornflowerBlue ",100,149,237 }, { 0, "CornflowerBlue ",100,149,237 },
{ 0, "Cornsilk ",255,248,220 }, { 0, "Cornsilk ",255,248,220 },
{ 0, "Crimson ",220, 20, 60 }, { 0, "Crimson ",220, 20, 60 },
{ 0, "Cyan ", 0,255,255 }, { 0, "Cyan ", 0,255,255 },
{ 0, "DarkBlue ", 0, 0,139 }, { 0, "DarkBlue ", 0, 0,139 },
{ 0, "DarkCyan ", 0,139,139 }, { 0, "DarkCyan ", 0,139,139 },
{ 0, "DarkGoldenRod ",184,134, 11 }, { 0, "DarkGoldenRod ",184,134, 11 },
{ 0, "DarkGray ",169,169,169 }, { 0, "DarkGray ",169,169,169 },
{ 0, "DarkGreen ", 0,100, 0 }, { 0, "DarkGreen ", 0,100, 0 },
{ 0, "DarkKhaki ",189,183,107 }, { 0, "DarkKhaki ",189,183,107 },
{ 0, "DarkMagenta ",139, 0,139 }, { 0, "DarkMagenta ",139, 0,139 },
{ 0, "DarkOliveGreen ", 85,107, 47 }, { 0, "DarkOliveGreen ", 85,107, 47 },
{ 0, "DarkOrange ",255,140, 0 }, { 0, "DarkOrange ",255,140, 0 },
{ 0, "DarkOrchid ",153, 50,204 }, { 0, "DarkOrchid ",153, 50,204 },
{ 0, "DarkRed ",139, 0, 0 }, { 0, "DarkRed ",139, 0, 0 },
{ 0, "DarkSalmon ",233,150,122 }, { 0, "DarkSalmon ",233,150,122 },
{ 0, "DarkSeaGreen ",143,188,143 }, { 0, "DarkSeaGreen ",143,188,143 },
{ 0, "DarkSlateBlue ", 72, 61,139 }, { 0, "DarkSlateBlue ", 72, 61,139 },
{ 0, "DarkSlateGray ", 47, 79, 79 }, { 0, "DarkSlateGray ", 47, 79, 79 },
{ 0, "DarkTurquoise ", 0,206,209 }, { 0, "DarkTurquoise ", 0,206,209 },
{ 0, "DarkViolet ",148, 0,211 }, { 0, "DarkViolet ",148, 0,211 },
{ 0, "DeepPink ",255, 20,147 }, { 0, "DeepPink ",255, 20,147 },
{ 0, "DeepSkyBlue ", 0,191,255 }, { 0, "DeepSkyBlue ", 0,191,255 },
{ 0, "DimGray ",105,105,105 }, { 0, "DimGray ",105,105,105 },
{ 0, "DodgerBlue ", 30,144,255 }, { 0, "DodgerBlue ", 30,144,255 },
{ 0, "FireBrick ",178, 34, 34 }, { 0, "FireBrick ",178, 34, 34 },
{ 0, "FloralWhite ",255,250,240 }, { 0, "FloralWhite ",255,250,240 },
{ 0, "ForestGreen ", 34,139, 34 }, { 0, "ForestGreen ", 34,139, 34 },
{ 0, "Fuchsia ",255, 0,255 }, { 0, "Fuchsia ",255, 0,255 },
{ 0, "Gainsboro ",220,220,220 }, { 0, "Gainsboro ",220,220,220 },
{ 0, "GhostWhite ",248,248,255 }, { 0, "GhostWhite ",248,248,255 },
{ 0, "Gold ",255,215, 0 }, { 0, "Gold ",255,215, 0 },
{ 0, "GoldenRod ",218,165, 32 }, { 0, "GoldenRod ",218,165, 32 },
{ 0, "Gray ",127,127,127 }, { 0, "Gray ",127,127,127 },
{ 0, "Green ", 0,255, 0 }, { 0, "Green ", 0,255, 0 },
{ 0, "GreenYellow ",173,255, 47 }, { 0, "GreenYellow ",173,255, 47 },
{ 0, "HoneyDew ",240,255,240 }, { 0, "HoneyDew ",240,255,240 },
{ 0, "HotPink ",255,105,180 }, { 0, "HotPink ",255,105,180 },
{ 0, "IndianRed ",205, 92, 92 }, { 0, "IndianRed ",205, 92, 92 },
{ 0, "Indigo ", 75, 0,130 }, { 0, "Indigo ", 75, 0,130 },
{ 0, "Ivory ",255,255,240 }, { 0, "Ivory ",255,255,240 },
{ 0, "Khaki ",240,230,140 }, { 0, "Khaki ",240,230,140 },
{ 0, "Lavender ",230,230,250 }, { 0, "Lavender ",230,230,250 },
{ 0, "LavenderBlush ",255,240,245 }, { 0, "LavenderBlush ",255,240,245 },
{ 0, "Lawngreen ",124,252, 0 }, { 0, "Lawngreen ",124,252, 0 },
{ 0, "LemonChiffon ",255,250,205 }, { 0, "LemonChiffon ",255,250,205 },
{ 0, "LightBlue ",173,216,230 }, { 0, "LightBlue ",173,216,230 },
{ 0, "LightCoral ",240,128,128 }, { 0, "LightCoral ",240,128,128 },
{ 0, "LightCyan ",224,255,255 }, { 0, "LightCyan ",224,255,255 },
{ 0, "LightGoldenRodYellow ",250,250,210 }, { 0, "LightGoldenRodYellow ",250,250,210 },
{ 0, "LightGreen ",144,238,144 }, { 0, "LightGreen ",144,238,144 },
{ 0, "LightGrey ",211,211,211 }, { 0, "LightGrey ",211,211,211 },
{ 0, "LightPink ",255,182,193 }, { 0, "LightPink ",255,182,193 },
{ 0, "LightSalmon ",255,160,122 }, { 0, "LightSalmon ",255,160,122 },
{ 0, "LightSeaGreen ", 32,178,170 }, { 0, "LightSeaGreen ", 32,178,170 },
{ 0, "LightSkyBlue ",135,206,250 }, { 0, "LightSkyBlue ",135,206,250 },
{ 0, "LightSlateGray ",119,136,153 }, { 0, "LightSlateGray ",119,136,153 },
{ 0, "LightSteelBlue ",176,196,222 }, { 0, "LightSteelBlue ",176,196,222 },
{ 0, "Light Violet ",128, 0,255 }, { 0, "Light Violet ",128, 0,255 },
{ 0, "LightYellow ",255,255,224 }, { 0, "LightYellow ",255,255,224 },
{ 0, "Lime ", 0,255, 0 }, { 0, "Lime ", 0,255, 0 },
{ 0, "LimeGreen ", 50,205, 50 }, { 0, "LimeGreen ", 50,205, 50 },
{ 0, "Linen ",250,240,230 }, { 0, "Linen ",250,240,230 },
{ 0, "Magenta ",255, 0,255 }, { 0, "Magenta ",255, 0,255 },
{ 0, "Maroon ",128, 0, 0 }, { 0, "Maroon ",128, 0, 0 },
{ 0, "MediumAquamarine ",102,205,170 }, { 0, "MediumAquamarine ",102,205,170 },
{ 0, "MediumBlue ", 0, 0,205 }, { 0, "MediumBlue ", 0, 0,205 },
{ 0, "MediumOrchid ",186, 85,211 }, { 0, "MediumOrchid ",186, 85,211 },
{ 0, "MediumPurple ",147,112,219 }, { 0, "MediumPurple ",147,112,219 },
{ 0, "MediumSeaGreen ", 60,179,113 }, { 0, "MediumSeaGreen ", 60,179,113 },
{ 0, "MediumSlateBlue ",123,104,238 }, { 0, "MediumSlateBlue ",123,104,238 },
{ 0, "MediumSpringGreen ", 0,250,154 }, { 0, "MediumSpringGreen ", 0,250,154 },
{ 0, "MediumTurquoise ", 72,209,204 }, { 0, "MediumTurquoise ", 72,209,204 },
{ 0, "MediumVioletRed ",199, 21,133 }, { 0, "MediumVioletRed ",199, 21,133 },
{ 0, "MidnightBlue ", 25, 25,112 }, { 0, "MidnightBlue ", 25, 25,112 },
{ 0, "MintCream ",245,255,250 }, { 0, "MintCream ",245,255,250 },
{ 0, "MistyRose ",255,228,225 }, { 0, "MistyRose ",255,228,225 },
{ 0, "Moccasin ",255,228,181 }, { 0, "Moccasin ",255,228,181 },
{ 0, "NavajoWhite ",255,222,173 }, { 0, "NavajoWhite ",255,222,173 },
{ 0, "Navy ", 0, 0,128 }, { 0, "Navy ", 0, 0,128 },
{ 0, "Navyblue ",159,175,223 }, { 0, "Navyblue ",159,175,223 },
{ 0, "OldLace ",253,245,230 }, { 0, "OldLace ",253,245,230 },
{ 0, "Olive ",128,128, 0 }, { 0, "Olive ",128,128, 0 },
{ 0, "OliveDrab ",107,142, 35 }, { 0, "OliveDrab ",107,142, 35 },
{ 0, "Orange ",255,165, 0 }, { 0, "Orange ",255,165, 0 },
{ 0, "OrangeRed ",255, 69, 0 }, { 0, "OrangeRed ",255, 69, 0 },
{ 0, "Orchid ",218,112,214 }, { 0, "Orchid ",218,112,214 },
{ 0, "PaleGoldenRod ",238,232,170 }, { 0, "PaleGoldenRod ",238,232,170 },
{ 0, "PaleGreen ",152,251,152 }, { 0, "PaleGreen ",152,251,152 },
{ 0, "PaleTurquoise ",175,238,238 }, { 0, "PaleTurquoise ",175,238,238 },
{ 0, "PaleVioletRed ",219,112,147 }, { 0, "PaleVioletRed ",219,112,147 },
{ 0, "PapayaWhip ",255,239,213 }, { 0, "PapayaWhip ",255,239,213 },
{ 0, "PeachPuff ",255,218,185 }, { 0, "PeachPuff ",255,218,185 },
{ 0, "Peru ",205,133, 63 }, { 0, "Peru ",205,133, 63 },
{ 0, "Pink ",255,192,203 }, { 0, "Pink ",255,192,203 },
{ 0, "Plum ",221,160,221 }, { 0, "Plum ",221,160,221 },
{ 0, "PowderBlue ",176,224,230 }, { 0, "PowderBlue ",176,224,230 },
{ 0, "Purple ",128, 0,128 }, { 0, "Purple ",128, 0,128 },
{ 0, "Red ",255, 0, 0 }, { 0, "Red ",255, 0, 0 },
{ 0, "RosyBrown ",188,143,143 }, { 0, "RosyBrown ",188,143,143 },
{ 0, "RoyalBlue ", 65,105,225 }, { 0, "RoyalBlue ", 65,105,225 },
{ 0, "SaddleBrown ",139, 69, 19 }, { 0, "SaddleBrown ",139, 69, 19 },
{ 0, "Salmon ",250,128,114 }, { 0, "Salmon ",250,128,114 },
{ 0, "SandyBrown ",244,164, 96 }, { 0, "SandyBrown ",244,164, 96 },
{ 0, "SeaGreen ", 46,139, 87 }, { 0, "SeaGreen ", 46,139, 87 },
{ 0, "SeaShell ",255,245,238 }, { 0, "SeaShell ",255,245,238 },
{ 0, "Sienna ",160, 82, 45 }, { 0, "Sienna ",160, 82, 45 },
{ 0, "Silver ",192,192,192 }, { 0, "Silver ",192,192,192 },
{ 0, "SkyBlue ",135,206,235 }, { 0, "SkyBlue ",135,206,235 },
{ 0, "SlateBlue ",106, 90,205 }, { 0, "SlateBlue ",106, 90,205 },
{ 0, "SlateGray ",112,128,144 }, { 0, "SlateGray ",112,128,144 },
{ 0, "Snow ",255,250,250 }, { 0, "Snow ",255,250,250 },
{ 0, "SpringGreen ", 0,255,127 }, { 0, "SpringGreen ", 0,255,127 },
{ 0, "SteelBlue ", 70,130,180 }, { 0, "SteelBlue ", 70,130,180 },
{ 0, "Tan ",210,180,140 }, { 0, "Tan ",210,180,140 },
{ 0, "Teal ", 0,128,128 }, { 0, "Teal ", 0,128,128 },
{ 0, "Thistle ",216,191,216 }, { 0, "Thistle ",216,191,216 },
{ 0, "Tomato ",255, 99, 71 }, { 0, "Tomato ",255, 99, 71 },
{ 0, "Turquoise ", 64,224,208 }, { 0, "Turquoise ", 64,224,208 },
{ 0, "Violet ",238,130,238 }, { 0, "Violet ",238,130,238 },
{ 0, "WebGreen ", 0,128, 0 }, { 0, "WebGreen ", 0,128, 0 },
{ 0, "Wheat ",245,222,179 }, { 0, "Wheat ",245,222,179 },
{ 0, "White ",255,255,255 }, { 0, "White ",255,255,255 },
{ 0, "WhiteSmoke ",245,245,245 }, { 0, "WhiteSmoke ",245,245,245 },
{ 0, "Yellow ",255,255, 0 }, { 0, "Yellow ",255,255, 0 },
{ 0, "YellowGreen ",139,205, 50 } { 0, "YellowGreen ",139,205, 50 }
}; };
char* stdcolornames[] = char* stdcolornames[] =
{ {
"black", "white", "green", "red", "blue", "yellow", "violet", "black", "white", "green", "red", "blue", "yellow", "violet",
"azure", "orange", "brown", "light violet", "pink", "azure", "orange", "brown", "light violet", "pink",
"white", "green", "red", "blue", "yellow", "violet", "white", "green", "red", "blue", "yellow", "violet",
"azure", "orange", "brown", "light violet", "pink" "azure", "orange", "brown", "light violet", "pink"
}; };
#endif // __ID_COLOR_NAMES #endif // __ID_COLOR_NAMES

View File

@ -1,10 +1,10 @@
#ifndef gettokens_h_included #ifndef gettokens_h_included
#define gettokens_h_included #define gettokens_h_included
/* Type definition for each possible token returned. */ /* Type definition for each possible token returned. */
typedef enum token_type_s { CNV_NO_TOK, CNV_STRING_TOK } Cnv_Token_Type_t; 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 * CNVget_token(char **s, Cnv_Token_Type_t *type);
char *CNVgettok(char **s); char *CNVgettok(char **s);
int cnv_get_spice_value(char *str, double *p_value); int cnv_get_spice_value(char *str, double *p_value);
#endif /* gettokens_h_included */ #endif /* gettokens_h_included */

View File

@ -1,38 +1,38 @@
#include "eno2.h" #include "eno2.h"
#include "eno3.h" #include "eno3.h"
typedef struct { typedef struct {
int ix; /* size of array in x */ int ix; /* size of array in x */
int iy; /* size of array in y */ int iy; /* size of array in y */
int iz; /* size of array in z */ int iz; /* size of array in z */
sf_eno3 newtable; /* the table, code borrowed from madagascar project */ sf_eno3 newtable; /* the table, code borrowed from madagascar project */
/* Input values corresponding to each index. They define the value /* Input values corresponding to each index. They define the value
* in the domain at each index value */ * in the domain at each index value */
double *xcol; /* array of doubles in x */ double *xcol; /* array of doubles in x */
double *ycol; /* array of doubles in y */ double *ycol; /* array of doubles in y */
double *zcol; /* array of doubles in z */ double *zcol; /* array of doubles in z */
double ***table; /* f(xi, yj, zk) */ double ***table; /* f(xi, yj, zk) */
} Table3_Data_t; } Table3_Data_t;
void free_local_data(Table3_Data_t *loc); void free_local_data(Table3_Data_t *loc);
Table3_Data_t *init_local_data(const char *filename, int order); Table3_Data_t *init_local_data(const char *filename, int order);
/* Finds difference between column values */ /* Finds difference between column values */
static inline double get_local_diff(int n, double *col, int ind) static inline double get_local_diff(int n, double *col, int ind)
{ {
if (ind >= n - 1) { if (ind >= n - 1) {
return col[n - 1] - col[n - 2]; return col[n - 1] - col[n - 2];
} }
if (ind <= 0) { if (ind <= 0) {
return col[1] - col[0]; return col[1] - col[0];
} }
return 0.5 * (col[ind + 1] - col[ind - 1]); return 0.5 * (col[ind + 1] - col[ind - 1]);
} /* end of function get_local_diff */ } /* end of function get_local_diff */