removed most math functions from the main engine. migrated them to the math module

This commit is contained in:
2014-07-01 15:27:27 +00:00
parent 0c5d9eee9c
commit 7423092c39
11 changed files with 341 additions and 582 deletions

View File

@ -1288,15 +1288,6 @@ protected:
// primitive handlers
virtual flt_t pow (flt_t x, flt_t y) = 0;
virtual flt_t mod (flt_t x, flt_t y) = 0;
virtual flt_t sin (flt_t x) = 0;
virtual flt_t cos (flt_t x) = 0;
virtual flt_t tan (flt_t x) = 0;
virtual flt_t atan (flt_t x) = 0;
virtual flt_t atan2 (flt_t x, flt_t y) = 0;
virtual flt_t log (flt_t x) = 0;
virtual flt_t log10 (flt_t x) = 0;
virtual flt_t exp (flt_t x) = 0;
virtual flt_t sqrt (flt_t x) = 0;
virtual void* modopen (const mod_spec_t* spec) = 0;
virtual void modclose (void* handle) = 0;
@ -1325,15 +1316,6 @@ protected:
static flt_t pow (awk_t* awk, flt_t x, flt_t y);
static flt_t mod (awk_t* awk, flt_t x, flt_t y);
static flt_t sin (awk_t* awk, flt_t x);
static flt_t cos (awk_t* awk, flt_t x);
static flt_t tan (awk_t* awk, flt_t x);
static flt_t atan (awk_t* awk, flt_t x);
static flt_t atan2 (awk_t* awk, flt_t x, flt_t y);
static flt_t log (awk_t* awk, flt_t x);
static flt_t log10 (awk_t* awk, flt_t x);
static flt_t exp (awk_t* awk, flt_t x);
static flt_t sqrt (awk_t* awk, flt_t x);
static void* modopen (awk_t* awk, const mod_spec_t* spec);
static void modclose (awk_t* awk, void* handle);

View File

@ -158,15 +158,6 @@ protected:
flt_t pow (flt_t x, flt_t y);
flt_t mod (flt_t x, flt_t y);
flt_t sin (flt_t x);
flt_t cos (flt_t x);
flt_t tan (flt_t x);
flt_t atan (flt_t x);
flt_t atan2 (flt_t x, flt_t y);
flt_t log (flt_t x);
flt_t log10 (flt_t x);
flt_t exp (flt_t x);
flt_t sqrt (flt_t x);
void* modopen (const mod_spec_t* spec);
void modclose (void* handle);

View File

@ -669,15 +669,6 @@ struct qse_awk_prm_t
{
qse_awk_math2_t pow; /**< floating-point power function */
qse_awk_math2_t mod; /**< floating-point remainder function */
qse_awk_math1_t sin;
qse_awk_math1_t cos;
qse_awk_math1_t tan;
qse_awk_math1_t atan;
qse_awk_math2_t atan2;
qse_awk_math1_t log;
qse_awk_math1_t log10;
qse_awk_math1_t exp;
qse_awk_math1_t sqrt;
} math;
qse_awk_modopen_t modopen;
@ -786,6 +777,16 @@ struct qse_awk_fnc_spec_t
qse_size_t min; /**< min. numbers of argument for a function */
qse_size_t max; /**< max. numbers of argument for a function */
const qse_char_t* spec;
/**< argument specifier
* if min is greater than max, spec points to an external module
* name where the function is found. otherwise, spec can be QSE_NULL
* to indicate all arguments are passed by value or point to a
* argument specification string composed of 'max' characters.
* Each character can be one of:
* - v: value
* - r: reference
* - x:regular expression
*/
} arg;
/** pointer to the function implementing this function */