Category:Dc: Difference between revisions
Content added Content deleted
(Expand the quick reference to cover OpenBSD dc.) |
m (→Quick reference: Use literal numbers, not 'a' 'b' 'n', when those were not commands.) |
||
Line 19: | Line 19: | ||
Sx : push to register x |
Sx : push to register x |
||
Lx : pop register x |
Lx : pop register x |
||
1 2 :x : store x[2] = 1 (x is register) |
|||
2 ;x : retrieve x[2] |
|||
<x >x =x : compare top 2 values: if true, then execute register x |
<x >x =x : compare top 2 values: if true, then execute register x |
||
!>x !<x !=x : (example: 5 2 <A executes register A if 2 < 5) |
!>x !<x !=x : (example: 5 2 <A executes register A if 2 < 5) |
||
! : shell command |
! : shell command |
||
q : quit, or break 2 execution levels |
q : quit, or break 2 execution levels |
||
3 Q : break 3 execution levels |
|||
i : set input radix from top of stack |
i : set input radix from top of stack |
||
I : get current input base, push it on stack |
I : get current input base, push it on stack |
||
Line 50: | Line 50: | ||
Extensions in [[OpenBSD dc]] |
Extensions in [[OpenBSD dc]] |
||
3 J : break 3 execution levels, then jump to next M |
|||
M : mark for the J command |
M : mark for the J command |
||
⚫ | |||
R : pop and discard top of the stack |
R : pop and discard top of the stack |
||
<xey >xey : comparisons with an else branch: if true, |
<xey >xey : comparisons with an else branch: if true, |
||
=xey !<xey : then execute register x |
=xey !<xey : then execute register x |
||
!>xey !=xey : else execute register y |
!>xey !=xey : else execute register y |
||
1 2 G : equality: push 1 if 2 == 1, else push 0 |
|||
1 2 ( : less than: push 1 if 2 < 1, else push 0 |
|||
⚫ |