diff options
-rw-r--r-- | miscutils/bc.c | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 02a61ac49..84bbe7b14 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -138,11 +138,53 @@ | |||
138 | //usage: | 138 | //usage: |
139 | //usage:#define dc_full_usage "\n" | 139 | //usage:#define dc_full_usage "\n" |
140 | //usage: "\nTiny RPN calculator. Operations:" | 140 | //usage: "\nTiny RPN calculator. Operations:" |
141 | //usage: "\n+, -, *, /, %, ~, ^," IF_FEATURE_DC_BIG(" |,") | 141 | //usage: "\nArithmetic: + - * / % ^" |
142 | //usage: IF_FEATURE_DC_BIG( | ||
143 | //usage: "\n~ - divide with remainder" | ||
144 | //usage: "\n| - modular exponentiation" | ||
145 | //usage: "\nv - square root" | ||
146 | //////// "\n_NNN - push neagtive number -NNN | ||
147 | //////// "\n[string] - push string | ||
148 | //////// "\nR - DC_LEX_POP pop and discard | ||
149 | //////// "\nc - DC_LEX_CLEAR_STACK clear stack | ||
150 | //////// "\nd - DC_LEX_DUPLICATE pop, push, push | ||
151 | //////// "\nr - DC_LEX_SWAP pop 1, pop 2, push 1, push 2 | ||
152 | //////// "\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 | //////// "\nLr - DC_LEX_LOAD_PO, pop register 'r', push | ||
155 | //////// "\nSr - DC_LEX_STORE_PUSH pop, push to register 'r' | ||
156 | //////// "\nlr - DC_LEX_LOAD read register 'r', push | ||
157 | //////// "\nsr - DC_LEX_OP_ASSIGN pop, assign to register 'r' | ||
158 | //////// "\n? - DC_LEX_READ read line and execute | ||
159 | //////// "\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_LT pop, pop, execute register 'r' if top-of-stack was less | ||
162 | //////// "\n=r - XC_LEX_OP_REL_EQ pop, pop, execute register 'r' if equal | ||
163 | //////// "\n!<r !>r !=r - negated forms | ||
164 | //////// "\ne - DC_LEX_ELSE >tef: "if greater execute 't' else execute 'f'" | ||
165 | //////// "\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 | //////// "\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 | //////// "\na - DC_LEX_ASCIIFY pop, push low-order byte as char or 1st string char | ||
170 | //////// "\n( - DC_LEX_LPAREN ? | ||
171 | //////// "\n{ - DC_LEX_LBRACE ? | ||
172 | //////// "\n_ - XC_LEX_NEG (not a command - starts negative number) | ||
173 | //////// "\nG - DC_LEX_EQ_NO_REG (? GNU dc has no such cmd) | ||
174 | //////// "\nN - DC_LEX_OP_BOOL_NOT (? GNU dc has no such cmd) | ||
175 | //////// "\nn - DC_LEX_PRINT_POP pop, print without newline | ||
176 | //////// "\nP - DC_LEX_PRINT_STREAM pop, print string or hex bytes | ||
177 | //usage: ) | ||
142 | //usage: "\np - print top of the stack without popping" | 178 | //usage: "\np - print top of the stack without popping" |
143 | //usage: "\nf - print entire stack" | 179 | //usage: "\nf - print entire stack" |
144 | //usage: "\nk - pop the value and set the precision" | 180 | //////// "\nz - DC_LEX_STACK_LEVEL push stack depth |
181 | //////// "\nK - DC_LEX_SCALE push precision | ||
182 | //////// "\nI - DC_LEX_IBASE push input radix | ||
183 | //////// "\nO - DC_LEX_OBASE push output radix | ||
184 | //usage: IF_FEATURE_DC_BIG( | ||
185 | //usage: "\nk - pop the value and set precision" | ||
145 | //usage: "\ni - pop the value and set input radix" | 186 | //usage: "\ni - pop the value and set input radix" |
187 | //usage: ) | ||
146 | //usage: "\no - pop the value and set output radix" | 188 | //usage: "\no - pop the value and set output radix" |
147 | //usage: "\nExamples: dc -e'2 2 + p' -> 4, dc -e'8 8 * 2 2 + / p' -> 16" | 189 | //usage: "\nExamples: dc -e'2 2 + p' -> 4, dc -e'8 8 * 2 2 + / p' -> 16" |
148 | //usage: | 190 | //usage: |