From 608ca0f52343eed15ff31f513967ca5aec437447 Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Sun, 14 Jun 2015 17:04:38 -0500 Subject: [PATCH] wmsun: Fix implicit definition warnings. Add declaration for SunRise() in wmSun.c and move Interp() earlier in SunRise.c. --- wmsun/SunRise.c | 59 +++++++++++++++++++++---------------------------- wmsun/wmSun.c | 3 ++- 2 files changed, 27 insertions(+), 35 deletions(-) diff --git a/wmsun/SunRise.c b/wmsun/SunRise.c index 1126667..0a8e43c 100644 --- a/wmsun/SunRise.c +++ b/wmsun/SunRise.c @@ -10,6 +10,31 @@ double cosEPS = 0.91748; double sinEPS = 0.39778; double P2 = 6.283185307; +Interp(double ym, double y0, double yp, double *xe, double *ye, double *z1, double *z2, int *nz){ + + double a, b, c, d, dx; + + *nz = 0; + a = 0.5*(ym+yp)-y0; + b = 0.5*(yp-ym); + c = y0; + *xe = -b/(2.0*a); + *ye = (a*(*xe) + b) * (*xe) + c; + d = b*b - 4.0*a*c; + + if (d >= 0){ + dx = 0.5*sqrt(d)/fabs(a); + *z1 = *xe - dx; + *z2 = *xe+dx; + if (fabs(*z1) <= 1.0) *nz += 1; + if (fabs(*z2) <= 1.0) *nz += 1; + if (*z1 < -1.0) *z1 = *z2; + } + + return(0); + + +} SunRise(int year, int month, int day, double LocalHour, double *UTRise, double *UTSet){ @@ -93,40 +118,6 @@ UTTohhmm(double UT, int *h, int *m){ } - - - - - -Interp(double ym, double y0, double yp, double *xe, double *ye, double *z1, double *z2, int *nz){ - - double a, b, c, d, dx; - - *nz = 0; - a = 0.5*(ym+yp)-y0; - b = 0.5*(yp-ym); - c = y0; - *xe = -b/(2.0*a); - *ye = (a*(*xe) + b) * (*xe) + c; - d = b*b - 4.0*a*c; - - if (d >= 0){ - dx = 0.5*sqrt(d)/fabs(a); - *z1 = *xe - dx; - *z2 = *xe+dx; - if (fabs(*z1) <= 1.0) *nz += 1; - if (fabs(*z2) <= 1.0) *nz += 1; - if (*z1 < -1.0) *z1 = *z2; - } - - return(0); - - -} - - - - double SinH(int year, int month, int day, double UT){ double TU0, TU, TU2, TU3, LambdaMoon, BetaMoon, R, AGE, frac(), jd(); diff --git a/wmsun/wmSun.c b/wmsun/wmSun.c index 70ad18c..3873636 100644 --- a/wmsun/wmSun.c +++ b/wmsun/wmSun.c @@ -98,7 +98,8 @@ void ParseCMDLine(int argc, char *argv[]); void pressEvent(XButtonEvent *xev); - +SunRise(int year, int month, int day, double LocalHour, double *UTRise, + double *UTSet); int ToggleWindow = 0; int nMAX = 1;