migrated math functions in Awk and StdAwk
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.hpp 458 2011-05-13 04:06:55Z hyunghwan.chung $
|
||||
* $Id: Awk.hpp 460 2011-05-17 14:56:54Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -1071,10 +1071,19 @@ protected:
|
||||
/// @}
|
||||
|
||||
// primitive handlers
|
||||
virtual real_t pow (real_t x, real_t y) = 0;
|
||||
virtual int vsprintf (char_t* buf, size_t size,
|
||||
const char_t* fmt, va_list arg) = 0;
|
||||
|
||||
virtual real_t pow (real_t x, real_t y) = 0;
|
||||
virtual real_t sin (real_t x) = 0;
|
||||
virtual real_t cos (real_t x) = 0;
|
||||
virtual real_t tan (real_t x) = 0;
|
||||
virtual real_t atan (real_t x) = 0;
|
||||
virtual real_t atan2 (real_t x, real_t y) = 0;
|
||||
virtual real_t log (real_t x) = 0;
|
||||
virtual real_t exp (real_t x) = 0;
|
||||
virtual real_t sqrt (real_t x) = 0;
|
||||
|
||||
// static glue members for various handlers
|
||||
static ssize_t readSource (
|
||||
awk_t* awk, sio_cmd_t cmd, sio_arg_t* arg,
|
||||
@ -1095,9 +1104,17 @@ protected:
|
||||
|
||||
static int functionHandler (rtx_t* rtx, const cstr_t* name);
|
||||
|
||||
static real_t pow (awk_t* data, real_t x, real_t y);
|
||||
static int sprintf (awk_t* data, char_t* buf, size_t size,
|
||||
const char_t* fmt, ...);
|
||||
static real_t pow (awk_t* data, real_t x, real_t y);
|
||||
static real_t sin (awk_t* data, real_t x);
|
||||
static real_t cos (awk_t* data, real_t x);
|
||||
static real_t tan (awk_t* data, real_t x);
|
||||
static real_t atan (awk_t* data, real_t x);
|
||||
static real_t atan2 (awk_t* data, real_t x, real_t y);
|
||||
static real_t log (awk_t* data, real_t x);
|
||||
static real_t exp (awk_t* data, real_t x);
|
||||
static real_t sqrt (awk_t* data, real_t x);
|
||||
|
||||
protected:
|
||||
awk_t* awk;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: StdAwk.hpp 441 2011-04-22 14:28:43Z hyunghwan.chung $
|
||||
* $Id: StdAwk.hpp 460 2011-05-17 14:56:54Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -103,22 +103,6 @@ public:
|
||||
|
||||
protected:
|
||||
// intrinsic functions
|
||||
int sin (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int cos (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int tan (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int atan (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int atan2 (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int log (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int exp (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int sqrt (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int fnint (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
const char_t* name, size_t len);
|
||||
int rand (Run& run, Value& ret, const Value* args, size_t nargs,
|
||||
@ -155,10 +139,19 @@ protected:
|
||||
void* reallocMem (void* ptr, size_t n);
|
||||
void freeMem (void* ptr);
|
||||
|
||||
real_t pow (real_t x, real_t y);
|
||||
int vsprintf (char_t* buf, size_t size,
|
||||
const char_t* fmt, va_list arg);
|
||||
|
||||
real_t pow (real_t x, real_t y);
|
||||
real_t sin (real_t x);
|
||||
real_t cos (real_t x);
|
||||
real_t tan (real_t x);
|
||||
real_t atan (real_t x);
|
||||
real_t atan2 (real_t x, real_t y);
|
||||
real_t log (real_t x);
|
||||
real_t exp (real_t x);
|
||||
real_t sqrt (real_t x);
|
||||
|
||||
protected:
|
||||
unsigned int seed;
|
||||
|
||||
|
Reference in New Issue
Block a user