1 OVERVIEW PortaCalc PortaCalc is an electronic spreadsheet program which was written in "portable" Fortran 66 and runs on your PDP11 or VAX systems. It has a variety of commands and operates on a "command verb" syntax. That is, everything you tell it is a command. Some commands enter numbers or formulae; others manipulate them or change the display. Online help is available (though limited) via the Help command (or the PF2 key on some systems). 2 INTRODUCTION Getting Started with PortaCalc When using PortaCalc, you will find its commands are NOT similar to commercial spreadsheets. This has happened because of the method for reading them in. Do NOT expect to use the same commands you learned with Visicalc here. Few if any of them are the same. Do, however, expect to be able to perform the same functions, even if a bit differently. You will probably find this a more powerful program than you knew on the micros. It just takes some learning. The PortaCalc spreadsheet asks some questions when you run it, to set up its working storage. PortaCalc contains a direct access file which it sets up and can reuse or reinitialize, containing the basic information for the spreadsheet's physical sheet. 3 INITIAL QUESTIONS When you run PortaCalc, it first asks you whether to change the default floating point format. This is initially set to the Fortran format F9.2 (9 characters wide, 2 decimal places), but if you reply Y, it lets you enter any format you like as the default format. It will try to use it, so if you enter an illegal format, PortaCalc will issue error messages before it generates a bad workfile. Note that the default applies when the workfile is BUILT, not later (though the DF command will reset the format of any part of the file later). Portacalc then asks you to enter up to 80 characters as the Title of the spreadsheet. To reply, enter any title you like, up to 80 characters long, followed (as all PortaCalc commands) by a carriage return (labelled RETURN on the VT100). This will appear across the top of the sheet on screen and in print images of it. You may include any desired leading spaces in the title. It will be printed on screen printouts, so make it descriptive of the sheet you'll be using. The next question is whether there is already a work file on disk to use or reuse. If you have such a file, you can save considerable time by letting PortaCalc just reuse it. PortaCalc will create one if none exists, but one already in existence can be more quickly set up. Reply N if there is no file and one must be made. The reply Y will cause PortaCalc to read the old file and find out what format entries are valid over the whole sheet, so that an old sheet's workfile can be used to continue; formulas and format information is still there. To start quickly, you can type Q, which means PortaCalc does not read the whole file, but only the default display window part. If you choose this option, all cells will start with 0 until the first R (Recalculate)command is given, when the values in the display window will reappear. Other cells' values will not be set up however, so large sheets may need the Y option if the old cells are to be used outside the immediate display area. Note that the Q option is likely NOT to work if you have used integer formats. In that case, ALWAYS use the P and G commands to save and load sheets. These are a good idea anyway. They permit sheets to be loaded across PortaCalc versions, and some variants permit graphing the entries. A workfile is only usable as long as the physical sheet PortaCalc is compiled for is identical to that which created the workfile. The last question of this setup phase is the filename. A standard filename, either that of the old file, or the name to use for a new one, is required. Limit it to the max supported by your system for names (on DEC, 9 character names max). If the Q option is not given, PortaCalc displays its help file while initializing the file or reading it, then goes into the sheet proper. 3 DISPLAY The sheet is displayed at the top part of the screen and a command cell in Row 23 is shown with the current position encoded. This starts off looking like A 1> and then PortaCalc awaits your commands. Note that if the cell pointed to by the command (which is always a Physical sheet address) is occupied (i.e., has ever had any numbers or text entered into it), that cell is displayed in the display in reverse video when you are positioned there. If the cell is totally empty, it is not displayed, however, in any reverse video. A pattern of >-< is displayed, however, wherever the cell is null. This pattern is in reverse video. 3 CONTROL You control the sheet by entering a command followed by Return. These commands are in the first few columns of the command line and are the first few characters (often the first 1 or 2) you type, and they are REQUIRED for every command. PortaCalc does NOT assume any command names. Commands entered to PortaCalc MUST BE IN UPPER CASE. Text entered can be of either case. For PDP11 and VAX, most versions of Portacalc now translate cases unless the " character is seen on the line (see below). 2 COMMANDS The commands available in PortaCalc are each described separately. 3 ENTER ENTER E expression This command enters the given expression at your current cursor position, and may optionally move in some direction that has been set up by the M command (Move) after the entry is made. The text entered becomes the Formula for that cell, and PortaCalc takes a guess as to whether that text is just text or a number to compute. If the text contains any of the characters (, +, -, ., or [, it is assumed to be a formula, and the cell is marked as containing a computable formula. Otherwise it is just treated as a label and the formula itself is displayed. If you find the guess is not to your liking, the DF command below lets you alter the format and tell PortaCalc that the entry is / is not a numeric. An additional special character is the '"' (double quote) character. If this character appears any- where in the entered formula, PortaCalc will take the formula as text, regardless of whatever else is in it. You can also combine comments and formulas by using a separate statement and the *C construct (e.g. SUM[A3:A12]\SQRT(%)\*C SQUARE ROOT OF THE LENGTHS) of Calc. Where the auxiliary console support routines supplied for PDP11 or VAX are in use, any commands will be translated to upper case unless a " character appears anywhere in the command. If a " character is found, only the first 2 characters are converted. These special console routines also attempt to convert the PF2 key to H (Help) (as in EDT), and to convert the arrow keys of VT100 or VT52 to the 1,2,3, or 4 commands to move the current cell. This works on PDP11, but still fails on VAX. The terminal must be set to /ESCSEQ to allow this; the VAX version seems to need something more. The PDP11 version performs all these functions correctly however. 4 EXAMPLES The expressions that are entered can be numbers or formulas relating numbers and other cells. They may also consist of several statements separated by a \ character which will all be evaluated at that cell, up to 110 characters. Thus, valid commands might be E 55.234 Enters literal value 55.234 at current cell E B4+H2+D5 Cell will contain the sum of cells B4,H2, and D5. E Totals Cell contains literal text "Totals". 4 FORMULAS Formulas may be used too. These are in 2 classes. The first are the multi-argument functions, which must appear at the start of their statements or substatements. The ones present are: SUM[variables] Sum of all arguments MAX[variables] Max of arguments MIN[variables] Min of arguments AVG[variables] Average of arguments STD[variables] Standard deviation squared IF [V1.rel.V2] statement | else-statement In the first 5 cases, arguments are variable names separated by commas, or variable ranges, or mixtures separaged by columns. 4 VARIABLE_NAMES A valid variable name might be H14 or N22 or A3, or the position independent forms P#n#m and D#n#m where n and m are offsets in Physical or Display sheets from the current column and row. A valid range is 2 variable names separated by colon (:). Thus the range B2:B12 is valid and means B2 through B12 inclusive. The range expression D#0#1:D#0#12 is also valid and means the cells on the display sheet in the same column but 1 to 12 rows down from the current cell inclusive. (The displacements may be negative too, with - sign to indicate it, as D#-3#2 for the display cell 3 columns left and 2 rows down from the current position.) The P# and D# forms are valuable since they work wherever you move them. Other variables may be relocated when moved (renaming them to correspond to their new locations), but the P# and D# forms need never change and allow working with projections across the physical sheet in various ways. 4 VARIABLE_RANGES Variable ranges must lie in a single row or column. Erroneous specifications are rejected and ignored generally. 4 FUNCTION_ARGUMENTS Note that the square brackets ([]) are needed to delimit arguments in these forms. The results are left in accumulator % and in the cell. The IF form will compare 2 variables and execute either the statement or the else-statement (which must NOT be another IF). The valid relations are: .EQ. Equal .NE. Not Equal .GT. Greater than (V1 greater than V2) .LT. Less than (V1 less than V2) .GE. Greater than or Equal to (V1 >= V2) .LE. Less than or Equal to (V1 =< V2) and must appear in this form. (Note that your formulas must generally be in upper case only; text can be anything.) 4 UNARY_FUNCTIONS The second class of formulas is what the Calc program interprets. These are more conventional, use parentheses, and include single argument functions like SQRT, ALOG, EXP, SIN, COS, and so on. See the Calc manual for more detail. However, they may use variable names as anywhere, not just single letter accumulators. Thus, SQRT(A5) is a valid number. 4 ACCUMULATORS The single letter accumulators of Calc (letters A through Z and %) are available globally and may take on all Calc data types (see the description of calc mode below) including multiple precision. They are usable globally on the entire sheet and may serve as arguments to command files or return cells for results. Inside command files, Calc can perform any of its usual calculations. The multi-argument functions listed above are not available there (though they can be simulated by enumerating cells), but everything else is. The letter accumulators are available in all cases in addition to cells. Of course, any unused cell may be used as an accumulator too, but cells in the spreadsheet are at most 8 bytes long and cannot hold multiple precision arguments. To get, e.g., the square root of the sum of several variables (in a row or column; ranges may only be in rows or columns together) one might have a formula line like: SUM[A1:A20,B4,F2,C5:C20,J3:M3]\SQRT(%) which computes the sum of the 2 cells and 3 ranges and leaves it in %, then computes the square root of that and leaves it in the cell. The formulas to Calc may be complex but MUST NOT be longer than 78 characters. Break up longer ones so they can be fed to Calc in smaller chunks. 4 AUX_COMMANDS The commands of CALC should be examined carefully for usefulness. You can enter programs into CALC which can be used as user-defined functions from the sheet if need be. Also, there are a few new commands in CALC for the sheet. One of these is the *G command. Its syntax is *G V1,V2 which has the effect of evaluating variables V1 and V2 as column and row numbers on the physical sheet and returning the physical sheet variable addressed by those variables. The ranges are clamped to fit on the sheet. This gives indirect addressing, permitting lookup tables to be made up by creating the index you want and then accessing the addressed table element. Typically the *G command would be the last on a formula line, though it need not be. Its value is returned in the % accumulator. Another is the *W command, which simply takes the number in % and places it in the formula for the current cell on the spread sheet. This may be used to "freeze" a value, replacing a formula by a constant for future use. Note that the previous contents of the formula entry are lost. Thus, a *W command in the sheet will normally cause itself to be overwritten after one use. The number is stored in a format E35.24 in the worksheet. To implement user functions, if Calc sees an expression of the form "@filename.ext", it will execute that file as a command at that cell. Any filename may be used and as many functions as desired can be handled in this way (with obvious overhead), with nesting depth of up to 3 permitted. Once Calc starts using logical unit 4, however, it conflicts with the P or G commands and may have problems. Calc has also a command called *P which allows resetting of the physical coordinates while executing a cell's formulas, FOR THE DURATION OF THAT CELL'S FORMULA ONLY or while in K mode only. The syntax of the *P command is either just *P (which causes Calc to prompt for column and row), or *P Variablename (which moves the current location to the named location), or *P@ variable1,variable2 (which moves to the location which is defined by variable 1 and 2 as col. and row). Some other commands exist for the main benefit of PortaCalc in Calc. The command *F LABEL will evaluate the % variable. If it is positive and nonzero, then the current input line will be rewound and the program will (silently) seek a line of the form *CLABEL. This allows loops to be defined with % as the counter. This command acts on the unit used by the Portacalc @ command, NOT the unit for the Calc @ command, and is a way that the Calc formula conditionals may be reflected back into its command processing. The command *J LABEL will act as does *F LABEL but its search will be in the current file opened by a Calc @ command (i.e., an @file inside a cell on the sheet, or given from the console after a K command [see below] to enter bare interactive Calc). The command *QF or *QW file ?searchkey? will open file and look for lines starting with searchkey as given (with _ as a wild character). Upon finding this, it will look for the and if it finds it, it will select the part of the line in the file between the 2 characters given (which may be alike) as they are first found, and will do one of 2 things. If the command was *QF, then Calc will Float the value found there (attempting to use a large E format) and return it in %. If the command was *QW, then Calc will Write the selected part of the record into the formula at the current physical position on the sheet (which may be reset by an IMMEDIATELY PRECEDING *P command). The record may contain the search key anywhere. It is up to the user to make sure the formulas copied make sense. This however allows access to sequential files of data which can be created by an editor, word processor, etc., and which might hold keyed information that the spreadsheet should be able to manipulate. As a user convenience, there may be a second key specified (also inside a pair of ?s). If two keys are specified, Calc will search for and require that BOTH be somewhere in the record accepted. Note too that the files opened may not have any records longer than 128 characters per line. 4 FORMULA_LENGTH Formulas have 109 characters allotted to them for use inside the spread sheet. It may happen these are not enough for use. In other spreadsheets, the technique is to put the formulas in other cells inside the sheet and possibly use screen windows to avoid display of the intermediate results. While you can use that technique here too, you have an alternative. It is to use an indirect file in that cell and inside the cell in the spreadsheet just have a command "@FILE.TYP" where the file is named "FILE.TYP" (you pick the real name). Inside this file may be whatever calculations you like. So long as the file is to operate in a fixed cell location in your spreadsheet, you may use variable names like A3, D1, etc. inside the file. Note that ranges (e.g. C2:C8) are NOT permitted inside files; nor are functions AVG,MAX,MIN,STD,SUM. You may however have a formula that looks like C2+C3+C4+C5+C6+C7+C8. Once you add or delete rows or columns, or copy a formula, though, the file will not work as expected if the cell calling it has moved. Since the relocation done by PortaCalc only operates on formulas stored directly in the spreadsheet, it cannot relocate variables in the indirect files. However, you can make the files "position independent" so they WILL work wherever they are called from. (This has the side benefit that a single file can be called from many cells.) The way to make the files position independent is to use location-relative variable names instead of absolute ones. That is, inside cell B4, the cell immediately above can be named B3 (the ABSOLUTE name), or it can be relocatably named P#0#-1 (the relative name). Likewise the cell one to the right would be named either C3 or P#1#0, and so on. The cell two down and one left would be either A5 or P#-1#2 (you can begin to see how it goes). A file containing only location-relative variable names will work even if called from a different cell, since the references will be figured out when used. These references are more difficult to write than the absolute ones, but since they work without renaming, they provide a level of flexibility needed where long formulas must be used. These forms should be used wherever indirect files are used to hold cell formulas. 4 LINKING_SHEETS LINKING SHEETS To enhance PortaCalc, it is possible to have a cell refer to cells from another, saved sheet anywhere in the system. The sheet must normally have been saved NUMERICALLY (see PPN command below) starting at the upper left (i.e., cell A1) as would be the convention for using with PCGRAF (see PCG.DOC). The command *XV filename V1 will eXtract the Value of cell V1 (V1 is any variable name, e.g. C15, AA3, F9, B34, etc.) from the saved sheet saved in filename. The filename is any legal host system file specifier. Note that there may be as many files as desired here, but only one cell is returned. If it is desired to extract a formula from a saved sheet saved NON-NUMERICALLY, the command form is *XF filename V1 and this will cause the formula in "filename"'s cell V1 to overwrite the current physical sheet. To avoid this, one might write a formula like *P V2 \*XF myfile.typ V1 which would cause current sheet variable V2 to have its' formula loaded from saved sheet "myfile.typ"'s variable V1. 3 EDIT EDIT FORMULAS ED 'string1'string2' Replace string1 with string2 in current cell formula. Either string may be null if desired. The ED command allows editing of formulas with some extra bells and whistles. Basically, the new string replaces the old one, EXCEPT that it is possible to do some limited argument replacement. The constructs &1 through &4 will be replaced by arguments 1 through 4 as last entered by the "-" command (see below). These may be from 0 to 51 characters long each, and multiple & constructs may appear in a substitution. No & constructs may recurse, however. A second ED command can have the effect of the recursion in some cases however. The construct &5 will evaluate accumulator Z and, if it is in a range where it may be so represented, take its integer part and convert it to a numeric string (up to 10 characters) in the place of the &5. The construct &6 will replace the cell with the contents of the integer part of accumulator Z provided that that number is between 1 and 256. Thus, any single non-null ASCII code can be entered. Accumulator Z is used to avoid conflicts with %, which is used too frequently to reserve for this purpose. The EDited formula is re-entered into the cell after the edit. 3 RECALCULATE RECALCULATE R Recalculate all of the sheet. RM Recalculate manually only until R command given RAF Recalculate sheet, without constant recalculation The R command forces a recalculation of the sheet. This will evaluate all formulas on the sheet and update the display to show the new numbers. Normally, recalculation is done after each number is entered to update the new cell, but the R command forces total recalculation in case anything was missed. USE THE RAF COMMAND FOR MOST RECALCULATIONS TO AVOID THE EXTRA TIME USED BY R. Since these calculations can be time-consuming, you can suppress them while doing input by entering the RM command (Recalculate Manually) which suppresses recalculation until an R command is entered. This command's format is just RM To speed normal recalculation, PortaCalc only computes constants once. The normal R command will force them to be recomputed also. This may be suppressed (for speed) by the command RAF. (Actually the second character may be anything except M.) 3 EXIT EXIT X Exit to operating system. The X command exits from PortaCalc to the operating system. In general, this is the ONLY way (short of an abort command to the operating system) to get out of PortaCalc, and is the ONLY WAY TO LEAVE GRACEFULLY. 3 LOCATE_CURSOR LOCATE CURSOR (Move Around the sheet) L variable-name Position cursor at variable-name The L command moves the current position to the variable named on the Physical sheet (and the display sheet if the variable is on the display). Examples might be L B3 Move to cell B3 L D6 Move to cell D6 3 MOTION_DIRECTION MOTION DIRECTION (Set Default Direction to move after an Enter) THIS COMMAND SETS DIRECTIONS FOR AUTOMATIC MOTION AFTER ENTER ONLY. SEE BELOW FOR HOW TO MOVE THE CURSOR AT OTHER TIMES. M1 (Move up) M2 (Move down) M3 (Move left) M4 (Move right) The M command causes automatic cursor motion after an E command in the direction indicated. This only occurs after an E command. The default condition is not to move at all after an E command, and this may be reestablished by a command of form M5 (actually Mc, where c is any character other than 1 to 4.) 3 MOVE_CURSOR CURSOR MOTION (Commands to move around the sheet one cell at a time) 1 (Move up) 2 (Move down) 3 (Move left) 4 (Move right) The cursor motion keys move the cursor on the display in the direction indicated. Note these keys are in the same order on the keyboard as the arrow keys of the VT100. (The reason the cursor keys are not used directly is that on VT100 they are multiple characters and difficult for Fortran to parse.) NOTE THAT THE KEYS 1 TO 4 ARE INTERPRETED IN THE SAME WAY AS THE UP, DOWN, LEFT, AND RIGHT ARROW KEYS ON THE VT100. THEY APPEAR IN THE SAME ORDER AS THE ARROW KEYS ON THE VT100 ON THE KEYBOARD. The X and Y accumulators are set to the column number and the (row number + 1) respectively during commands. This allows procedures to detect cursor position or motion where useful. These accumulators may be used within cells for anything; resetting them does not move the cursor. Certain portacalc versions (i.e. some CMDMUN routines) interpret the PF1, PF3, and PF4 keys on VT100s as the commands @KYP, @KYR, and @KYS commands, which will use KYP.DAT, KYR.DAT, or KYS.DAT as input command files. This may be used to locally tailor some PortaCalc commands using the keypad. (If CMDMUN and TTYINI are altered, the entire aux keypad may be interpreted in this way.) 3 VIEWSCREEN_REFRESH VIEWCREEN UPDATE V Redraw screen with normal formats VF Redraw screen showing all formulas VM Don't redraw screen until a V or VF is given. The V and VF commands redraw the display screen showing numerics as numerics in the selected format (V) or displaying whatever part of the formulas fits on screen in the column (VF). This is used wherever the picture on the screen is damaged, e.g., by operating system broadcasts. VM is used to inhibit redraw while numerous changes may be made, to save time. A V or VF command will re enable display updates. 3 ZERO ZERO VARIABLES ZA Zero whole sheet ZE V1:V2 Zero variables in a row or column in range from cell V1 to cell V2 (V1,V2 = names of cells) The ZEro commands clear out a sheet. The ZA command will also ask if you mean it and needs a reply of Yes to actually clobber the whole sheet and return it to pristine purity. The ZA command takes a noticeable time to clear the workfile out; do not be alarmed at this. It will ask afterwards for a new title, new display format default for floating point, etc. If you give the ZA command, PortaCalc will ask you to confirm that you indeed want to zero the entire sheet. A reply of Y will proceed to execute the command; any other reply will abort the clearing operation. 3 ORIGIN_RESET ORIGIN RESET (Windows onto physical sheet) OA variable Reset origin of display to variable OR variable Reset display down and right to start with variable The OA and OR commands let you do quick scrolls around the physical sheet by resetting the upper left corner of the display sheet to point at any variable on the physical one and make the rest follow suit (OA), or will reset the display sheet starting at your current cursor location to point at the physical sheet variable and make all parts of the displayed sheet down and right from your current location correspond likewise. Thus, if you start with a normal initial display and execute the commands L C1 OR H1 you wind up with columns A and B still on screen, but now the remaining columns are H, I, J, K, L instead of C, D, E, F, and G. This happened because cell H1, down and right were pointed to by the display sheet starting where you were, which was cell C1, initially the 3rd column and first row. Had the command been OA H1, the column labels would be H-N rather than the initial A-G. 3 DISPLAY_SORT SORTING DISPLAYS DSRA nn Sort display on row/col nn (display coord) The DS command sorts "normally" ordered display sheets. It operates something like a sorted OA command, the sort key being the number in a column or row. The command looks like this DS Command specifier R or C Row or Column specifier (i.e. whether to sort a row or a col.) A or D Ascending or Descending order sort nn row or column number to sort on. The command letters must all appear together. Thus a command to sort Column 4 on the display in Descending order would be: DSCD 4 and a command to sort Row 3 in Ascending order is: DSRA 3 3 DISPLAY_LOCATE DISPLAY LOCATE (Map physical sheet variables onto Display Sheet) DL V1:V2 Rn:m point at display coordinates (n,m) (col,row) and, going left to right along a Row, copy in variables V1 through V2 (actually, point those display sheet cells at variables V1 thru V2). DL V1:V2 Cn:m point at display coordinates (n,m) (col,row) and, going top to bottom along a Column, copy in variables V1 through V2 (actually, point those display sheet cells at variables V1 thru V2). The DL command lets you associate any variables in the physical sheet with any location on the display sheet (the display sheet coordinates always count from 1 as the topmost row or leftmost column, through the maximum number there). This flexible association means that in principle every cell on the display sheet can be a "window" in the sense of other sheets, though that would be quite hard to follow. If the :V2 part of the command is left off, only one display cell is changed. 3 COPY_CELLS COPYING CELLS CA V1:V2 V3:V4 Copy all cell attributes from V1:V2 to V3:V4. CV V1:V2 V3:V4 Copy numeric values only CD V1:V2 V3:V4 Copy Display Formats only CF V1:V2 V3:V4 Copy Formulas only (no relocation) CR V1:V2 V3:V4 Copy all cell attributes as in CA but relocate cell names to new location from old one. Only relocate names right of or below the cursor or on same row/col with cursor (cells above or left of cursor are NOT relocated). The Copy commands let you reproduce cells' contents in other locations on your sheet without re-entering them. The CA form is most useful, though the CD part can be used to change default formats and the others may be handy. Note that formulas are NOT changed by the copy operation. If they should function correctly in their new location relative to different cells, the cell identifications should be position independent forms (P#n#m for forms relative to physical sheet, D#n#m for forms relative to display sheet) so no modification is necessary. CA will normally save all information about a cell in the new cell. Unlike the other C class commands, the CR command WILL relocate any variable names that are below or to the right of the cursor at the time the command is given. Names above or left of the cursor are not changed. The row and column the cursor is in is included in the relocation region. Thus, to be sure names are relocated, use a command like L A1 first toposition yourself at the top left part of the physical sheet. BE SURE YOU DO THE REPOSITION IF YOU USE THE CR COMMAND!!!!!!! When you specify one variable to the C class commands in the V1:V2 range location and give a range V3:V4, the command will copy the named V1 into all cells in the V3:V4 range. 3 DISPLAY_FORMAT DISPLAY FORMAT SETTING DF V1:V2 [format] The DF command sets the display format for the variable range V1 to V2 inclusive to be whatever is in the square brackets. This is expected to be a valid FORTRAN FORMAT specifier for display of the number and may be up to 9 characters long. If the format specifier entered is however just A or L in the first character, the program will indicate the text is to be displayed literally, not as a number, so titles and such can be shown. To display numbers in Fortran A or L forms, just use formats like 4A1 or similar; as long as there is something ahead of the A or L it goes to Fortran. The program will try your format once before writing to disk to ensure against any crashes that will damage your file. Otherwise, the format is up to you. You can even display in octal or hex if you wish! The DF command will also set the type to Floating if the format begins with F or E, and will set the type to Integer if the format begins with I. Beyond this (e.g., for octal or hex) you must use the DT command (below) to set the storage to floating (8 bytes) or integer (4 bytes). NOTE: There are 2 items in any cell which may be displayed. One of these is the number in the cell, which takes 4 bytes if an integer, 8 if floating point, and which is displayed normally using a Fortran FORMAT statement type declaration. The other is the FORMULA associated with the cell, which may contain just text or labels. This is selected by the A or L formats. Thus, the declaration DF A1:A64 [8A1] would display the NUMBERs in column A as 8 characters (assuming this makes sense), and would cause strange errors if the number did not make sense as characters. The declaration DF A1:A64 [A] would display the FORMULA TEXT in column A on the screen. This normally will always make sense, and is the normal way to display labels. To reset FORTRAN Formats, the Fw.d format is useful. In that format, w means an integer giving the width in characters of the output number, and d is the number of decimal places to be shown. For example F9.2 has 9 places total, 2 to the right of a decimal point. A valid number in this format might be 123456.78 The format F9.1 would give 123456.8 (note rounding) You may devise whatever formats desired. In addition, PortaCalc will only display the number of characters that fit in the column on screen, so display width can be set to remove undesired decimals. 3 DISPLAY_TYPE DISPLAY TYPE SETTING DT V1:V2 F Set V1 thru V2 to Floating data type DT V1:V2 I Set V1 thru V2 to Integer data type The DT command sets Float/Integer attributes on physical cells. Initial default is F (8 bytes) but this can set it to I (4 byte integer). Computation is done in floating point always, but I type variables will be converted to integer when stored and may be displayed in valid Fortran formats. This information is stored/restored by the P/G class commands, but not on disk as it is considered volatile. 3 COLUMN_WIDTH DISPLAY WIDTH SETTING DW N,M Set column N on display to be M characters wide DW lets you set any column width. They are independent of each other, and may be set in any order. Maximum width supported is 132 columns with the present version of UVT100; it may be larger on terminals where it makes sense, if UVT100 is altered. 3 SET_DISPLAY_BOUNDARIES DISPLAY BOUNDARIES SETTING DB n,m Set number of columns displayed on screen to n, number of rows displayed to m. The DB command sets display size. It also effects the number of cells modified by the OA and OR commands, so setting the display small, doing an OA or OR, then setting it large, leaves the part omitted as it was before the OA or OR. 3 WRITE WRITING SCREEN TO HARDCOPY OR FILES W The W command lets you write a hard copy of the screen as it exists on display to a file. PortaCalc will prompt you for the file name; the device specifier should be included. Note that if the filename you enter (or the last character after the device or file specifier) is a "/" character, PortaCalc will omit the column and row labels in the output file or printout so that you need not edit them out afterwards. They will always be displayed on the screen however. To output to the lineprinter on PDP11, the file specifiers to give are either "LP:" or "LP:/", then. The device name normally should be given on PDP11. On other systems (e.g., VAX), the device will default to disk unless otherwise specified. The output file in any case has no strange escape sequences and may be edited with any normal system editor. 3 COMMAND_FILE_EXECUTION EXECUTING COMMAND FILES @filespec Read filespec and execute commands as though typed in. The @ command lets you treat a file as though it were your console input (returns on endfile) to let you execute saved sets of commands to set up your sheets. Note that if you issue the K command (below), those inputs come from a separate file on logical unit 1. 3 JOURNALING JOURNALING +J filename Opens filename as a journal file, recording commands to that file. (Note: auxiliary inputs are not so recorded, where asked for as separate questions.) +N Closes any open journal file The journaling commands (available for VAX only by editing XQTCMD.FTN or using XQTCMD.FOR) allow typed commands to be saved into a file later usable as an indirect command input to Portacalc to allow recreation of screen formats, data, formulas, etc. 3 INTERACTIVE_CALC DROPPING INTO INTERACTIVE CALCULATOR K Drop into Calc program straight. The K command gets you into Calc, described in Calc.rno and lets you do computations. When you give the interactive Calc program the *E command to exit, you return to PortaCalc. This may be useful where you want to do auxiliary computations not in the spread sheet or try out formulas that you may want to debug interactively before entering them onto the sheet. See HELP INT_CALC for further information about Calc mode. 3 SAVING_SHEET SAVING YOUR SPREADSHEET PD Put out current Display sheet (Formulas) PP Put out current Physical sheet (Formulas) PDN Put out current Display sheet (Numbers) PPN Put out current Physical sheet (Numbers) S Save work file, allow you to start using a new one The S command just returns to the start of Calc to let you select a new work file. You may reselect the old one if you wish; this lets you change the title only. Otherwise you can use the direct access file as primary saved info on a sheet. The PP and PD commands (with the GP/GD commands described below) are intended to be the primary means of saving/restoring sheets, and allow more flexibility in saving, restoring, or mixing sheets than the S command. Thus, the S command is intended as a highly temporary form of saving data, and should NOT be used as an archival means of storing a spread sheet. The PD and PP commands write Display or Physical sheet cells that are active to a specially formatted sequential ASCII text file, always starting from the current position of the cursor and saving right and down. Some questions will be asked so you may enter a maximum displacement to save (so not all of a large sheet need be saved) in columns and rows. On reload (the GP/GD commands), these questions are also asked, and minimum displacements are asked also to allow you to enter basically any region of the saved sheets into the current sheet starting at the current location and moving down and right. This gives a large scale move capability and a sheet merge capability. The PPN and PDN commands save numbers instead of formats to permit loading of isolated numeric values from other sheets by using the GD or GP commands (below). They record only numbers and not formulas, but this allows any cell's numeric value from other sheets to be loaded into another sheet without loading all formulas and repeating calculations. Also, the PPN/PDN commands are needed to use the PCGRAF program to graph parts of a sheet if this form of output is desired. The PP/PD commands are suitable for archival storage of spread sheet data, or for its transportation to differently compiled versions of PortaCalc. 3 ADDING_OR_REMOVING_ROWS_OR_COL ADJUSTING PHYSICAL LOCATIONS AA number R Add "number" rows ahead of the current physical position, moving all cells below the current cell down by "number" rows and losing the physical sheet's bottom "number" rows' contents, NOT adjusting variable references where the variables are in the moved range and are not the position independent (P## or D## forms) type. AA number C Add "number" columns ahead of the current physical position, moving all cells right of the current cell right by "number" columns and losing the physical sheet's bottom "number" columns' contents, NOT adjusting variable references where the variables are in the moved range and are not the position independent (P## or D## forms) type. AR number R Add "number" rows ahead of the current physical position, moving all cells below the current cell down by "number" rows and losing the physical sheet's bottom "number" rows' contents, adjusting variable references where the variables are in the moved range and are not the position independent (P## or D## forms) type. AR number C Add "number" columns ahead of the current physical position, moving all cells right of the current cell right by "number" columns and losing the physical sheet's bottom "number" columns' contents, adjusting variable references where the variables are in the moved range and are not the position independent (P## or D## forms) type. These commands permit the operations known on other spread sheets as "insertion" or "deletion". Deletion takes place where "number" is negative and the sense of the motion is reversed. These commands change the physical sheet's contents and permit wholesale modifications to variable names (other than P## or D## forms which are position independent already and are left alone for simplicity and to preserve some of the flexibility of the D## forms which can be used for projections of 3D sheets onto the display and math with ranges of these). another computation to be used. To save a sheet for merging such selected values, both forms, or at least the numeric form, should be used. Note that the previous contents of the rows or columns inserted is RETAINED, though it can be zeroed by the ZE command if desired. It will have been copied also to the lower or further-right row/column also, but do not be alarmed; the space is free to re-use. You may however elect to use this feature as a shorthand for copy. The AR/AA operations take place on the physical sheet and do not affect the display sheet mapping to the physical sheet. CAUTION: the rows/columns not moved are not relocated in a relocating insert/delete. 3 RESTORING_SAVED_SHEET RESTORING YOUR SPREADSHEET GD Reload sheet down/right onto display coordinates. GP Reload sheet down/right onto physical coordinates. The GP/GD commands are the inverse of the PP/PD commands and load those files to potentially new locations. This is the simple way to merge sheets. In these cases, you are separately asked for filenames and limits on what part of the sheets to load/save. Only cells that are marked in use are saved, so sparse sheets take less space than saving the direct access files. Note that on save or restore the ranges to restore are asked for. To restore the sheet starting at the cursor, specify the lowest row/column offset of 1 and the highest either 0 or a very large number. Any rectangular region can be restored by giving the X and Y coordinates of the lowest and highest offsets from the upper left to restore, counting from 1. 3 PROMPTING_FOR_DATA READING ARGUMENTS OFF CONSOLE - Prompt The "-" command will print the prompt text on the screen and await entry of a line of text. This text is stored as up to 4 arguments for possible later use in EDit commands. Spaces separate input arguments, and no argument may be longer than 51 characters. This facility is intended for use with indirect command files (@ files) which may want to be able to prompt for parts of formulas and then edit them into the command formulas for use, or to prompt for parts of later-used Calc commands. Note that Calc never sees any formulas that are given the A format, so they can be prepared in this way, to be used when they are given a numeric format. A suitable - command might be -Enter net pay> which would produce the printout (in row 23 of the screen) Enter net pay> and to which one might reply with a number to be entered onto a "template" worksheet. 3 LOOPING_COMMAND_FILES LOOPING COMMAND FILES < Rewind the current Portacalc input file This command will allow a command file to restart itself from the beginning. It does so only if the % variable is positive (permitting some control over it). 3 COMMENTS COMMENTS * any text Any line beginning with * is treated by PortaCalc as a comment (except when in the *F mode when it is sought). This allows you to comment your indirect PortaCalc command files. 3 HELP HELP H Display a screen of help. The H command will display a screenful of help giving a summary of many PortaCalc commands and syntax options. When you type a second return, it will redraw the screen. In some flavors of PortaCalc, the PF2 key also means 'Help'. There will eventually be multiple help pages. They will be selected by commands H0 through H9, the number defaulting to 0 and selecting which help screen will appear. The h) screen is presently the only one implemented. 3 FILE_LOADING FILE LOADING F filename/nnnn Read filename, skipping nnnn lines if the "/nnnn" is there, and load contents onto the currently displayed screen, broken into columns as the current screen is set up. This command is designed to make it easy to load document files into PortaCalc in quasi-image mode. Once loaded, the characters are in formula cells and may be moved around the sheet. The display format must be reset to get them to be treated as non-text; this command will reset all loaded cells to text format display. It repaints the screen upon loading. This feature makes it easy to capture data in PortaCalc from other unrelated programs. 2 APPLICATION NOTES NOTES: Note that if PortaCalc crashes, your data is on the direct access file and may be recovered and reused if need be. It's a good idea to exit Portacalc once you create your workfile, then reenter it with the Q option. This leaves it fully created and you need not worry about a file whose EOF was never put into a directory. (This is true in DEC-land; maybe not for others.) In entering numbers, use a decimal (.) to get them to go in correctly. The parser doesn't seem to understand they are numeric otherwise (even integers). Note that the default format for numeric output is F9.2 and that it may be changed if desired. If you set up the format of a cell, that marks the cell valid and the format is not altered by input defaults, nor the numeric/text interpretation of the cell. To put in a lot of labels, then, set up format A using DF and then enter the labels. If the sheet's calculations contain forward references (down or right), you may need to give the R (Recalculate) command a few times to get proper values. If the values on the sheet do not stabilize, you probably have a circular reference in your formulas and should examine the cells that do not stabilize for the circularity. If you enter numbers with exponentials, use +/- in front of the E so that PortaCalc can tell that the "E4" type strings in numbers like "1.3E4" are really exponents, not cell names. That is, Don't enter 1.35E4 Enter 1.35E+4 to avoid confusion when cells are relocated. You may use lowercase E also (1.35e4) to avoid confusion. Because the cell relocation logic is somewhat stupid, filenames that look like cell names should be avoided too. That is, a sheet that contains a formula like @D5.FRM might, upon getting moved from D5 to F3, be changed to @F3.FRM and if this is not what is desired, it could cause confusion. 2 INT_CALC THE CALC OPTION (K) and Functions Available: This describes the CALC option (K) of PortaCalc which is also the mathematical engine used for expression evaluation except for multi-argument functions and IF statements. 3 OVERVIEW CALC is a calculator designed to evaluate arithmetic expressions. In its basic form, expression evaluation is similar to that used by ANSI FORTRAN with calculations performed on INTEGER*4 and REAL*8 constants. Variables may also be invoked but are limited to single alphabetic characters. It is assumed that the reader is familiar with FORTRAN data types, constants, expression syntax, operator precedence, and the syntax for assigning values to variables. Additional features include octal, hexadecimal, and multiple precision arithmetic capabilities. Commonly used commands and expressions can be placed in a file and executed when convenient. 3 ENTERING To enter Calc, use the K command of Portacalc. Calc will then prompt as follows: CALC> Try typing 123+456 followed by a carriage return. CALC will evaluate the expression and output the answer 579 It then prompts for further input. Try other expressions such as 12.0 - 99. (answer=-87.00000000000000) -(-32767+(6-2)**8-(512/(409-401))) (answer=-32705) 3*5/7 (answer=2) 3*(5/7) (answer=0) Mixed mode is legal, for example 1977/50. is evaluated as 39.54000000000000 Reals may be expressed using D or E format. For example 1.2E10*2.D0**3-1.D-8 is evaluated as 0.95999999999999992D+11 3 ACCUMULATORS Variables may also be used to retain values for later use. Variables may be the letters A through Z, or any Portacalc physical sheet cell name. As in FORTRAN, variable A through H and O thru Z default to type real, I thru N to type integer. To set I to a value use the usual FORTRAN syntax, for example: I=2**10-1 Try typing the single character 'I'. CALC will respond with its value. We can now use I in various expressions such as J=I-I/3*3 % is a special variable that retains the value of the last expression evaluated. For example, to successively add up the numbers 1, 2, 3, 4, 5, and 6 we could enter 1 %+2 %+3 %+4 %+5 %+6 Note that you can examine the value of the variables by typing the appropriate single character followed by a carriage return. Such an examination does not change the value of %. 3 EXITING To exit from CALC, type *E (or *EXIT) or *S (or *STOP) This will return you to PortaCalc. (To exit Portacalc, use the X command.) 3 FUNCTIONS -SPECIAL FUNCTIONS- CALC recognizes a variety of special functions. For example, to calculate the square root of 2, we can type SQRT(2.) CALC responds with the value 1.41421356237310 Each function may have an expression for its argument. For example, A=2.0*SQRT(ALOG(9.)+3.) sets A to 4.55948443459838 The following special functions are available: FUNCTION NAME ARGUMENT TYPE FUNCTION VALUE DESCRIPTION -------------------------------------------------------------------------- ABS REAL REAL absolute value DABS REAL REAL absolute value IABS INTEGER INTEGER absolute value IFIX REAL INTEGER REAL to INTEGER conversion AINT REAL REAL REAL truncation INT REAL INTEGER REAL to INTEGER conversion IDINT REAL INTEGER REAL to INTEGER conversion EXP REAL REAL e**X DEXP REAL REAL e**X ALOG REAL REAL natural logarithm DLOG REAL REAL natural logarithm ALOG10 REAL REAL logarithm base 10 DLOG10 REAL REAL logarithm base 10 SQRT REAL REAL square root DSQRT REAL REAL square root SIN REAL REAL trigonometric sine DSIN REAL REAL trigonometric sine COS REAL REAL trigonometric cosine DCOS REAL REAL trigonometric cosine TANH REAL REAL hyperbolic tangent DTANH REAL REAL hyperbolic tangent ATAN REAL REAL arc tangent DATAN REAL REAL arc tangent 3 OCTAL_OR_HEX -WORKING IN OCTAL AND HEXADECIMAL- You may change the base used to specify constants by using the *B command. Legal forms are command action ------- ------ *B displays current default base *B 8 changes default base to octal *B 10 changes default base to 10 *B 16 changes default base to 16 Suppose we have changed the default base to octal. Then adding 7 + 1 we obtain the result 00000000010 (BASE 8) If the default base is hexadecimal, we can enter 9 + 1 which is evaluated as 0000000A (BASE 16) Suppose we have assigned A=1 then 1+A gives 2.000000000000000 even when the default base is 16. If we wish to add the hexadecimal digit 'A' to 1, enter 1+0A We now obtain the desired 0000000B (BASE 16) This leading 0 is only necessary when the first hexadecimal digit is greater than 9. If constants are entered with digits that are not legal for the base being used, the entire number is converted using a more appropriate base. For example, if we have set the default base to octal and type 1+9 the 9 is not an octal number so it is converted to base 10. If a base 16 number is involved, the result will be in base 16. You may temporarily change the base for a single integer constant by preceeding it with ^8 for octal ^10 for base 10 ^16 for base 16 For example, if the default base is 10, 100+^840 gives 132 a base 10 integer. I=100+^1610 gives 116 also a base 10 integer. Note that the '^' can only be used to specify the base of constants and that expressions such as ^16I are illegal. To declare variables to be integers of a specific base, we can use the commands *INTEGER (base 10) *OCTAL (base 8) *HEX (base 16) for example, *INTEGER A declares variable A to be a base 10 integer. *HEX B,Z,F declares variables B, Z, and F to be base 16 integers. *DECIMAL lists all the variables that have been declared to be of type DECIMAL. To summarize, there are three distinct ways of making base declarations when using CALC. The first is to use the *B command to designate the base default value. This is used to determine the base for constants when they occur in expressions. It does not in any way influence the type of any variables found in an expression. The only way to change the type of a variable is with a specific CALC command such as *INTEGER A,B Note that the *INTEGER command can be used to set types for PortaCalc cells. However, exercise care in doing so that your display formats match the new type. Suppose for example that the default base is 10 and we enter *OCTAL A A=100 then CALC responds with 00000000144 (BASE 8) Finally, the last way to change a base is to use the explicit base specifiers for a constant, for example ^10 123 ^8 777 ^16 AB 3 MULTI_PREC -MULTIPLE PRECISION- Normally integer arithmetic (base 8, 10, and 16) is done internally with INTEGER*4 variables. To allow for larger numbers, CALC has multiple precision capabilities that allow numbers up to 99 digits to be manipulated. Constants are converted to a multiple precision data type when the number of digits specified exceeds a certain value. This value depends upon the specified base. Leading zeroes are included in this count and can be used to force constants to be of type multiple precision. base maximum number of digits before conversion ---- ------------------------------------------ 8 10 10 9 16 7 Suppose we type (with the default base of 10) the number 1234567890 then CALC echoes with 1,234,567,890 (BASE 10) The commas indicate that % now has type multiple precision base 10. Similarly, typing 1234ABCD results in 1234,ABCD (BASE 16) Notice that base 16 multiple precision numbers are separated by commas every 4 digits, octal and base 10 numbers every 3 digits. You may perform the usual operations of addition, subtraction, multipli- cation, division, and exponentiation. As of version 1.0, exponentiation of a multiple precision number may only be to a non-negative integral power. To declare variables of type multiple precision, use *M8 (multiple precision base 8) *M10 (multiple precision base 10) *M16 (multiple precision base 16) for example, *M8 A,B declares A and B to be multiple precision octal variables. Then typing A=32768 results in CALC responding with 100,000 (BASE 8) The accumulators in Calc (variables A-Z and %) all may take on or use multiple precision values. However, the spreadsheet cells may not; they must fit in 8 bytes (double precision real) or 4 bytes if integer. Accumulators may however be used globally in a sheet for large numbers. 3 CALC_COMMANDS -ADDITIONAL COMMANDS- All commands to CALC (as distinguished from expressions to be evaluated) begin with an asterisk. To obtain a list of all possible commands, type a question mark followed by a carriage return. Most of the commands have already been described. The following section gives an explanation of the remaining commands. (Some additional ones are described in the Portacalc manual.) COMMAND DESCRIPTION ------- ----------- *@filename Where filename is the name of a file of CALC commands. CALC reads the file and executes the commands. Up to 5 nested calls can be made. Recursive calls are not allowed. CALC prompts with CALC before each command line is executed, where n is the calling level. You may optionally follow the file name with a blank followed by a single variable name (a single alphabetic character or %). CALC will then execute the file until the value of that variable is zero or negative. The test of this variable is made before the file is executed and not during execution of commands within the file. If the variable's value is not positive when the command is initially encountered, the file will not be opened for execution. See the section on command file examples for ways to use this option. *ASCII Declares a list of variables to be of type ASCII. Useful when decoding ASCII characters. For example, if we set A to be of type ASCII, then typing A=77 results in the character 'M' being output. The inverse operation is the single quote. It allows us to specify a single ASCII constant. For example, if we type 'M then the character 'M' is echoed and indicates that % holds that character and has data type ASCII. Suppose that the variable I has data type INTEGER. Then we can output the base 10 code for the ASCII character 'M' by entering I='M which results in 77 being output. Notice that you may not be able to enter certain control characters that are intercepted by your operating system. Characters whose value is less than 32. are output by printing the character '^' followed by the equivalent ASCII character of that number plus 32. For example, A=10 results in ^* being output since 42 is the ASCII code for the character '*'. See apendix A for a table of the characters output by CALC to represent such non-printable characters. *C COMMENT line. The characters that follow are ignored by CALC. This is useful when documenting files containing CALC commands. *N NOVIEW. Prevents CALC from outputting the value of the expressions evaluated. This is especially useful when executing files containing CALC commands that initialize variables to special values. Equivalent to *V 1 *V VIEW. Controls CALC's printing options: command output class ------------- -------------- *V 0 error messages *V 1 error messages command lines read from files *V 2 error messages value of expressions evaluated *V 3 error messages command lines read from a file value of expressions evaluated *V same as *V 3 The default setting is *V 3. Notice that other legal forms are *VIEW 1 and *V2 *R READ. Allows a single line to be read from the terminal. Useful in files of CALC commands to allow additional commands to be entered (like *S to exit from that file) or simply as a way to halt terminal output until the carriage return key is pressed. *REAL declares specified variables to be REAL*8. When the value of such variables are output, FORTRAN's D format is used. *DECIMAL Declares specified variables to be REAL*8. When the value of such variables are output, FORTRAN's F format is used. Variables A-H and O-Z default to type DECIMAL. *S STOP. Same as *E *E EXIT. Terminates CALC session unless it is used within a file of CALC commands. In this case, CALC closes the file and continues with the next command. *Z ZERO. Zeroes all variables except %. Data types are not changed. *G *G V1,V2 (where V1 and V2 are cell or accumulator names) will evaluate V1 and V2 as the column and row numbers, on the physical sheet, of the desired cell. The addressed cell's value is retrieved and used as the resulting number. This is used for lookup tables. *W Takes the value at the current cell and writes it out to the formula as a numeric (floating) value. The current cell may have been modified temporarily by the *P command. This will overwrite the formula at that cell. *P The *P command resets the current cell coordinate from within a cell (until the next cell is evaluated only). It has several forms: *P - By itself, *P causes Calc to prompt for the new physical column and row number. *P V1 - This moves the current location to the named cell where V1 is the cell name (e.g. A5, H2) *P@ V1,V2 - This uses V1 and V2 (cell names) as column and row numbers and changes the current physical cell position to that defined by the contents of cells V1 and V2. This gives complete addressing of the sheet from within any cell. *F *F Label - If the value in % is positive and nonzero this command rewinds the input file for the PORTACALC @ command (not the Calc @ command) and seeks a line beginning with the characters *CLabel (where "label" is what you put after the *F command). This allows Calc commands inside a cell to direct outside command entry. *J *J Label - This command behaves as the *F command but operates on the file used by the Calc @ command rather than the Portacalc one. Thus, conditions in Calc program files may be implemented. *QF *QW The *QF (Float) or *QW (write) commands are used to examine sequential files created outside Portacalc and return values or formulas. Their syntax is *QF filename ?key1? ?key2? or *QW filename ?key1? ?key2? where ?key2? is optional l and m are delimiter characters for start and end of the parts of the selected records to extract (defaults to first part of the record) filename is just the file specifier in the host OS. operation is that the file is searched from the beginning for records containing key1 (and key2 if specified) and then the part of the record between character l and character m (delimiter characters, which may be the same as for example 2 commas) is extracted. That part of the record is then either Floated by converting to a floating point number using a wide Floating Point format specifier (in *QF) or read in and made the current cell's formula between those delimiters (in the case of *QW). Records may not be over 128 characters long. This command would be used to extract data from a database or word processing files. The first key will begin at the start of the line for each file if it's first character is the ` (accent grave) character. Then the key searched for is sought always at the start of the line, minus the ` character. The delimiters may contain 3 characters to specify positional fields. In this case, the first delimiter character is ` (again) and the second 2 are encoded start location and length fields. They are just the binary values of these + 32 (starting from 1) to turn them to printable ASCII. *XV filename V1 *XF filename V1 The *X class commands are for sheet linkages. *XF loads a Formula from another saved spreadsheet, while *XV loads a Value (normally from a NUMERICALLY saved sheet). They look in the given file for the named variable in the saved sheet and place the formula or value in the current position of the current sheet. Note the *P commands may be used to reset the position if it is desired not to overwrite the current formula in the case of the *XF command; the *XV command assumes the sheet was saved numerically and does not modify the formula. Note that each *X class command gets 1 number or formula. -ADDITIONAL FEATURES- CALC is similar to FORTRAN with respect to operator precedence. Blanks may occur anywhere on a command line without effect except after a single quote mark used to specify a single ASCII character constant. CALC extends the ANSI FORTRAN syntax by allowing the following: 1. multiple assignments on one line, for example I=J=K=812 2. Unary + and unary - are allowed, for example 2*-3 +2+-7 -2**4 are all legal. The last expression evaluates to 16 because the unary - has a higher precedence than exponentiation. 3. exponentiation may be indicated by using ! as well as ** If any of the declarations are entered (such as *INTEGER or *M8) and no argument to this command is given, then CALC will print out the variables that have been assigned that data type. Note that a variable can be assigned to different data types using such commands and still not be assigned a value. If you attempt to output the value of such a variable, an error message will result. USAGE NOTES VERSION 1.0 1. When you iterate on a file by a call such as *@REPEAT X then note that A) X must have been set to a positive value when the command is executed or else the file will not be executed. B) If the file of commands does not change the value of the variable X you will enter an infinite loop. You can explicitly set X to a non-positive value, use the *Z command to zero it (if it is not %), or include a *R command to give you a chance to reset the variable and get out of the loop. C) *E and *S will allow you to exit from the command file REPEAT but will not of themselves prevent repetitions. D) Entering constants echo on the terminal (assuming *V is properly set) and can change the value and type of the variable %. This is important to remember when using % to control the iteration of a file. 2. In practice, multiple precision arithmetic may be limited to less than 99 digits because of your terminal's inability to print that many characters. 3. No implicit conversion is made to multiple precision when operations with reals or integers cause an overflow. This was done in version 1.0 in case the multiple precision routines have to be removed when creating a small task image for some operating system. 6. In FORTRAN, -A**2 is the same as -(A**2) with CALC, -A**2 is the same as (-A)**2 (just like SNOBOL!) 5. If R and A are positive reals and I is a positive integer, some compilers like RSX-11M's F4P won't allow (at run time) evaluation of (-I)**R (-A)**R 6. Under RSX-11M F4P you will find 2**.5 to have value 1 while 2.**.5 has value 1.41421356237310 7. 10E10 is a hexadecimal constant (integer) while 10.E10 is a real. APPENDIX A ASCII CALC ASCII CALC ASCII CALC ASCII CALC CODE PRINTS CODES PRINTS CODE PRINTS CODE PRINTS ---- ------ ----- ------ ---- ------ ---- ------ 0 ^ 32 64 @ 96 ` 1 ^! 33 ! 65 A 97 a 2 ^" 34 " 66 B 98 b 3 ^# 35 # 67 C 99 c 4 ^$ 36 $ 68 D 100 d 5 ^% 37 % 69 E 101 e 6 ^& 38 & 70 F 102 f 7 ^' 39 ' 71 G 103 g 8 ^( 40 ( 72 H 104 h 9 ^) 41 ) 73 I 105 i 10 ^* 42 * 74 J 106 j 11 ^+ 43 + 75 K 107 k 12 ^, 44 , 76 L 108 l 13 ^- 45 - 77 M 109 m 14 ^. 46 . 78 N 110 n 15 ^/ 47 / 79 O 111 o 16 ^0 48 0 80 P 112 p 17 ^1 49 1 81 Q 113 q 18 ^2 50 2 82 R 114 r 19 ^3 51 3 83 S 115 s 20 ^4 52 4 84 T 116 t 21 ^5 53 5 85 U 117 u 22 ^6 54 6 86 V 118 v 23 ^7 55 7 87 W 119 w 24 ^8 56 8 88 X 120 x 25 ^9 57 9 89 Y 121 y 26 ^: 58 : 90 Z 122 Z 27 ^; 59 ; 91 [ 123 { 28 ^< 60 < 92 \ 124 | 29 ^= 61 = 93 ] 125 } 30 ^> 62 > 94 ^ 126 ~ 31 ^? 63 ? 95 _ 127 Calc in the PortaCalc environment Calc runs as part of PortaCalc to do much of the math. The K command drops into straight Calc and it works as described here. There are a few additions however. First, Calc can access all the variables on the sheet (names a1 and up), which may be up to 8 bytes long. However, while it can examine or set any of these, the spreadsheet recomputes them from its disk based formula file when re-entered by the *e command. To modify this file, the "current position" in the physical display sheet may be set by answering the prompts after giving the *p command. Then the current display value (contents of the "%" variable) may be entered into the disk file by executing the *w command. This is the only way the interactive Calc can modify the sheet. These commands work also from indirect files. The physical location is clamped to legal values. Note too that any unused cells of the sheet may be used as scratch accumulators. However, they may not assume any types of multiple precision numbers, as they are all 8 bytes long.