reduce compiler warnings

This commit is contained in:
h_vogt 2011-05-21 12:44:27 +00:00
parent 9dd48a1b4e
commit 561e339365
8 changed files with 101 additions and 47 deletions

View File

@ -1,3 +1,7 @@
2011-05-21 Holger Vogt
* windisp.c, winprint.c, windisp.h, winprint.h, display.c xdisplay.c,
winmain.c: reduce compiler warnings
2011-05-20 Robert Larice
* src/spicelib/devices/adms/admst/ngspiceMakefile.am.xml:
revert ngspiceMakfile.am.xml

View File

@ -31,7 +31,7 @@ static int nodev(void);
#ifdef HAS_WINDOWS /* Graphic-IO under MS Windows */
#include "wdisp/windisp.h"
#include "wdisp/winprint.h"
//#include "wdisp/winprint.h"
#endif
#include "plotting/plot5.h"
@ -280,22 +280,22 @@ gen_DatatoScreen(GRAPH *graph, double x, double y, int *screenx, int *screeny)
(graph->grid.gridtype == GRID_YLOG)) {
low = mylog10(graph->datawindow.ymin);
high = mylog10(graph->datawindow.ymax);
*screeny = (mylog10(y) - low) / (high - low) * graph->viewport.height
+ 0.5 + graph->viewportyoff;
*screeny = (int)((mylog10(y) - low) / (high - low) * graph->viewport.height
+ 0.5 + graph->viewportyoff);
} else {
*screeny = ((y - graph->datawindow.ymin) / graph->aspectratioy)
+ 0.5 + graph->viewportyoff;
*screeny = (int)(((y - graph->datawindow.ymin) / graph->aspectratioy)
+ 0.5 + graph->viewportyoff);
}
if ((graph->grid.gridtype == GRID_LOGLOG) ||
(graph->grid.gridtype == GRID_XLOG)) {
low = mylog10(graph->datawindow.xmin);
high = mylog10(graph->datawindow.xmax);
*screenx = (mylog10(x) - low) / (high - low) * graph->viewport.width
+ 0.5 + graph ->viewportxoff;
*screenx = (int)((mylog10(x) - low) / (high - low) * graph->viewport.width
+ 0.5 + graph ->viewportxoff);
} else {
*screenx = (x - graph->datawindow.xmin) / graph->aspectratiox
+ 0.5 + graph ->viewportxoff;
*screenx = (int)((x - graph->datawindow.xmin) / graph->aspectratiox
+ 0.5 + graph ->viewportxoff);
}
}

View File

@ -24,11 +24,17 @@ int hlp_buttonstyle = BS_LEFT;
#ifdef X_DISPLAY_MISSING
/* ARGSUSED */ bool hlp_xdisplay(topic *top) { return (FALSE); }
/* ARGSUSED */ void hlp_xkillwin(topic *top) { }
bool hlp_xdisplay(topic *top) {
NG_IGNORE(top);
return (FALSE);
}
void hlp_xkillwin(topic *top) {
NG_IGNORE(top);
}
#endif
/* ARGSUSED */ void hlp_xwait(topic *top, bool on)
void hlp_xwait(topic *top, bool on)
{
NG_IGNORE(on);
NG_IGNORE(top);

View File

@ -237,6 +237,7 @@ static int LType( int ColorIndex)
static LRESULT HcpyPlot( HWND hwnd)
{
int colorval = isblack? 0 : 1;
NG_IGNORE(hwnd);
cp_vset("hcopypscolor", CP_NUM, &colorval);
com_hardcopy(NULL);
return 0;
@ -245,6 +246,7 @@ static LRESULT HcpyPlot( HWND hwnd)
static LRESULT HcpyPlotBW( HWND hwnd)
{
int bgcolor;
NG_IGNORE(hwnd);
if (cp_getvar("hcopypscolor", CP_NUM, &bgcolor))
cp_remvar("hcopypscolor");
com_hardcopy(NULL);
@ -762,10 +764,10 @@ int WIN_Arc(int x0, int y0, int radius, double theta, double delta_theta)
r = radius;
dx0 = x0;
dy0 = y0;
xs = (dx0 + (r * cos(theta)));
ys = (dy0 + (r * sin(theta)));
xe = (dx0 + (r * cos(theta + delta_theta)));
ye = (dy0 + (r * sin(theta + delta_theta)));
xs = (int)(dx0 + (r * cos(theta)));
ys = (int)(dy0 + (r * sin(theta)));
xe = (int)(dx0 + (r * cos(theta + delta_theta)));
ye = (int)(dy0 + (r * sin(theta + delta_theta)));
/* plot */
NewPen = CreatePen( LType(wd->ColorIndex), linewidth, ColorTable[wd->ColorIndex] );
@ -842,19 +844,26 @@ int WIN_Text( char * text, int x, int y)
int WIN_DefineColor(int colorid, double red, double green, double blue)
{
/* nothing */
return (0);
NG_IGNORE(colorid);
NG_IGNORE(red);
NG_IGNORE(green);
NG_IGNORE(blue);
return (0);
}
int WIN_DefineLinestyle(int num, int mask)
{
/* nothing */
return (0);
NG_IGNORE(num);
NG_IGNORE(mask);
return (0);
}
int WIN_SetLinestyle(int style)
{
/* nothing */
return (0);
NG_IGNORE(style);
return (0);
}
int WIN_SetColor( int color)

View File

@ -19,6 +19,19 @@ disp_fn_SetLinestyle_t WIN_SetLinestyle;
disp_fn_SetColor_t WIN_SetColor;
disp_fn_Update_t WIN_Update;
disp_fn_Init_t WPRINT_Init;
disp_fn_NewViewport_t WPRINT_NewViewport;
disp_fn_Close_t WPRINT_Close;
disp_fn_Clear_t WPRINT_Clear;
disp_fn_DrawLine_t WPRINT_DrawLine;
disp_fn_Arc_t WPRINT_Arc;
disp_fn_Text_t WPRINT_Text;
disp_fn_DefineColor_t WPRINT_DefineColor;
disp_fn_DefineLinestyle_t WPRINT_DefineLinestyle;
disp_fn_SetLinestyle_t WPRINT_SetLinestyle;
disp_fn_SetColor_t WPRINT_SetColor;
disp_fn_Update_t WPRINT_Update;
//extern int WIN_DiagramReady();
#endif /* WINDISP_H */

View File

@ -23,16 +23,16 @@
*/
#undef BOOLEAN
#ifdef _MSC_VER
#pragma warn -dup
#endif /* _MSC_VER */
#include <windows.h>
#include <windowsx.h>
#include "suffix.h"
#ifdef _MSC_VER
#pragma hdrstop
#endif /* _MSC_VER */
#include "winprint.h" /* function prototypes */
/* Typen */
typedef struct { /* Extra Printdaten */
int ColorIndex; /* Index auf die akt. Farbe */
@ -96,7 +96,10 @@ void WPRINT_PrintInit(HWND hwnd)
/* Abort-Procedur zum Drucken */
BOOL CALLBACK WPRINT_Abort( HDC hdc, int iError)
{
/* Multitasking */
NG_IGNORE(hdc);
NG_IGNORE(iError);
/* Multitasking */
WaitForIdle();
/* Warten */
@ -116,7 +119,7 @@ WPRINT_Init() gibt 0 zurueck, falls kein Fehler auftrat.
******************************************************************************/
int WPRINT_Init( )
int WPRINT_Init(void)
{
int pWidth;
int pHeight;
@ -290,7 +293,7 @@ int WPRINT_NewViewport( GRAPH * graph)
return(0);
}
int WPRINT_Close()
int WPRINT_Close(void)
{
if (PrinterDC) {
EndPage( PrinterDC);
@ -307,7 +310,7 @@ int WPRINT_Close()
}
int WPRINT_Clear()
int WPRINT_Clear(void)
{
return 0;
}
@ -384,10 +387,10 @@ int WPRINT_Arc(int x0, int y0, int radius, double theta, double delta_theta)
r = radius;
dx0 = x0;
dy0 = y0;
xs = (dx0 + (r * cos(theta)));
ys = (dy0 + (r * sin(theta)));
xe = (dx0 + (r * cos(theta + delta_theta)));
ye = (dy0 + (r * sin(theta + delta_theta)));
xs = (int)(dx0 + (r * cos(theta)));
ys = (int)(dy0 + (r * sin(theta)));
xe = (int)(dx0 + (r * cos(theta + delta_theta)));
ye = (int)(dy0 + (r * sin(theta + delta_theta)));
/* Zeichnen */
NewPen = CreatePen( LineTable[pd->LineIndex], 0, ColorTable[ColIndex] );
@ -403,6 +406,7 @@ int WPRINT_Text( char * text, int x, int y, int degrees)
{
tpPrintData pd;
int ColIndex;
NG_IGNORE(degrees);
if (!currentgraph) return 0;
pd = pPrintData(currentgraph);
@ -422,12 +426,18 @@ int WPRINT_Text( char * text, int x, int y, int degrees)
int WPRINT_DefineColor(int colorid, double red, double green, double blue)
{
/* nix */
NG_IGNORE(colorid);
NG_IGNORE(red);
NG_IGNORE(green);
NG_IGNORE(blue);
return (0);
}
int WPRINT_DefineLinestyle(int num, int mask)
{
/* nix */
NG_IGNORE(num);
NG_IGNORE(mask);
return (0);
}
@ -453,12 +463,12 @@ int WPRINT_SetColor( int color)
return (0);
}
int WPRINT_Update()
int WPRINT_Update(void)
{
return (0);
}
int WPRINT_DiagramReady()
int WPRINT_DiagramReady(void)
{
return 0;
}

View File

@ -6,19 +6,20 @@
#ifndef WINPRINT_H
#define WINPRINT_H
disp_fn_Init_t WPRINT_Init;
disp_fn_NewViewport_t WPRINT_NewViewport;
disp_fn_Close_t WPRINT_Close;
disp_fn_Clear_t WPRINT_Clear;
disp_fn_DrawLine_t WPRINT_DrawLine;
disp_fn_Arc_t WPRINT_Arc;
disp_fn_Text_t WPRINT_Text;
disp_fn_DefineColor_t WPRINT_DefineColor;
disp_fn_DefineLinestyle_t WPRINT_DefineLinestyle;
disp_fn_SetLinestyle_t WPRINT_SetLinestyle;
disp_fn_SetColor_t WPRINT_SetColor;
disp_fn_Update_t WPRINT_Update;
extern int WPRINT_DiagramReady();
void WPRINT_PrintInit(HWND hwnd);
BOOL CALLBACK WPRINT_Abort( HDC hdc, int iError);
int WPRINT_Init(void);
int WPRINT_NewViewport( GRAPH * graph);
int WPRINT_Close(void);
int WPRINT_Clear(void);
int WPRINT_DrawLine(int x1, int y1, int x2, int y2);
int WPRINT_Arc(int x0, int y0, int radius, double theta, double delta_theta);
int WPRINT_Text( char * text, int x, int y, int degrees);
int WPRINT_DefineColor(int colorid, double red, double green, double blue);
int WPRINT_DefineLinestyle(int num, int mask);
int WPRINT_SetLinestyle(int style);
int WPRINT_SetColor( int color);
int WPRINT_Update(void);
int WPRINT_DiagramReady(void);
#endif /* WINPRINT_H */

View File

@ -44,6 +44,9 @@
#define AnalyseLength 100 // Platz fuer Analyse
#define QuitButtonLength 80
/* macro to ignore unused variables and parameters */
#define NG_IGNORE(x) (void)x
/* Types */
typedef char SBufLine[SBufSize+1]; // Eingabezeile
@ -399,6 +402,9 @@ void Main_OnSize(HWND hwnd, UINT state, int cx, int cy)
{
int h = cy - LineHeight - StatusHeight;
NG_IGNORE(hwnd);
NG_IGNORE(state);
/* Expand text window */
MoveWindow( twText, 0, 0, cx, h , TRUE);
VisibleRows = (h / RowHeight) -1;
@ -776,6 +782,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLi
RECT wsize; /* size of usable window */
NG_IGNORE(hPrevInstance);
/* fill global variables */
hInst = hInstance;
nShowState = nCmdShow;
@ -1157,7 +1165,7 @@ size_t f_w_r_i_t_e(const void * __ptr, size_t __size, size_t __n, FILE * __strea
// p_r_i_n_t_f("test1 %s\n", __s);
if (!__s) return EOF;
if (!__s) return 0 /*EOF*/;
for (i = 0; i< (__size * __n); i++) {
if (*__s) {
c = *__s++;
@ -1210,12 +1218,15 @@ int p_u_t_s(const char * __s)
int s_c_a_n_f(const char * __format, ...)
{
NG_IGNORE(__format);
assert( FALSE);
return FALSE;
}
int ung_e_t_c(int __c, FILE * __stream)
{
NG_IGNORE(__c);
NG_IGNORE(__stream);
assert( FALSE);
return FALSE;
}