dc: conditionalize parts which require libm
This commit is contained in:
parent
b730474bda
commit
078323010b
@ -14,7 +14,7 @@ config AWK
|
|||||||
|
|
||||||
config FEATURE_AWK_MATH
|
config FEATURE_AWK_MATH
|
||||||
bool "Enable math functions (requires libm)"
|
bool "Enable math functions (requires libm)"
|
||||||
default y
|
default n
|
||||||
depends on AWK
|
depends on AWK
|
||||||
help
|
help
|
||||||
Enable math functions of the Awk programming language.
|
Enable math functions of the Awk programming language.
|
||||||
|
@ -138,6 +138,14 @@ config DC
|
|||||||
Dc is a reverse-polish desk calculator which supports unlimited
|
Dc is a reverse-polish desk calculator which supports unlimited
|
||||||
precision arithmetic.
|
precision arithmetic.
|
||||||
|
|
||||||
|
config FEATURE_DC_LIBM
|
||||||
|
bool "Enable power and exp functions (requires libm)"
|
||||||
|
default n
|
||||||
|
depends on DC
|
||||||
|
help
|
||||||
|
Enable power and exp functions.
|
||||||
|
NOTE: This will require libm to be present for linking.
|
||||||
|
|
||||||
config DEVFSD
|
config DEVFSD
|
||||||
bool "devfsd (obsolete)"
|
bool "devfsd (obsolete)"
|
||||||
default n
|
default n
|
||||||
|
@ -53,12 +53,14 @@ static void mul(void)
|
|||||||
push(pop() * pop());
|
push(pop() * pop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_FEATURE_DC_LIBM
|
||||||
static void power(void)
|
static void power(void)
|
||||||
{
|
{
|
||||||
double topower = pop();
|
double topower = pop();
|
||||||
|
|
||||||
push(pow(pop(), topower));
|
push(pow(pop(), topower));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void divide(void)
|
static void divide(void)
|
||||||
{
|
{
|
||||||
@ -137,9 +139,11 @@ static const struct op operators[] = {
|
|||||||
{"mul", mul},
|
{"mul", mul},
|
||||||
{"/", divide},
|
{"/", divide},
|
||||||
{"div", divide},
|
{"div", divide},
|
||||||
|
#if ENABLE_FEATURE_DC_LIBM
|
||||||
{"**", power},
|
{"**", power},
|
||||||
{"exp", power},
|
{"exp", power},
|
||||||
{"pow", power},
|
{"pow", power},
|
||||||
|
#endif
|
||||||
{"%", mod},
|
{"%", mod},
|
||||||
{"mod", mod},
|
{"mod", mod},
|
||||||
{"and", and},
|
{"and", and},
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
VAR7=VAL
|
VAR7=VAL
|
||||||
0
|
0
|
||||||
|
VAR8=VAL
|
||||||
|
0
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
export VAR7=VAL
|
export VAR7=VAL
|
||||||
env | grep ^VAR7=
|
env | grep ^VAR7=
|
||||||
echo $?
|
echo $?
|
||||||
|
VAR8=VAL env | grep ^VAR8=
|
||||||
|
echo $?
|
||||||
|
Loading…
Reference in New Issue
Block a user