Commit | Line | Data |
---|---|---|
343218ea KB |
1 | .\" Warning: The string "pname" is converted to the true program name |
2 | .\" by the makefile, throughout this document. | |
3 | .\" | |
4 | .\" Warning: The order of presentation of commands largely matches the | |
5 | .\" help screen built into the program. | |
6 | .\" | |
7 | .\" Conventions: | |
8 | .\" - pname italicized and never uppercased (it's a proper name). | |
9 | .\" - Refer to lists of commands in the same order as introduced. | |
10 | .\" - Command and function names bold when introduced, italicized in all | |
11 | .\" other places if possible, or in `` '' if not. | |
12 | .\" - Cell names italicized except when used in expressions; row numbers | |
13 | .\" and column names not italicized. | |
14 | .\" - Use `` '' rather than " " except referring to literal input or output. | |
15 | .\" - TPs use default indent except for function names, then 18. | |
16 | .\" - Smallify uppercase strings. | |
17 | .\" - Avoid passive voice and third person. | |
18 | .\" $Revision: 6.8 $ | |
19 | .\" | |
20384acc | 20 | .TH SC 1 |
343218ea | 21 | .SH NAME |
20384acc | 22 | sc \- spreadsheet calculator |
343218ea | 23 | .SH SYNOPSIS |
20384acc | 24 | .B sc |
343218ea KB |
25 | [ |
26 | .B -c | |
27 | ] | |
28 | [ | |
29 | .B -m | |
30 | ] | |
31 | [ | |
32 | .B -n | |
33 | ] | |
34 | [ | |
35 | .B -r | |
36 | ] | |
37 | [ | |
38 | .B -x | |
39 | ] | |
40 | [ | |
41 | .I file | |
42 | ] | |
43 | .\" ========== | |
44 | .SH DESCRIPTION | |
45 | The spreadsheet calculator | |
20384acc | 46 | .I sc |
343218ea KB |
47 | is based on rectangular tables much like a financial spreadsheet. |
48 | When invoked it presents you with a table | |
49 | organized as rows and columns of cells. | |
50 | If invoked without a | |
51 | .I file | |
52 | argument, the table is initially empty. | |
53 | Otherwise | |
54 | .I file | |
55 | is read in (see the | |
56 | .I Get | |
57 | command below). | |
58 | Each cell may have associated with it | |
59 | a numeric value, | |
60 | a label string, | |
61 | and/or an expression (formula) | |
62 | which evaluates to a numeric value or label string, | |
63 | often based on other cell values. | |
64 | .\" ---------- | |
65 | .PP | |
66 | Options are: | |
67 | .\" ---------- | |
68 | .TP | |
69 | .B \-c | |
70 | Start the program with the recalculation being done in column order. | |
71 | .\" ---------- | |
72 | .TP | |
73 | .B \-m | |
74 | Start the program with automatic recalculation disabled. | |
75 | The spreadsheet will be recalculated only when the ``@'' command is used. | |
76 | .\" ---------- | |
77 | .TP | |
78 | .B \-n | |
79 | Start the program in quick numeric entry mode (see below). | |
80 | .\" ---------- | |
81 | .TP | |
82 | .B \-r | |
83 | Start the program with the recalculation being done in row | |
84 | order (default option). | |
85 | .\" ---------- | |
86 | .TP | |
87 | .B \-x | |
88 | Cause the | |
89 | .I Get | |
90 | and | |
91 | .I Put | |
92 | commands (see below) to encrypt and decrypt data files. | |
93 | .\" ---------- | |
94 | .PP | |
95 | All of these options can be changed with the | |
96 | .I ^T | |
97 | and | |
98 | .I S | |
99 | commands (see below) while | |
20384acc | 100 | .I sc |
343218ea | 101 | is running. Options specified when |
20384acc | 102 | .I sc |
343218ea KB |
103 | is invoked |
104 | override options saved in the data file. | |
105 | .\" ========== | |
106 | .SS "General Information" | |
107 | .\" ---------- | |
108 | The screen is divided into four regions. | |
109 | The top line is for entering commands and displaying cell values. | |
110 | The second line is for messages from | |
20384acc | 111 | .IR sc . |
343218ea KB |
112 | The third line and the first four columns show the column and row numbers, |
113 | from which are derived cell addresses, e.g. | |
114 | .I A0 | |
115 | for the cell in column A, row 0. | |
116 | Note that column names are case-insensitive: you can enter | |
117 | .I A0 | |
118 | or | |
119 | .IR a0 . | |
120 | .\" ---------- | |
121 | .PP | |
122 | The rest of the screen forms a window looking at a portion of the table. | |
123 | The total number of display rows and columns available, | |
124 | hence the number of table rows and columns displayed, | |
125 | is set by | |
126 | .IR curses (3) | |
127 | and may be overridden by setting the | |
128 | .SM LINES | |
129 | and | |
130 | .SM COLUMNS | |
131 | environment variables, respectively. | |
132 | .\" ---------- | |
133 | .PP | |
134 | The screen has two cursors: | |
135 | a cell cursor, indicated by a highlighted cell and a ``<'' on the screen, | |
136 | and a character cursor, indicated by the terminal's hardware cursor. | |
137 | The cell and character cursors are often the same. | |
138 | They differ when you type a command on the top line. | |
139 | .\" ---------- | |
140 | .PP | |
141 | If a cell's numeric value is wider than the column width (see the | |
142 | .I f | |
143 | command), the cell is filled with asterisks. | |
144 | If a cell's label string is wider than the column width, | |
145 | it is truncated at the start of the next non-blank cell in the row, if any. | |
146 | .\" ---------- | |
147 | .PP | |
148 | Cursor control commands and row and column commands | |
149 | can be prefixed by a numeric argument | |
150 | which indicates how many times the command is to be executed. | |
151 | You can type | |
152 | .I ^U | |
153 | before a repeat count if quick numeric entry mode is enabled | |
154 | or if the number is to be entered | |
155 | while the character cursor is on the top line. | |
156 | .\" ---------- | |
157 | .PP | |
158 | Commands which use the terminal's control key, such as | |
159 | .IR ^N , | |
160 | work both when a command is being typed and when in normal mode. | |
161 | .\" ========== | |
162 | .SS "Changing Options" | |
163 | .\" ---------- | |
164 | \0 \" exactly one blank line (hard to get) | |
165 | .PD 0 | |
166 | .TP | |
167 | .BI ^T o | |
168 | Toggle options. | |
169 | This command allows you to switch the state of one option selected by | |
170 | .IR o . | |
171 | A small menu lists the choices for | |
172 | .I o | |
173 | when you type | |
174 | .IR ^T . | |
175 | The options selected are saved when the data and formulas are saved | |
176 | so that you will have the same setup next time you enter the | |
177 | spreadsheet. | |
178 | .PD | |
179 | .RS | |
180 | .\" ---------- | |
181 | .TP | |
182 | .B a | |
183 | Automatic Recalculation. | |
184 | When set, each change in the spreadsheet causes the entire spreadsheet | |
185 | be recalculated. Normally this is not noticeable, but for very large | |
186 | spreadsheets, it may be faster to clear automatic recalculation mode and | |
187 | update the spreadsheet via explicit ``@'' commands. Default is | |
188 | automatic recalculation on. | |
189 | .\" ---------- | |
190 | .TP | |
191 | .B c | |
192 | Current cell highlighting. | |
193 | If enabled, the current cell is highlighted | |
194 | (using the terminal's standout mode, if available) | |
195 | in addition to being marked by the cell cursor. | |
196 | .\" ---------- | |
197 | .TP | |
198 | .B e | |
199 | External function execution. | |
200 | When disabled, external functions (see | |
201 | .IR @ext () | |
202 | below) are not called. | |
203 | This saves a lot of time at each screen update. | |
204 | External functions are disabled by default. | |
205 | If disabled, and external functions are used anywhere, | |
206 | a warning is printed each time the screen is updated, | |
207 | and the result of | |
208 | .IR @ext () | |
209 | is the value from the previous call, if any, or a null string. | |
210 | .\" ---------- | |
211 | .TP | |
212 | .B n | |
213 | Quick numeric entry. | |
214 | If enabled, | |
215 | a typed digit is assumed to be | |
216 | the start of a numeric value for the current cell, | |
217 | not a repeat count, unless preceded by | |
218 | .IR ^U . | |
219 | .\" ---------- | |
220 | .TP | |
221 | .B t | |
222 | Top line display. | |
223 | If enabled, | |
224 | the name and value of the current cell is displayed on the top line. | |
225 | If there is an associated label string, | |
226 | the first character of the string value | |
227 | is ``<'' for a leftstring or ``>'' for a rightstring (see below), | |
228 | followed by "\fIstring\fP" for a constant string | |
229 | or | |
230 | .RI { expr } | |
231 | for a string expression. | |
232 | If the cell has a numeric value, | |
233 | it follows as | |
234 | .RI [ value ], | |
235 | which may be a constant or expression. | |
236 | .\" ---------- | |
237 | .TP | |
238 | .B x | |
239 | Encryption. | |
240 | See the | |
241 | .B \-x | |
242 | option. | |
243 | .\" ---------- | |
244 | .TP | |
245 | .B $ | |
246 | Dollar prescale. | |
247 | If enabled, all numeric | |
248 | .B constants | |
249 | (not expressions) which you enter are multipled by 0.01 | |
250 | so you don't have to keep typing the decimal point | |
251 | if you enter lots of dollar figures. | |
252 | .RE | |
253 | .\" ---------- | |
254 | \0 \" exactly one blank line (hard to get) | |
255 | .PD 0 | |
256 | .TP | |
257 | .B S | |
258 | Set options. This command allows you to set various options. | |
259 | A small menu lists the options that cannot be changed through | |
260 | .I ^T | |
261 | above. | |
262 | .PD | |
263 | .RS | |
264 | .TP | |
265 | .BR byrows / bycols | |
266 | Specify the order cell evaluation when updating. These options also affect | |
267 | the order in which cells are filled (see | |
268 | .IR /f ) | |
269 | and whether a row or column is cleared by an | |
270 | .I x | |
271 | command. | |
272 | .TP | |
273 | .BI iterations =n | |
274 | Set the maximum number of recalculations before | |
275 | the screen is displayed again. | |
276 | .I Iterations | |
277 | is set to 10 by default. | |
278 | .TP | |
279 | .BI tblstyle =s | |
280 | Control the output of the | |
281 | .I T | |
282 | command. | |
283 | .I s | |
284 | can be: | |
285 | .B 0 | |
286 | (default) to give colon delimited fields, with no | |
287 | .I tbl | |
288 | control lines; | |
289 | .B tbl | |
290 | to give colon delimited fields, with | |
291 | .IR tbl (1) | |
292 | control lines; | |
293 | .B latex | |
294 | to give a | |
295 | .I LaTeX | |
296 | tabular environment; and | |
297 | .B tex | |
298 | to give a | |
299 | .I TeX | |
300 | simple tabbed alignment with ampersands as delimiters. | |
301 | .PP | |
302 | Other | |
303 | .I Set | |
304 | options are normally used only in | |
20384acc | 305 | .I sc |
343218ea KB |
306 | data files since they are available through |
307 | .IR ^T . | |
308 | You can also use them interactively | |
309 | .TP | |
310 | .BR autocalc / !autocalc | |
311 | Set/clear auto recalculation mode. | |
312 | .TP | |
313 | .BR numeric / !numeric | |
314 | Set/clear numeric mode. | |
315 | .TP | |
316 | .BR prescale / !prescale | |
317 | Set/clear numeric prescale mode. | |
318 | .TP | |
319 | .BR extfun / !extfun | |
320 | Enable/disable external functions. | |
321 | .TP | |
322 | .BR cellcur / !cellcur | |
323 | Set/clear current cell highlighting mode. | |
324 | .TP | |
325 | .BR toprow / !toprow | |
326 | Set/clear top row display mode. | |
327 | .RE | |
328 | .\" ========== | |
329 | .SS "Cursor Control Commands" | |
330 | .\" ---------- | |
331 | \0 \" exactly one blank line (hard to get) | |
332 | .PD 0 | |
333 | .TP | |
334 | .B ^P | |
335 | Move the cell cursor up to the previous row. | |
336 | .PD | |
337 | .\" ---------- | |
338 | .TP | |
339 | .B ^N | |
340 | Move the cell cursor down to the next row. | |
341 | .\" ---------- | |
342 | .TP | |
343 | .B ^B | |
344 | Move the cell cursor backward one column. | |
345 | .\" ---------- | |
346 | .TP | |
347 | .B ^F | |
348 | Move the cell cursor forward one column. | |
349 | .\" ---------- | |
350 | .TP | |
351 | .B "h, j, k, l" | |
352 | If the character cursor is not on the top line, these are alternate, | |
353 | .IR vi -compatible | |
354 | cell cursor controls (left, down, up, right). | |
355 | .\" ---------- | |
356 | .TP | |
357 | .B ^H | |
358 | If the character cursor is not on the top line, | |
359 | .I ^H | |
360 | is the same as | |
361 | .IR ^B . | |
362 | .\" ---------- | |
363 | .TP | |
364 | .B SPACE | |
365 | If the character cursor is not on the top line, | |
366 | the space bar is the same as | |
367 | .IR ^F . | |
368 | .\" ---------- | |
369 | .TP | |
370 | .B TAB | |
371 | If the character cursor is on the top line, | |
372 | .SM TAB | |
373 | starts a range (see below). | |
374 | Otherwise, it is the same as | |
375 | .IR ^F . | |
376 | .\" ---------- | |
377 | .TP | |
378 | .B "Arrow Keys" | |
379 | The terminal's arrow keys provide another alternate set of cell cursor controls | |
380 | if they exist and are supported in the appropriate | |
381 | .I termcap | |
382 | entry. | |
383 | Some terminals have arrow keys which conflict with other control key codes. | |
384 | For example, a terminal might send | |
385 | .I ^H | |
386 | when the back arrow key is pressed. | |
387 | In these cases, the conflicting arrow key performs the same function | |
388 | as the key combination it mimics. | |
389 | .\" ---------- | |
390 | .TP | |
391 | .B ^ | |
392 | Move the cell cursor up to row 0 of the current column. | |
393 | .\" ---------- | |
394 | .TP | |
395 | .B # | |
396 | Move the cell cursor down to the last valid row of the current column. | |
397 | .\" ---------- | |
398 | .TP | |
399 | .B 0 | |
400 | Move the cell cursor backward to column A of the current row. | |
401 | This command must be prefixed with | |
402 | .I ^U | |
403 | if quick numeric entry mode is enabled. | |
404 | .\" ---------- | |
405 | .TP | |
406 | .B $ | |
407 | Move the cell cursor forward to the last valid column of the current row. | |
408 | .\" ---------- | |
409 | .TP | |
410 | .B b | |
411 | Scan the cursor backward (left and up) to the previous valid cell. | |
412 | .\" ---------- | |
413 | .TP | |
414 | .B w | |
415 | Scan the cursor forward (right and down) to the next valid cell. | |
416 | .\" ---------- | |
417 | .TP | |
418 | .BI ^E d | |
419 | Go to end of range. | |
420 | Follow | |
421 | .I ^E | |
422 | by a direction indicator such as | |
423 | .I ^P | |
424 | or | |
425 | .IR j . | |
426 | If the cell cursor starts on a non-blank cell, | |
427 | it goes in the indicated direction until the last non-blank adjacent cell. | |
428 | If the cell cursor starts on a blank cell, | |
429 | it goes in the indicated direction until the first non-blank cell. | |
430 | This command is useful when specifying ranges of adjacent cells (see below), | |
431 | especially when the range is bigger than the visible window. | |
432 | .\" ---------- | |
433 | .TP | |
434 | .B g | |
435 | Go to a cell. | |
20384acc | 436 | .I sc |
343218ea KB |
437 | prompts for a cell's name, a regular expression surrounded by |
438 | quotes, or a number. | |
439 | If a cell's name such as | |
440 | .I ae122 | |
441 | or a the name of a defined range is given, the cell cursor goes | |
442 | directly to that cell. | |
443 | If a quoted regular expression such as " | |
444 | .I Tax Table | |
445 | " or " | |
446 | .I ^Jan [0-9]*$ | |
447 | " is given, | |
20384acc | 448 | .I sc |
343218ea KB |
449 | searches for a cell containing a string matching the regular |
450 | expression. | |
451 | See | |
452 | .I regex(3) | |
453 | or | |
454 | .I ed(1) | |
455 | for more details on the form of regular | |
456 | expressions. | |
457 | If a number is given, | |
20384acc | 458 | .I sc |
343218ea KB |
459 | will search for a cell containing that number. |
460 | Searches for either strings or numbers proceed forward from the | |
461 | current cell, wrapping back to a0 at the end of the table, and | |
462 | terminate at the current cell if the string or number is not found. | |
463 | The last | |
464 | .I g | |
465 | command is saved, and can be re-issued by entering | |
466 | .IR g<return> . | |
467 | .\" ========== | |
468 | .SS "Cell Entry and Editing Commands" | |
469 | .\" ---------- | |
470 | Cells can contain both a numeric value and a string value. | |
471 | Either value can be the result of an expression, | |
472 | but not both at once, | |
473 | i.e. each cell can have only one expression associated with it. | |
474 | Entering a valid numeric expression | |
475 | alters the cell's previous numeric value, if any, | |
476 | and replaces the cell's previous string expression, if any, | |
477 | leaving only the previously computed constant label string. | |
478 | Likewise, entering a valid string expression | |
479 | alters the cell's the previous label string, if any, | |
480 | and replaces the cell's previous numeric expression, if any, | |
481 | leaving only the previously computed constant numeric value. | |
482 | .TP | |
483 | .B = | |
484 | Enter a numeric constant or expression into the current cell. | |
20384acc | 485 | .I sc |
343218ea KB |
486 | prompts for the expression on the top line. |
487 | The usual way to enter a number into a cell is to type ``='', | |
488 | then enter the number in response to the prompt on the top line. | |
489 | The quick numeric entry option, enabled through the | |
490 | .B \-n | |
491 | option or | |
492 | .I ^T | |
493 | command, shows the prompt when you enter the first digit of a number | |
494 | (you can skip typing ``=''). | |
495 | .\" ---------- | |
496 | .TP | |
497 | .B < | |
498 | Enter a label string into the current cell | |
499 | to be flushed left against the left edge of the cell. | |
500 | .\" ---------- | |
501 | .IP \fB"\fP | |
502 | .PD 0 | |
503 | .TP | |
504 | .B > | |
505 | Enter a label string into the current cell | |
506 | to be flushed right against the right edge of the cell. | |
507 | .PD | |
508 | .\" ---------- | |
509 | .PP | |
510 | Strings you enter must start with ". | |
511 | You can leave off the trailing " and | |
20384acc | 512 | .I sc |
343218ea KB |
513 | will add it for you. |
514 | You can also enter a string expression | |
515 | by backspacing over the opening " in the prompt. | |
516 | .\" ---------- | |
517 | .TP | |
518 | .B e | |
519 | Edit the value associated with the current cell. | |
520 | This is identical to ``='' | |
521 | except that the command line starts out containing | |
522 | the old numeric value or expression associated with the cell. | |
523 | .\" ---------- | |
524 | .TP | |
525 | .B E | |
526 | Edit the string associated with the current cell. | |
527 | This is identical to ``<'', ``"'', or ``>'' | |
528 | except that the command line starts out containing | |
529 | the old string value or expression associated with the cell. | |
530 | .\" ---------- | |
531 | .PP | |
532 | To enter and edit a cell's number part, use the ``='' and | |
533 | .I e | |
534 | commands. | |
535 | To enter and edit a cell's string part, use the ``<'', ``"'', ``>'', and | |
536 | .I E | |
537 | commands. | |
538 | See the sections below on numeric and string expressions for more information. | |
539 | .\" ---------- | |
540 | .TP | |
541 | .B x | |
542 | Clear the current cell. | |
543 | Deletes the numeric value, label string, and/or numeric or string expression. | |
544 | You can prefix this command with a count | |
545 | of the number of cells on the current row to clear. The current column is | |
546 | used if column recalculation order is set. | |
547 | Cells cleared with this command may be recalled | |
548 | with any of the | |
549 | .I pull | |
550 | commands (see below). | |
551 | .\" ---------- | |
552 | .TP | |
553 | .B m | |
554 | Mark a cell to be used as the source for the | |
555 | .I copy | |
556 | command. | |
557 | .\" ---------- | |
558 | .TP | |
559 | .B c | |
560 | Copy the last marked cell to the current cell, | |
561 | updating row and column references in its numeric or string expression, if any. | |
562 | .\" ---------- | |
563 | .TP | |
564 | .B + | |
565 | If not in numeric mode, add the current numeric argument (default 1) | |
566 | to the value of the current cell. In numeric mode, ``+'' introduces a new | |
567 | numeric expression or value, the same as ``=''. | |
568 | .\" ---------- | |
569 | .TP | |
570 | .B - | |
571 | If not in numeric mode, subtract the current numeric argument (default 1) | |
572 | from the value of the current cell. In numeric mode, ``-'' introduces a new, | |
573 | negative, numeric expression or value, like ``=''. | |
574 | .\" ========== | |
575 | .SS "File Commands" | |
576 | .\" ---------- | |
577 | \0 \" exactly one blank line (hard to get) | |
578 | .PD 0 | |
579 | .TP | |
580 | .B G | |
581 | Get a new database from a file. | |
582 | If encryption is enabled, | |
583 | the file is decrypted before it is loaded into the spreadsheet. | |
584 | .PD | |
585 | .\" ---------- | |
586 | .TP | |
587 | .B P | |
588 | Put the current database into a file. | |
589 | If encryption is enabled, | |
590 | the file is encrypted before it is saved. | |
591 | .\" ---------- | |
592 | .TP | |
593 | .B W | |
594 | Write a listing of the current database into a file | |
595 | in a form that matches its appearance on the screen. | |
596 | This differs from the | |
597 | .I Put | |
598 | command in that its files are intended to be reloaded with | |
599 | .IR Get , | |
600 | while | |
601 | .I Write | |
602 | produces a file for people to look at. Hidden rows or columns | |
603 | are not shown when the data is printed. | |
604 | .\" ---------- | |
605 | .TP | |
606 | .B T | |
607 | Write a listing of the current database to a file, | |
608 | but include delimiters suitable for processing by the | |
609 | .IR tbl , | |
610 | .IR LaTeX , | |
611 | or | |
612 | .I TeX | |
613 | table processors. | |
614 | The delimiters are controlled by the | |
615 | .I tblstyle | |
616 | option. See | |
617 | .I Set | |
618 | above. | |
619 | The delimters are are a colon\ (:) for style | |
620 | .IR 0 or tbl | |
621 | and an ampersand\ (&) for style | |
622 | .IR latex or tex . | |
623 | .\" ---------- | |
624 | .PP | |
625 | With the | |
626 | .IR Put , | |
627 | .IR Write , | |
628 | and | |
629 | .I Table | |
630 | commands, the optional range argument writes a subset of the spreadsheet to | |
631 | the output file. | |
632 | .\" ---------- | |
633 | .PP | |
634 | With the | |
635 | .I Write | |
636 | and | |
637 | .I Table | |
638 | commands, if you try to write to the last file used with the | |
639 | .I Get | |
640 | or | |
641 | .I Put | |
642 | commands, or the file specified on the command line when | |
20384acc | 643 | .I sc |
343218ea KB |
644 | was invoked, you are asked to confirm |
645 | that the (potentially) dangerous operation is really what you want. | |
646 | .\" ---------- | |
647 | .PP | |
648 | The three output commands, | |
649 | .IR Put , | |
650 | .IR Write , | |
651 | and | |
652 | .IR Table , | |
653 | can pipe their (unencrypted only) output to a program. | |
654 | To use this feature, | |
655 | enter ``| program'' to the prompt asking for a filename. | |
656 | For example, to redirect the output of the | |
657 | .I Write | |
658 | command to the printer, | |
659 | you might enter ``| lpr -p''. | |
660 | .\" ---------- | |
661 | .TP | |
662 | .B M | |
663 | Merge the database from the named file into the current database. | |
664 | Values and expressions defined in the named file | |
665 | are read into the current spreadsheet | |
666 | overwriting the existing entries at matching cell locations. | |
667 | .\" ---------- | |
668 | .TP | |
669 | .B R | |
670 | Run macros. | |
671 | Since | |
20384acc | 672 | .I sc |
343218ea KB |
673 | files are saved as ASCII files, |
674 | it is possible to use them as primitive macro definition files. | |
675 | The | |
676 | .I Run | |
677 | command makes this easier. | |
678 | It's like the | |
679 | .I Merge | |
680 | command, | |
681 | but prints a saved path name as the start of the filename to merge in. | |
682 | The string to use is set with the | |
683 | .I Define | |
684 | command. | |
685 | To write macros, you must be familiar with the file format written by the | |
686 | .I Put | |
687 | command. | |
688 | This facility is still primitive and could be much improved. | |
689 | .\" ---------- | |
690 | .TP | |
691 | .B D | |
692 | Define a path for the | |
693 | .I Run | |
694 | command to use. | |
695 | .\" ---------- | |
696 | .PP | |
697 | All file operations take a filename as the first argument | |
698 | to the prompt on the top line. | |
699 | The prompt supplies a " to aid in typing in the filename. | |
700 | The filename can also be obtained from a cell's label string | |
701 | or string expression. | |
702 | In this case, delete the leading " with the backspace key | |
703 | and enter a cell name such as | |
704 | .I a22 | |
705 | instead. | |
706 | If the resulting string starts with ``|'', | |
707 | the rest of the string is interpreted as a | |
708 | .SM UNIX | |
709 | command, as above. | |
710 | .\" ========== | |
711 | .SS "Row and Column Commands" | |
712 | .\" ---------- | |
713 | These commands can be used on either rows or columns. | |
714 | The second letter of the command is either a row designator | |
715 | (one of the characters | |
716 | .IR r , | |
717 | .IR ^B , | |
718 | .IR ^F , | |
719 | .IR h , | |
720 | .IR l ) | |
721 | or a column designator (one of | |
722 | .IR c , | |
723 | .IR ^P , | |
724 | .IR ^N , | |
725 | .IR k , | |
726 | .IR j ). | |
727 | A small menu lists the choices for the second letter | |
728 | when you type the first letter of one of these commands. | |
729 | Commands which move or copy cells | |
730 | also modify the row and column references in affected cell expressions. | |
731 | The references may be frozen by using the | |
732 | .I fixed | |
733 | operator or using the | |
734 | .I $ | |
735 | character in the reference to the cell (see below). | |
736 | .\" ---------- | |
737 | .TP | |
738 | .B "ir, ic" | |
739 | Insert a new row (column) | |
740 | by moving the row (column) containing the cell cursor, | |
741 | and all following rows (columns), down (right) one row (column). | |
742 | The new row (column) is empty. | |
743 | .\" ---------- | |
744 | .TP | |
745 | .B "ar, ac" | |
746 | Append a new row (column) immediately following the current row (column). | |
747 | It is initialized as a copy of the current one. | |
748 | .\" ---------- | |
749 | .TP | |
750 | .B "dr, dc" | |
751 | Delete the current row (column). | |
752 | .\" ---------- | |
753 | .TP | |
754 | .B "pr, pc, pm" | |
755 | Pull deleted rows (columns) back into the spreadsheet. | |
756 | The last deleted set of cells is put back into the spreadsheet | |
757 | at the current location. | |
758 | .I pr | |
759 | inserts enough rows to hold the data. | |
760 | .I pc | |
761 | inserts enough columns to hold the data. | |
762 | .I pm | |
763 | (merge) does not insert rows or columns; | |
764 | it overwrites the cells beginning at the current cell cursor location. | |
765 | .\" ---------- | |
766 | .TP | |
767 | .B "vr, vc" | |
768 | Remove expressions from the affected rows (columns), | |
769 | leaving only the values which were in the cells | |
770 | before the command was executed. | |
771 | .\" ---------- | |
772 | .TP | |
773 | .B "zr, zc" | |
774 | Hide (``zap'') the current row (column). | |
775 | This keeps a row (column) from being displayed but keeps it in the data base. | |
776 | The status of the rows and columns is saved with the data base so hidden | |
777 | rows and columns will be still | |
778 | be hidden when you reload the spreadsheet. Hidden rows or columns are not | |
779 | printed by the | |
780 | .I W | |
781 | command. | |
782 | .\" ---------- | |
783 | .TP | |
784 | .B "sr, sc" | |
785 | Show hidden rows (columns). | |
786 | Enter a range of rows (columns) to be revealed. | |
787 | The default is the first range of rows (columns) currently hidden. | |
788 | This command ignores the repeat count, if any. | |
789 | .\" ---------- | |
790 | .TP | |
791 | .B f | |
792 | Set the output format to be used | |
793 | for printing the numeric values in each cell in the current column. | |
794 | Enter two numbers: | |
795 | the total width in characters of the column, | |
796 | and the number of digits to follow decimal points. | |
797 | Values are rounded off to the least significant digit displayed. | |
798 | The total column width affects displays of strings as well as numbers. | |
799 | A preceding count can be used to affect more than one column. | |
800 | This command has only a column version (no second letter). | |
801 | .\" ========== | |
802 | .SS "Range Commands" | |
803 | .\" ---------- | |
804 | Range operations affect a rectangular region on the screen | |
805 | defined by the upper left and lower right cells in the region. | |
806 | All of the commands in this class start with a slash; | |
807 | the second letter of the command indicates which command. | |
808 | A small menu lists the choices for the second letter when you type ``/''. | |
20384acc | 809 | .I sc |
343218ea KB |
810 | prompts for needed parameters for each command. |
811 | Phrases surrounded by square brackets in the prompt are informational only | |
812 | and may be erased with the backspace key. | |
813 | .\" ---------- | |
814 | .PP | |
815 | Prompts requesting variable names may be satisfied | |
816 | with either an explicit variable name, such as | |
817 | .IR A10 , | |
818 | or with a variable name previously defined in a | |
819 | .I /d | |
820 | command (see below). | |
821 | Range name prompts require either an explicit range such as | |
822 | .IR A10:B20 , | |
823 | or a range name previously defined with a | |
824 | .I /d | |
825 | command. | |
826 | A default range shown in the second line | |
827 | is used if you omit the range from the command or press the | |
828 | .SM TAB | |
829 | key (see below). | |
830 | The default range can be changed by moving the cell cursor | |
831 | via the control commands | |
832 | .RI ( ^P , | |
833 | .IR ^N , | |
834 | .IR ^B , | |
835 | .IR ^F ) | |
836 | or the arrow keys. | |
837 | The cells in the default range are highlighted | |
838 | (using the terminal's standout mode, if available). | |
839 | .\" ---------- | |
840 | .TP | |
841 | .B /x | |
842 | Clear a range. | |
843 | Cells cleared with this command may be recalled with any of the | |
844 | .I pull | |
845 | commands. | |
846 | .\" ---------- | |
847 | .TP | |
848 | .B /v | |
849 | Values only. | |
850 | This command removes the expressions from a range of cells, | |
851 | leaving just the values of the expressions. | |
852 | .\" ---------- | |
853 | .TP | |
854 | .B /c | |
855 | Copy a source range to a destination range. | |
856 | The source and destination may be different sizes. | |
857 | The result is always one or more full copies of the source. | |
858 | Copying a row to a row yields a row. | |
859 | Copying a column to a column yields a column. | |
860 | Copying a range to anything yields a range. | |
861 | Copying a row to a column or a column to a row yields a range | |
862 | with as many copies of the source as there are cells in the destination. | |
863 | This command can be used to duplicate a cell through an arbitrary range | |
864 | by making the source a single cell range such as | |
865 | .IR b20:b20 . | |
866 | .\" ---------- | |
867 | .TP | |
868 | .B /f | |
869 | Fill a range with constant values | |
870 | starting with a given value and increasing by a given increment. | |
871 | Each row is filled before moving on to the next row if row order | |
872 | recalculation is set. Column order fills each column in the range | |
873 | before moving on to the next column. | |
874 | The start and increment numbers may be positive or negative. | |
875 | To fill all cells with the same value, give an increment of zero. | |
876 | .\" ---------- | |
877 | .TP | |
878 | .B /d | |
879 | Use this command to assign a symbolic name to a single cell | |
880 | or a rectangular range of cells on the screen. | |
881 | The parameters are the name, surrounded by "", | |
882 | and either a single cell name such as | |
883 | .I A10 | |
884 | or a range such as | |
885 | .IR a1:b20 . | |
886 | Names defined in this fashion are used by the program in future prompts, | |
887 | may be entered in response to prompts requesting a cell or range name, | |
888 | and are saved when the spreadsheet is saved with the | |
889 | .I Put | |
890 | command. | |
891 | Names defined must be more than two alpha characters long | |
892 | to differentiate them from a column names, | |
893 | and must not have embedded special characters. | |
894 | Names may include the character ``_'' or numerals | |
895 | as long as they occur after the first three alpha characters. | |
896 | .\" ---------- | |
897 | .TP | |
898 | .B /s | |
899 | This command lists (shows) the currently defined range names. | |
900 | If there are no defined range names, then a message is given, | |
901 | otherwise | |
902 | it pipes output to | |
903 | .IR sort , | |
904 | then to | |
905 | .IR less . | |
906 | If the environment variable PAGER is set, its value is used in place of | |
907 | .IR less. | |
908 | .\" ---------- | |
909 | .TP | |
910 | .B /u | |
911 | Use this command to undefine a previously defined range name. | |
912 | .\" ========== | |
913 | .SS "Miscellaneous Commands" | |
914 | .\" ---------- | |
915 | \0 \" exactly one blank line (hard to get) | |
916 | .PD 0 | |
917 | .TP | |
918 | .B Q | |
919 | .TP | |
920 | .B q | |
921 | .TP | |
922 | .B ^C | |
923 | Exit from | |
20384acc | 924 | .IR sc . |
343218ea KB |
925 | If you made any changes since the last |
926 | .I Get | |
927 | or | |
928 | .IR Put , | |
20384acc | 929 | .I sc |
343218ea KB |
930 | asks about saving your data before exiting. |
931 | .PD | |
932 | .\" ---------- | |
933 | .TP | |
934 | .B ^G | |
935 | .PD 0 | |
936 | .TP | |
937 | .B ESC | |
938 | Abort entry of the current command. | |
939 | .PD | |
940 | .\" ---------- | |
941 | .TP | |
942 | .B ? | |
943 | Enter an interactive help facility. Lets you look up brief | |
944 | summaries of the main features of the program. The help facility is | |
945 | structured like this manual page so it is easy to find more | |
946 | information on a particular topic. | |
947 | .\" ---------- | |
948 | .TP | |
949 | .B ! | |
950 | Shell escape. | |
20384acc | 951 | .I sc |
343218ea KB |
952 | prompts for a shell command to run. |
953 | End the command line with the | |
954 | .SM RETURN | |
955 | key. | |
956 | If the environment variable | |
957 | .SM SHELL | |
958 | is defined, that shell is run. | |
959 | If not, /bin/sh is used. | |
960 | Giving a null command line starts the shell in interactive mode. | |
961 | A second ``!'' repeats the previous command. | |
962 | .\" ---------- | |
963 | .TP | |
964 | .B ^L | |
965 | Redraw the screen. | |
966 | .\" ---------- | |
967 | .TP | |
968 | .B ^R | |
969 | Redraw the screen with special highlighting of cells to be filled in. | |
970 | This is useful for finding values you need to provide or update | |
971 | in a form with which you aren't familiar | |
972 | or of which you have forgotten the details. | |
973 | ||
974 | It's also useful for checking a form you are creating. | |
975 | All cells which contain constant numeric values | |
976 | (not the result of a numeric expression) | |
977 | are highlighted temporarily, | |
978 | until the next screen change, however minor. | |
979 | To avoid ambiguity, | |
980 | the current range (if any) and current cell are not highlighted. | |
981 | .\" ---------- | |
982 | .TP | |
983 | .B ^X | |
984 | This command is similar to | |
985 | .IR ^R , | |
986 | but highlights cells which have expressions. | |
987 | It also displays the expressions in the highlighted cells | |
988 | as left-flushed strings, | |
989 | instead of the numeric values and/or label strings of those cells. | |
990 | This command makes it easier to check expressions, | |
991 | at least when they fit in their cells or the following cell(s) are blank | |
992 | so the expressions can slop over (like label strings). | |
993 | In the latter case, the slop over is not cleared on the next screen update, | |
994 | so you may want to type | |
995 | .I ^L | |
996 | after the | |
997 | .I ^X | |
998 | in order to clean up the screen. | |
999 | .\" ---------- | |
1000 | .TP | |
1001 | .B @ | |
1002 | Recalculates the spreadsheet. | |
1003 | .\" ---------- | |
1004 | .TP | |
1005 | .B ^V | |
1006 | Type, in the command line, the name of the current cell | |
1007 | (the one at the cell cursor). | |
1008 | This is useful when entering expressions | |
1009 | which refer to other cells in the table. | |
1010 | .\" ---------- | |
1011 | .TP | |
1012 | .B ^W | |
1013 | Type, in the command line, the expression attached to the current cell. | |
1014 | If there is none, the result is ``?''. | |
1015 | .\" ---------- | |
1016 | .TP | |
1017 | .B ^A | |
1018 | Type, in the command line, the numeric value of the current cell, if any. | |
1019 | .\" ---------- | |
1020 | .PP | |
1021 | The | |
1022 | .IR ^V , | |
1023 | .IR ^W , | |
1024 | and | |
1025 | .I ^A | |
1026 | commands only work when the character cursor | |
1027 | is on the command line and beyond the first character. | |
1028 | .\" ---------- | |
1029 | .TP | |
1030 | .B TAB | |
1031 | When the character cursor is on the top line, | |
1032 | defines a range of cells via the cursor control commands or the arrow keys. | |
1033 | The range is highlighted, | |
1034 | starts at the cell where you typed | |
1035 | .SM TAB, | |
1036 | and continues through the current cell cursor. | |
1037 | Pressing | |
1038 | .SM TAB | |
1039 | again causes the highlighted range to be entered into the command line | |
1040 | and the highlighting to be turned off. | |
1041 | This is most useful for defining ranges to functions such as | |
1042 | .IR @sum (). | |
1043 | Pressing ``)'' acts just like typing the | |
1044 | .SM TAB | |
1045 | key the second time and adds the closing ``)''. | |
1046 | Note that when you give a range command, | |
1047 | you don't need to press the first | |
1048 | .SM TAB | |
1049 | to begin defining a range starting with the current cell. | |
1050 | .\" ========== | |
1051 | .SS "Variable Names" | |
1052 | .\" ---------- | |
1053 | Normally, a variable name is just the name of a cell, such as | |
1054 | .IR K20 . | |
1055 | The value is the numeric or string value of the cell, | |
1056 | according to context. | |
1057 | .\" ---------- | |
1058 | .PP | |
1059 | When a cell's expression (formula) is copied to another location via | |
1060 | .I copy | |
1061 | or | |
1062 | .IR range-copy , | |
1063 | variable references are by default offset by the amount the formula moved. | |
1064 | This allows the new formula to work on new data. | |
1065 | If cell references are not to change, | |
1066 | you can either use the | |
1067 | .I fixed | |
1068 | operator (see below), | |
1069 | or one of the following variations on the cell name. | |
1070 | .\" ---------- | |
1071 | .TP | |
1072 | .I K20 | |
1073 | References cell | |
1074 | .IR K20 ; | |
1075 | the reference changes when the formula is copied. | |
1076 | .\" ---------- | |
1077 | .TP | |
1078 | .BI $ K $ 20 | |
1079 | Always refers to cell | |
1080 | .IR K20 ; | |
1081 | the reference stays fixed when the formula is copied. | |
1082 | .\" ---------- | |
1083 | .TP | |
1084 | .BI $ K20 | |
1085 | Keeps the column fixed at column K; | |
1086 | the row is free to vary. | |
1087 | .\" ---------- | |
1088 | .TP | |
1089 | .IB K $ 20 | |
1090 | Similarly, this fixes the row and allows the column to vary. | |
1091 | .\" ---------- | |
1092 | .PP | |
1093 | These conventions also hold on defined ranges. | |
1094 | Range references vary when formulas containing them are copied. | |
1095 | If the range is defined with fixed variable references, | |
1096 | the references do not change. | |
1097 | .\" ---------- | |
1098 | .TP | |
1099 | .B fixed | |
1100 | To make a variable not change automatically when a cell moves, | |
1101 | put the word | |
1102 | .I fixed | |
1103 | in front of the reference, for example: | |
1104 | B1 \(** fixed C3. | |
1105 | .\" ========== | |
1106 | .SS "Numeric Expressions" | |
1107 | .\" ---------- | |
1108 | Numeric expressions used with the ``='' | |
1109 | and | |
1110 | .I e | |
1111 | commands have a fairly conventional syntax. | |
1112 | Terms may be | |
1113 | constants, | |
1114 | variable names, | |
1115 | parenthesized expressions, | |
1116 | and negated terms. | |
1117 | Ranges may be operated upon with range functions such as sum | |
1118 | .RI ( @sum ()) | |
1119 | and average | |
1120 | .RI ( @avg ()). | |
1121 | Terms may be combined using binary operators. | |
1122 | .\" ---------- | |
1123 | .TP | |
1124 | .BR \- e | |
1125 | Negation. | |
1126 | .\" ---------- | |
1127 | .TP | |
1128 | .RB e + e | |
1129 | Addition. | |
1130 | .\" ---------- | |
1131 | .TP | |
1132 | .RB e \- e | |
1133 | Subtraction. | |
1134 | .\" ---------- | |
1135 | .TP | |
1136 | .RB e \(** e | |
1137 | Multiplication. | |
1138 | .\" ---------- | |
1139 | .TP | |
1140 | .RB e / e | |
1141 | Division. | |
1142 | .\" ---------- | |
1143 | .TP | |
1144 | .RB e1 % e2 | |
1145 | e1 mod e2. | |
1146 | .\" ---------- | |
1147 | .TP | |
1148 | .RB e ^ e | |
1149 | Exponentiation. | |
1150 | .\" ---------- | |
1151 | .TP | |
1152 | .RB e < e | |
1153 | .PD 0 | |
1154 | .TP | |
1155 | .RB e <= e | |
1156 | .TP | |
1157 | .RB e = e | |
1158 | .TP | |
1159 | .RB e != e | |
1160 | .TP | |
1161 | .RB e >= e | |
1162 | .TP | |
1163 | .RB e > e | |
1164 | Relationals: | |
1165 | true (1) if and only if the indicated relation holds, | |
1166 | else false (0). | |
1167 | Note that ``<='', ``!='', and ``>='' | |
1168 | are converted to their ``~()'' equivalents. | |
1169 | .PD | |
1170 | .\" ---------- | |
1171 | .TP | |
1172 | .BR ~ e | |
1173 | Boolean operator | |
1174 | .SM NOT. | |
1175 | .\" ---------- | |
1176 | .TP | |
1177 | .RB e & e | |
1178 | Boolean operator | |
1179 | .SM AND. | |
1180 | .\" ---------- | |
1181 | .TP | |
1182 | .RB e | e | |
1183 | Boolean operator | |
1184 | .SM OR. | |
1185 | .\" ---------- | |
1186 | .TP | |
1187 | .RB @if (e, e, e) | |
1188 | .PD 0 | |
1189 | .TP | |
1190 | .RB e ? e : e | |
1191 | Conditional: | |
1192 | If the first expression is true then the value of the second is returned, | |
1193 | otherwise the value of the third. | |
1194 | .\" ---------- | |
1195 | .PP | |
1196 | Operator precedence from highest to lowest is: | |
1197 | .PP | |
1198 | .nf | |
1199 | .RS | |
1200 | \-, ~ | |
1201 | ^ | |
1202 | \(**, / | |
1203 | +, \- | |
1204 | <, <=, =, !=, >=, > | |
1205 | & | |
1206 | | | |
1207 | ?: | |
1208 | .RE | |
1209 | .fi | |
1210 | .\" ========== | |
1211 | .SS "Built-in Range Functions" | |
1212 | .\" ---------- | |
1213 | These functions return numeric values. | |
1214 | .\" ---------- | |
1215 | .TP 18 | |
1216 | .BR @sum (r) | |
1217 | Sum all valid (nonblank) entries in the region | |
1218 | whose two corners are defined by the two variable names (e.g. | |
1219 | .IR c5:e14 ) | |
1220 | or the range name specified. | |
1221 | .\" ---------- | |
1222 | .TP 18 | |
1223 | .BR @prod (r) | |
1224 | Multiply together all valid (nonblank) entries in the specified region. | |
1225 | .\" ---------- | |
1226 | .TP 18 | |
1227 | .BR @avg (r) | |
1228 | Average all valid (nonblank) entries in the specified region. | |
1229 | .\" ---------- | |
1230 | .TP 18 | |
1231 | .BR @count (r) | |
1232 | Count all valid (nonblank) entries in the specified region. | |
1233 | .\" ---------- | |
1234 | .TP 18 | |
1235 | .BR @max (r) | |
1236 | Return the maximum value in the specified region. See also the multi argument | |
1237 | version of | |
1238 | .I @max | |
1239 | below. | |
1240 | .\" ---------- | |
1241 | .TP 18 | |
1242 | .BR @min (r) | |
1243 | Return the minimum value in the specified region. See also the multi argument | |
1244 | version of | |
1245 | .I @min | |
1246 | below. | |
1247 | .\" ---------- | |
1248 | .TP 18 | |
1249 | .BR @stddev (r) | |
1250 | Return the sample standard deviation of the cells in the specified region. | |
1251 | .\" ---------- | |
1252 | .TP 18 | |
1253 | .BR @lookup (e,r) | |
1254 | .PD 0 | |
1255 | .TP 18 | |
1256 | .BR @lookup (se,r) | |
1257 | .PD | |
1258 | Evaluates the expression then searches through the range | |
1259 | .I r | |
1260 | for a matching value. | |
1261 | The range should be either a single row or a single column. | |
1262 | The expression can be either a string | |
1263 | expression or a numeric expression. If it is a numeric expression, | |
1264 | the range is searched for the the last value less than or equal to | |
1265 | .IR e . | |
1266 | If the expression is a string expression, the string portions | |
1267 | of the cells in the range are searched for an exact string match. | |
1268 | The value returned is the numeric value from the next row and the same | |
1269 | column as the match, if the range was a single row, or the value from | |
1270 | the next column and the same row as the match if the range was a single | |
1271 | column. | |
1272 | .\" ---------- | |
1273 | .TP 18 | |
1274 | .BR @hlookup (e,r,n) | |
1275 | .PD 0 | |
1276 | .TP 18 | |
1277 | .BR @hlookup (se,r,n) | |
1278 | .PD | |
1279 | Evaluates the expression then searches through the first row in the range | |
1280 | .I r | |
1281 | for a matching value. | |
1282 | The expression can be either a string | |
1283 | expression or a numeric expression. If it is a numeric expression, | |
1284 | the row is searched for the the last value less than or equal to | |
1285 | .IR e . | |
1286 | If the expression is a string expression, the string portions | |
1287 | of the cells in the row are searched for an exact string match. | |
1288 | The value returned is the numeric value from the same column | |
1289 | .I n | |
1290 | rows below the match. | |
1291 | .\" ---------- | |
1292 | .TP 18 | |
1293 | .BR @vlookup (e,r,n) | |
1294 | .PD 0 | |
1295 | .TP 18 | |
1296 | .BR @vlookup (se,r,n) | |
1297 | .PD | |
1298 | Evaluates the expression then searches through the first column in the range | |
1299 | .I r | |
1300 | for a matching value. | |
1301 | The expression can be either a string | |
1302 | expression or a numeric expression. If it is a numeric expression, | |
1303 | the column is searched for the the last value less than or equal to | |
1304 | .IR e . | |
1305 | If the expression is a string expression, the string portions | |
1306 | of the cells in the column are searched for an exact string match. | |
1307 | The value returned is the numeric value from the same row | |
1308 | .I n | |
1309 | columns to the right of the match. | |
1310 | .\" ---------- | |
1311 | .TP 18 | |
1312 | .BR @index (e,r) | |
1313 | Use the value of the expression | |
1314 | .I e | |
1315 | to index into | |
1316 | the range | |
1317 | .IR r . | |
1318 | The numeric value at that position is returned. | |
1319 | The value 1 selects the first item in the range, | |
1320 | 2 selects the second item, etc. | |
1321 | .I R | |
1322 | should be either a single row or a single | |
1323 | column. | |
1324 | .\" ---------- | |
1325 | .TP 18 | |
1326 | .BR @stindex (e,r) | |
1327 | Use the value of | |
1328 | .I e | |
1329 | to index into | |
1330 | the range | |
1331 | .IR r . | |
1332 | The string value at that position is returned. | |
1333 | The value 1 selects the first item in the range, | |
1334 | 2 selects the second item, etc. | |
1335 | The range should be either a single row or a single | |
1336 | column. | |
1337 | .\" ========== | |
1338 | .SS "Built-in Numeric Functions" | |
1339 | .\" ---------- | |
1340 | All of these functions operate on floating point numbers (doubles) | |
1341 | and return numeric values. | |
1342 | Most of them are standard system functions more fully described in | |
1343 | .IR math (3). | |
1344 | The trig functions operate with angles in radians. | |
1345 | .\" ---------- | |
1346 | .TP 18 | |
1347 | .BR @sqrt (e) | |
1348 | Return the square root of | |
1349 | .IR e . | |
1350 | .\" ---------- | |
1351 | .TP 18 | |
1352 | .BR @exp (e) | |
1353 | Return the exponential function of | |
1354 | .IR e . | |
1355 | .\" ---------- | |
1356 | .TP 18 | |
1357 | .BR @ln (e) | |
1358 | Return the natural logarithm of | |
1359 | .IR e . | |
1360 | .\" ---------- | |
1361 | .TP 18 | |
1362 | .BR @log (e) | |
1363 | Return the base 10 logarithm of | |
1364 | .IR e . | |
1365 | .\" ---------- | |
1366 | .TP 18 | |
1367 | .BR @floor (e) | |
1368 | Return the largest integer not greater than | |
1369 | .IR e . | |
1370 | .\" ---------- | |
1371 | .TP 18 | |
1372 | .BR @ceil (e) | |
1373 | Return the smallest integer not less than | |
1374 | .IR e . | |
1375 | .\" ---------- | |
1376 | .TP 18 | |
1377 | .BR @rnd (e) | |
1378 | Round | |
1379 | .I e | |
1380 | to the nearest integer. | |
1381 | .TP 18 | |
1382 | .BR @round (e,n) | |
1383 | Round | |
1384 | .I e | |
1385 | to | |
1386 | .I n | |
1387 | decimal places. | |
1388 | .\" ---------- | |
1389 | .TP 18 | |
1390 | .BR @abs (e) | |
1391 | .PD 0 | |
1392 | .TP 18 | |
1393 | .BR @fabs (e) | |
1394 | Return the absolute value of | |
1395 | .IR e . | |
1396 | .\" ---------- | |
1397 | .TP 18 | |
1398 | .BR @pow (e1,e2) | |
1399 | Return | |
1400 | .I e1 | |
1401 | raised to the power of | |
1402 | .IR e2 . | |
1403 | .\" ---------- | |
1404 | .TP 18 | |
1405 | .BR @hypot (e1,e2) | |
1406 | Return sqrt(e1\(**e1+e2\(**e2), taking precautions against unwarranted | |
1407 | overflows. | |
1408 | .\" ---------- | |
1409 | .TP 18 | |
1410 | .B pi | |
1411 | A constant quite close to pi. | |
1412 | .\" ---------- | |
1413 | .TP 18 | |
1414 | .BR @dtr (e) | |
1415 | Convert | |
1416 | .I e | |
1417 | in degrees to radians. | |
1418 | .\" ---------- | |
1419 | .TP 18 | |
1420 | .BR @rtd (e) | |
1421 | Convert | |
1422 | .I e | |
1423 | in radians to degrees. | |
1424 | .\" ---------- | |
1425 | .TP 18 | |
1426 | .BR @sin (e) | |
1427 | .PD 0 | |
1428 | .TP 18 | |
1429 | .BR @cos (e) | |
1430 | .TP 18 | |
1431 | .BR @tan (e) | |
1432 | Return trigonometric functions of radian arguments. | |
1433 | The magnitude of the arguments are not checked to assure meaningful results. | |
1434 | .PD | |
1435 | .\" ---------- | |
1436 | .TP 18 | |
1437 | .BR @asin (e) | |
1438 | Return the arc sine of | |
1439 | .I e | |
1440 | in the range -pi/2 to pi/2. | |
1441 | .\" ---------- | |
1442 | .TP 18 | |
1443 | .BR @acos (e) | |
1444 | Return the arc cosine of | |
1445 | .I e | |
1446 | in the range 0 to pi. | |
1447 | .\" ---------- | |
1448 | .TP 18 | |
1449 | .BR @atan (e) | |
1450 | Return the arc tangent of | |
1451 | .I e | |
1452 | in the range -pi/2 to pi/2. | |
1453 | .\" ---------- | |
1454 | .TP 18 | |
1455 | .BR @atan2 (e1,e2) | |
1456 | Returns the arc tangent of | |
1457 | .IR e1 / e2 | |
1458 | in the range -pi to pi. | |
1459 | .\" ---------- | |
1460 | .TP 18 | |
1461 | .BR @max (e1,e2,...) | |
1462 | Return the maximum of the values of the expressions. Two or more expressions | |
1463 | may be specified. See also the range version of | |
1464 | .I @max | |
1465 | above. | |
1466 | .\" ---------- | |
1467 | .TP 18 | |
1468 | .BR @min (e1,e2,...) | |
1469 | Return the minimum of the values of the expressions. Two or more expressions | |
1470 | may be specified. See also the range version of | |
1471 | .I @min | |
1472 | above. | |
1473 | .\" ---------- | |
1474 | .TP 18 | |
1475 | .BR @ston (se) | |
1476 | Convert string expression | |
1477 | .I se | |
1478 | to a numeric value. | |
1479 | .\" ---------- | |
1480 | .TP 18 | |
1481 | .BR @eqs (se1,se2) | |
1482 | Return 1 if string expression | |
1483 | .I se1 | |
1484 | has the same value as string expression | |
1485 | .IR se2 , | |
1486 | 0 otherwise. | |
1487 | .\" ---------- | |
1488 | .TP 18 | |
1489 | .BR @nval (se,e) | |
1490 | Return the numeric value of a cell selected by name. | |
1491 | String expression | |
1492 | .I se | |
1493 | must evaluate to a column name (``A''-``AE'') and | |
1494 | .I e | |
1495 | must evaluate to a row number (0-199). | |
1496 | If | |
1497 | .I se | |
1498 | or | |
1499 | .I e | |
1500 | is out of bounds, or the cell has no numeric value, the result is 0. | |
1501 | You can use this for simple table lookups. | |
1502 | Be sure the table doesn't move unexpectedly! | |
1503 | See also | |
1504 | .IR @sval () | |
1505 | below. | |
1506 | .\" ========== | |
1507 | .SS "String Expressions" | |
1508 | .\" ---------- | |
1509 | String expressions are made up of constant strings | |
1510 | (characters surrounded by double quotation marks), | |
1511 | variables | |
1512 | (cell names, which refer to the cells's label strings or expressions), | |
1513 | and string functions. | |
1514 | Note that string expressions are only allowed | |
1515 | when entering a cell's label string, not its numeric part. | |
1516 | Also note that string expression results may be left or right flushed, | |
1517 | according to the type of the cell's string label. | |
1518 | .\" ---------- | |
1519 | .TP | |
1520 | .B # | |
1521 | Concatenate strings. | |
1522 | For example, the string expression | |
1523 | .IP "" | |
1524 | A0 # "zy dog" | |
1525 | .IP "" | |
1526 | displays the string ``the lazy dog'' in the cell if the value of | |
1527 | .IR A0 's | |
1528 | string is ``the la''. | |
1529 | .\" ========== | |
1530 | .SS "Built-in String Functions" | |
1531 | .\" ---------- | |
1532 | \0 \" exactly one blank line (hard to get) | |
1533 | .PD 0 | |
1534 | .TP 18 | |
1535 | .BR @substr (se,e1,e2) | |
1536 | Extract and return from string expression | |
1537 | .I se | |
1538 | the substring indexed by character number | |
1539 | .I e1 | |
1540 | through character number | |
1541 | .I e2 | |
1542 | (defaults to the size of | |
1543 | .I se | |
1544 | if beyond the end of it). | |
1545 | If | |
1546 | .I e1 | |
1547 | is less than 1 or greater than | |
1548 | .IR e2 , | |
1549 | the result is the null string. | |
1550 | For example, | |
1551 | .PD | |
1552 | .IP "" | |
1553 | @substr ("Nice jacket", 4, 7) | |
1554 | .IP "" | |
1555 | returns the string ``e jac''. | |
1556 | .\" ---------- | |
1557 | .TP 18 | |
1558 | .BR @fmt (se,e) | |
1559 | Convert a number to a string. | |
1560 | The argument | |
1561 | .I se | |
1562 | must be a valid | |
1563 | .IR printf (3) | |
1564 | format string. | |
1565 | .I e | |
1566 | is converted according to the standard rules. | |
1567 | For example, the expression | |
1568 | .IP "" | |
1569 | @fmt ("\(**\(**%6.3f\(**\(**", 10.5) | |
1570 | .IP "" | |
1571 | yields the string ``\(**\(**10.500\(**\(**''. | |
1572 | .I e | |
1573 | is a double, so applicable formats are e, E, f, g, and G. | |
1574 | Try ``%g'' as a starting point. | |
1575 | .\" ---------- | |
1576 | .TP 18 | |
1577 | .BR @sval (se,e) | |
1578 | Return the string value of a cell selected by name. | |
1579 | String expression | |
1580 | .I se | |
1581 | must evaluate to a column name (``A''-``AE'') and | |
1582 | .I e | |
1583 | must evaluate to a row number (0-199). | |
1584 | If | |
1585 | .I se | |
1586 | or | |
1587 | .I e | |
1588 | is out of bounds, or the cell has no string value, | |
1589 | the result is the null string. | |
1590 | You can use this for simple table lookups. | |
1591 | Be sure the table doesn't move unexpectedly! | |
1592 | .\" ---------- | |
1593 | .TP 18 | |
1594 | .BR @ext (se,e) | |
1595 | Call an external function (program or script). | |
1596 | The purpose is to allow arbitrary functions on values, | |
1597 | e.g. table lookups and interpolations. | |
1598 | String expression | |
1599 | .I se | |
1600 | is a command or command line to call with | |
1601 | .IR popen (3). | |
1602 | The value of | |
1603 | .I e | |
1604 | is converted to a string and appended to the command line as an argument. | |
1605 | The result of | |
1606 | .IR @ext () | |
1607 | is a string: | |
1608 | the first line printed to standard output by the command. | |
1609 | The command should emit exactly one output line. | |
1610 | Additional output, or output to standard error, messes up the screen. | |
1611 | .IR @ext () | |
1612 | returns a null string and prints an appropriate warning | |
1613 | if external functions are disabled, | |
1614 | .I se | |
1615 | is null, or the attempt to run the command fails. | |
1616 | .IP "" | |
1617 | External functions can be slow to run, | |
1618 | and if enabled are called at each screen update, | |
1619 | so they are disabled by default. | |
1620 | You can enable them with | |
1621 | .I ^T | |
1622 | when you really want them called. | |
1623 | .IP "" | |
1624 | A simple example: | |
1625 | .IP "" | |
1626 | @ext ("echo", a1) | |
1627 | .IP "" | |
1628 | You can use | |
1629 | .IR @ston () | |
1630 | to convert the | |
1631 | .IR @ext () | |
1632 | result back to a number. | |
1633 | For example: | |
1634 | .IP "" | |
1635 | @ston (@ext ("form.sc.ext", a9 + b9)) | |
1636 | .IP "" | |
1637 | Note that you can built a command line (including more argument values) | |
1638 | from a string expression with concatenation. | |
1639 | You can also "hide" the second argument by ending the command line | |
1640 | (first argument) with `` #'' (shell comment). | |
1641 | .\" ========== | |
1642 | .SS "Built-in Financial Functions" | |
1643 | .\" ---------- | |
1644 | Financial functions compute the mortgage (or loan) payment, future value, | |
1645 | and the present value functions. Each accepts | |
1646 | three arguments, an amount, a rate of interest (per period), and | |
1647 | the number of periods. | |
1648 | These functions are the same as those commonly found in other spreadsheets | |
1649 | and financial calculators | |
1650 | .\" ---------- | |
1651 | .TP 18 | |
1652 | .BR @pmt (e1,e2,e3) | |
1653 | .IR @pmt (60000,.01,360) | |
1654 | computes the monthly payments for a $60000 mortgage at 12% annual interest | |
1655 | (.01 per month) for 30 years (360 months). | |
1656 | .\" ---------- | |
1657 | .TP 18 | |
1658 | .BR @fv (e1,e2,e3) | |
1659 | .IR @fv (100,.005,36) | |
1660 | computes the future value for of 36 monthly payments of $100 at 6% | |
1661 | interest (.005 per month). It answers the question: "How much | |
1662 | will I have in 36 months if I deposit $100 per month in a savings | |
1663 | account paying 6% interest compounded monthly?" | |
1664 | .\" ---------- | |
1665 | .TP 18 | |
1666 | .BR @pv (e1,e2,e3) | |
1667 | .IR @pv (1000,.015,36) | |
1668 | computes the present value of an a ordinary annuity of | |
1669 | 36 monthly payments of $1000 at 18% annual interest. | |
1670 | It answers the question: "How much can I borrow at 18% for 30 years | |
1671 | if I pay $1000 per month?" | |
1672 | .\" ========== | |
1673 | .SS "Built-in Date and Time Functions" | |
1674 | .\" ---------- | |
1675 | Time for | |
20384acc | 1676 | .I sc |
343218ea KB |
1677 | follows the system standard: |
1678 | the number of seconds since 1970. | |
1679 | All date and time functions except | |
1680 | .IR @date () | |
1681 | return numbers, not strings. | |
1682 | .\" ---------- | |
1683 | .TP 18 | |
1684 | .B @now | |
1685 | Return the current time encoded | |
1686 | as the number of seconds since the beginning of the | |
1687 | epoch (December 31, 1969, midnight, GMT.) | |
1688 | .\" ---------- | |
1689 | .TP 18 | |
1690 | .BR @dts (e1,e2,e3) | |
1691 | .IR @dts (9,14,1988) | |
1692 | converts the date September 14, 1988 | |
1693 | to the number of seconds from the epoch | |
1694 | to the first second of 9/14/88, local time. | |
1695 | For example, | |
1696 | .IR @date ( @dts (12,14,1976)) | |
1697 | yields | |
1698 | .IP "" | |
1699 | .I " Tue Dec 14 00:00:00 1976" | |
1700 | .IP "" | |
1701 | The month should be range from 1 to 12, the day should range from | |
1702 | 1 to the number of days in the specified month, and the year should | |
1703 | range from 1970 to 1999. | |
1704 | .\" ---------- | |
1705 | .TP 18 | |
1706 | .BR @tts (e1,e2,e3) | |
1707 | .IR @tts (8,20,45) | |
1708 | converts the time 8:40:45 to the number of seconds since | |
1709 | midnight, the night before. The hour should range from 0 to 23; | |
1710 | the minutes and seconds should range from 0 to 59. | |
1711 | .\" ---------- | |
1712 | .PP | |
1713 | The following functions take the time in seconds | |
1714 | (e.g. from | |
1715 | .IR @now ) | |
1716 | as an argument and return the specified value. | |
1717 | The functions all convert from GMT to local time. | |
1718 | .\" ---------- | |
1719 | .TP 18 | |
1720 | .BR @date (e) | |
1721 | Convert the time in seconds to a date string | |
1722 | 24 characters long in the following form: | |
1723 | .IP "" | |
1724 | .I " Sun Sep 16 01:03:52 1973" | |
1725 | .IP "" | |
1726 | Note that you can extract parts of this fixed-format string with | |
1727 | .IR @substr (). | |
1728 | .\" ---------- | |
1729 | .TP 18 | |
1730 | .BR @year (e) | |
1731 | Return the year. | |
1732 | Valid years begin with 1970. | |
1733 | The last legal year is system dependent. | |
1734 | .\" ---------- | |
1735 | .TP 18 | |
1736 | .BR @month (e) | |
1737 | Return the month, encoded as 1 (January) to 12 (December). | |
1738 | .\" ---------- | |
1739 | .TP 18 | |
1740 | .BR @day (e) | |
1741 | Return the day of the month, encoded as 1 to 31. | |
1742 | .\" ---------- | |
1743 | .TP 18 | |
1744 | .BR @hour (e) | |
1745 | Return the number of hours since midnight, encoded as 0 to 23. | |
1746 | .\" ---------- | |
1747 | .TP 18 | |
1748 | .BR @minute (e) | |
1749 | Return the number of minutes since the last full hour, encoded as 0 to 59. | |
1750 | .\" ---------- | |
1751 | .TP 18 | |
1752 | .BR @second (e) | |
1753 | Return the number of seconds since the last full minute, encoded as 0 to 59. | |
1754 | .\" ========== | |
1755 | .SS "Spreadsheet Update" | |
1756 | .\" ---------- | |
1757 | Re-evaluation of spreadsheet expressions | |
1758 | is done by row or by column depending on the selected calculation order. | |
1759 | Evaluation is repeated up to | |
1760 | .I iterations | |
1761 | times for each update if necessary, | |
1762 | so forward references usually work as expected. See | |
1763 | .I set | |
1764 | above. | |
1765 | If stability is not reached after ten iterations, | |
1766 | a warning is printed. | |
1767 | This is usually due to a long series of forward references, | |
1768 | or to unstable cyclic references (for example, set | |
1769 | .IR A0 's | |
1770 | expression to ``A0+1''). | |
1771 | .\" ========== | |
1772 | .SH SEE ALSO | |
20384acc | 1773 | bc(1), dc(1), crypt(1) |
343218ea KB |
1774 | .\" ========== |
1775 | .SH BUGS | |
1776 | Top-to-bottom, left-to-right evaluation of expressions is silly. | |
1777 | A proper following of the dependency graph | |
1778 | with (perhaps) recourse to relaxation should be implemented. | |
1779 | .\" ---------- | |
1780 | .PP | |
1781 | Editing is crude. | |
1782 | All you can do is backspace over and retype text to be altered. | |
1783 | There is no easy way to switch a leftstring to a rightstring or vice versa. | |
1784 | Of course, you can always write the spreadsheet to a file with | |
1785 | .IR Put , | |
1786 | edit it by calling an editor on the file with ``!'', | |
1787 | and read it back with | |
1788 | .I Get | |
1789 | -- if you are comfortable editing spreadsheet files. | |
1790 | .\" ---------- | |
1791 | .PP | |
1792 | Only one previous value is saved from any call of | |
1793 | .IR @ext (). | |
1794 | If it is used more than once in a spreadsheet | |
1795 | and external functions are enabled and later disabled, | |
1796 | the last returned value pops up in several places. | |
1797 | .\" ---------- | |
1798 | .PP | |
1799 | On some systems, | |
1800 | if the cell cursor is in column 0 with topline enabled | |
1801 | (so the current cell is highlighted), | |
1802 | or if any cell in column 0 is highlighted, | |
1803 | the corresponding row number gets displayed and then blanked | |
1804 | during a screen refresh. | |
1805 | This looks like a bug in | |
1806 | .IR curses . | |
1807 | .\" ---------- | |
1808 | .PP | |
1809 | Many commands give no indication (a message or beep) if they have null effect. | |
1810 | Some should give confirmation of their action, but they don't. |