diff options
-rw-r--r-- | miscutils/bc.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index cc48ed3fe..934a1f8ba 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -143,12 +143,13 @@ | |||
143 | //usage: "\n~ - divide with remainder" | 143 | //usage: "\n~ - divide with remainder" |
144 | //usage: "\n| - modular exponentiation" | 144 | //usage: "\n| - modular exponentiation" |
145 | //usage: "\nv - square root" | 145 | //usage: "\nv - square root" |
146 | //////// "\n_NNN - push neagtive number -NNN | 146 | //////// "\nA-F - digits 10..15 |
147 | //////// "\n[string] - push string | 147 | //////// "\n_NNN - push negative number -NNN |
148 | //////// "\n[string] - push string (in FreeBSD, \[, \] and \\ are escapes, not implemented here and in GNU) | ||
148 | //////// "\nR - DC_LEX_POP pop and discard | 149 | //////// "\nR - DC_LEX_POP pop and discard |
149 | //////// "\nc - DC_LEX_CLEAR_STACK clear stack | 150 | //////// "\nc - DC_LEX_CLEAR_STACK clear stack |
150 | //////// "\nd - DC_LEX_DUPLICATE pop, push, push | 151 | //////// "\nd - DC_LEX_DUPLICATE duplicate top-of-stack |
151 | //////// "\nr - DC_LEX_SWAP pop 1, pop 2, push 1, push 2 | 152 | //////// "\nr - DC_LEX_SWAP swap top-of-stack |
152 | //////// "\n:r - DC_LEX_COLON pop index, pop value, store to array 'r' | 153 | //////// "\n:r - DC_LEX_COLON pop index, pop value, store to array 'r' |
153 | //////// "\n;r - DC_LEX_SCOLON pop index, fetch from array 'r', push | 154 | //////// "\n;r - DC_LEX_SCOLON pop index, fetch from array 'r', push |
154 | //////// "\nLr - DC_LEX_LOAD_PO, pop register 'r', push | 155 | //////// "\nLr - DC_LEX_LOAD_PO, pop register 'r', push |
@@ -157,21 +158,21 @@ | |||
157 | //////// "\nsr - DC_LEX_OP_ASSIGN pop, assign to register 'r' | 158 | //////// "\nsr - DC_LEX_OP_ASSIGN pop, assign to register 'r' |
158 | //////// "\n? - DC_LEX_READ read line and execute | 159 | //////// "\n? - DC_LEX_READ read line and execute |
159 | //////// "\nx - DC_LEX_EXECUTE pop string and execute | 160 | //////// "\nx - DC_LEX_EXECUTE pop string and execute |
160 | //////// "\n<r - XC_LEX_OP_REL_GT pop, pop, execute register 'r' if top-of-stack was greater | 161 | //////// "\n<r - XC_LEX_OP_REL_GT pop, pop, execute register 'r' if top-of-stack was less |
161 | //////// "\n>r - XC_LEX_OP_REL_LT pop, pop, execute register 'r' if top-of-stack was less | 162 | //////// "\n>r - XC_LEX_OP_REL_LT pop, pop, execute register 'r' if top-of-stack was greater |
162 | //////// "\n=r - XC_LEX_OP_REL_EQ pop, pop, execute register 'r' if equal | 163 | //////// "\n=r - XC_LEX_OP_REL_EQ pop, pop, execute register 'r' if equal |
163 | //////// "\n!<r !>r !=r - negated forms | 164 | //////// "\n !<r !>r !=r - negated forms |
164 | //////// "\ne - DC_LEX_ELSE >tef: "if greater execute 't' else execute 'f'" | 165 | //////// "\n >tef - "if greater execute register 't' else execute 'f'" |
165 | //////// "\nQ - DC_LEX_NQUIT pop, "break N" from macro invocations | 166 | //////// "\nQ - DC_LEX_NQUIT pop, "break N" from macro invocations |
166 | //////// "\nq - DC_LEX_QUIT "break 2" (if less than 2 levels of macros, exit dc) | 167 | //////// "\nq - DC_LEX_QUIT "break 2" (if less than 2 levels of macros, exit dc) |
167 | //////// "\nX - DC_LEX_SCALE_FACTOR pop, push number of fractional digits | 168 | //////// "\nX - DC_LEX_SCALE_FACTOR pop, push number of fractional digits |
168 | //////// "\nZ - DC_LEX_LENGTH pop, push number of digits it has (or number of characters in string) | 169 | //////// "\nZ - DC_LEX_LENGTH pop, push number of digits it has (or number of characters in string) |
169 | //////// "\na - DC_LEX_ASCIIFY pop, push low-order byte as char or 1st char of string | 170 | //////// "\na - DC_LEX_ASCIIFY pop, push low-order byte as char or 1st char of string |
170 | //////// "\n( - DC_LEX_LPAREN (not in GNU) pop, pop, if top-of-stack was less push 1 else push 0 | 171 | //////// "\n( - DC_LEX_LPAREN (FreeBSD, not in GNU) pop, pop, if top-of-stack was less push 1 else push 0 |
171 | //////// "\n{ - DC_LEX_LBRACE (not in GNU) pop, pop, if top-of-stack was less-or-equal push 1 else push 0 | 172 | //////// "\n{ - DC_LEX_LBRACE (FreeBSD, not in GNU) pop, pop, if top-of-stack was less-or-equal push 1 else push 0 |
172 | //////// "\nG - DC_LEX_EQ_NO_REG (not in GNU) pop, pop, if equal push 1 else push 0 | 173 | //////// "\nG - DC_LEX_EQ_NO_REG (FreeBSD, not in GNU) pop, pop, if equal push 1 else push 0 |
173 | //////// "\nN - DC_LEX_OP_BOOL_NOT (not in GNU) pop, if 0 push 1 else push 0 | 174 | //////// "\nN - DC_LEX_OP_BOOL_NOT (FreeBSD, not in GNU) pop, if 0 push 1 else push 0 |
174 | //////// "\n_ - XC_LEX_NEG (not a command - starts negative number) | 175 | //////// FreeBSD also has J and M commands, used internally by bc |
175 | //////// "\nn - DC_LEX_PRINT_POP pop, print without newline | 176 | //////// "\nn - DC_LEX_PRINT_POP pop, print without newline |
176 | //////// "\nP - DC_LEX_PRINT_STREAM pop, print string or hex bytes | 177 | //////// "\nP - DC_LEX_PRINT_STREAM pop, print string or hex bytes |
177 | //usage: ) | 178 | //usage: ) |