mirror of
https://codeberg.org/scip/rpnc.git
synced 2025-12-17 12:31:04 +01:00
added no versions of batch debug and showstack toggles
This commit is contained in:
17
calc.go
17
calc.go
@@ -53,9 +53,9 @@ type Calc struct {
|
|||||||
|
|
||||||
// help for lua functions will be added dynamically
|
// help for lua functions will be added dynamically
|
||||||
const Help string = `Available commands:
|
const Help string = `Available commands:
|
||||||
batch toggle batch mode
|
batch toggle batch mode (nobatch turns it off)
|
||||||
debug toggle debug output
|
debug toggle debug output (nodebug turns it off)
|
||||||
show show the last 5 items of the stack
|
showstack toggle show last 5 items of the stack (noshowtack turns it off)
|
||||||
dump display the stack contents
|
dump display the stack contents
|
||||||
clear clear the whole stack
|
clear clear the whole stack
|
||||||
shift remove the last element of the stack
|
shift remove the last element of the stack
|
||||||
@@ -94,7 +94,7 @@ Register variables:
|
|||||||
// commands, constants and operators, defined here to feed completion
|
// commands, constants and operators, defined here to feed completion
|
||||||
// and our mode switch in Eval() dynamically
|
// and our mode switch in Eval() dynamically
|
||||||
const (
|
const (
|
||||||
Commands string = `dump reverse debug undebug clear batch shift undo help history manual exit quit swap show vars`
|
Commands string = `dump reverse clear shift undo help history manual exit quit swap debug undebug nodebug batch nobatch showstack noshowstack vars`
|
||||||
Constants string = `Pi Phi Sqrt2 SqrtE SqrtPi SqrtPhi Ln2 Log2E Ln10 Log10E`
|
Constants string = `Pi Phi Sqrt2 SqrtE SqrtPi SqrtPhi Ln2 Log2E Ln10 Log10E`
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -290,10 +290,15 @@ func (c *Calc) Eval(line string) {
|
|||||||
c.stack.Dump()
|
c.stack.Dump()
|
||||||
case "debug":
|
case "debug":
|
||||||
c.ToggleDebug()
|
c.ToggleDebug()
|
||||||
|
case "nodebug":
|
||||||
|
fallthrough
|
||||||
case "undebug":
|
case "undebug":
|
||||||
c.debug = false
|
c.debug = false
|
||||||
|
c.stack.debug = false
|
||||||
case "batch":
|
case "batch":
|
||||||
c.ToggleBatch()
|
c.ToggleBatch()
|
||||||
|
case "nobatch":
|
||||||
|
c.batch = false
|
||||||
case "clear":
|
case "clear":
|
||||||
c.stack.Backup()
|
c.stack.Backup()
|
||||||
c.stack.Clear()
|
c.stack.Clear()
|
||||||
@@ -316,8 +321,12 @@ func (c *Calc) Eval(line string) {
|
|||||||
for _, entry := range c.history {
|
for _, entry := range c.history {
|
||||||
fmt.Println(entry)
|
fmt.Println(entry)
|
||||||
}
|
}
|
||||||
|
case "showstack":
|
||||||
|
fallthrough
|
||||||
case "show":
|
case "show":
|
||||||
c.ToggleShow()
|
c.ToggleShow()
|
||||||
|
case "noshowstack":
|
||||||
|
c.showstack = false
|
||||||
case "exit":
|
case "exit":
|
||||||
fallthrough
|
fallthrough
|
||||||
case "quit":
|
case "quit":
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -30,7 +30,7 @@ import (
|
|||||||
lua "github.com/yuin/gopher-lua"
|
lua "github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION string = "2.0.7"
|
const VERSION string = "2.0.8"
|
||||||
|
|
||||||
const Usage string = `This is rpn, a reverse polish notation calculator cli.
|
const Usage string = `This is rpn, a reverse polish notation calculator cli.
|
||||||
|
|
||||||
|
|||||||
6
rpn.go
6
rpn.go
@@ -152,14 +152,14 @@ DESCRIPTION
|
|||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
|
||||||
batch toggle batch mode
|
[no]batch toggle batch mode (nobatch turns it off)
|
||||||
debug toggle debug output
|
[no]debug toggle debug output (nodebug turns it off)
|
||||||
|
[no]showstack show the last 5 items of the stack (noshowtack turns it off)
|
||||||
dump display the stack contents
|
dump display the stack contents
|
||||||
clear clear the whole stack
|
clear clear the whole stack
|
||||||
shift remove the last element of the stack
|
shift remove the last element of the stack
|
||||||
reverse reverse the stack elements
|
reverse reverse the stack elements
|
||||||
swap exchange the last two stack elements
|
swap exchange the last two stack elements
|
||||||
show show the last 5 items of the stack
|
|
||||||
history display calculation history
|
history display calculation history
|
||||||
help|? show this message
|
help|? show this message
|
||||||
quit|exit|c-d|c-c exit program
|
quit|exit|c-d|c-c exit program
|
||||||
|
|||||||
6
rpn.pod
6
rpn.pod
@@ -159,14 +159,14 @@ Math functions:
|
|||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
|
||||||
batch toggle batch mode
|
[no]batch toggle batch mode (nobatch turns it off)
|
||||||
debug toggle debug output
|
[no]debug toggle debug output (nodebug turns it off)
|
||||||
|
[no]showstack show the last 5 items of the stack (noshowtack turns it off)
|
||||||
dump display the stack contents
|
dump display the stack contents
|
||||||
clear clear the whole stack
|
clear clear the whole stack
|
||||||
shift remove the last element of the stack
|
shift remove the last element of the stack
|
||||||
reverse reverse the stack elements
|
reverse reverse the stack elements
|
||||||
swap exchange the last two stack elements
|
swap exchange the last two stack elements
|
||||||
show show the last 5 items of the stack
|
|
||||||
history display calculation history
|
history display calculation history
|
||||||
help|? show this message
|
help|? show this message
|
||||||
quit|exit|c-d|c-c exit program
|
quit|exit|c-d|c-c exit program
|
||||||
|
|||||||
Reference in New Issue
Block a user