mirror of
https://github.com/louisrubet/rpn
synced 2024-12-29 10:23:59 +01:00
Manage cmdline
This commit is contained in:
parent
d0947b73a0
commit
e7d0f60aa1
2 changed files with 13 additions and 9 deletions
8
TODO
8
TODO
|
@ -4,14 +4,14 @@
|
|||
general:
|
||||
|
||||
entry:
|
||||
- parse en entier la ligne de commande puis si pas de pb de syntaxe entrer
|
||||
- entrée sur plusieurs lignes
|
||||
- gestion des flèches haut/bas
|
||||
- autocompletion avec tab
|
||||
- alt-R + recherche
|
||||
- entrée interactive sur plusieurs lignes
|
||||
- entrée d'une variable sans '' = rcl
|
||||
- rpn <"commande entière">
|
||||
- entrée de commande shell avec $commande shell, résultat dans une chaîne (?)
|
||||
|
||||
commands:
|
||||
print
|
||||
alias
|
||||
alt-R + recherche ?
|
||||
date / time
|
||||
|
|
14
src/rpn.cpp
14
src/rpn.cpp
|
@ -39,7 +39,7 @@ using namespace std;
|
|||
#include "stack.h"
|
||||
|
||||
static const char CURSOR[] = "> ";
|
||||
static const char SHOW_STACK_SEPARATOR[] = ":\t";
|
||||
static const string g_show_stack_separator = ":\t";
|
||||
static int g_verbose = 0;
|
||||
|
||||
typedef enum {
|
||||
|
@ -608,7 +608,7 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void show_stack(stack& st)
|
||||
static void show_stack(stack& st, const string& separator = g_show_stack_separator)
|
||||
{
|
||||
if (st.size() == 1)
|
||||
{
|
||||
|
@ -617,9 +617,11 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
bool show_sep = (! separator.empty());
|
||||
for (int i = st.size()-1; i>=0; i--)
|
||||
{
|
||||
cout<<i+1<<SHOW_STACK_SEPARATOR;
|
||||
if (show_sep)
|
||||
cout<<i+1<<separator;
|
||||
((object*)st[i])->show();
|
||||
cout<<endl;
|
||||
}
|
||||
|
@ -729,7 +731,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||
string entry;
|
||||
int i;
|
||||
|
||||
// entry
|
||||
// make one string from entry
|
||||
for (i=1; i<argc; i++)
|
||||
{
|
||||
entry += argv[i];
|
||||
|
@ -740,9 +742,11 @@ int _tmain(int argc, _TCHAR* argv[])
|
|||
ret = program::parse(entry, prog);
|
||||
if (ret == ret_ok)
|
||||
{
|
||||
string separator = "";
|
||||
|
||||
// run it
|
||||
ret = prog.run(st, hp);
|
||||
program::show_stack(st);
|
||||
program::show_stack(st, separator);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue