h_vogt 15 years ago
parent
commit
51614f0915
  1. 3
      ChangeLog
  2. 2
      src/main.c
  3. 58
      src/winmain.c
  4. 73
      src/winmain.h
  5. 18
      visualc/vngspice.sln
  6. 17542
      visualc/vngspice.vcproj

3
ChangeLog

@ -1,3 +1,6 @@
2011-05-29 Holger Vogt
* winmain.c, winmain.h: prototypes and forwards
2011-05-29 Robert Larice 2011-05-29 Robert Larice
* Removed tests/hisimhv/nmos/Makefile , * Removed tests/hisimhv/nmos/Makefile ,
* Removed tests/hisimhv/pmos/Makefile , * Removed tests/hisimhv/pmos/Makefile ,

2
src/main.c

@ -423,7 +423,7 @@ int DEVmaxnum = 0;
- ngspice (standard) - ngspice (standard)
- a commercial simulator - a commercial simulator
- Spice3 - Spice3
- all compatibility staff
- all compatibility stuff
*/ */
COMPATMODE_T ngspice_compat_mode(void) COMPATMODE_T ngspice_compat_mode(void)
{ {

58
src/winmain.c

@ -1,4 +1,4 @@
/* Hauptprogramm fuer Spice 3F5 unter Windows95
/* Main program for ngspice under Windows OS
Autor: Wolfgang Muees Autor: Wolfgang Muees
Stand: 28.10.97 Stand: 28.10.97
Autor: Holger Vogt Autor: Holger Vogt
@ -94,14 +94,15 @@ extern bool ft_ngdebug; /* some additional debug info printed */
extern bool ft_batchmode; extern bool ft_batchmode;
extern FILE *flogp; /* definition see xmain.c */ extern FILE *flogp; /* definition see xmain.c */
#include "winmain.h"
/* Forward definition of main() */ /* Forward definition of main() */
int xmain( int argc, char * argv[]);
//int xmain( int argc, char * argv[]);
/* forward of Update function */ /* forward of Update function */
void DisplayText( void);
/*void DisplayText( void);
char* rlead(char*); char* rlead(char*);
void winmessage(char*); void winmessage(char*);
int p_r_i_n_t_f(const char * __format, ...); int p_r_i_n_t_f(const char * __format, ...);
int f_f_l_u_s_h( FILE * __stream);
int f_f_l_u_s_h( FILE * __stream); */
/* private heap for storing plot data */ /* private heap for storing plot data */
HANDLE outheap; HANDLE outheap;
@ -109,7 +110,7 @@ HANDLE outheap;
/* --------------------------<history management>------------------------------ */ /* --------------------------<history management>------------------------------ */
/* Clear history buffer, set pointer to the beginning */ /* Clear history buffer, set pointer to the beginning */
void HistoryInit(void)
static void HistoryInit(void)
{ {
int i; int i;
HistIndex = 0; HistIndex = 0;
@ -119,7 +120,7 @@ void HistoryInit(void)
} }
/* Delete first line of buffer, all other lines move one down */ /* Delete first line of buffer, all other lines move one down */
void HistoryScroll(void)
static void HistoryScroll(void)
{ {
memmove( &(HistBuffer[0]), &(HistBuffer[1]), sizeof(SBufLine) * (HistSize-1)); memmove( &(HistBuffer[0]), &(HistBuffer[1]), sizeof(SBufLine) * (HistSize-1));
HistBuffer[HistSize-1][0] = SE; HistBuffer[HistSize-1][0] = SE;
@ -128,7 +129,7 @@ void HistoryScroll(void)
} }
/* Enter new input line into history buffer */ /* Enter new input line into history buffer */
void HistoryEnter( char * newLine)
static void HistoryEnter( char * newLine)
{ {
if (!newLine || !*newLine) return; if (!newLine || !*newLine) return;
if (HistPtr == HistSize) HistoryScroll(); if (HistPtr == HistSize) HistoryScroll();
@ -138,14 +139,14 @@ void HistoryEnter( char * newLine)
} }
// Mit dem Index eine Zeile zurueckgehen und den dort stehenden Eintrag zurueckgeben // Mit dem Index eine Zeile zurueckgehen und den dort stehenden Eintrag zurueckgeben
char * HistoryGetPrev(void)
static char * HistoryGetPrev(void)
{ {
if (HistIndex) HistIndex--; if (HistIndex) HistIndex--;
return &(HistBuffer[HistIndex][0]); return &(HistBuffer[HistIndex][0]);
} }
// Mit dem Index eine Zeile vorgehen und den dort stehenden Eintrag zurueckgeben // Mit dem Index eine Zeile vorgehen und den dort stehenden Eintrag zurueckgeben
char * HistoryGetNext(void)
static char * HistoryGetNext(void)
{ {
if (HistIndex < HistPtr) HistIndex++; if (HistIndex < HistPtr) HistIndex++;
if (HistIndex == HistPtr) return ""; //HistIndex--; if (HistIndex == HistPtr) return ""; //HistIndex--;
@ -169,7 +170,7 @@ void WaitForIdle(void)
// Warte, bis keine Messages mehr zu bearbeiten sind, // Warte, bis keine Messages mehr zu bearbeiten sind,
// dann warte auf neue Message (Input handling ohne Dauerloop) // dann warte auf neue Message (Input handling ohne Dauerloop)
void WaitForMessage(void)
static void WaitForMessage(void)
{ {
MSG m; MSG m;
// arbeite alle Nachrichten ab // arbeite alle Nachrichten ab
@ -183,7 +184,7 @@ void WaitForMessage(void)
// -----------------------------<Stringfenster>-------------------------------- // -----------------------------<Stringfenster>--------------------------------
// Loeschen des Stringfensters // Loeschen des Stringfensters
void ClearInput(void)
static void ClearInput(void)
{ {
// Darstellen // Darstellen
Edit_SetText( swString, ""); Edit_SetText( swString, "");
@ -270,7 +271,7 @@ void SetAnalyse(
// Anpassen des Scrollers im Textfenster // Anpassen des Scrollers im Textfenster
// Stellt gleichzeitig den Text neu dar // Stellt gleichzeitig den Text neu dar
void AdjustScroller(void)
static void AdjustScroller(void)
{ {
int LineCount; int LineCount;
int FirstLine; int FirstLine;
@ -285,7 +286,7 @@ void AdjustScroller(void)
} }
// Loeschen einer Zeile im Textbuffer // Loeschen einer Zeile im Textbuffer
void _DeleteFirstLine(void)
static void _DeleteFirstLine(void)
{ {
char * cp = strchr( TBuffer, LF); char * cp = strchr( TBuffer, LF);
if (!cp) { if (!cp) {
@ -301,7 +302,7 @@ void _DeleteFirstLine(void)
} }
// Anfuegen eines chars an den TextBuffer // Anfuegen eines chars an den TextBuffer
void AppendChar( char c)
static void AppendChar( char c)
{ {
// Textbuffer nicht zu grosz werden lassen // Textbuffer nicht zu grosz werden lassen
while ((TBufEnd+4) >= TBufSize) while ((TBufEnd+4) >= TBufSize)
@ -316,7 +317,7 @@ void AppendChar( char c)
} }
// Anfuegen eines Strings an den TextBuffer // Anfuegen eines Strings an den TextBuffer
void AppendString( const char * Line)
static void AppendString( const char * Line)
{ {
size_t i; size_t i;
if (!Line) return; if (!Line) return;
@ -333,7 +334,7 @@ void AppendString( const char * Line)
} }
// Text neu darstellen // Text neu darstellen
void DisplayText( void)
static void DisplayText( void)
{ {
// Darstellen // Darstellen
Edit_SetText( twText, TBuffer); Edit_SetText( twText, TBuffer);
@ -356,7 +357,7 @@ void AppendLine( const char * Line)
// -----------------------------------<User-IO>-------------------------------- // -----------------------------------<User-IO>--------------------------------
// Lese ein Zeichen ein // Lese ein Zeichen ein
int w_getch(void)
static int w_getch(void)
{ {
int c; int c;
@ -388,7 +389,7 @@ int w_getch(void)
} }
// Gebe ein Zeichen aus // Gebe ein Zeichen aus
int w_putch( int c)
static int w_putch( int c)
{ {
if (c) if (c)
AppendChar( (char)c ); AppendChar( (char)c );
@ -398,7 +399,7 @@ int w_putch( int c)
/* -------------------------------<Window procedures>-------------------------- */ /* -------------------------------<Window procedures>-------------------------- */
/* Main window changes size */ /* Main window changes size */
void Main_OnSize(HWND hwnd, UINT state, int cx, int cy)
static void Main_OnSize(HWND hwnd, UINT state, int cx, int cy)
{ {
int h = cy - LineHeight - StatusHeight; int h = cy - LineHeight - StatusHeight;
@ -423,14 +424,14 @@ void Main_OnSize(HWND hwnd, UINT state, int cx, int cy)
} }
/* Write a command into the command buffer */ /* Write a command into the command buffer */
void PostSpiceCommand( const char * const cmd)
static void PostSpiceCommand( const char * const cmd)
{ {
strcpy( SBuffer, cmd); strcpy( SBuffer, cmd);
strcat( SBuffer, CRLF); strcat( SBuffer, CRLF);
} }
/* Main Window procedure */ /* Main Window procedure */
LRESULT CALLBACK MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) { switch (uMsg) {
@ -488,7 +489,7 @@ DEFAULT_AFTER:
} }
/* Procedure for string window */ /* Procedure for string window */
LRESULT CALLBACK StringWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK StringWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
char c; char c;
UINT i; UINT i;
@ -530,7 +531,7 @@ DEFAULT:
} }
/* Procedure for text window */ /* Procedure for text window */
LRESULT CALLBACK TextWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK TextWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
unsigned char c; unsigned char c;
UINT i; UINT i;
@ -560,7 +561,7 @@ DEFAULT_TEXT:
} }
void Element_OnPaint(HWND hwnd)
static void Element_OnPaint(HWND hwnd)
{ {
PAINTSTRUCT ps; PAINTSTRUCT ps;
RECT r; RECT r;
@ -612,7 +613,7 @@ void Element_OnPaint(HWND hwnd)
/* Procedure for element window */ /* Procedure for element window */
LRESULT CALLBACK ElementWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
static LRESULT CALLBACK ElementWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
switch (uMsg) { switch (uMsg) {
@ -644,7 +645,7 @@ LRESULT CALLBACK ElementWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
0 on success 0 on success
-1 on failure -1 on failure
*/ */
int MakeArgcArgv(char *cmdline,int *argc,char ***argv)
static int MakeArgcArgv(char *cmdline,int *argc,char ***argv)
{ {
char *pC1; /* a temporary character pointer */ char *pC1; /* a temporary character pointer */
char *pWorkString=NULL; /* a working copy of cmdline */ char *pWorkString=NULL; /* a working copy of cmdline */
@ -1405,7 +1406,7 @@ int system( const char * command)
#endif #endif
*/ */
/* Strip leading spaces, return a copy of s */ /* Strip leading spaces, return a copy of s */
char* rlead(char *s)
/*static char* rlead(char *s)
{ {
int i,j=0; int i,j=0;
static char temp[512]; static char temp[512];
@ -1414,7 +1415,7 @@ char* rlead(char *s)
{ {
if(isspace(s[i]) && has_space) if(isspace(s[i]) && has_space)
{ {
; /*Do nothing*/
; //Do nothing
} }
else else
{ {
@ -1426,6 +1427,7 @@ char* rlead(char *s)
temp[j] = '\0'; temp[j] = '\0';
return copy(temp); return copy(temp);
} }
*/
void winmessage(char* new_msg) void winmessage(char* new_msg)
{ {

73
src/winmain.h

@ -0,0 +1,73 @@
/* Forwards and external function declarations
for winmain.c
$Id$
*/
/* Forward definition of main() */
int xmain( int argc, char * argv[]);
/* forward of Update function */
//static char* rlead(char*);
void winmessage(char*);
static void HistoryInit(void);
static void HistoryScroll(void);
static void HistoryEnter( char * newLine);
static char * HistoryGetPrev(void);
static char * HistoryGetNext(void);
void WaitForIdle(void);
static void WaitForMessage(void);
static void ClearInput(void);
void SetSource( char * Name);
void SetAnalyse(char *, int );
static void AdjustScroller(void);
static void _DeleteFirstLine(void);
static void AppendChar( char c);
static void AppendString( const char * Line);
static void DisplayText( void);
static int w_getch(void);
static int w_putch( int c);
static void Main_OnSize(HWND hwnd, UINT state, int cx, int cy);
static void PostSpiceCommand( const char * const cmd);
static LRESULT CALLBACK MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK StringWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK TextWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static void Element_OnPaint(HWND hwnd);
static LRESULT CALLBACK ElementWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static int MakeArgcArgv(char *cmdline,int *argc,char ***argv);
int f_c_l_o_s_e( FILE * __stream);
int f_f_l_u_s_h( FILE * __stream);
int fg_e_t_c( FILE * __stream);
int f_g_e_t_p_o_s( FILE * __stream, fpos_t * __pos);
char * fg_e_t_s(char * __s, int __n, FILE * __stream);
int fp_r_i_n_t_f(FILE * __stream, const char * __format, ...);
int fp_u_t_c(int __c, FILE * __stream);
int fp_u_t_s(const char * __s, FILE * __stream);
size_t f_r_e_a_d(void * __ptr, size_t __size, size_t __n, FILE * __stream);
FILE * f_r_e_o_p_e_n(const char * __path, const char * __mode, FILE * __stream);
int fs_c_a_n_f(FILE * __stream, const char * __format, ...);
int f_s_e_e_k(FILE * __stream, long __offset, int __whence);
int f_s_e_t_p_o_s(FILE * __stream, const fpos_t*__pos);
long f_t_e_l_l(FILE * __stream);
size_t f_w_r_i_t_e(const void * __ptr, size_t __size, size_t __n, FILE * __stream);
char * g_e_t_s(char * __s);
void p_e_r_r_o_r(const char * __s);
int p_r_i_n_t_f(const char * __format, ...);
int p_u_t_s(const char * __s);
int s_c_a_n_f(const char * __format, ...);
int ung_e_t_c(int __c, FILE * __stream);
int vfp_r_i_n_t_f(FILE * __stream, const char * __format, void * __arglist);
/*int vfs_c_a_n_f(FILE * __stream, const char * __format, void * __arglist);*/
int vp_r_i_n_t_f(const char * __format, void * __arglist);
/*int vs_c_a_n_f(const char * __format, void * __arglist); */
int r_e_a_d(int fd, char * __buf, int __n);
int g_e_t_c(FILE * __fp);
int g_e_t_char(void);
int p_u_t_char(const int __c);
int p_u_t_c(const int __c, FILE * __fp);
int f_e_o_f(FILE * __fp);
int f_e_r_r_o_r(FILE * __fp);
int fg_e_t_char(void);
int fp_u_t_char(int __c);

18
visualc/vngspice.sln

@ -10,10 +10,16 @@ Global
console_release|x64 = console_release|x64 console_release|x64 = console_release|x64
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Debug64|Win32 = Debug64|Win32
Debug64|x64 = Debug64|x64
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
Release|x64 = Release|x64 Release|x64 = Release|x64
Release64|Win32 = Release64|Win32
Release64|x64 = Release64|x64
ReleaseOMP|Win32 = ReleaseOMP|Win32 ReleaseOMP|Win32 = ReleaseOMP|Win32
ReleaseOMP|x64 = ReleaseOMP|x64 ReleaseOMP|x64 = ReleaseOMP|x64
ReleaseOmp64|Win32 = ReleaseOmp64|Win32
ReleaseOmp64|x64 = ReleaseOmp64|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|Win32.ActiveCfg = console_debug|Win32 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|Win32.ActiveCfg = console_debug|Win32
@ -28,14 +34,26 @@ Global
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|Win32.Build.0 = Debug|Win32 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|Win32.Build.0 = Debug|Win32
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.ActiveCfg = Debug|x64 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.ActiveCfg = Debug|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.Build.0 = Debug|x64 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.Build.0 = Debug|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug64|Win32.ActiveCfg = Debug64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug64|Win32.Build.0 = Debug64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug64|x64.ActiveCfg = Debug64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug64|x64.Build.0 = Debug64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.ActiveCfg = Release|Win32 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.ActiveCfg = Release|Win32
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.Build.0 = Release|Win32 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.Build.0 = Release|Win32
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.ActiveCfg = Release|x64 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.ActiveCfg = Release|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.Build.0 = Release|x64 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.Build.0 = Release|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release64|Win32.ActiveCfg = Release64|Win32
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release64|Win32.Build.0 = Release64|Win32
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release64|x64.ActiveCfg = Release64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release64|x64.Build.0 = Release64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|Win32.ActiveCfg = ReleaseOMP|Win32 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|Win32.ActiveCfg = ReleaseOMP|Win32
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|Win32.Build.0 = ReleaseOMP|Win32 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|Win32.Build.0 = ReleaseOMP|Win32
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|x64.ActiveCfg = ReleaseOMP|x64 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|x64.ActiveCfg = ReleaseOMP|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|x64.Build.0 = ReleaseOMP|x64 {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOMP|x64.Build.0 = ReleaseOMP|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOmp64|Win32.ActiveCfg = ReleaseOmp64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOmp64|Win32.Build.0 = ReleaseOmp64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOmp64|x64.ActiveCfg = ReleaseOmp64|x64
{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.ReleaseOmp64|x64.Build.0 = ReleaseOmp64|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

17542
visualc/vngspice.vcproj
File diff suppressed because it is too large
View File

Loading…
Cancel
Save