aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/astro
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-05-27 18:35:26 +0000
committerrsc <devnull@localhost>2006-05-27 18:35:26 +0000
commit2ad582ee88c98eefdd00d4f16704783f3db52d6f (patch)
treed8b2942f2967cf43580fc6dd385b9b02663bce8d /src/cmd/astro
parentdfbaaaa65076fe72b99e3953efc3baf1ec487332 (diff)
downloadplan9port-2ad582ee88c98eefdd00d4f16704783f3db52d6f.tar.gz
plan9port-2ad582ee88c98eefdd00d4f16704783f3db52d6f.tar.bz2
plan9port-2ad582ee88c98eefdd00d4f16704783f3db52d6f.zip
Use va_args in cosadd/sinadd (Michael Teichgräber)
Diffstat (limited to 'src/cmd/astro')
-rw-r--r--src/cmd/astro/astro.h4
-rw-r--r--src/cmd/astro/cosadd.c24
2 files changed, 19 insertions, 9 deletions
diff --git a/src/cmd/astro/astro.h b/src/cmd/astro/astro.h
index 1553fff7..4648e34e 100644
--- a/src/cmd/astro/astro.h
+++ b/src/cmd/astro/astro.h
@@ -152,7 +152,7 @@ extern void args(int, char**);
extern void bdtsetup(double, Tim*);
extern double betcross(double);
extern double convdate(Tim*);
-extern double cosadd(int, double, ...);
+extern double cosadd(int, ...);
extern double cosx(double, int, int, int, int, double);
extern double dist(Obj1*, Obj1*);
extern double dsrc(double, Tim*, int);
@@ -201,7 +201,7 @@ extern void setime(double);
extern void setobj(Obj1*);
extern void setpt(Occ*, double);
extern void shad(void);
-extern double sinadd(int, double, ...);
+extern double sinadd(int, ...);
extern double sinx(double, int, int, int, int, double);
extern char* skip(int);
extern double solstice(int);
diff --git a/src/cmd/astro/cosadd.c b/src/cmd/astro/cosadd.c
index a632149a..637ad206 100644
--- a/src/cmd/astro/cosadd.c
+++ b/src/cmd/astro/cosadd.c
@@ -10,15 +10,20 @@ icosadd(double *fp, char *cp)
}
double
-cosadd(int n, double coef, ...)
+cosadd(int n, ...)
{
- double *coefp;
+ double *coefp, coef[10];
char *cp;
int i;
double sum, a1, a2;
-
+ va_list arg;
+
sum = 0;
cp = cacp;
+ va_start(arg, n);
+ for(i=0; i<n; i++)
+ coef[i] = va_arg(arg, double);
+ va_end(arg);
loop:
a1 = *cafp++;
@@ -28,7 +33,7 @@ loop:
}
a2 = *cafp++;
i = n;
- coefp = &coef;
+ coefp = coef;
do
a2 += *cp++ * *coefp++;
while(--i);
@@ -37,15 +42,20 @@ loop:
}
double
-sinadd(int n, double coef, ...)
+sinadd(int n, ...)
{
- double *coefp;
+ double *coefp, coef[10];
char *cp;
int i;
double sum, a1, a2;
+ va_list arg;
sum = 0;
cp = cacp;
+ va_start(arg, n);
+ for(i=0; i<n; i++)
+ coef[i] = va_arg(arg, double);
+ va_end(arg);
loop:
a1 = *cafp++;
@@ -55,7 +65,7 @@ loop:
}
a2 = *cafp++;
i = n;
- coefp = &coef;
+ coefp = coef;
do
a2 += *cp++ * *coefp++;
while(--i);