2015-07-23 13:22:42 +02:00
|
|
|
void plus()
|
|
|
|
{
|
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//// float
|
|
|
|
//if (IS_ARG_TYPE(0, cmd_number))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
// //TODO really too slow
|
|
|
|
// putf(getf() + getf());
|
|
|
|
//}
|
|
|
|
//// binary
|
|
|
|
//else if (IS_ARG_TYPE(0, cmd_binary))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
|
|
|
|
// //TODO really too slow
|
|
|
|
// putb(getb() + getb());
|
|
|
|
//}
|
|
|
|
|
2015-07-23 13:22:42 +02:00
|
|
|
//TODO
|
|
|
|
#if 0
|
|
|
|
// string
|
|
|
|
else if (IS_ARG_TYPE(0, cmd_string))
|
|
|
|
{
|
|
|
|
ARG_MUST_BE_OF_TYPE(1, cmd_string);
|
|
|
|
string& second = *((ostring*)_stack->back())->_value;
|
|
|
|
_stack->pop_back();
|
|
|
|
*((ostring*)_stack->back())->_value += second;
|
|
|
|
}
|
|
|
|
#endif
|
2017-04-17 23:10:53 +02:00
|
|
|
//else
|
|
|
|
// ERR_CONTEXT(ret_bad_operand_type);
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void minus()
|
|
|
|
{
|
|
|
|
MIN_ARGUMENTS(2);
|
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//// float
|
|
|
|
//if (IS_ARG_TYPE(0, cmd_number))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
// //TODO really too slow
|
|
|
|
// floating_t first = getf();
|
|
|
|
// putf(getf() - first);
|
|
|
|
//}
|
|
|
|
//// binary
|
|
|
|
//else if (IS_ARG_TYPE(0, cmd_binary))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
|
|
|
|
// //TODO really too slow
|
|
|
|
// integer_t first = getb();
|
|
|
|
// putb(getb() - first);
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
// ERR_CONTEXT(ret_bad_operand_type);
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void mul()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//// float
|
|
|
|
//if (IS_ARG_TYPE(0, cmd_number))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
// //TODO really too slow
|
|
|
|
// putf(getf() * getf());
|
|
|
|
//}
|
|
|
|
//// binary
|
|
|
|
//else if (IS_ARG_TYPE(0, cmd_binary))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
|
|
|
|
// //TODO really too slow
|
|
|
|
// putb(getb() * getb());
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
// ERR_CONTEXT(ret_bad_operand_type);
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void div()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(2);
|
|
|
|
|
|
|
|
//// float
|
|
|
|
//if (IS_ARG_TYPE(0, cmd_number))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
|
|
|
// //TODO really too slow
|
|
|
|
|
|
|
|
// floating_t first = getf();
|
|
|
|
// // arithmetic faults are managed by c++
|
|
|
|
// putf(getf() / first);
|
|
|
|
//}
|
|
|
|
//// binary
|
|
|
|
//else if (IS_ARG_TYPE(0, cmd_binary))
|
|
|
|
//{
|
|
|
|
// ARG_MUST_BE_OF_TYPE(1, cmd_binary);
|
|
|
|
// if (((binary*)_stack->get_obj(0))->_value == 0)
|
|
|
|
// {
|
|
|
|
// ERR_CONTEXT(ret_div_by_zero);
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// //TODO really too slow
|
|
|
|
// integer_t first = getb();
|
|
|
|
// putb(getb() / first);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
// ERR_CONTEXT(ret_bad_operand_type);
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void neg()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(1);
|
|
|
|
|
|
|
|
//// float
|
|
|
|
//if (IS_ARG_TYPE(0, cmd_number))
|
|
|
|
// putf(-getf());
|
|
|
|
//// binary
|
|
|
|
//else if (IS_ARG_TYPE(0, cmd_binary))
|
|
|
|
// putb(-getb());
|
|
|
|
//else
|
|
|
|
// ERR_CONTEXT(ret_bad_operand_type);
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void inv()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(1);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
2015-07-23 13:22:42 +02:00
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//// arithmetic faults are managed by c++
|
|
|
|
//putf(1 / getf());
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void purcent()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(2);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
2015-07-23 13:22:42 +02:00
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//putf((getf() * getf()) / 100);
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void purcentCH()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(2);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
2015-07-23 13:22:42 +02:00
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//// arithmetic faults are managed by c++
|
|
|
|
//floating_t first = getf();
|
|
|
|
//putf((100 * first) / getf());
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void power()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(2);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
2015-07-23 13:22:42 +02:00
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//// arithmetic faults are managed by c++
|
|
|
|
//floating_t first = getf();
|
|
|
|
//putf(powl(getf(), first));
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void squareroot()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(1);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
2015-07-23 13:22:42 +02:00
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//// arithmetic faults are managed by c++
|
|
|
|
//putf(sqrtl(getf()));
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void square()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(1);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
2015-07-23 13:22:42 +02:00
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//floating_t first = getf();
|
|
|
|
//putf(first * first);
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void modulo()
|
|
|
|
{
|
2017-04-17 23:10:53 +02:00
|
|
|
//TODO
|
|
|
|
//MIN_ARGUMENTS(2);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(0, cmd_number);
|
|
|
|
//ARG_MUST_BE_OF_TYPE(1, cmd_number);
|
2015-07-23 13:22:42 +02:00
|
|
|
|
2017-04-17 23:10:53 +02:00
|
|
|
//// arithmetic faults are managed by c++
|
|
|
|
//floating_t first = getf();
|
|
|
|
//putf(fmodl(getf(), first));
|
2015-07-23 13:22:42 +02:00
|
|
|
}
|