|
|
|
@ -4,7 +4,9 @@ |
|
|
|
Autor: Holger Vogt |
|
|
|
Stand: 17.10.2009 |
|
|
|
*/ |
|
|
|
|
|
|
|
#include "ngspice/config.h" |
|
|
|
|
|
|
|
#ifdef HAS_WINGUI |
|
|
|
|
|
|
|
#define STRICT // strict type checking |
|
|
|
@ -109,6 +111,7 @@ static void HistoryInit(void) |
|
|
|
HistBuffer[i][0] = SE; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Delete first line of buffer, all other lines move one down */ |
|
|
|
static void HistoryScroll(void) |
|
|
|
{ |
|
|
|
@ -118,16 +121,20 @@ static void HistoryScroll(void) |
|
|
|
if (HistPtr) HistPtr--; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Enter new input line into history buffer */ |
|
|
|
static void HistoryEnter(char *newLine) |
|
|
|
{ |
|
|
|
if (!newLine || !*newLine) return; |
|
|
|
|
|
|
|
if (HistPtr == HistSize) HistoryScroll(); |
|
|
|
|
|
|
|
strcpy(HistBuffer[HistPtr], newLine); |
|
|
|
HistPtr++; |
|
|
|
HistIndex = HistPtr; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Mit dem Index eine Zeile zurueckgehen und den dort stehenden Eintrag zurueckgeben |
|
|
|
static char *HistoryGetPrev(void) |
|
|
|
{ |
|
|
|
@ -135,6 +142,7 @@ static char * HistoryGetPrev(void) |
|
|
|
return &(HistBuffer[HistIndex][0]); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Mit dem Index eine Zeile vorgehen und den dort stehenden Eintrag zurueckgeben |
|
|
|
static char *HistoryGetNext(void) |
|
|
|
{ |
|
|
|
@ -143,6 +151,7 @@ static char * HistoryGetNext(void) |
|
|
|
return &(HistBuffer[HistIndex][0]); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------<Message Handling>------------------------------- |
|
|
|
|
|
|
|
// Warte, bis keine Messages mehr zu bearbeiten sind |
|
|
|
@ -156,6 +165,7 @@ void WaitForIdle(void) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------<Message Handling>------------------------------- |
|
|
|
|
|
|
|
// Warte, bis keine Messages mehr zu bearbeiten sind, |
|
|
|
@ -171,6 +181,7 @@ static void WaitForMessage(void) |
|
|
|
WaitMessage(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------<Stringfenster>-------------------------------- |
|
|
|
|
|
|
|
// Loeschen des Stringfensters |
|
|
|
@ -191,11 +202,14 @@ void SetSource( char * Name) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------<Analyse-Fenster>----------------------------- |
|
|
|
|
|
|
|
/* New progress report into analysis window. |
|
|
|
Update only every DELTATIME milliseconds */ |
|
|
|
|
|
|
|
#define DELTATIME 150 |
|
|
|
|
|
|
|
void SetAnalyse( |
|
|
|
char *Analyse, /* in: analysis type */ |
|
|
|
int DecaPercent /* in: 10 times the progress [%]*/ |
|
|
|
@ -209,7 +223,9 @@ void SetAnalyse( |
|
|
|
int diffsec, diffmillisec; /* differences actual minus prev. time stamp */ |
|
|
|
|
|
|
|
WaitForIdle(); |
|
|
|
|
|
|
|
if ((DecaPercent == OldPercent) && !strcmp(OldAn, Analyse)) return; |
|
|
|
|
|
|
|
/* get actual time */ |
|
|
|
ftime(&timenow); |
|
|
|
timediff(&timenow, &timebefore, &diffsec, &diffmillisec); |
|
|
|
@ -221,6 +237,7 @@ void SetAnalyse( |
|
|
|
if ((int)((double)DecaPercent/10.) > (int)((double)OldPercent/10.)) { |
|
|
|
win_x_printf("%3.1f%% percent progress after %4.2f seconds.\n", (double)DecaPercent/10., seconds()); |
|
|
|
} |
|
|
|
|
|
|
|
OldPercent = DecaPercent; |
|
|
|
/* output only into hwAnalyse window and if time elapsed is larger than |
|
|
|
DELTATIME given value, or if analysis has changed, else return */ |
|
|
|
@ -261,6 +278,7 @@ void SetAnalyse( |
|
|
|
UpdateWindow(hwMain); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------<Textfenster>--------------------------------- |
|
|
|
|
|
|
|
// Anpassen des Scrollers im Textfenster |
|
|
|
@ -273,12 +291,15 @@ static void AdjustScroller(void) |
|
|
|
LineCount = Edit_GetLineCount(twText); |
|
|
|
FirstLine = Edit_GetFirstVisibleLine(twText); |
|
|
|
MyFirstLine = LineCount - VisibleRows; |
|
|
|
|
|
|
|
if (MyFirstLine < 0 ) MyFirstLine = 0; |
|
|
|
|
|
|
|
Edit_Scroll(twText, MyFirstLine - FirstLine, 0); |
|
|
|
// Das wars |
|
|
|
DoUpdate = FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Loeschen einer Zeile im Textbuffer |
|
|
|
static void _DeleteFirstLine(void) |
|
|
|
{ |
|
|
|
@ -295,6 +316,7 @@ static void _DeleteFirstLine(void) |
|
|
|
TBuffer[TBufEnd] = SE; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Anfuegen eines chars an den TextBuffer |
|
|
|
static void AppendChar(char c) |
|
|
|
{ |
|
|
|
@ -310,6 +332,7 @@ static void AppendChar( char c) |
|
|
|
DisplayText(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Anfuegen eines Strings an den TextBuffer |
|
|
|
static void AppendString(const char *Line) |
|
|
|
{ |
|
|
|
@ -327,6 +350,7 @@ static void AppendString( const char * Line) |
|
|
|
DoUpdate = TRUE; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Text neu darstellen |
|
|
|
static void DisplayText(void) |
|
|
|
{ |
|
|
|
@ -335,6 +359,8 @@ static void DisplayText( void) |
|
|
|
// Scroller updaten, neuen Text darstellen |
|
|
|
AdjustScroller(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
// Anfuegen einer Zeile an den Textbuffer |
|
|
|
void AppendLine(const char *Line) |
|
|
|
@ -348,6 +374,8 @@ void AppendLine( const char * Line) |
|
|
|
AppendString(CRLF); |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------<User-IO>-------------------------------- |
|
|
|
|
|
|
|
// Lese ein Zeichen ein |
|
|
|
@ -382,6 +410,7 @@ static int w_getch(void) |
|
|
|
return c; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Gebe ein Zeichen aus |
|
|
|
static int w_putch(int c) |
|
|
|
{ |
|
|
|
@ -390,6 +419,7 @@ static int w_putch( int c) |
|
|
|
return c; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------<Window procedures>-------------------------- */ |
|
|
|
|
|
|
|
/* Main window changes size */ |
|
|
|
@ -417,6 +447,7 @@ static void Main_OnSize(HWND hwnd, UINT state, int cx, int cy) |
|
|
|
h, QuitButtonLength, StatusElHeight, TRUE); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Write a command into the command buffer */ |
|
|
|
static void PostSpiceCommand(const char *const cmd) |
|
|
|
{ |
|
|
|
@ -424,6 +455,7 @@ static void PostSpiceCommand( const char * const cmd) |
|
|
|
strcat(SBuffer, CRLF); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Main Window procedure */ |
|
|
|
static LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
|
|
{ |
|
|
|
@ -459,6 +491,7 @@ DEFAULT_AFTER: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Procedure for string window */ |
|
|
|
static LRESULT CALLBACK StringWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
|
|
{ |
|
|
|
@ -480,8 +513,6 @@ static LRESULT CALLBACK StringWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, L |
|
|
|
ClearInput(); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
goto DEFAULT; |
|
|
|
|
|
|
|
case WM_CHAR: |
|
|
|
@ -514,6 +545,7 @@ DEFAULT: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Procedure for text window */ |
|
|
|
static LRESULT CALLBACK TextWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
|
|
|
{ |
|
|
|
@ -634,6 +666,7 @@ static LRESULT CALLBACK ElementWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, |
|
|
|
0 on success |
|
|
|
-1 on failure |
|
|
|
*/ |
|
|
|
|
|
|
|
static int MakeArgcArgv(char *cmdline, int *argc, char ***argv) |
|
|
|
{ |
|
|
|
char *pC1; /* a temporary character pointer */ |
|
|
|
@ -656,8 +689,10 @@ static int MakeArgcArgv(char *cmdline,int *argc,char ***argv) |
|
|
|
status = -1; |
|
|
|
goto outahere; |
|
|
|
} |
|
|
|
|
|
|
|
*argc = 0; /* set the count to zero to start */ |
|
|
|
*argv = NULL; /* set the pointer to NULL to start */ |
|
|
|
|
|
|
|
/* if the string passed in was a NULL pointer, consider this |
|
|
|
to be an empty command line and give back only |
|
|
|
an argc of 1 and an argv[0] */ |
|
|
|
@ -710,6 +745,7 @@ static int MakeArgcArgv(char *cmdline,int *argc,char ***argv) |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* Now, we should have ctrl-Zs everywhere that |
|
|
|
there used to be a space not protected by |
|
|
|
quote marks. We should also have the number |
|
|
|
@ -750,10 +786,12 @@ static int MakeArgcArgv(char *cmdline,int *argc,char ***argv) |
|
|
|
/* copy the working values over to the arguments */ |
|
|
|
*argc = numargs; |
|
|
|
*argv = tmpargv; |
|
|
|
|
|
|
|
outahere: |
|
|
|
/* free the working string if one was allocated */ |
|
|
|
if (pWorkString) |
|
|
|
free(pWorkString); |
|
|
|
|
|
|
|
/* return status */ |
|
|
|
return status; |
|
|
|
} |
|
|
|
@ -795,24 +833,29 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi |
|
|
|
hwMainClass.hbrBackground = GetStockObject(LTGRAY_BRUSH); |
|
|
|
hwMainClass.lpszMenuName = NULL; |
|
|
|
hwMainClass.lpszClassName = hwClassName; |
|
|
|
|
|
|
|
if (!RegisterClass(&hwMainClass)) goto THE_END; |
|
|
|
|
|
|
|
/* Define text window class */ |
|
|
|
if (!GetClassInfo(NULL, "EDIT", &twTextClass)) goto THE_END; |
|
|
|
|
|
|
|
twProc = twTextClass.lpfnWndProc; |
|
|
|
twTextClass.lpfnWndProc = TextWindowProc; |
|
|
|
twTextClass.hInstance = hInst; |
|
|
|
twTextClass.lpszMenuName = NULL; |
|
|
|
twTextClass.lpszClassName = twClassName; |
|
|
|
|
|
|
|
if (!RegisterClass(&twTextClass)) goto THE_END; |
|
|
|
|
|
|
|
/* Define string window class */ |
|
|
|
if (!GetClassInfo(NULL, "EDIT", &swStringClass)) goto THE_END; |
|
|
|
|
|
|
|
swProc = swStringClass.lpfnWndProc; |
|
|
|
swStringClass.lpfnWndProc = StringWindowProc; |
|
|
|
swStringClass.hInstance = hInst; |
|
|
|
swStringClass.lpszMenuName = NULL; |
|
|
|
swStringClass.lpszClassName = swClassName; |
|
|
|
|
|
|
|
if (!RegisterClass(&swStringClass)) goto THE_END; |
|
|
|
|
|
|
|
/* Define status element class */ |
|
|
|
@ -826,6 +869,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi |
|
|
|
hwElementClass.hbrBackground = GetStockObject(LTGRAY_BRUSH); |
|
|
|
hwElementClass.lpszMenuName = NULL; |
|
|
|
hwElementClass.lpszClassName = hwElementClassName; |
|
|
|
|
|
|
|
if (!RegisterClass(&hwElementClass)) goto THE_END; |
|
|
|
|
|
|
|
/*Create main window */ |
|
|
|
@ -845,6 +889,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi |
|
|
|
ES_LEFT | ES_MULTILINE | ES_READONLY | WS_CHILD | WS_BORDER | WS_VSCROLL, |
|
|
|
20, 20, 300, 100, hwMain, NULL, hInst, NULL); |
|
|
|
if (!twText) goto THE_END; |
|
|
|
|
|
|
|
/* Ansii fixed font */ |
|
|
|
{ |
|
|
|
HDC textDC; |
|
|
|
@ -867,6 +912,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi |
|
|
|
swString = CreateWindowEx(WS_EX_NOPARENTNOTIFY, swClassName, swWindowName, |
|
|
|
ES_LEFT | WS_CHILD | WS_BORDER, 20,20,300,100, hwMain, NULL, hInst, NULL); |
|
|
|
if (!swString) goto THE_END; |
|
|
|
|
|
|
|
{ |
|
|
|
HDC stringDC; |
|
|
|
TEXTMETRIC tm; |
|
|
|
@ -925,7 +971,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi |
|
|
|
/* Go to main() */ |
|
|
|
nReturnCode = xmain(argc, argv); |
|
|
|
|
|
|
|
|
|
|
|
THE_END: |
|
|
|
|
|
|
|
/* terminate */ |
|
|
|
@ -949,6 +994,7 @@ int win_x_fflush( FILE * stream) |
|
|
|
return fflush(stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fgetc(FILE *stream) |
|
|
|
{ |
|
|
|
if (stream == stdin) { |
|
|
|
@ -961,6 +1007,7 @@ int win_x_fgetc( FILE * stream) |
|
|
|
return fgetc(stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fgetpos(FILE *stream, fpos_t *pos) |
|
|
|
{ |
|
|
|
int result; |
|
|
|
@ -972,6 +1019,7 @@ int win_x_fgetpos( FILE * stream, fpos_t * pos) |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char *win_x_fgets(char *s, int n, FILE *stream) |
|
|
|
{ |
|
|
|
if (stream == stdin) { |
|
|
|
@ -992,6 +1040,7 @@ char * win_x_fgets(char * s, int n, FILE * stream) |
|
|
|
return fgets(s, n, stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fputc(int c, FILE *stream) |
|
|
|
{ |
|
|
|
if (!flogp && ((stream == stdout) || (stream == stderr))) { |
|
|
|
@ -1005,6 +1054,7 @@ int win_x_fputc(int c, FILE * stream) |
|
|
|
return fputc(c, stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fputs(const char *s, FILE *stream) |
|
|
|
{ |
|
|
|
// if (((stream == stdout) && !flogp) || (stream == stderr)) { hvogt 14.6.2000 |
|
|
|
@ -1023,11 +1073,13 @@ int win_x_fputs(const char * s, FILE * stream) |
|
|
|
return fputs(s, stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fprintf(FILE *stream, const char *format, ...) |
|
|
|
{ |
|
|
|
int result; |
|
|
|
char s[IOBufSize]; |
|
|
|
va_list args; |
|
|
|
|
|
|
|
va_start(args, format); |
|
|
|
|
|
|
|
// if (((stream == stdout) && !flogp) || (stream == stderr)) { |
|
|
|
@ -1043,6 +1095,7 @@ int win_x_fprintf(FILE * stream, const char * format, ...) |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fclose(FILE *stream) |
|
|
|
{ |
|
|
|
if ((stream == stdin) || ((stream == stdout) && !flogp) || (stream == stderr)) { |
|
|
|
@ -1052,6 +1105,7 @@ int win_x_fclose( FILE * stream) |
|
|
|
return fclose(stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t win_x_fread(void *ptr, size_t size, size_t n, FILE *stream) |
|
|
|
{ |
|
|
|
// if ((stream == stdin) || ((stream == stdout) && !flogp) || (stream == stderr)) { |
|
|
|
@ -1077,9 +1131,11 @@ size_t win_x_fread(void * ptr, size_t size, size_t n, FILE * stream) |
|
|
|
ptr = &s[0]; |
|
|
|
return (size_t)(i / size); |
|
|
|
} |
|
|
|
|
|
|
|
return fread(ptr, size, n, stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
FILE *win_x_freopen(const char *path, const char *mode, FILE *stream) |
|
|
|
{ |
|
|
|
if ((stream == stdin)/* || ((stream == stdout) && !flogp) || (stream == stderr)*/) { |
|
|
|
@ -1089,10 +1145,12 @@ FILE * win_x_freopen(const char * path, const char * mode, FILE * stream) |
|
|
|
return freopen(path, mode, stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fscanf(FILE *stream, const char *format, ...) |
|
|
|
{ |
|
|
|
int result; |
|
|
|
va_list args; |
|
|
|
|
|
|
|
va_start(args, format); |
|
|
|
if ((stream == stdin) || ((stream == stdout) && !flogp) || (stream == stderr)) { |
|
|
|
assert(FALSE); |
|
|
|
@ -1103,6 +1161,7 @@ int win_x_fscanf(FILE * stream, const char * format, ...) |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fseek(FILE *stream, long offset, int whence) |
|
|
|
{ |
|
|
|
if ((stream == stdin) || ((stream == stdout) && !flogp) || (stream == stderr)) { |
|
|
|
@ -1112,6 +1171,7 @@ int win_x_fseek(FILE * stream, long offset, int whence) |
|
|
|
return fseek(stream, offset, whence); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fsetpos(FILE *stream, const fpos_t *pos) |
|
|
|
{ |
|
|
|
if ((stream == stdin) || ((stream == stdout) && !flogp) || (stream == stderr)) { |
|
|
|
@ -1121,6 +1181,7 @@ int win_x_fsetpos(FILE * stream, const fpos_t *pos) |
|
|
|
return fsetpos(stream, pos); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
long win_x_ftell(FILE *stream) |
|
|
|
{ |
|
|
|
if ((stream == stdin) || ((stream == stdout) && !flogp) || (stream == stderr)) { |
|
|
|
@ -1130,6 +1191,7 @@ long win_x_ftell(FILE * stream) |
|
|
|
return ftell(stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
size_t win_x_fwrite(const void *ptr, size_t size, size_t n, FILE *stream) |
|
|
|
{ |
|
|
|
// win_x_printf("entered fwrite, size %d, n %d \n", size, n); |
|
|
|
@ -1147,6 +1209,7 @@ size_t win_x_fwrite(const void * ptr, size_t size, size_t n, FILE * stream) |
|
|
|
// win_x_printf("test1 %s\n", s); |
|
|
|
|
|
|
|
if (!s) return 0 /* EOF */; |
|
|
|
|
|
|
|
for (i = 0; i < (size * n); i++) { |
|
|
|
if (*s) { |
|
|
|
c = *s++; |
|
|
|
@ -1162,11 +1225,13 @@ size_t win_x_fwrite(const void * ptr, size_t size, size_t n, FILE * stream) |
|
|
|
return fwrite(ptr, size, n, stream); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
char *win_x_gets(char *s) |
|
|
|
{ |
|
|
|
return win_x_fgets(s, 10000, stdin); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void win_x_perror(const char *s) |
|
|
|
{ |
|
|
|
const char *cp; |
|
|
|
@ -1178,25 +1243,29 @@ void win_x_perror(const char * s) |
|
|
|
if (!flogp) winmessage(s);*/ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_printf(const char *format, ...) |
|
|
|
{ |
|
|
|
int result; |
|
|
|
char s[IOBufSize]; |
|
|
|
va_list args; |
|
|
|
va_start(args, format); |
|
|
|
|
|
|
|
va_start(args, format); |
|
|
|
s[0] = SE; |
|
|
|
result = vsprintf(s, format, args); |
|
|
|
win_x_fputs(s, stdout); |
|
|
|
va_end(args); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_puts(const char *s) |
|
|
|
{ |
|
|
|
return win_x_fputs(s, stdout); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_scanf(const char *format, ...) |
|
|
|
{ |
|
|
|
NG_IGNORE(format); |
|
|
|
@ -1204,6 +1273,7 @@ int win_x_scanf(const char * format, ...) |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_ungetc(int c, FILE *stream) |
|
|
|
{ |
|
|
|
NG_IGNORE(c); |
|
|
|
@ -1212,6 +1282,7 @@ int win_x_ungetc(int c, FILE * stream) |
|
|
|
return FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_vfprintf(FILE *stream, const char *format, void *arglist) |
|
|
|
{ |
|
|
|
int result; |
|
|
|
@ -1228,6 +1299,7 @@ int win_x_vfprintf(FILE * stream, const char * format, void * arglist) |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*int win_x_vfscanf(FILE *stream, const char *format, void *arglist) |
|
|
|
{ |
|
|
|
if (stream == stdin) { |
|
|
|
@ -1237,6 +1309,8 @@ int win_x_vfprintf(FILE * stream, const char * format, void * arglist) |
|
|
|
return vfscanf(stream, format, arglist); |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
int win_x_vprintf(const char *format, void *arglist) |
|
|
|
{ |
|
|
|
int result; |
|
|
|
@ -1248,12 +1322,14 @@ int win_x_vprintf(const char * format, void * arglist) |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*int win_x_vscanf(const char *format, void *arglist) |
|
|
|
{ |
|
|
|
assert(FALSE); |
|
|
|
return FALSE; |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
int win_x_read(int fd, char *buf, int n) |
|
|
|
{ |
|
|
|
if (fd == 0) { |
|
|
|
@ -1277,26 +1353,32 @@ int win_x_read(int fd, char * buf, int n) |
|
|
|
return _read(fd, buf, n); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_getc(FILE *fp) |
|
|
|
{ |
|
|
|
return win_x_fgetc(fp); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_getchar(void) |
|
|
|
{ |
|
|
|
return win_x_fgetc(stdin); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_putchar(const int c) |
|
|
|
{ |
|
|
|
return win_x_fputc(c, stdout); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_putc(const int c, FILE *fp) |
|
|
|
{ |
|
|
|
return win_x_fputc(c, fp); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_feof(FILE *fp) |
|
|
|
{ |
|
|
|
if ((fp == stdin) || (fp == stdout) || (fp == stderr)) { |
|
|
|
@ -1306,6 +1388,7 @@ int win_x_feof(FILE * fp) |
|
|
|
return feof(fp); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_ferror(FILE *fp) |
|
|
|
{ |
|
|
|
if ((fp == stdin) || (fp == stdout) || (fp == stderr)) { |
|
|
|
@ -1315,12 +1398,15 @@ int win_x_ferror(FILE * fp) |
|
|
|
return ferror(fp); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int win_x_fputchar(int c) |
|
|
|
{ |
|
|
|
return win_x_fputc(c, stdout); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// --------------------------<Verfuegbarer Speicher>---------------------------- |
|
|
|
|
|
|
|
/* |
|
|
|
size_t _memavl(void) |
|
|
|
{ |
|
|
|
@ -1332,7 +1418,9 @@ size_t _memavl(void) |
|
|
|
return (size_t) sum; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ---------------------<Aufruf eines anderen Programms>----------------------- |
|
|
|
|
|
|
|
#ifndef _MSC_VER |
|
|
|
int system(const char *command) |
|
|
|
{ |
|
|
|
@ -1381,7 +1469,9 @@ int system( const char * command) |
|
|
|
#endif |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
#ifdef __CYGWIN__ |
|
|
|
|
|
|
|
/* Strip leading spaces, return a copy of s */ |
|
|
|
static char * |
|
|
|
rlead(char *s) |
|
|
|
@ -1405,8 +1495,10 @@ rlead(char *s) |
|
|
|
temp[j] = '\0'; |
|
|
|
return copy(temp); |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
void winmessage(char *new_msg) |
|
|
|
{ |
|
|
|
/* open a message box only if message is not written into -o xxx.log */ |
|
|
|
@ -1414,5 +1506,5 @@ void winmessage(char* new_msg) |
|
|
|
MessageBox(NULL, new_msg, "Ngspice Info", MB_OK | MB_ICONERROR); |
|
|
|
} |
|
|
|
|
|
|
|
#endif /* HAS_WINGUI */ |
|
|
|
|
|
|
|
#endif /* HAS_WINGUI */ |