rpn/src/rpn-general.h

78 lines
1.5 KiB
C
Raw Normal View History

//
void nop()
{
// nop
}
void good_bye()
{
2014-02-11 14:33:40 +01:00
ERR_CONTEXT(ret_good_bye);
}
void verbose()
{
MIN_ARGUMENTS(1);
ARG_IS_OF_TYPE(0, cmd_number);
g_verbose = (int)getf();
}
void help()
{
2014-09-03 14:03:19 +02:00
cout<<"rpn - HP28S reverse polish notation language simulator"<<endl;
cout<<"syntax: rpn [command]"<<endl;
cout<<"with optional command = list of commands"<<endl;
2014-02-12 11:26:26 +01:00
for(unsigned int i=0; i<sizeof(_keywords)/sizeof(_keywords[0]); i++)
if (_keywords[i].comment.size() != 0)
2014-02-11 14:33:40 +01:00
cout<<_keywords[i].name<<"\t"<<_keywords[i].comment<<endl;
cout<<endl;
2014-09-06 22:31:01 +02:00
cout<<"Current verbosity is "<<g_verbose<<endl;
cout<<"Current float mode is ";
switch(g_float_mode)
{
case mode_std: cout << "'std'"; break;
case mode_fix: cout << "'fix'"; break;
case mode_sci: cout << "'sci'"; break;
default: cout << "unknown"; break;
}
cout<<endl<<"Current float precision is "<<g_current_precision<<endl;
cout<<endl<<endl;
}
2014-02-11 14:33:40 +01:00
void test();
2014-09-05 09:49:39 +02:00
void std()
{
if (stack_size()>=1)
{
ARG_IS_OF_TYPE(0, cmd_number);
g_default_precision = (int)getf();
}
2014-09-06 22:31:01 +02:00
g_current_precision = g_default_precision;
g_float_mode = mode_std;
cout.precision(g_current_precision);
2014-09-05 09:49:39 +02:00
cout.unsetf(ios_base::floatfield);
}
void fix()
{
MIN_ARGUMENTS(1);
ARG_IS_OF_TYPE(0, cmd_number);
2014-09-06 22:31:01 +02:00
g_current_precision = (int)getf();
g_float_mode = mode_fix;
cout << setprecision(g_current_precision) << fixed;
2014-09-05 09:49:39 +02:00
}
void sci()
{
MIN_ARGUMENTS(1);
ARG_IS_OF_TYPE(0, cmd_number);
2014-09-06 22:31:01 +02:00
g_current_precision = (int)getf();
g_float_mode = mode_sci;
cout << setprecision(g_current_precision) << scientific;
2014-09-05 09:49:39 +02:00
}