fix the type signature of the cx_* functions

This commit is contained in:
rlar 2010-07-24 12:37:41 +00:00
parent 92353ab6d5
commit d074de41f2
7 changed files with 96 additions and 84 deletions

View File

@ -1,3 +1,12 @@
2010-07-24 Robert Larice
* src/frontend/evaluate.c ,
* src/frontend/parse.c ,
* src/include/fteext.h ,
* src/include/fteparse.h ,
* src/maths/cmaths/cmath2.c ,
* src/maths/cmaths/cmath2.h :
fix the type signature of the cx_* functions
2010-07-23 Robert Larice
* src/include/smpdefs.h ,
* src/include/spmatrix.h :

View File

@ -150,7 +150,7 @@ static struct dvec *
doop(char what,
void*(*func) (void *data1, void *data2,
short int datatype1, short int datatype2,
int length, ...),
int length),
struct pnode *arg1,
struct pnode *arg2)
{
@ -845,7 +845,7 @@ apply_func(struct func *func, struct pnode *arg)
if (eq(func->fu_name, "interpolate") || eq(func->fu_name, "deriv") || eq(func->fu_name, "group_delay")) /* Ack */
{
void *(*f)(void *data, short int type, int length,
int *newlength, short int *newtype, ...)=func->fu_func;
int *newlength, short int *newtype, struct plot *, struct plot *, int) = (void *(*)(void *, short int, int, int *, short int *, struct plot *, struct plot *, int)) func->fu_func;
data = ((*f) ((isreal(v) ? (void *) v->v_realdata : (void *) v->v_compdata),
(short) (isreal(v) ? VF_REAL : VF_COMPLEX),
v->v_length, &len, &type,

View File

@ -136,6 +136,8 @@ struct op uops[] = {
* we do for vm(), etc won't work. This is caught in evaluate(). Bad kludge.
*/
typedef void* cx_function_t(void*,short int,int,int*,short int*);
struct func ft_funcs[] = {
{ "mag", cx_mag } ,
{ "magnitude", cx_mag } ,
@ -162,15 +164,15 @@ struct func ft_funcs[] = {
{ "pos", cx_pos } ,
{ "mean", cx_mean } ,
{ "avg", cx_avg } , /* A.Roldan 03/06/05 incremental average new function */
{ "group_delay", cx_group_delay } , /* A.Roldan 10/06/05 group delay new function */
{ "group_delay", (cx_function_t*) cx_group_delay } , /* A.Roldan 10/06/05 group delay new function */
{ "vector", cx_vector } ,
{ "unitvec", cx_unitvec } ,
{ "length", cx_length } ,
{ "vecmin", cx_min } ,
{ "vecmax", cx_max } ,
{ "vecd", cx_d } ,
{ "interpolate", cx_interpolate } ,
{ "deriv", cx_deriv } ,
{ "interpolate", (cx_function_t*) cx_interpolate } ,
{ "deriv", (cx_function_t*) cx_deriv } ,
{ "v", NULL } ,
{ NULL, NULL }
} ;

View File

@ -74,63 +74,64 @@ extern bool clip_to_circle(int *x1, int *y1, int *x2, int *y2, int cx, int cy, i
/* cmath1.c */
extern bool cx_degrees;
extern void *cx_mag(void *, short int , int , int *, short int *, ...);
extern void *cx_ph(void *, short int , int , int *, short int *, ...);
extern void *cx_j(void *, short int , int , int *, short int *, ...);
extern void *cx_real(void *, short int , int , int *, short int *, ...);
extern void *cx_imag(void *, short int , int , int *, short int *, ...);
extern void *cx_pos(void *, short int , int , int *, short int *, ...);
extern void *cx_db(void *, short int , int , int *, short int *, ...);
extern void *cx_log(void *, short int , int , int *, short int *, ...);
extern void *cx_ln(void *, short int , int , int *, short int *, ...);
extern void *cx_exp(void *, short int , int , int *, short int *, ...);
extern void *cx_sqrt(void *, short int , int , int *, short int *, ...);
extern void *cx_sin(void *, short int , int , int *, short int *, ...);
extern void *cx_cos(void *, short int , int , int *, short int *, ...);
extern void *cx_mag(void *, short int , int , int *, short int *);
extern void *cx_ph(void *, short int , int , int *, short int *);
extern void *cx_j(void *, short int , int , int *, short int *);
extern void *cx_real(void *, short int , int , int *, short int *);
extern void *cx_imag(void *, short int , int , int *, short int *);
extern void *cx_pos(void *, short int , int , int *, short int *);
extern void *cx_db(void *, short int , int , int *, short int *);
extern void *cx_log(void *, short int , int , int *, short int *);
extern void *cx_ln(void *, short int , int , int *, short int *);
extern void *cx_exp(void *, short int , int , int *, short int *);
extern void *cx_sqrt(void *, short int , int , int *, short int *);
extern void *cx_sin(void *, short int , int , int *, short int *);
extern void *cx_cos(void *, short int , int , int *, short int *);
/* cmath2.c */
extern void *cx_tan(void *, short int , int , int *, short int *, ...);
extern void *cx_atan(void *, short int , int , int *, short int *, ...);
extern void *cx_norm(void *, short int , int , int *, short int *, ...);
extern void *cx_uminus(void *, short int , int , int *, short int *, ...);
extern void *cx_rnd(void *, short int , int , int *, short int *, ...);
extern void *cx_mean(void *, short int , int , int *, short int *, ...);
extern void *cx_avg(void *, short int , int , int *, short int *, ...);
extern void *cx_length(void *, short int , int , int *, short int *, ...);
extern void *cx_vector(void *, short int , int , int *, short int *, ...);
extern void *cx_unitvec(void *, short int , int , int *, short int *, ...);
extern void *cx_tan(void *, short int , int , int *, short int *);
extern void *cx_atan(void *, short int , int , int *, short int *);
extern void *cx_norm(void *, short int , int , int *, short int *);
extern void *cx_uminus(void *, short int , int , int *, short int *);
extern void *cx_rnd(void *, short int , int , int *, short int *);
extern void *cx_mean(void *, short int , int , int *, short int *);
extern void *cx_avg(void *, short int , int , int *, short int *);
extern void *cx_length(void *, short int , int , int *, short int *);
extern void *cx_vector(void *, short int , int , int *, short int *);
extern void *cx_unitvec(void *, short int , int , int *, short int *);
/* Routoure JM : somme useful functions */
extern void *cx_min(void *, short int , int , int *, short int *, ...);
extern void *cx_max(void *, short int , int , int *, short int *, ...);
extern void *cx_d(void *, short int , int , int *, short int *, ...);
extern void *cx_min(void *, short int , int , int *, short int *);
extern void *cx_max(void *, short int , int , int *, short int *);
extern void *cx_d(void *, short int , int , int *, short int *);
extern void *cx_plus(void *, void *, short int , short int , int, ...);
extern void *cx_minus(void *, void *, short int , short int , int, ...);
extern void *cx_times(void *, void *, short int , short int , int, ...);
extern void *cx_mod(void *, void *, short int , short int , int, ...);
extern void *cx_plus(void *, void *, short int , short int , int);
extern void *cx_minus(void *, void *, short int , short int , int);
extern void *cx_times(void *, void *, short int , short int , int);
extern void *cx_mod(void *, void *, short int , short int , int);
/* cmath3.c */
extern void *cx_divide(void *, void *, short int , short int , int, ...);
extern void *cx_comma(void *, void *, short int , short int , int, ...);
extern void *cx_power(void *, void *, short int , short int , int, ...);
extern void *cx_eq(void *, void *, short int , short int , int, ...);
extern void *cx_gt(void *, void *, short int , short int , int, ...);
extern void *cx_lt(void *, void *, short int , short int , int, ...);
extern void *cx_ge(void *, void *, short int , short int , int, ...);
extern void *cx_le(void *, void *, short int , short int , int, ...);
extern void *cx_ne(void *, void *, short int , short int , int, ...);
extern void *cx_divide(void *, void *, short int , short int , int);
extern void *cx_comma(void *, void *, short int , short int , int);
extern void *cx_power(void *, void *, short int , short int , int);
extern void *cx_eq(void *, void *, short int , short int , int);
extern void *cx_gt(void *, void *, short int , short int , int);
extern void *cx_lt(void *, void *, short int , short int , int);
extern void *cx_ge(void *, void *, short int , short int , int);
extern void *cx_le(void *, void *, short int , short int , int);
extern void *cx_ne(void *, void *, short int , short int , int);
/* cmath4.c */
extern void *cx_and(void *, void *, short int , short int , int, ...);
extern void *cx_or(void *, void *, short int , short int , int, ...);
extern void *cx_not(void *, short int , int , int *, short int * , ...);
extern void *cx_interpolate(void *, short int , int , int *, short int *, ...); /* struct plot *, struct plot *, int ); */
extern void *cx_deriv(void *, short int , int , int *, short int *, ...); /*struct plot *, struct plot *, int );*/
extern void *cx_group_delay(void *, short int , int , int *, short int *, ...); /*struct plot *, struct plot *, int );*/
extern void *cx_and(void *, void *, short int , short int , int);
extern void *cx_or(void *, void *, short int , short int , int);
extern void *cx_not(void *, short int , int , int *, short int *);
extern void *cx_interpolate(void *, short int , int , int *, short int *, struct plot *, struct plot *, int );
extern void *cx_deriv(void *, short int , int , int *, short int *, struct plot *, struct plot *, int );
extern void *cx_group_delay(void *, short int , int , int *, short int *, struct plot *, struct plot *, int );
/* cmdtab.c */

View File

@ -43,7 +43,7 @@ struct func {
/* The function. */
void *(*fu_func)(void *data, short int type, int length,
int *newlength, short int *newtype, ...);
int *newlength, short int *newtype);
} ;
/* User-definable functions. The idea of ud_name is that the args are

View File

@ -75,7 +75,7 @@ c_tan(complex *cc, int length)
}
void *
cx_tan(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_tan(void *data, short int type, int length, int *newlength, short int *newtype)
{
*newlength = length;
if (type == VF_REAL) {
@ -90,7 +90,7 @@ cx_tan(void *data, short int type, int length, int *newlength, short int *newtyp
void *
cx_atan(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_atan(void *data, short int type, int length, int *newlength, short int *newtype)
{
double *d;
@ -140,7 +140,7 @@ cx_max_local(void *data, short int type, int length)
/* Normalize the data so that the magnitude of the greatest value is 1. */
void *
cx_norm(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_norm(void *data, short int type, int length, int *newlength, short int *newtype)
{
double largest = 0.0;
@ -179,7 +179,7 @@ cx_norm(void *data, short int type, int length, int *newlength, short int *newty
}
void *
cx_uminus(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_uminus(void *data, short int type, int length, int *newlength, short int *newtype)
{
*newlength = length;
if (type == VF_COMPLEX) {
@ -208,7 +208,7 @@ cx_uminus(void *data, short int type, int length, int *newlength, short int *new
}
void *
cx_rnd(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_rnd(void *data, short int type, int length, int *newlength, short int *newtype)
{
*newlength = length;
checkseed();
@ -248,7 +248,7 @@ cx_rnd(void *data, short int type, int length, int *newlength, short int *newtyp
Created by A.M.Roldan 2005-05-21 */
void
*cx_avg(void *data, short int type, int length, int *newlength, short int *newtype, ...)
*cx_avg(void *data, short int type, int length, int *newlength, short int *newtype)
{
complex *c;
double *d = NULL, sum_real = 0.0,sum_imag = 0.0;
@ -292,7 +292,7 @@ void
/* Compute the mean of a vector. */
void *
cx_mean(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_mean(void *data, short int type, int length, int *newlength, short int *newtype)
{
*newlength = 1;
rcheck(length > 0, "mean");
@ -326,7 +326,7 @@ cx_mean(void *data, short int type, int length, int *newlength, short int *newty
void *
cx_length(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_length(void *data, short int type, int length, int *newlength, short int *newtype)
{
double *d;
@ -343,7 +343,7 @@ cx_length(void *data, short int type, int length, int *newlength, short int *new
void *
cx_vector(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_vector(void *data, short int type, int length, int *newlength, short int *newtype)
{
complex *cc = (complex *) data;
double *dd = (double *) data;
@ -368,7 +368,7 @@ cx_vector(void *data, short int type, int length, int *newlength, short int *new
void *
cx_unitvec(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_unitvec(void *data, short int type, int length, int *newlength, short int *newtype)
{
complex *cc = (complex *) data;
double *dd = (double *) data;
@ -398,7 +398,7 @@ cx_unitvec(void *data, short int type, int length, int *newlength, short int *ne
*/
void *
cx_plus(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...)
cx_plus(void *data1, void *data2, short int datatype1, short int datatype2, int length)
{
double *dd1 = (double *) data1;
double *dd2 = (double *) data2;
@ -438,7 +438,7 @@ cx_plus(void *data1, void *data2, short int datatype1, short int datatype2, int
}
void *
cx_minus(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...)
cx_minus(void *data1, void *data2, short int datatype1, short int datatype2, int length)
{
double *dd1 = (double *) data1;
double *dd2 = (double *) data2;
@ -478,7 +478,7 @@ cx_minus(void *data1, void *data2, short int datatype1, short int datatype2, int
}
void *
cx_times(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...)
cx_times(void *data1, void *data2, short int datatype1, short int datatype2, int length)
{
double *dd1 = (double *) data1;
double *dd2 = (double *) data2;
@ -520,7 +520,7 @@ cx_times(void *data1, void *data2, short int datatype1, short int datatype2, int
}
void *
cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...)
cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, int length)
{
double *dd1 = (double *) data1;
double *dd2 = (double *) data2;
@ -579,7 +579,7 @@ cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, int l
/* Routoure JM : Compute the max of a vector. */
void *
cx_max(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_max(void *data, short int type, int length, int *newlength, short int *newtype)
{
*newlength = 1;
/* test if length >0 et affiche un message d'erreur */
@ -620,7 +620,7 @@ cx_max(void *data, short int type, int length, int *newlength, short int *newtyp
/* Routoure JM : Compute the min of a vector. */
void *
cx_min(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_min(void *data, short int type, int length, int *newlength, short int *newtype)
{
*newlength = 1;
/* test if length >0 et affiche un message d'erreur */
@ -663,7 +663,7 @@ cx_min(void *data, short int type, int length, int *newlength, short int *newtyp
/* Routoure JM : Compute the differential of a vector. */
void *
cx_d(void *data, short int type, int length, int *newlength, short int *newtype, ...)
cx_d(void *data, short int type, int length, int *newlength, short int *newtype)
{
*newlength = length;
/* test if length >0 et affiche un message d'erreur */

View File

@ -7,22 +7,22 @@
#define CMATH2_H_INCLUDED
void * cx_tan(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_atan(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_norm(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_uminus(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_rnd(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_mean(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_length(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_vector(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_unitvec(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_plus(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...);
void * cx_minus(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...);
void * cx_times(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...);
void * cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, int length, ...);
void * cx_max(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_min(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_d(void *data, short int type, int length, int *newlength, short int *newtype, ...);
void * cx_tan(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_atan(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_norm(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_uminus(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_rnd(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_mean(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_length(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_vector(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_unitvec(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_plus(void *data1, void *data2, short int datatype1, short int datatype2, int length);
void * cx_minus(void *data1, void *data2, short int datatype1, short int datatype2, int length);
void * cx_times(void *data1, void *data2, short int datatype1, short int datatype2, int length);
void * cx_mod(void *data1, void *data2, short int datatype1, short int datatype2, int length);
void * cx_max(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_min(void *data, short int type, int length, int *newlength, short int *newtype);
void * cx_d(void *data, short int type, int length, int *newlength, short int *newtype);
#endif