mirror of
https://github.com/louisrubet/rpn
synced 2025-01-15 03:41:25 +01:00
#164: added command history
This commit is contained in:
parent
ee8d007c71
commit
5033746821
3 changed files with 28 additions and 13 deletions
27
MANUAL.md
27
MANUAL.md
|
@ -61,14 +61,14 @@ rpn>
|
||||||
|
|
||||||
```
|
```
|
||||||
rpn>
|
rpn>
|
||||||
Display all 140 possibilities? (y or n)
|
Display all 142 possibilities? (y or n)
|
||||||
nop test sci inv dec mod fp c->r <= same dup over sub next while vars sneg cos ln exp2
|
nop test neg sq %CH ip arg sci < not rot rolld pos for unti purge sto/ asin e log2 tanh
|
||||||
? version + ^ hex fact min r->c != swap dup2 ->str if step whil clusr sinv acos exp sinh
|
? version * sqr mod fp c->r prec <= same dup over sub next while vars sneg cos ln alog2 atanh
|
||||||
h uname - pow prec mant max p->r == drop dupn str-> then ift repeat edit eval tan log10 asinh
|
h uname / abs fact min r->c round != swap dup2 ->str if step whil clusr sinv acos log exp2
|
||||||
help type chs sqrt round xpon re r->p and drop2 pick chr else ifte repea sto+ -> atan alog10 cosh
|
help history inv dec mant max p->r default == drop dupn str-> then ift repeat edit eval tan exp sinh
|
||||||
q default neg sq sign floor im > or dropn depth num end do sto sto- pi d->r exp10 acosh
|
q + ^ hex xpon re r->p type and drop2 pick chr else ifte repea sto+ -> atan log10 asinh
|
||||||
quit std * sqr % ceil conj >= xor erase roll size start until rcl sto* sin r->d log2 tanh
|
quit - pow sign floor im std > or dropn depth num end do sto sto- pi d->r alog10 cosh
|
||||||
exit fix / abs %CH ip arg < not rot rolld pos for unti purge sto/ asin e alog2 atanh
|
exit chs sqrt % ceil conj fix >= xor erase roll size start until rcl sto* sin r->d exp10 acosh
|
||||||
```
|
```
|
||||||
|
|
||||||
## keywords
|
## keywords
|
||||||
|
@ -77,11 +77,12 @@ exit fix / abs %CH ip arg < not
|
||||||
|
|
||||||
|keyword|description|
|
|keyword|description|
|
||||||
|-|-|
|
|-|-|
|
||||||
|nop | no operation |
|
|nop | no operation
|
||||||
|help | (or h or ?) this help message
|
|help | (or h or ?) this help message
|
||||||
|quit | (or q or exit) quit software
|
|quit | (or q or exit) quit software
|
||||||
|version | show rpn version
|
|version | show rpn version
|
||||||
|uname | show rpn complete identification string
|
|uname | show rpn complete identification string
|
||||||
|
|history| see commands history
|
||||||
|
|
||||||
### usual operations - real and complex
|
### usual operations - real and complex
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ program::keyword_t program::s_keywords[] =
|
||||||
{ cmd_keyword, "test", &program::test, "" }, //not seen by user
|
{ cmd_keyword, "test", &program::test, "" }, //not seen by user
|
||||||
{ cmd_keyword, "version", &program::rpn_version, "show rpn version" },
|
{ cmd_keyword, "version", &program::rpn_version, "show rpn version" },
|
||||||
{ cmd_keyword, "uname", &program::rpn_uname, "show rpn complete identification string" },
|
{ cmd_keyword, "uname", &program::rpn_uname, "show rpn complete identification string" },
|
||||||
|
{ cmd_keyword, "history", &program::rpn_history, "see commands history" },
|
||||||
|
|
||||||
//USUAL OPERATIONS ON REALS AND COMPLEXEXE
|
//USUAL OPERATIONS ON REALS AND COMPLEXEXE
|
||||||
{ cmd_undef, "", NULL, "\nUSUAL OPERATIONS ON REALS AND COMPLEXES"},
|
{ cmd_undef, "", NULL, "\nUSUAL OPERATIONS ON REALS AND COMPLEXES"},
|
||||||
|
|
|
@ -130,6 +130,19 @@ void rpn_uname()
|
||||||
str->set(uname, naked_entry_len);
|
str->set(uname, naked_entry_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void rpn_history()
|
||||||
|
{
|
||||||
|
//see command history on stdout
|
||||||
|
int index = 0;
|
||||||
|
char* line = linenoiseHistoryLine(index);
|
||||||
|
while(line != NULL)
|
||||||
|
{
|
||||||
|
cout<<line<<endl;
|
||||||
|
free(line);
|
||||||
|
line = linenoiseHistoryLine(++index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void type()
|
void type()
|
||||||
{
|
{
|
||||||
MIN_ARGUMENTS(1);
|
MIN_ARGUMENTS(1);
|
||||||
|
|
Loading…
Reference in a new issue