PortaCalc Brought to you courtesy of Glenn Everhart 409 High St. Mt. Holly, NJ. 08060 USA 609-261-3709 Spring 1983 Edition: Version 4.3 This version of PortaCalc is smaller, faster (by a large factor) and more capable than the ones on Fall '82 SIG tapes. It is now fully 3 dimensional as well (by a reasonable definition of that.) Also, the keypad finally works on VAX as well as PDP11. See KEYPAD.DOC for info on the supplied default command files for implementing keypad functions. 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. Three versions are provided, with complete source code for all: a PDP11 version for I/D space machines that builds flat under RSX11M+, an overlaid version for other mapped PDP11's under regular RSX (11M or 11D/IAS), and a version for VAX that builds (flat of course) under VMS. I assume the F77 compiler but the program is in Fortran 66 (I use the /NOF77 switch). It is expected only minor changes would be needed for the DEC Fortran IV compiler however. 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. RESTRICTION: The overlaid version provides only a rather small spreadsheet, though it is large enough to be useful in many applications. There are some overlay tricks I haven't tried to increase the size, notably clustering. 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: There are 3 build files. COMPIL.COM Build for Vax/vms...only compiles. Concatinate the objects and link. MAKE.CMD Non-overlay I/D space build for RSX11M+ V2 (uses F77 Compiler in non-F77 mode) SOMAKE.CMD Compact overlay structure, OK for any 11, RSX11M/M+. 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 VVKLUGPR5.FTN VAX "standard" version for VT52 systems BVKLUGPRM.FTN VAX "big" version for VT52 terminal use MVKLUGPRM.FTN PDP11 version for RSX11M+ V2 I/D space, VT100 MVKLUGPR5.FTN PDP11 version for RSX11M+ V2 I/D space, VT52 SVKLUGPRM.FTN PDP11 version for RSX11M/M+ overlain, VT100 SVKLUGPR5.FTN PDP11 version for RSX11M/M+ overlain, VT52 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 not used for showing negative numbers but could be adapted to (compare UVTAVO). UVTTV925.FTN Televideo 925 experimental version. This version has not been well tested but is intended for Televideo 925 terminals. 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. 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. To get PortaCalc to control the PDP11 more efficiently you may also want to SET /SERIAL=TI: under RSX (which will inhibit MCR from grabbing input you want to send to PortaCalc). The RSX flavors of PortaCalc can use escape sequences and now recognize VT100 arrow keys (VT52 too) and also that PF2 means "help". On VMS, the ESCAPE parameter works differently so the arrow key support is somewhat flaky. Edit to use a QIO$ to read the commands to fix this if you wish, just before CMDMUN is called... Remember under VMS to copy the desired file to VKLUGPRM.FTN before compiling. Ignore compiler/linker errors in RSX or VMS. They are harmless warnings. 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. You should be able to build PortaCalc with regular old F4P but you may need minor changes to some OPEN statements. Note too the CMDMUN and TTYINI routines to set up the console. The supplied RSX versions implement case translation and enable the arrow keys. The VAX CMDMUN usually should be used but its' TTYINI is probably wrong and the dummy should be used. The idea is to effectively SET TERM /ESCAPE (and SET TERM /NOWRAP) on VMS to get the full escape sequences in. At least set the nowrap attribute. VMS does funny things to the escape sequences; I haven't deciphered them yet. WRITEUP: This is a spreadsheet written in Fortran (the only universal assembler) for portability. Its functions are described in the separate document file; it assumes VT100, but 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. There are 2 ODL files, either of which can build a reduced version when the fortran files are compiled with OVKLUGPRM.FTN renamed to VKLUGPRM.FTN, included. There is a bit of extra space so the parameters in that file can be enlarged somewhat. They use a very overlain FCS and F4P OTS. You may be able to do similar things clustering an FCSRES and a F4PRES together too. However, the overlay versions (made with the OMAKE.CMD file) do work, though more slowly than the I/D space one. This at least gets you something on a machine with only normal 11/34 type resources. I assume the F4P or F77 compiler here for the OTS part. You will need to tailor to other Fortran compilers on PDP11's yourself. 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. If you put something in that Fortran can't understand, you lose. Portacalc will try your format once before writing to disk, however, to (hopefully) prevent you from generating an un-reusable work file. Conversely, 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 the statement IF [v1.RL.v2]true-statement|false-statement 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. Glenn Everhart FURTHER NOTE: In response to some user queries, I have added some comments in the XQTCMD.FTN and OXQTCMD.FTN code about journaling. They are a section of code (look for it just before the string "'*'" (minus the " chars)) which will implement journaling. The syntax of the journaling command would be +J filename which will cause Portacalc to record all commands issued to it in a file of the given name. The command +N will close the journal file and stop recording.. If you want to implement the functions, just take out the initial C's in column 1 and use. It uses unit 10, and I didn't want to overload task size on PDP11's. On VAX it should be fine. Glenn Everhart The journaling commands are implemented by default for VAX; not for PDP11 for size reasons. Try them if you want however; they work well. PortaCalc This file is VAX build notes: To build PortaCalc from supplied object libraries, you need just to extract all objects from a library and link: $LIBR/EXTRACT=*/OUT=PCCAVO.OBJ PCCAVO.OLB $LINK/NOMAP PCCAVO or replace PCCAVO (VT100 version with advanced video) by PCC100 (for VT100 without advanced video) or PCGRAF (for the graphics utility). These should run even if you don't have Fortran. For those with Fortran, the COMPIL.COM file builds these files from source. You can edit the VVKLUGPRM.FTN file first (compil.com copies it to vklugprm.ftn for inclusion in the compiles) to set your max sheet sizes if the ones supplied are too small. The maxima possible then are large enough you are very unlikely to need to go into sources to edit them. The file PortaCalc.hlp can become a VAX help library and be integrated with your system help if desired. The graphics utility is described separately in PCG.DOC and there is a file called KEYPAD.DOC in the distribution which describes various files of PortaCalc commands which implement auxiliary keypad functions. It should be edited to reflect any system default changes if these features are to be generally used. Note that if CMDMUN.FOR is compiled with the /debug qualifier, these files reside on device DK:, which may be ASSIGN/USER'd to a particular system area prior to running the local PortaCalc version. Apology: To those who have come to know and love the name ViziKluge which used to appear as this program's alternate title: I have withdrawn the name ViziKluge from the title page since it can be interpreted to mean the program is not really a useful tool. In fact, you will find PortaCalc a spreadsheet equal or greater in power to most any commercial product on the market, of speeds comparable with any of them, and more easily tailored to particular needs than most. I am also mindful of the difficulty of convincing people to use a tool named "vizikluge", since its' command set is not closely related to anyone else's and learning it is another educational chore people may have. This is the reason for the alternate keypad commands (which I may expand and which you will see can be expanded yourself by editing cmdmun.for or perhaps xqtcmd.for) and the alternate keypad diagram. I expect eventually to offer a supported and enhanced version of this program commercially (for a price similar to those of Z80-based sheets, however; I am opposed to super high priced software just because it runs on VAXen or PDP11's and encourage users to revolt against it as I have done). For the present, however, enhancements to this version of PortaCalc are expected at most to include spawning subprocesses and perhaps a Datatrieve interface for the VAX versions only. I'm considering an interface to the public domain RIM DBMS instead, since that DBMS is pretty good and available from Boeing for a copy fee. However, the difficulty of providing a general purpose DBMS interface is considerable where values need to be returned. Therefore, a usable general purpose database interface may wait on a commercialized version which will integrate various other tools as well (including hopefully editing, more complex graphics, and timekeeping). I recommend all who use this product for office automation look into the DTC program from DECUS also (#11-597, code MC $70). It's a highly useful desktop calendar program for doing time based scheduling, meetings, etc. Glenn Everhart 6/14/1983 KEYS ON VT100 FOR PORTACALC The files KYP.CMD, KYR.CMD and KYSAUX.CMD implement auxiliary keypad commands when used with PortaCalc for PF1, PF3, and PF4 keys. They need to be inside the login account as presently set up but can come off DK: device if CMDMUN.FOR is compiled /DEBUG. Functions: PF1 (KYP.CMD) WIDE - Sets screen into wide mode and sets up display of 10 columns. (The DB command can vary this) PF2 (no file) HELP (gets to top help page. A reply of Hn instead of just return will get help page n. PF3 (KYR.CMD) NARROW - Sets screen into 80 column mode and sets display back to 7 columns (DB command may vary this) PF4 (KYSAUX.CMD) ENTER - Turns off aux keypad mode and goes into a mode of reading input for expressions to enter, entering them at current cursor position. The Mn command should have previously been used to set automatic motion. Any control character or space as 1st entered character, or \ as first entered character, gets out of enter mode and back to normal command mode. Note if aux keypad mode isn't turned off, various AKl.CMD files (l varies from A to N; see cmdmun.for) may be used for user defined commands. To implement this scheme rename KYSAUX.CMD to KYS.CMD; otherwise you use KYS.CMD which means "recalculate" and the keypad is all a lot of functions.