Skip to content

Commit

Permalink
Add docs for the M and m commands to the dc manual
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Howard committed Nov 30, 2019
1 parent 3b6c07e commit e8a90e6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
22 changes: 21 additions & 1 deletion manuals/dc.1
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,26 @@ The top two values are popped off of the stack, they are compared, and a \fB1\fR
.IP
This is a \fBnon\-portable extension\fR\.
.
.TP
\fBM\fR
The top two values are popped off of the stack\. If they are both non\-zero, a \fB1\fR is pushed onto the stack\. If either of them is zero, or both of them are, then a \fB0\fR is pushed onto the stack\.
.
.IP
This is like the \fB&&\fR operator in bc(1), and it is not a short\-circuit operator\.
.
.IP
This is a \fBnon\-portable extension\fR\.
.
.TP
\fBm\fR
The top two values are popped off of the stack\. If at least one of them is non\-zero, a \fB1\fR is pushed onto the stack\. If both of them are zero, then a \fB0\fR is pushed onto the stack\.
.
.IP
This is like the \fB||\fR operator in bc(1), and it is not a short\-circuit operator\.
.
.IP
This is a \fBnon\-portable extension\fR\.
.
.SS "Stack Control"
These commands control the stack\.
.
Expand Down Expand Up @@ -438,7 +458,7 @@ Strings can also be executed as macros\. For example, if the string \fB[1pR]\fR
.
.TP
\fB[\fR\fIcharacters\fR\fB]\fR
Makes a string containing \fBcharacters\fR and pushes it onto the stack\.
Makes a string containing \fIcharacters\fR and pushes it onto the stack\.
.
.IP
If there are brackets (\fB[\fR and \fB]\fR) in the string, then they must be balanced\. Unbalanced brackets can be escaped using a backslash (\fB\e\fR) character\.
Expand Down
22 changes: 21 additions & 1 deletion manuals/dc.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,26 @@ These are the commands used for arithmetic.

This is a **non-portable extension**.

* `M`:
The top two values are popped off of the stack. If they are both non-zero, a
`1` is pushed onto the stack. If either of them is zero, or both of them
are, then a `0` is pushed onto the stack.

This is like the `&&` operator in bc(1), and it is not a short-circuit
operator.

This is a **non-portable extension**.

* `m`:
The top two values are popped off of the stack. If at least one of them is
non-zero, a `1` is pushed onto the stack. If both of them are zero, then a
`0` is pushed onto the stack.

This is like the `||` operator in bc(1), and it is not a short-circuit
operator.

This is a **non-portable extension**.

### Stack Control

These commands control the stack.
Expand Down Expand Up @@ -489,7 +509,7 @@ executed as a macro, then the code `1pR` is executed, meaning that the `1` will
be printed with a newline after and then popped from the stack.

* `[`*characters*`]`:
Makes a string containing `characters` and pushes it onto the stack.
Makes a string containing *characters* and pushes it onto the stack.

If there are brackets (`[` and `]`) in the string, then they must be
balanced. Unbalanced brackets can be escaped using a backslash (`\`)
Expand Down

0 comments on commit e8a90e6

Please sign in to comment.