Added uname and version commands

This commit is contained in:
Louis RUBET 2014-09-24 16:55:59 +02:00
parent c5ac343adc
commit 521ecbea6b
4 changed files with 27 additions and 4 deletions

2
README
View file

@ -19,7 +19,7 @@ Some new commands are added. They are tagged with (+).
Already implemented commands are tagged with (*).
GENERAL (some are 'CURSOR' commands)
verbose(*)(+), std(*), fix(*), sci(*)
verbose(*)(+), std(*), fix(*), sci(*), version(*)(+), uname(*)(+)
STACK
drop(*), swap(*), roll, dup(*), over, dup2(*), drop2(*), rot(*),

View file

@ -14,6 +14,8 @@ program::keyword_t program::_keywords[] =
{ cmd_keyword, "std", &program::std, "standard floating numbers representation. ex: [25] std" },
{ cmd_keyword, "fix", &program::fix, "fixed point representation. ex: 6 fix" },
{ cmd_keyword, "sci", &program::sci, "scientific floating point representation. ex: 20 sci" },
{ cmd_keyword, "version", &program::rpn_version, "show rpn version" },
{ cmd_keyword, "uname", &program::rpn_uname, "show rpn complete identification string" },
//ALGEBRA
{ cmd_undef, "", NULL, "\nALGEBRA"},

View file

@ -1,3 +1,5 @@
void test();
//
void nop()
{
@ -18,7 +20,11 @@ void verbose()
void help()
{
cout<<"rpn - HP28S reverse polish notation language simulator"<<endl;
cout<<endl;
rpn_uname();
cout<<endl;
cout<<"HP28S Reverse Polish Notation language simulator"<<endl;
cout<<"syntax: rpn [command]"<<endl;
cout<<"with optional command = list of commands"<<endl;
for(unsigned int i=0; i<sizeof(_keywords)/sizeof(_keywords[0]); i++)
@ -38,8 +44,6 @@ void help()
cout<<endl<<endl;
}
void test();
void std()
{
if (stack_size()>=1)
@ -75,3 +79,13 @@ void sci()
cout << setprecision(g_current_precision) << scientific;
}
void rpn_version()
{
cout << version << endl;
}
void rpn_uname()
{
cout << uname << endl;
}

View file

@ -42,11 +42,18 @@ using namespace std;
static const char CURSOR[] = "> ";
static const string g_show_stack_separator = ":\t";
//
static int g_verbose = 0;
//
static int g_default_precision = 20;
static int g_current_precision = g_default_precision;
//
static const char version[] = "1.0";
static const char uname[] = "rpn v1.0, (c) 2013 <louis@rubet.fr>";
//
typedef enum {
mode_std,
mode_fix,