From cbeb0b26e4c7caa8d1b47de791a7418dc20a4567 Mon Sep 17 00:00:00 2001 From: rsc Date: Sat, 1 Apr 2006 19:24:03 +0000 Subject: Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms. --- src/cmd/astro/astro.h | 10 ++++++---- src/cmd/astro/init.c | 4 ++-- src/cmd/astro/main.c | 16 ++++++++-------- src/cmd/astro/merct.c | 4 ++-- src/cmd/astro/moont.c | 2 +- src/cmd/astro/nept.c | 34 +++++++++++++++++----------------- src/cmd/astro/nutt.c | 4 ++-- src/cmd/astro/pdate.c | 10 +++++----- src/cmd/astro/plut.c | 34 +++++++++++++++++----------------- src/cmd/astro/satel.c | 2 +- src/cmd/astro/search.c | 2 +- src/cmd/astro/sunt.c | 4 ++-- src/cmd/astro/uran.c | 34 +++++++++++++++++----------------- src/cmd/astro/venust.c | 4 ++-- 14 files changed, 83 insertions(+), 81 deletions(-) (limited to 'src/cmd/astro') diff --git a/src/cmd/astro/astro.h b/src/cmd/astro/astro.h index 1c74a162..52754039 100644 --- a/src/cmd/astro/astro.h +++ b/src/cmd/astro/astro.h @@ -1,8 +1,10 @@ #include #include -//#pragma varargck type "R" double -//#pragma varargck type "D" double +#ifdef VARARGCK +#pragma varargck type "R" double +#pragma varargck type "D" double +#endif typedef struct Obj1 Obj1; typedef struct Obj2 Obj2; @@ -20,7 +22,7 @@ enum DARK = 1<<0, SIGNIF = 1<<1, PTIME = 1<<2, - LIGHT = 1<<3, + LIGHT = 1<<3 }; struct Obj1 @@ -150,7 +152,7 @@ extern double cosx(double, int, int, int, int, double); extern double dist(Obj1*, Obj1*); extern double dsrc(double, Tim*, int); extern void dtsetup(double, Tim*); -//extern int evcomp(void*, void*); +/*extern int evcomp(void*, void*);*/ extern void event(char*, char*, char*, double, int); extern void evflush(void); extern double fmod(double, double); diff --git a/src/cmd/astro/init.c b/src/cmd/astro/init.c index f376f665..9375a3a9 100644 --- a/src/cmd/astro/init.c +++ b/src/cmd/astro/init.c @@ -14,7 +14,7 @@ Obj2* objlst[] = &onept, &oplut, &ocomet, - 0, + 0 }; struct idata @@ -35,7 +35,7 @@ struct idata "Uranus", "uranus", uran, "Neptune", "neptune", nept, "Pluto", "pluto", plut, - "Comet", "comet", comet, + "Comet", "comet", comet }; void diff --git a/src/cmd/astro/main.c b/src/cmd/astro/main.c index a6441aae..43ce4cc4 100644 --- a/src/cmd/astro/main.c +++ b/src/cmd/astro/main.c @@ -52,12 +52,12 @@ loop: d = dist(&eobj1->point[i], &eobj2->point[i]); print("dist %s to %s = %.4f\n", eobj1->name, eobj2->name, d); } -// if(flags['p']) { -// pdate(d); -// print(" "); -// ptime(d); -// print("\n"); -// } +/* if(flags['p']) { */ +/* pdate(d); */ +/* print(" "); */ +/* ptime(d); */ +/* print("\n"); */ +/* } */ if(flags['p'] || flags['e']) break; d += deld; @@ -151,8 +151,8 @@ args(int argc, char *argv[]) if(flags['j']) print("jday = %.4f\n", day); deltat = day * .001704; - if(deltat > 32.184) // assume date is utc1 - deltat = 32.184; // correct by leap sec + if(deltat > 32.184) /* assume date is utc1 */ + deltat = 32.184; /* correct by leap sec */ if(flags['t']) deltat = readdt(); diff --git a/src/cmd/astro/merct.c b/src/cmd/astro/merct.c index ebe1f0ec..6ada968d 100644 --- a/src/cmd/astro/merct.c +++ b/src/cmd/astro/merct.c @@ -168,7 +168,7 @@ double mercfp[] = 0.160e-6, 2.1241, 0.134e-6, 5.1260, 0.347e-6, 5.1620, - 0, + 0 }; char merccp[] = @@ -332,5 +332,5 @@ char merccp[] = 0, 2, -1, 2, 2, 3, - 1, 3, + 1, 3 }; diff --git a/src/cmd/astro/moont.c b/src/cmd/astro/moont.c index 1509492e..3658035c 100644 --- a/src/cmd/astro/moont.c +++ b/src/cmd/astro/moont.c @@ -286,5 +286,5 @@ Moontab moontab[] = -.0130, 4,0,0,-2, 0.0115, 3,-1,0,0, -.0141, 2,0,-2,-2, - 0, 0,0,0,0, + 0, 0,0,0,0 }; diff --git a/src/cmd/astro/nept.c b/src/cmd/astro/nept.c index 2d05d59c..ff0c9fca 100644 --- a/src/cmd/astro/nept.c +++ b/src/cmd/astro/nept.c @@ -2,21 +2,21 @@ static double elem[] = { - 36525.0, // [0] eday of epoc - - 30.06896348, // [1] semi major axis (au) - 0.00858587, // [2] eccentricity - 1.76917, // [3] inclination (deg) - 131.72169, // [4] longitude of the ascending node (deg) - 44.97135, // [5] longitude of perihelion (deg) - 304.88003, // [6] mean longitude (deg) - - -0.00125196, // [1+6] (au/julian century) - 0.0000251, // [2+6] (e/julian century) - -3.64, // [3+6] (arcsec/julian century) - -151.25, // [4+6] (arcsec/julian century) - -844.43, // [5+6] (arcsec/julian century) - 786449.21, // [6+6] (arcsec/julian century) + 36525.0, /* [0] eday of epoc */ + + 30.06896348, /* [1] semi major axis (au) */ + 0.00858587, /* [2] eccentricity */ + 1.76917, /* [3] inclination (deg) */ + 131.72169, /* [4] longitude of the ascending node (deg) */ + 44.97135, /* [5] longitude of perihelion (deg) */ + 304.88003, /* [6] mean longitude (deg) */ + + -0.00125196, /* [1+6] (au/julian century) */ + 0.0000251, /* [2+6] (e/julian century) */ + -3.64, /* [3+6] (arcsec/julian century) */ + -151.25, /* [4+6] (arcsec/julian century) */ + -844.43, /* [5+6] (arcsec/julian century) */ + 786449.21, /* [6+6] (arcsec/julian century) */ }; void @@ -32,12 +32,12 @@ nept(void) double cy; - cy = (eday - elem[0]) / 36525.; // per julian century + cy = (eday - elem[0]) / 36525.; /* per julian century */ mrad = elem[1] + elem[1+6]*cy; ecc = elem[2] + elem[2+6]*cy; - cy = cy / 3600; // arcsec/deg per julian century + cy = cy / 3600; /* arcsec/deg per julian century */ incl = elem[3] + elem[3+6]*cy; node = elem[4] + elem[4+6]*cy; argp = elem[5] + elem[5+6]*cy; diff --git a/src/cmd/astro/nutt.c b/src/cmd/astro/nutt.c index 8ddf2b91..b4bfdefe 100644 --- a/src/cmd/astro/nutt.c +++ b/src/cmd/astro/nutt.c @@ -34,7 +34,7 @@ double nutfp[] = .0183, 0, .0113, 0, -.0050, 0, - 0, + 0 }; char nutcp[] = @@ -67,5 +67,5 @@ char nutcp[] = 2,2,0, 1,2,0, 2,2,1, - 2,2,-1, + 2,2,-1 }; diff --git a/src/cmd/astro/pdate.c b/src/cmd/astro/pdate.c index e88d7006..4d60fdeb 100644 --- a/src/cmd/astro/pdate.c +++ b/src/cmd/astro/pdate.c @@ -14,7 +14,7 @@ char* month[] = "September", "October", "November", - "December", + "December" }; double @@ -163,13 +163,13 @@ pstime(double d) lambda = 0; beta = 0; -// uses lambda, beta, rad, motion -// sets alpha, delta, rp +/* uses lambda, beta, rad, motion */ +/* sets alpha, delta, rp */ helio(); -// uses alpha, delta, rp -// sets ra, decl, lha, decl2, az, el +/* uses alpha, delta, rp */ +/* sets ra, decl, lha, decl2, az, el */ geo(); diff --git a/src/cmd/astro/plut.c b/src/cmd/astro/plut.c index 36702a80..6c31ed58 100644 --- a/src/cmd/astro/plut.c +++ b/src/cmd/astro/plut.c @@ -2,21 +2,21 @@ static double elem[] = { - 36525.0, // [0] eday of epoc - - 39.48168677, // [1] semi major axis (au) - 0.24880766, // [2] eccentricity - 17.14175, // [3] inclination (deg) - 110.30347, // [4] longitude of the ascending node (deg) - 224.06676, // [5] longitude of perihelion (deg) - 238.92881, // [6] mean longitude (deg) - - -0.00076912, // [1+6] (au/julian century) - 0.00006465, // [2+6] (e/julian century) - 11.07, // [3+6] (arcsec/julian century) - -37.33, // [4+6] (arcsec/julian century) - -132.25, // [5+6] (arcsec/julian century) - 522747.90, // [6+6] (arcsec/julian century) + 36525.0, /* [0] eday of epoc */ + + 39.48168677, /* [1] semi major axis (au) */ + 0.24880766, /* [2] eccentricity */ + 17.14175, /* [3] inclination (deg) */ + 110.30347, /* [4] longitude of the ascending node (deg) */ + 224.06676, /* [5] longitude of perihelion (deg) */ + 238.92881, /* [6] mean longitude (deg) */ + + -0.00076912, /* [1+6] (au/julian century) */ + 0.00006465, /* [2+6] (e/julian century) */ + 11.07, /* [3+6] (arcsec/julian century) */ + -37.33, /* [4+6] (arcsec/julian century) */ + -132.25, /* [5+6] (arcsec/julian century) */ + 522747.90, /* [6+6] (arcsec/julian century) */ }; void @@ -32,12 +32,12 @@ plut(void) double cy; - cy = (eday - elem[0]) / 36525.; // per julian century + cy = (eday - elem[0]) / 36525.; /* per julian century */ mrad = elem[1] + elem[1+6]*cy; ecc = elem[2] + elem[2+6]*cy; - cy = cy / 3600; // arcsec/deg per julian century + cy = cy / 3600; /* arcsec/deg per julian century */ incl = elem[3] + elem[3+6]*cy; node = elem[4] + elem[4+6]*cy; argp = elem[5] + elem[5+6]*cy; diff --git a/src/cmd/astro/satel.c b/src/cmd/astro/satel.c index 38206e5f..e610afa1 100644 --- a/src/cmd/astro/satel.c +++ b/src/cmd/astro/satel.c @@ -2,7 +2,7 @@ char* satlst[] = { - 0, + 0 }; struct diff --git a/src/cmd/astro/search.c b/src/cmd/astro/search.c index e4ed4eda..71424ee8 100644 --- a/src/cmd/astro/search.c +++ b/src/cmd/astro/search.c @@ -5,7 +5,7 @@ char* solstr[] = "Fall equinox", "Winter solstice", "Spring equinox", - "Summer solstice", + "Summer solstice" }; struct diff --git a/src/cmd/astro/sunt.c b/src/cmd/astro/sunt.c index 7f452bcf..0265632d 100644 --- a/src/cmd/astro/sunt.c +++ b/src/cmd/astro/sunt.c @@ -122,7 +122,7 @@ double sunfp[] = -1.33e-6, 0, 0.37e-6, 0, 0.36e-6, 0, - 0, + 0 }; char suncp[] = { @@ -238,5 +238,5 @@ char suncp[] = 1,0,0, 1,-1,0, 1,1,0, - 1,0,-1, + 1,0,-1 }; diff --git a/src/cmd/astro/uran.c b/src/cmd/astro/uran.c index b40fabe1..33e6f1bd 100644 --- a/src/cmd/astro/uran.c +++ b/src/cmd/astro/uran.c @@ -2,21 +2,21 @@ static double elem[] = { - 36525.0, // [0] eday of epoc - - 19.19126393, // [1] semi major axis (au) - 0.04716771, // [2] eccentricity - 0.76986, // [3] inclination (deg) - 74.22988, // [4] longitude of the ascending node (deg) - 170.96424, // [5] longitude of perihelion (deg) - 313.23218, // [6] mean longitude (deg) - - 0.00152025, // [1+6] (au/julian century) - -0.00019150, // [2+6] (e/julian century) - -2.09, // [3+6] (arcsec/julian century) - -1681.40, // [4+6] (arcsec/julian century) - 1312.56, // [5+6] (arcsec/julian century) - 1542547.79, // [6+6] (arcsec/julian century) + 36525.0, /* [0] eday of epoc */ + + 19.19126393, /* [1] semi major axis (au) */ + 0.04716771, /* [2] eccentricity */ + 0.76986, /* [3] inclination (deg) */ + 74.22988, /* [4] longitude of the ascending node (deg) */ + 170.96424, /* [5] longitude of perihelion (deg) */ + 313.23218, /* [6] mean longitude (deg) */ + + 0.00152025, /* [1+6] (au/julian century) */ + -0.00019150, /* [2+6] (e/julian century) */ + -2.09, /* [3+6] (arcsec/julian century) */ + -1681.40, /* [4+6] (arcsec/julian century) */ + 1312.56, /* [5+6] (arcsec/julian century) */ + 1542547.79, /* [6+6] (arcsec/julian century) */ }; void @@ -32,12 +32,12 @@ uran(void) double cy; - cy = (eday - elem[0]) / 36525.; // per julian century + cy = (eday - elem[0]) / 36525.; /* per julian century */ mrad = elem[1] + elem[1+6]*cy; ecc = elem[2] + elem[2+6]*cy; - cy = cy / 3600; // arcsec/deg per julian century + cy = cy / 3600; /* arcsec/deg per julian century */ incl = elem[3] + elem[3+6]*cy; node = elem[4] + elem[4+6]*cy; argp = elem[5] + elem[5+6]*cy; diff --git a/src/cmd/astro/venust.c b/src/cmd/astro/venust.c index a4521af6..e34643af 100644 --- a/src/cmd/astro/venust.c +++ b/src/cmd/astro/venust.c @@ -27,7 +27,7 @@ double venfp[] = 0.717e-6, 2.2969, 2.991e-6, 2.0611, 1.335e-6, 0.9628, - 0., + 0. }; char vencp[] = @@ -56,5 +56,5 @@ char vencp[] = 4,-5,0,0, 2,0,-3,0, 1,0,0,-1, - 2,0,0,-2, + 2,0,0,-2 }; -- cgit v1.2.3