* BUG: Changed function prototypes in all files to use upper case variable names (xf) to (X)f.
   Moved frexp to c_gsl where it belongs.

git-svn-id: svn://localhost/gambas/trunk@4487 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Randall Morgan 2012-02-18 22:06:10 +00:00
parent e575e091cf
commit a919a08cf0
4 changed files with 81 additions and 80 deletions

View file

@ -22,17 +22,16 @@
MA 02110-1301, USA.
***************************************************************************/
#ifndef __C_GSL_COMPLEX_C
#define __C_GSL_COMPLEX_C
#endif
#include "c_complex.h"
#include "gambas.h"
#include "../gambas.h"
#include "gb_common.h"
#include "c_gsl.h"
#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
#include <gsl/gsl_sf.h>
#include <gsl/gsl_cblas.h>
#include <stdio.h>
@ -145,6 +144,7 @@ END_METHOD
BEGIN_METHOD(GslComplex_Polar, GB_FLOAT real; GB_FLOAT imag)
THIS->number = gsl_complex_polar(VARG(real), VARG(imag));
//GSL_SET_COMPLEX(&a, 10.0, 12.0);
//GB.ReturnObject(THIS);
@ -255,6 +255,7 @@ BEGIN_METHOD(GslComplex_Add_Real, GB_FLOAT x)
GSLCOMPLEX *obj;
obj = create_complex();
//int r;
obj->number = gsl_complex_add_real(THIS->number, VARG(x));
@ -510,24 +511,6 @@ BEGIN_METHOD(GslComplex_Log_b, GB_OBJECT x;)
END_METHOD
BEGIN_METHOD(GslComplex_Frexp, GB_FLOAT x; GB_POINTER e)
// Function: double gsl_frexp (double x, int * e)
// This function splits the number x into its normalized
// fraction f and exponent e, such that x = f * 2^e and
// 0.5 <= f < 1. The function returns f and stores the
// exponent in e. If x is zero, both f and e are set to
// zero. This function provides an alternative to the
// standard math function frexp(x, e).
int *b;
double r;
b = VARG(e);
r = gsl_frexp(VARG(x), (int *)VARG(e));
GB.ReturnFloat(r);
END_METHOD
/**************************************************
Complex Trigonometric Functions
@ -934,9 +917,9 @@ GB_DESC CComplexDesc[] =
GB_STATIC_METHOD("_call", "Complex", GslComplex_call, "[(Real)f(Imag)f]"),
GB_METHOD("ToString", "s", GslComplex_ToString, NULL),
GB_METHOD("Copy", "Complex", GslComplex_Copy, NULL),
GB_METHOD("Set", NULL, GslComplex_Set, "[(real)f(imag)f]"),
GB_METHOD("Rect", NULL, GslComplex_Rect, "[(real)f(imag)f]"),
GB_METHOD("Polar", NULL, GslComplex_Polar, "[(real)f(imag)f]"),
GB_METHOD("Set", NULL, GslComplex_Set, "[(Real)f(Imag)f]"),
GB_METHOD("Rect", NULL, GslComplex_Rect, "[(Real)f(Imag)f]"),
GB_METHOD("Polar", NULL, GslComplex_Polar, "[(Real)f(Imag)f]"),
// Properties
GB_PROPERTY("Real", "f", GslComplex_Real),
@ -965,12 +948,11 @@ GB_DESC CComplexDesc[] =
// Elementary Complex Functions
GB_METHOD("Sqrt", "Complex", GslComplex_Sqrt, NULL),
GB_METHOD("SqrtReal", "Complex", GslComplex_SqrtReal, "(x)f"),
GB_METHOD("SqrtReal", "Complex", GslComplex_SqrtReal, "(X)f"),
GB_METHOD("Exp", "Complex", GslComplex_Exp, NULL),
GB_METHOD("Log", "Complex", GslComplex_Log, NULL),
GB_METHOD("Log10", "Complex", GslComplex_Log10, NULL),
GB_METHOD("Logb", "Complex", GslComplex_Log_b, "(x)Complex"),
GB_STATIC_METHOD("Frexp", "f", GslComplex_Frexp, "(x)f(e)p"),
GB_METHOD("Logb", "Complex", GslComplex_Log_b, "(X)Complex"),
// Complex Trigonometric Functions
GB_METHOD("Sin", "Complex", GslComplex_Sin, NULL),
@ -982,14 +964,14 @@ GB_DESC CComplexDesc[] =
// Inverse Complex Trigonometric Functions
GB_METHOD("Arcsin", "Complex", GslComplex_Arcsin, NULL),
GB_STATIC_METHOD("ArcsinReal", "Complex", GslComplex_Arcsin_Real, "(x)f"),
GB_STATIC_METHOD("ArcsinReal", "Complex", GslComplex_Arcsin_Real, "(X)f"),
GB_METHOD("Arccos", "Complex", GslComplex_Arccos, NULL),
GB_STATIC_METHOD("ArccosReal", "Complex", GslComplex_Arccos_Real, "(x)f"),
GB_STATIC_METHOD("ArccosReal", "Complex", GslComplex_Arccos_Real, "(X)f"),
GB_METHOD("Arctan", "Complex", GslComplex_Arctan, NULL),
GB_METHOD("Arcsec", "Complex", GslComplex_Arcsec, NULL),
GB_STATIC_METHOD("ArcsecReal", "Complex", GslComplex_Arcsec_Real, "(x)f"),
GB_STATIC_METHOD("ArcsecReal", "Complex", GslComplex_Arcsec_Real, "(X)f"),
GB_METHOD("Arccsc", "Complex", GslComplex_Arccsc, NULL),
GB_STATIC_METHOD("ArccscReal", "Complex", GslComplex_Arccsc_Real, "(x)f"),
GB_STATIC_METHOD("ArccscReal", "Complex", GslComplex_Arccsc_Real, "(X)f"),
GB_METHOD("Arccot", "Complex", GslComplex_Arccot, NULL),
// Complex Hyperbolic Functions
@ -1003,9 +985,9 @@ GB_DESC CComplexDesc[] =
// Inverse Complex Hyperbolic Functions
GB_METHOD("Arcsinh", "Complex", GslComplex_Arcsinh, NULL),
GB_METHOD("Arccosh", "Complex", GslComplex_Arccosh, NULL),
GB_METHOD("ArccoshReal", "Complex", GslComplex_Arccosh_Real, "(x)f"),
GB_METHOD("ArccoshReal", "Complex", GslComplex_Arccosh_Real, "(X)f"),
GB_METHOD("Arctanh", "Complex", GslComplex_Arctanh, NULL),
GB_METHOD("ArctanhReal", "Complex", GslComplex_Arctanh_Real, "(x)f"),
GB_METHOD("ArctanhReal", "Complex", GslComplex_Arctanh_Real, "(X)f"),
GB_METHOD("Arcsech", "Complex", GslComplex_Arcsech, NULL),
GB_METHOD("Arccsch", "Complex", GslComplex_Arccsch, NULL),
GB_METHOD("Arccoth", "Complex", GslComplex_Arccoth, NULL),

View file

@ -1,6 +1,6 @@
/***************************************************************************
c_gsl.h
c_complex.h
gb.gsl component
@ -27,7 +27,12 @@
#define __C_GSL_COMPLEX_H
#include "gambas.h"
#include <gsl/gsl_math.h>
#include <gsl/gsl_cblas.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
//GSLCOMPLEX GslComplex_Add_Real(GB_FLOAT x);
GB_INTERFACE GB EXPORT;
@ -38,6 +43,8 @@ typedef
{
GB_BASE ob;
gsl_complex number;
//double real;
//double imagined;
}
GSLCOMPLEX;

View file

@ -248,18 +248,25 @@ BEGIN_METHOD(GSL_LDEXP, GB_FLOAT x; GB_INTEGER e;)
GB.ReturnFloat(gsl_ldexp(VARG(x), VARG(e)));
END_METHOD
/*
BEGIN_METHOD(GSL_FREXP, GB_FLOAT x; GB_POINTER e;)
// Function: double gsl_frexp (double x, int * e)
// This function splits the number x into its normalized fraction f
// and exponent e, such that x = f * 2^e and 0.5 <= f < 1. The function
// returns f and stores the exponent in e. If x is zero, both f and e
// are set to zero. This function provides an alternative to the
// standard math function frexp(x, e).
GB.ReturnFloat(gsl_frexp(VARG(x), VARG(e)));
END_METHOD
*/
BEGIN_METHOD(GSL_Frexp, GB_FLOAT x; GB_POINTER e)
// Function: double gsl_frexp (double x, int * e)
// This function splits the number x into its normalized
// fraction f and exponent e, such that x = f * 2^e and
// 0.5 <= f < 1. The function returns f and stores the
// exponent in e. If x is zero, both f and e are set to
// zero. This function provides an alternative to the
// standard math function frexp(x, e).
int *b;
double r;
b = VARG(e);
r = gsl_frexp(VARG(x), (int *)VARG(e));
GB.ReturnFloat(r);
END_METHOD
@ -277,19 +284,20 @@ BEGIN_METHOD(GSL_INTPOW, GB_FLOAT x; GB_INTEGER i;)
END_METHOD
BEGIN_METHOD(GSL_INTPOW2, GB_FLOAT x;)
// Return x^2 using a small int safe method
// call gsl native function double gsl_pow_2(double x)
GB.ReturnFloat(gsl_pow_2(VARG(x)));
END_METHOD
BEGIN_METHOD(GSL_INTPOW3, GB_FLOAT x;)
// Return x^3 using a small int safe method
// call gsl native function double gsl_pow_3(double x)
GB.ReturnFloat(gsl_pow_3(VARG(x)));
END_METHOD
BEGIN_METHOD(GSL_INTPOW4, GB_FLOAT x;)
// Return x^4 using a small int safe method
// call gsl native function double gsl_pow_3(double x)
@ -302,24 +310,28 @@ BEGIN_METHOD(GSL_INTPOW5, GB_FLOAT x;)
GB.ReturnFloat(gsl_pow_5(VARG(x)));
END_METHOD
BEGIN_METHOD(GSL_INTPOW6, GB_FLOAT x;)
// Return x^6 using a small int safe method
// call gsl native function double gsl_pow_3(double x)
GB.ReturnFloat(gsl_pow_6(VARG(x)));
END_METHOD
BEGIN_METHOD(GSL_INTPOW7, GB_FLOAT x;)
// Return x^7 using a small int safe method
// call gsl native function double gsl_pow_3(double x)
GB.ReturnFloat(gsl_pow_7(VARG(x)));
END_METHOD
BEGIN_METHOD(GSL_INTPOW8, GB_FLOAT x;)
// Return x^8 using a small int safe method
// call gsl native function double gsl_pow_3(double x)
GB.ReturnFloat(gsl_pow_8(VARG(x)));
END_METHOD
BEGIN_METHOD(GSL_INTPOW9, GB_FLOAT x;)
// Return x^9 using a small int safe method
// call gsl native function double gsl_pow_3(double x)
@ -335,41 +347,41 @@ GB_DESC CGslDesc[] =
GB_DECLARE("GSL",0), GB_NOT_CREATABLE(),
// Number testing functions
GB_STATIC_METHOD("IsNan", "b", GSL_ISNAN, "(x)f"),
GB_STATIC_METHOD("IsInf", "b", GSL_ISINF, "(x)f"),
GB_STATIC_METHOD("IsFinite", "b", GSL_ISFINITE, "(x)f"),
GB_STATIC_METHOD("IsPos", "b", GSL_ISPOSITIVE, "(x)f"),
GB_STATIC_METHOD("Sign", "i", GSL_SIGNF, "(x)i"),
GB_STATIC_METHOD("IsOdd", "b", GSL_ISODD, "(x)i"),
GB_STATIC_METHOD("IsEven", "b", GSL_ISEVEN, "(x)i"),
GB_STATIC_METHOD("MaxFloat", "f", GSL_MAXFLOAT, "[(x)f(y)f"),
GB_STATIC_METHOD("MinFLoat", "f", GSL_MINFLOAT, "[(x)f(y)f]"),
GB_STATIC_METHOD("MaxInt", "i", GSL_MAXINT, "[(x)i(y)i]"),
GB_STATIC_METHOD("MinInt", "i", GSL_MININT, "[(x)i(y)i"),
GB_STATIC_METHOD("Fcmpb", "b", GSL_FCMPB, "[(x)f(y)f(e)f]"),
GB_STATIC_METHOD("Fcmpi", "i", GSL_FCMPI, "[(x)f(y)f(e)f]"),
GB_STATIC_METHOD("IsNan", "b", GSL_ISNAN, "(X)f"),
GB_STATIC_METHOD("IsInf", "b", GSL_ISINF, "(X)f"),
GB_STATIC_METHOD("IsFinite", "b", GSL_ISFINITE, "(X)f"),
GB_STATIC_METHOD("IsPos", "b", GSL_ISPOSITIVE, "(X)f"),
GB_STATIC_METHOD("Sign", "i", GSL_SIGNF, "(X)i"),
GB_STATIC_METHOD("IsOdd", "b", GSL_ISODD, "(X)i"),
GB_STATIC_METHOD("IsEven", "b", GSL_ISEVEN, "(X)i"),
GB_STATIC_METHOD("MaxFloat", "f", GSL_MAXFLOAT, "[(X)f(Y)f"),
GB_STATIC_METHOD("MinFLoat", "f", GSL_MINFLOAT, "[(X)f(Y)f]"),
GB_STATIC_METHOD("MaxInt", "i", GSL_MAXINT, "[(X)i(Y)i]"),
GB_STATIC_METHOD("MinInt", "i", GSL_MININT, "[(X)i(Y)i"),
GB_STATIC_METHOD("Fcmpb", "b", GSL_FCMPB, "[(X)f(Y)f(E)f]"),
GB_STATIC_METHOD("Fcmpi", "i", GSL_FCMPI, "[(X)f(Y)f(E)f]"),
// Elementary Functions
GB_STATIC_METHOD("Log1p", "f", GSL_LOG1P, "(x)f"),
GB_STATIC_METHOD("Expm1", "f", GSL_EXPM1, "(x)f"),
GB_STATIC_METHOD("Hypot", "f", GSL_HYPOT, "[(x)f(y)f]"),
GB_STATIC_METHOD("Log1p", "f", GSL_LOG1P, "(X)f"),
GB_STATIC_METHOD("Expm1", "f", GSL_EXPM1, "(X)f"),
GB_STATIC_METHOD("Hypot", "f", GSL_HYPOT, "[(X)f(Y)f]"),
//GB_STATIC_METHOD("Hypot3", "f", GSL_HYPOT3, "[(x)f(y)f(z)f]"),
GB_STATIC_METHOD("Acosh", "f", GSL_ACOSH, "(x)f"),
GB_STATIC_METHOD("Asinh", "f", GSL_ASINH, "(x)f"),
GB_STATIC_METHOD("Atanh", "f", GSL_ATANH, "(x)f"),
GB_STATIC_METHOD("Ldexp", "f", GSL_LDEXP, "[(x)f(e)i]"),
//GB_STATIC_METHOD("Frexp", "f", GSL_FREXP, "[(x)f(e)p]"),
GB_STATIC_METHOD("Acosh", "f", GSL_ACOSH, "(X)f"),
GB_STATIC_METHOD("Asinh", "f", GSL_ASINH, "(X)f"),
GB_STATIC_METHOD("Atanh", "f", GSL_ATANH, "(X)f"),
GB_STATIC_METHOD("Ldexp", "f", GSL_LDEXP, "[(X)f(E)i]"),
GB_STATIC_METHOD("Frexp", "f", GSL_FREXP, "[(X)f(E)p]"),
// Return x^y using a small int safe method
GB_STATIC_METHOD("IntPow", "f", GSL_INTPOW, "[(x)f(i)i]"),
GB_STATIC_METHOD("IntPow2", "f", GSL_INTPOW2, "(x)f"),
GB_STATIC_METHOD("IntPow3", "f", GSL_INTPOW3, "(x)f"),
GB_STATIC_METHOD("IntPow4", "f", GSL_INTPOW4, "(x)f"),
GB_STATIC_METHOD("IntPow5", "f", GSL_INTPOW5, "(x)f"),
GB_STATIC_METHOD("IntPow6", "f", GSL_INTPOW6, "(x)f"),
GB_STATIC_METHOD("IntPow7", "f", GSL_INTPOW7, "(x)f"),
GB_STATIC_METHOD("IntPow8", "f", GSL_INTPOW8, "(x)f"),
GB_STATIC_METHOD("IntPow9", "f", GSL_INTPOW9, "(x)f"),
GB_STATIC_METHOD("IntPow", "f", GSL_INTPOW, "[(X)f(I)i]"),
GB_STATIC_METHOD("IntPow2", "f", GSL_INTPOW2, "(X)f"),
GB_STATIC_METHOD("IntPow3", "f", GSL_INTPOW3, "(X)f"),
GB_STATIC_METHOD("IntPow4", "f", GSL_INTPOW4, "(X)f"),
GB_STATIC_METHOD("IntPow5", "f", GSL_INTPOW5, "(X)f"),
GB_STATIC_METHOD("IntPow6", "f", GSL_INTPOW6, "(X)f"),
GB_STATIC_METHOD("IntPow7", "f", GSL_INTPOW7, "(X)f"),
GB_STATIC_METHOD("IntPow8", "f", GSL_INTPOW8, "(X)f"),
GB_STATIC_METHOD("IntPow9", "f", GSL_INTPOW9, "(X)f"),
// Class Constants
// Appears that GSL Macros cannot be used in GB_CONSTANT

View file

@ -217,11 +217,11 @@ GB_DESC CPolynomialDesc[] =
GB_PROPERTY("AllocSize", "i", CPolynomial_AllocSize),
// Data Methods
GB_METHOD("Add", "i", CPolynomial_Add, "(x)f"),
GB_METHOD("Add", "i", CPolynomial_Add, "(X)f"),
GB_METHOD("ToString", "s", CPolynomial_ToString, NULL),
// Implementation Methods
GB_METHOD("Eval", "f", CPolynomial_Eval, "(x)f"),
GB_METHOD("Eval", "f", CPolynomial_Eval, "(X)f"),
GB_END_DECLARE
};