Category:Dc: Difference between revisions

m
→‎Quick reference: Use literal numbers, not 'a' 'b' 'n', when those were not commands.
(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:
Sx : push to register x
Lx : pop register x
a1 b2 :x : store x[b2] = a1 (x is register)
a2 ;x : retrieve x[b2]
<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)
! : shell command
q : quit, or break 2 execution levels
n3 Q : break n3 execution levels
i : set input radix from top of stack
I : get current input base, push it on stack
Line 50:
 
Extensions in [[OpenBSD dc]]
n3 J : break n3 execution levels, then jump to next M
M : mark for the J command
a N : boolean not: push 1 if a == 0, else push 0
R : pop and discard top of the stack
<xey >xey : comparisons with an else branch: if true,
=xey !<xey : then execute register x
!>xey !=xey : else execute register y
a1 b2 G : equality: push 1 if b2 == a1, else push 0
a1 b2 ( : less than: push 1 if b2 < a1, else push 0
a3 N : boolean not: push 1 if a3 == 0, else push 0
Anonymous user