PortaCalc Brought to you courtesy of Glenn Everhart 409 High St. Mt. Holly, NJ. 08060 USA NOTICE: The best versions of PortaCalc to build are: VAX: PortaCalc-VM, built with COMPILVMX.COM or other command files using the .F40 flavors of sources where there are multiple versions, and PDP11: PortaCalc-PC, built with PCCPDP.CMD in the UIC containing PCCPC. A respectable VAX sheet can also be built using PortaCalc-PC in native mode with PCCMAK.COM in that area. Version 12.1, Summer 1984 This version of PortaCalc has greatly enhanced resistance to crashes on erroneous user input and is far more bullet proof than all earlier ones. It also implements some new functions to enhance its programmability. It is now fully 3 dimensional as well (by a reasonable definition of that.) Also, the keypad works on VAX as well as PDP11. the supplied default command files for implementing keypad functions. This spreadsheet finally can do matrix math and has (in the usrfct module which may be optionally included) some routines for iteratively searching up to 8 dimensional spaces for solutions to problems. It is the first spreadsheet able to do really significant math in addition to the simple routines needed for finance calculations. There is also a word processing interface and date arithmetic, plus numerous other goodies. Directory [312,345] contains the basic PortaCalc submission with the major VAX version, the documentation, and one of the sets of auxiliary keypad command files. Directory [312,371] contains the PDP11 major version sources. Directory [312,376] contains the second (and preferred) set of auxiliary keypad files. Directory [312,366] is a version (now dated) of PortaCalc-XL which uses virtual arrays. Normally this version should be ignored, but is provided in case needed. ABSTRACT: The PortaCalc spreadsheet is a FORTRAN written program able to perform the usual "what if" types of calculations for anyone with a compiler, 31KW of task space (more or less), and (in the present version) an ANSI 3.64 terminal (e.g. VT100). The program is easily recustomized for other terminals and designed for portability and functionality. A data management system interface is built in, permitting spreadsheets to access a potentially unlimited number of files and records or parts of records in those files for user defined functions, numbers, formulas, text, or whatnot. In fact it has many of the attributes of a language. There are 2 major versions. PortaCalc-VM for VMS uses demand zero pages for storage and handles a large sheet. PortaCalc-PC for PDP11 or VMS is a full functionality sheet for PDP11 or VAX which will support a 16000 cell sheet even on a PDP11 with NO virtual arrays, PLAS directives, or other tricks, and with the full VAX functionality (except the *U XQTCM function, which only works in the VMS flavor). There are a number of older versions provided also, of more limited functionality. On PDP11 the F77 compiler is used, but in F66 mode so tha F4P compiler may be substituted with little or no change. This is a FULL FUNCTION spreadsheet package now and has been well hardened to resist crashes, however outrageous the user input may be. There is very little any commercially sold product has that is not supported in PortaCalc, and many features of PortaCalc are unavailable in any commerical sheet. A separate graphics output task is documented in PCG.DOC and provides histograms or scatterplots of any areas of the saved spread sheets with a simple command syntax. SPECIAL HARDWARE: The software must be built for the appropriate terminal. Versions of the UVT100 subroutine for VT100, VT52, Datamedia Elite, and several other types of terminals including VT100 with Advanced Video and Colorscan 10 are supplied, with command files for most combinations. The VT52 version will show what the minimum requirements are for control. Most any terminal can be easily interfaced to the package by editing one of the UVT100 routines to correspond to the terminal's control sequences, provided direct cursor addressing is supported. BUILD: (see also the PRIOR TO BUILD section) The major build files are: COMPILVMX.COM Builds PortaCalc-VM for VMS, using native mode Fortran. Assumes VMS Fortran is correctly installed on your system. PCCPDP.COM Builds PortaCalc-PC for PDP11. Needs to be edited into a .CMD file for use with MCR CLI and assumes the F77 compiler may be invoked as F77. PCCMAK.COM Builds PortaCalc-PC on VMS. The following documents some build files. them over before proceeding. COMPIL.COM Build for Vax/vms...only compiles. Concatinate the objects and link. The next 2 files build 128 by 256 sheets by default. COMPILVM.COM Builds a VAX/VMS version of the sheet that does not use a random access workfile on disk (and may run a bit faster than the standard one for that reason) but with all other capabilities. MAKE.CMD Non-overlay I/D space build for RSX11M+ V2 (uses F77 Compiler in non-F77 mode) Note: THERE ARE COMPILER WARNINGS (ABOUT FUNCTION "INDEX") WHICH SHOULD BE IGNORED DURING THE BUILDS. I ASSUME FORTRAN 77 IS INSTALLED AS ...F4P. PRIOR TO BUILD: You must be sure the final VKLUGPRM.FTN is as you will need it. The PDP11 command files generally copy one of the template versions to this file, but the parameter file may be edited as may any template. The VAX versions of command files generally assume you know what you have is right. READ the appropriate template. Supplied templates include: VVKLUGPRM.FTN VAX "standard" version for VT100 with or without AVO BVKLUGPRM.FTN VAX "big" version for VT100 (obsolete) VVKLUGPR5.FTN VAX "standard" version for VT52 systems BVKLUGPRM.FTN VAX "big" version for VT52 terminal use (obsolete) MVKLUGPRM.FTN PDP11 version for RSX11M+ V2 I/D space, VT100 MVKLUGPR5.FTN PDP11 version for RSX11M+ V2 I/D space, VT52 HVKLUGPRM.FTN VAX really huge (128 by 256) version, VT100 HVKLUGPR5.FTN VAX really huge (128 by 256) version, VT52 or colorscan (note: these may need a bigger VIRTUALPAGECNT parameter than the usual VMS default to link the program.) Note that several variants of UVT100 exist too. The ones presently included are: UVT100.FTN (.FOR for VAX) VT100 control, no Advanced Video Option (AVO) assumed. Many entries are not called by PortaCalc. The ones that are used are: CUP Cursor Position ED Erase Display SGR Set Graphics Rendition EL Erase Line ANSI set ANSI mode (may be nooped) UVTAVO.FTN VT100 control with AVO terminal support. Includes only entries needed. Also uses underline to underline alternate rows and will display display-sheet row numbers as well as physical ones. This version will also highlight negative values in intensified video. By editing to change how NUL is set in the CUP entry, this could be set to highlite entries over/under a fixed amount (put the amount in one of the letter accumulators). UVT52.FTN VT52 control. Since VT52 terminals have no reverse video, draws a ">" character in first col. of cell pointed at to indicate cursor location. UVTDM.FTN Datamedia Elite 1500 control. Similar to UVT52 but cursor controls for Datamedia. UVTCS.FTN Datamedia Colorscan-10 control. This terminal uses VT100 sequences, but UVTCS will use some of the color setup sequences to create a multicolor spread sheet. Colors are now used for showing negative numbers and work in a sensible screen design now. Negative numbers appear in red; positive ones in yellow. UVTTV925.FTN Televideo 925 experimental version. This version has not been well tested but is intended for Televideo 925 terminals. UVTPC.FTN IBM PC color mode and probably Intecolor terminals using ANSI escape sequences. This routine generates the necessary escape sequences to use the MSDOS ANSI.SYS driver from a suitable communications program to allow an IBM PC to run PortaCalc from a Vax or PDP11, using a color display. The Intecolor escape sequences seem to be the same (they differ from the Colorscan ones), so this may allow use from an Intecolor terminal. Note wide screen display is impossible on the IBM PC and its lookalikes. SCRIND.FOR VAX Screen independent version using screen independent cursor controls. Normal VAX builds use this. You may easily adapt the UVT100 subroutine from any of these to handle whatever terminal you have using these routines as examples. Note the parameter JVTINC in the VKLUGPRM.FTN which adjusts for the backspace generated by UVT100 on SGR calls needs to be set correctly. NOTE that most command files copy one of the template files to VKLUGPRM.FTN, so edit the TEMPLATE, NOT VKLUGPRM.FTN. Adapting UVT100 to your terminal and setting up VKLUGPRM.FTN correctly are the necessary setup actions needed prior to compiling and building PortaCalc. You may of course get UVT100 to determine what terminal type is there itself, or use the VMS terminal independent cursor positioning logic, if you wish. On a VAX you may also want to inhibit scrolling. The normal PDP11 builds will make a version which attaches the terminal so no funny modes need be set. The RSX and VMS flavors of PortaCalc can use escape sequences and now recognize VT100 arrow keys (VT52 too) and also that PF2 means "help". Remember under VMS to copy the desired file to VKLUGPRM.FTN before compiling, unless the build file does (MOST DO!) Ignore compiler/linker errors in RSX or VMS. They are harmless warnings. It develops that a few compilers treat the INDEX errors as errors, not warnings. Inserting a statement like EXTERNAL *INDEX into offending programs will get them to compile however. F77 V4.0 is one that seems to mess this up. Note that in VMS you may want to run PortaCalc from a command file to set the terminal /NOESCAPE after PortaCalc exits. Otherwise EDT gets VERY unhappy (not to mention screwed up). On overlay builds, some functions (notably the F file readin function) are commented out of OXQTCMD.FTN. You may uncomment them to get the functions if things fit. They may. Journaling is commented out except for VAX versions due to number of open files needed. Uncomment for PDP11 if you wish. The PortaCalc-PC version has all this, but beware of exceeding MAXFIL. You should be able to build PortaCalc with regular old F4P but you may need minor changes to some OPEN statements. To handle the program with anoher Fortran version, use the LBL Tools INCL and MACRO processors to handle the parameter statements and expand them inline. You'll need to edit the include files into the form MACRO needs, but it can be made to work (I've done it). Note too the CMDMUN and TTYINI routines to set up the console. The supplied versions implement case translation and enable the arrow keys. You will find 4 user function routine areas too: USRFCT.FTN Version supporting return of system date USRFCT.FOR Supports also matrix equation solution USRFCT.ASC Supports matrix determinant, matrix value copy also USRFCT.SRC Supports matrix multiply/add/subtract also, and general functional vary for VAX. USRFCT.F40 Full capability USRFCT supporting all kinds of extra functions, date arithmetic, etc. etc. Note the USRFCT programs are designed to be points for you to plug in your favorite statistical subroutines. They'll need extra routines which you'll find sources for here (things like MTXEQU, MDET, GMSUBS) which may not be well included into command files. However, they may be linked together and used to support functionality far beyond that of conventional sheets. WRITEUP: (Note: This hasn't been updated for awhile.) This is a spreadsheet written in Fortran (the only universal assembler) for portability. Its functions are described in the separate document file; the UVT100 routines are the only places the VT100 is actually handled in screen mode, and may be altered for other machines. The spreadsheet sizes may be defined by editing the parameter file Vklugprm.ftn (caveats and restrictions are listed there). There are 2 sheets -- a big physical sheet and a small display sheet which is what's really shown on screen. Sheets may be saved/merged/restored/ linked (via saved files)/printed or hardcopy made onto files. Numerous other functions exist. The sheet's physical size can be tailored to any desired size (subject to memory constraints) by editing VKLUGPRM.FTN and recompiling. WHEN BUILDING PORTACALC, YOU MAY ENCOUNTER FORTRAN WARNINGS ABOUT THE INDEX FUNCTION BEING ASSUMED USER SUPPLIED. IGNORE THESE; THERE IS AN INDEX FUNCTION SUPPLIED HERE, AND THE WARNINGS ARE OF NO CONSEQUENCE, EITHER ON PDP11 OR VAX. Several ODL files exist. Examine the command files to see which is which. NOTE: If you get this program working on a non-PDP11, non- VAX, the author would appreciate a (machine readable) copy of the modified version. BUGS: The functions here are mostly tested, but some bugs may remain. Fortran formats are used and any format entered will be used. You can use things like O or Z formats for octal/hex or whatever you like. Formats A and L by themselves mean "display the formula itself"; anything else means "display the number". On entering numbers, any formula containing the characters ".","[","+", "(", or "-" is treated as a numeric; anything else is treated as a formula, unless the string contains the double quote (") character, which forces it to be treated as a literal rather than a number regardless of what else it has. The DF command can fix up this if it's not what you want. Note too that the multi-argument functions: SUM[args] Sum MAX[args] Maximum MIN[args] Minimum AVG[args] Average STD[args] Standard Deviation AND[args] Boolean AND (args treated as integer) IOR[args] Boolean inclusive OR NOT[arg] Complement of arg. Treated as integer. CNT[args] Number of nonzero arguments. LKP[val,range] Lookup (and several more) and the statement IF [v1.RL.v2]true-statement |false-statement \more statements must appear at the start of a formula or formula substatement (substate- ments are delimited by \ characters) and the value goes into the current variable cell (which is universally named P## if you want something location independent). It's a good idea to include an else statement in IFs since something gets put in otherwise. Note that the DEFAULT format is for a REAL (not integer) number and must be appropriate. The sheet can be converted to integer format, but will start as real (floating point) numbers, the most generally useful sort. Double precision is used, so about 17 digits of precision are available. Glenn Everhart