Newsgroups: comp.sources.misc From: daveg@synaptics.com (David Gillespie) Subject: v24i049: gnucalc - GNU Emacs Calculator, v2.00, Part01/56 Message-ID: X-Md4-Signature: 52c1eac59d2e502ce40037027fd67942 Date: Tue, 29 Oct 1991 04:08:29 GMT Approved: kent@sparky.imd.sterling.com Submitted-by: daveg@synaptics.com (David Gillespie) Posting-number: Volume 24, Issue 49 Archive-name: gnucalc/part01 Environment: Emacs Supersedes: gmcalc: Volume 13, Issue 27-45 The following postings contain version 2.00 of Calc, the symbolic calculator for GNU Emacs. This is a complete re-posting, not a patch. Many things have changed since version 1.07; in particular, the installation procedure is all new. Be sure to read the file "INSTALL" for the necessary instructions. Calc is written entirely in Emacs Lisp, so it should run on any machine that runs GNU Emacs, and you don't need to recompile Emacs to use it. The Calc Manual is in "texinfo" format, which can be formatted for on-line documentation and can also be printed with TeX. The manual includes a tutorial with exercises and answers, a reference section, and a complete summary of commands. Calc can do both numeric computations and symbolic algebra. It has a variety of mathematical functions which can be evaluated to arbitrary precision on the complex plane. It can operate on vectors and matrices, and can also do arithmetic with fractions, dates and times, intervals, and error forms with standard deviations. Unit conversions are provided with a large variety of built-in units. Many common functions from business, statistics, programming, and number theory are included. Algebraic facilities include factoring polynomials, finding derivatives and integrals, solving systems of equations, and pattern-based rewriting of equations. Formulas can be copied to and from editing buffers in many formats, including C, FORTRAN, TeX, and Mathematica. Calc can use GNUPLOT to graph formulas and data. Calc is distributed free under the GNU General Public License. It is also available for FTP from csvax.cs.caltech.edu. Comments are welcome to daveg@synaptics.com, or daveg@csvax.cs.caltech.edu. Enjoy! -- Dave ---- Cut Here and unpack ---- #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # existing files will NOT be overwritten unless -c is specified # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 17492 -rw-r--r-- INSTALL # 4630 -rw-r--r-- Makefile # 3706 -rw-r--r-- README # 112529 -rw-r--r-- calc.el # 28616 -rw-r--r-- calc-aent.el # 108099 -rw-r--r-- calc-alg-2.el # 56657 -rw-r--r-- calc-alg-3.el # 53736 -rw-r--r-- calc-alg.el # 86526 -rw-r--r-- calc-arith.el # 24864 -rw-r--r-- calc-bin.el # 33469 -rw-r--r-- calc-comb.el # 54712 -rw-r--r-- calc-comp.el # 10186 -rw-r--r-- calc-cplx.el # 41524 -rw-r--r-- calc-embed.el # 118802 -rw-r--r-- calc-ext.el # 12610 -rw-r--r-- calc-fin.el # 51626 -rw-r--r-- calc-forms.el # 6304 -rw-r--r-- calc-frac.el # 30406 -rw-r--r-- calc-funcs.el # 47114 -rw-r--r-- calc-graph.el # 22452 -rw-r--r-- calc-help.el # 7165 -rw-r--r-- calc-incom.el # 22155 -rw-r--r-- calc-keypd.el # 36543 -rw-r--r-- calc-lang.el # 6182 -rw-r--r-- calc-macs.el # 12652 -rw-r--r-- calc-maint.el # 39224 -rw-r--r-- calc-map.el # 10372 -rw-r--r-- calc-mat.el # 52594 -rw-r--r-- calc-math.el # 24690 -rw-r--r-- calc-misc.el # 19361 -rw-r--r-- calc-mode.el # 35651 -rw-r--r-- calc-poly.el # 60998 -rw-r--r-- calc-prog.el # 69210 -rw-r--r-- calc-rewr.el # 17425 -rw-r--r-- calc-rules.el # 9143 -rw-r--r-- calc-sel-2.el # 25519 -rw-r--r-- calc-sel.el # 18079 -rw-r--r-- calc-stat.el # 18912 -rw-r--r-- calc-store.el # 9150 -rw-r--r-- calc-stuff.el # 4845 -rw-r--r-- calc-trail.el # 4666 -rw-r--r-- calc-undo.el # 46113 -rw-r--r-- calc-vec.el # 41220 -rw-r--r-- calc-units.el # 17330 -rw-r--r-- calc-yank.el # 22571 -rw-r--r-- macedit.el # 1420611 -rw-r--r-- calc.texinfo # if test -r _shar_seq_.tmp; then echo 'Must unpack archives in sequence!' echo Please unpack part `cat _shar_seq_.tmp` next exit 1 fi # ============= INSTALL ============== if test -f 'INSTALL' -a X"$1" != X"-c"; then echo 'x - skipping INSTALL (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting INSTALL (Text)' sed 's/^X//' << 'SHAR_EOF' > 'INSTALL' && X Installation ************ X Calc 2.00 comes as a set of GNU Emacs Lisp files, with names like `calc.el' and `calc-ext.el', and also as a `calc.texinfo' file which can be used to generate both on-line and printed documentation. X X To install Calc, just follow these simple steps. If you want more information, each step is discussed at length in the sections below. X X 1. Change (`cd') to the Calc "home" directory. This directory was X created when you unbundled the Calc `.tar' or `.shar' file. X X 2. Type `make' to install Calc privately for your own use, or type X `make install' to install Calc system-wide. This will compile all X the Calc component files, modify your `.emacs' or the system-wide X `lisp/default' file to install Calc as appropriate, and format X the on-line Calc manual. X X Both variants are shorthand for the following three steps: X X * `make compile' to run the byte-compiler. X X * `make private' or `make public', corresponding to `make' and X `make install', respectively. (If `make public' fails X because your system doesn't already have a `default' or X `default.el' file, use Emacs or the Unix `touch' command to X create a zero-sized one first.) X X * `make info' to format the on-line Calc manual. This first X tries to use the `makeinfo' program; if that program is not X present, it uses the Emacs `texinfo-format-buffer' command X instead. X X The Unix `make' utility looks in the file `Makefile' in the X current directory to see what Unix commands correspond to the X various "targets" like `install' or `public'. If your system X doesn't have `make', you will have to examine the `Makefile' and X type in the corresponding commands by hand. X X 3. If you ever move Calc to a new home directory, just give the X `make private' or `make public' command again in the new X directory. X X 4. Test your installation as described at the end of these X instructions. X X 5. (Optional.) To print a hardcopy of the Calc manual (over 500 X pages) or just the Calc Summary (about 20 pages), follow the X instructions under "Printed Documentation" below. X Calc is now installed and ready to go! X X Upgrading from Calc 1.07 ========================= X If you have Calc version 1.07 or earlier, you will find that Calc 2.00 is organized quite differently. For one, Calc 2.00 is now distributed already split into many parts; formerly this was done as part of the installation procedure. Also, some new functions must be autoloaded and the `M-#' key must be bound to `calc-dispatch' instead of to `calc'. X X The easiest way to upgrade is to delete your old Calc files and then install Calc 2.00 from scratch using the above instructions. You should then go into your `.emacs' or `default' file and remove the old `autoload' and `global-set-key' commands for Calc, since `make public'/`make private' has added new, better ones. X X *Note New for Calc 2.00::, for more information about what has changed since version 1.07. X X The `make public' Command ========================== X X If you are not the regular Emacs administrator on your system, your account may not be allowed to execute the `make public' command, since the system-wide `default' file may be write-protected. If this is the case, you will have to ask your Emacs installer to execute this command. (Just `cd' to the Calc home directory and type `make public'.) X X The `make private' command adds exactly the same set of commands to your `.emacs' file as `make public' adds to `default'. If your Emacs installer is concerned about typing this command out of the blue, you can ask her/him instead to copy the necessary text from your `.emacs' file. (They will be marked by a comment that says "Commands added by `calc-private-autoloads' on (date and time).") X X Compilation ============ X Calc is written in a way that maximizes performance when its code has been byte-compiled; a side effect is that performance is seriously degraded if it *isn't* compiled. Thus, it is essential to compile the Calculator before trying to use it. The function `calc-compile' in the file `calc-maint.el' runs the Emacs byte-compiler on all the Calc source files. (Specifically, it runs `M-x byte-compile-file' on all files in the current directory with names of the form `calc*.el', and also on the file `macedit.el'.) X X If `calc-compile' finds that certain files have already been compiled and have not been changed since, then it will not bother to recompile those files. X X The `calc-compile' command also pre-builds certain tables, such as the units table (see "The Units Table") and the built-in rewrite rules (see "Rearranging with Selections") which Calc would otherwise need to rebuild every time those features were used. X X The `make compile' shell command is simply a convenient way to start an Emacs and give it a `calc-compile' command. X X Auto-loading ============= X To teach Emacs how to load in Calc when you type `M-#' for the first time, add these lines to your `.emacs' file (if you are installing Calc just for your own use), or the system's `lisp/default' file (if you are installing Calc publicly). The `make private' and `make public' commands, respectively, take care of this. (Note that `make' runs `make private', and `make install' runs `make public'.) X X (autoload 'calc-dispatch "calc" "Calculator Options" t) X (autoload 'full-calc "calc" "Full-screen Calculator" t) X (autoload 'full-calc-keypad "calc" "Full-screen X Calculator" t) X (autoload 'calc-eval "calc" "Use Calculator from Lisp") X (autoload 'defmath "calc" nil t t) X (autoload 'calc "calc" "Calculator Mode" t) X (autoload 'quick-calc "calc" "Quick Calculator" t) X (autoload 'calc-keypad "calc" "X windows Calculator" t) X (autoload 'calc-embedded "calc" "Use Calc from any buffer" t) X (autoload 'calc-embedded-activate "calc" "Activate =>'s in buffer" t) X (autoload 'calc-grab-region "calc" "Grab region of Calc data" t) X (autoload 'calc-grab-rectangle "calc" "Grab rectangle of data" t) X X Unless you have installed the Calc files in Emacs' main `lisp/' directory, you will also have to add a command that looks like the following to tell Emacs where to find them. In this example, we have put the files in directory `/usr/gnu/src/calc-2.00'. X X (setq load-path (append load-path (list "/usr/gnu/src/calc-2.00"))) X The `make public' and `make private' commands also do this (they use the then-current directory as the name to add to the path). If you move Calc to a new location, just repeat the `make public' or `make private' command to have this new location added to the `load-path'. X X The `autoload' command for `calc-dispatch' is what loads `calc.elc' when you type `M-#'. It is the only `autoload' that is absolutely necessary for Calc to work. The others are for commands and features that you may wish to use before typing `M-#' for the first time. In particular, `full-calc' and `full-calc-keypad' are autoloaded to support "standalone" operation (see "Standalone Operation"), `calc-eval' and `defmath' are autoloaded to allow other Emacs Lisp programs to use Calc facilities (see "Calling Calc from Your Programs"), and `calc-embedded-activate' is autoloaded because some Embedded Mode files may call it as soon as they are read into Emacs (see "Assignments in Embedded Mode"). X X Finding Component Files ======================== X X There is no need to write `autoload' commands that point to all the various Calc component files like `calc-misc.elc' and `calc-alg.elc'. The main file, `calc.elc', contains all the necessary `autoload' commands for these files. X X (Actually, to conserve space `calc.elc' only autoloads a few of the component files, plus `calc-ext.elc', which in turn autoloads the rest of the components. This allows Calc to load a little faster in the beginning, but the net effect is the same.) X X This autoloading mechanism assumes that all the component files can be found on the `load-path'. The `make public' and `make private' commands take care of this, but Calc has a few other strategies in case you have installed it in an unusual way. X X If, when Calc is loaded, it is unable to find its components on the `load-path' it is given, it checks the file name in the original `autoload' command for `calc-dispatch'. If that name included directory information, Calc adds that directory to the `load-path': X X (autoload 'calc-dispatch "calc-2.00/calc" "Calculator" t) X Suppose the directory `/usr/gnu/src/emacs/lisp' is on the path, and the above `autoload' allows Emacs to find Calc under the name `/usr/gnu/src/emacs/lisp/calc-2.00/calc.elc'. Then when Calc starts up it will add `/usr/gnu/src/emacs/lisp/calc-2.00' to the path so that it will later be able to find its component files. X X If the above strategy does not locate the component files, Calc examines the variable `calc-autoload-directory'. This is initially `nil', but you can store the name of Calc's home directory in it as a sure-fire way of getting Calc to find its components. X X Merging Source Files ===================== X If the `autoload' mechanism is not managing to load each part of Calc when it is needed, you can concatenate all the `.el' files into one big file. The order should be `calc.el', then `calc-ext.el', then all the other files in any order. Byte-compile the resulting big file. This merged Calculator ought to work just like Calc normally does, though it will be *substantially* slower to load. X X Key Bindings ============= X Calc is normally bound to the `M-#' key. To set up this key binding, include the following command in your `.emacs' or `lisp/default' file. X (This is done automatically by `make private' or `make public', respectively.) X X (global-set-key "\e#" 'calc-dispatch) X X Note that `calc-dispatch' actually works as a prefix for various two-key sequences. If you have a convenient unused function key on your keyboard, you may wish to bind `calc-dispatch' to that as well. You may even wish to bind other specific Calc functions like `calc' or `quick-calc' to other handy function keys. X X Even if you bind `calc-dispatch' to other keys, it is best to bind it to `M-#' as well if you possibly can: There are references to `M-#' all throughout the Calc manual which would confuse novice users if they didn't work as advertised. X X Another key binding issue is the DEL key. Some installations use a different key (such as backspace) for this purpose. Calc normally scans the entire keymap and maps all keys defined like DEL to the `calc-pop' command. However, this may be slow. You can set the variable `calc-scan-for-dels' to `nil' to cause only the actual DEL key to be mapped to `calc-pop'; this will speed loading of Calc. X X The `macedit' Package ====================== X The file `macedit.el' contains another useful Emacs extension called `edit-kbd-macro'. It allows you to edit a keyboard macro in human-readable form. The `Z E' command in Calc knows how to use it to edit user commands that have been defined by keyboard macros. To autoload it, you will want to include the commands, X X (autoload 'edit-kbd-macro "macedit" "Edit Keyboard Macro" t) X (autoload 'edit-last-kbd-macro "macedit" "Edit Keyboard Macro" t) X (autoload 'read-kbd-macro "macedit" "Read Keyboard Macro" t) X The `make public' and `make private' commands do this. X X The GNUPLOT Program ==================== X Calc's graphing commands use the GNUPLOT program. If you have GNUPLOT but you must type some command other than `gnuplot' to get it, you should add a command to set the Lisp variable `calc-gnuplot-name' to the appropriate file name. You may also need to change the variables `calc-gnuplot-plot-command' and `calc-gnuplot-print-command' in order to get correct displays and hardcopies, respectively, of your plots. X X On-Line Documentation ====================== X The documentation for Calc (this manual) comes in a file called `calc.texinfo'. To format this for use as an on-line manual, type `make info' (to use the `makeinfo' program), or `make texinfo' (to use the `texinfmt.el' program which runs inside of Emacs). The former command is recommended if it works on your system; it is faster and produces nicer-looking output. X X The `makeinfo' program will report inconsistencies involving the nodes `Copying' and `Interactive Tutorial'; these messages should be ignored. X X The result will be a collection of files whose names begin with `calc.info'. You may wish to add a reference to the first of these, `calc.info' itself, to your Info system's `dir' file. (The `M-# i' command will access `calc.info' whether or not it appears in the `dir' file.) X X There is a Lisp variable called `calc-info-filename' which holds the name of the Info file containing Calc's on-line documentation. Its default value is `"calc.info"', which will work correctly if the Info files are stored in Emacs' main `info/' directory, or if they are in any of the directories listed in the `load-path'. If you keep them elsewhere, you will want to put a command of the form, X X (setq calc-info-filename ".../calc.info") X in your `.emacs' or `lisp/default' file, where `...' represents the directory containing the Info files. This will not be necessary if you follow the normal installation procedures. X X The `make info' and `make texinfo' commands compare the dates on the files `calc.texinfo' and `calc.info', and run the appropriate program only if the latter file is older or does not exist. X X Printed Documentation ====================== X Because the Calc manual is so large, you should only make a printed copy if you really need it. To print the manual, you will need the TeX typesetting program (this is a free program by Donald Knuth at Stanford University) as well as the `texindex' program and `texinfo.tex' file that come with GNU Emacs. X X To print the Calc manual in one huge 550 page tome, type `make tex'. This will take care of running the manual through TeX twice so that references to later parts of the manual will have correct page numbers. (Don't worry if you get some "overfull box" warnings. Also, some versions of `texinfo.tex' have a bug that causes cross-references to the index to print incorrectly.) X X The result will be a device-independent output file called `calc.dvi', which you must print in whatever way is right for your system. On many systems, the command is X X lpr -d calc.dvi X X Some people find the Calc manual to be too large to handle easily. In fact, some versions of TeX have too little memory to print it. So Calc includes a `calc-split-manual' command that splits `calc.texinfo' into two volumes, the Calc Tutorial and the Calc Reference. The easiest way to use it is to type `make tex2' instead of `make tex'. The result will be two smaller files, `calctut.dvi' and `calcref.dvi'. X The former contains the tutorial part of the manual; the latter contains the reference part. Both volumes include copies of the "Getting Started" chapter and licensing information. X X To save disk space, you may wish to delete `calctut.*' and `calcref.*' after you're done. Don't delete `calc.texinfo', because you will need it to install future patches to Calc. The `make tex2' command takes care of this for you. X X The `make textut' command formats only the Calc Tutorial volume, producing `calctut.dvi' but not `calcref.dvi'. Likewise, `make texref' formats only the Calc Reference volume. X X Finally, there is a `calc-split-summary' command that splits off just the Calc Summary appendix suitable for printing by itself. Type `make summary' instead of `make tex'. The resulting `calcsum.dvi' file will print in less than 20 pages. X X If you don't have TeX, you can print the summary as a plain text file by going to the `Summary' node in Calc's Info file, then typing `M-x print-buffer' (see "Summary"). X X Settings File ============== X Another variable you might want to set is `calc-settings-file', which holds the file name in which commands like `m m' and `Z P' store "permanent" definitions. The default value for this variable is `"~/.emacs"'. If `calc-settings-file' does not contain `".emacs"' as a substring, and if the variable `calc-loaded-settings-file' is `nil', then Calc will automatically load your settings file (if it exists) the first time Calc is invoked. X X Testing the Installation ========================= X To test your installation of Calc, start a new Emacs and type `M-# c' to make sure the autoloads and key bindings work. Type `M-# i' to make sure Calc can find its Info documentation. Press `q' to exit the Info system and `M-# c' to re-enter the Calculator. Type `20 S' to compute the sine of 20 degrees; this will test the autoloading of the extensions modules. The result should be 0.342020143326. Finally, press `M-# c' again to make sure the Calculator can exit. X X You may also wish to test the GNUPLOT interface; to plot a sine wave, type `' [0 .. 360], sin(x) RET g f'. Type `g q' when you are done viewing the plot. X X Calc is now ready to use. If you wish to go through the Calc Tutorial, press `M-# t' to begin. X X (The above text is included in both the Calc documentation and the file INSTALL in the Calc distribution directory.) SHAR_EOF chmod 0644 INSTALL || echo 'restore of INSTALL failed' Wc_c="`wc -c < 'INSTALL'`" test 17492 -eq "$Wc_c" || echo 'INSTALL: original size 17492, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= Makefile ============== if test -f 'Makefile' -a X"$1" != X"-c"; then echo 'x - skipping Makefile (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting Makefile (Text)' sed 's/^X//' << 'SHAR_EOF' > 'Makefile' && # Makefile for "Calc 2.00", the GNU Emacs Calculator. # Copyright (C) 1991 Free Software Foundation. # Author: Dave Gillespie. # Author's address: daveg@csvax.caltech.edu; 256-80 Caltech/Pasadena CA 91125. X # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation (any version). X # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. X # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. X X # To install Calc for private use, type `make'. # To install Calc for public use, type `make install'. X # How to read a Makefile: # The command `make target' looks for `target:' in the Makefile. # First, any sub-targets after the `:' are made. # Then, the Unix commands on the following lines are executed. # `$(SYMBOL)' expands according to the `SYMBOL =' definition below. X X # Programs. EMACS = emacs TEX = tex TEXINDEX = texindex MAKEINFO = makeinfo MAKE = make ECHO = @echo REMOVE = -rm # (The leading `@' tells "make" not to echo the command itself during make; # The leading `-' tells "make" to keep going if the command fails.) X # Other macros. EFLAGS = -batch MAINT = -l calc-maint.elc X # Control whether intermediate files are kept. PURGE = -rm #PURGE = echo Not deleting: X X X # Do full Calc installation. (Note that `make' == `make all'.) # These are written this way instead of `all: compile private info' # to make the steps more explicit while the `make' is in progress. all: X $(MAKE) compile X $(MAKE) private X $(MAKE) info X $(ECHO) "Calc is now installed." X install: X $(MAKE) compile X $(MAKE) public X $(MAKE) info X $(ECHO) "Calc is now installed." X X # Compile Calc. compile: maint X $(EMACS) $(EFLAGS) $(MAINT) -f calc-compile X X # Add autoload and set-global-key commands to system default file. public: maint X $(EMACS) $(EFLAGS) $(MAINT) -f calc-public-autoloads X X # Add autoload and set-global-key commands to ~/.emacs file. private: maint X $(EMACS) $(EFLAGS) $(MAINT) -f calc-private-autoloads X X # Format the Calc manual for the Info system using makeinfo. info: calc.info calc.info: calc.texinfo X -$(MAKEINFO) calc.texinfo X $(ECHO) "Please ignore warnings for Copying, Getting Started, and Interactive Tutorial." X $(MAKE) texinfo X X # Format the Calc manual for the Info system using texinfo.el. # (Use this only if you do not have makeinfo.) texinfo: calc.info-2 calc.info-2: calc.texinfo X $(EMACS) $(EFLAGS) calc.texinfo -f texinfo-format-buffer -f save-buffer X X # Format the Calc manual as one printable volume using TeX. tex: X $(TEX) calc.texinfo X $(TEXINDEX) calc.[cfkptv]? X $(TEX) calc.texinfo X $(PURGE) calc.cp calc.fn calc.ky calc.pg calc.tp calc.vr X $(PURGE) calc.cps calc.fns calc.kys calc.pgs calc.tps calc.vrs X $(PURGE) calc.aux calc.toc X X # Format the Calc manual as two printable volumes (Tutorial and Reference). tex2: texsplit texvol1 texvol2 X # Format the Calc Tutorial volume only. textut: texsplit texvol1 X $(PURGE) calcref.tex X # Format the Calc Reference volume only. texref: texsplit X $(PURGE) calctut.tex X texsplit: maint X $(EMACS) $(EFLAGS) $(MAINT) calc.texinfo -f calc-split-manual X texvol1: X $(TEX) calctut.tex X $(TEXINDEX) calctut.?? X $(TEX) calctut.tex X $(PURGE) calctut.tex calctut.?? calctut.??s calctut.aux calctut.toc X texvol2: X $(TEX) calcref.tex X $(TEXINDEX) calcref.?? X $(TEX) calcref.tex X $(PURGE) calcref.tex calcref.?? calcref.??s calcref.aux calcref.toc X X # Format the Calc summary separately using TeX. summary: texsum X $(TEX) calcsum.tex X $(PURGE) calcsum.?? calcsum.aux calcsum.toc X texsum: maint X $(EMACS) $(EFLAGS) $(MAINT) calc.texinfo -f calc-split-summary X X # All this because "-l calc-maint" doesn't work. maint: calc-maint.elc calc-maint.elc: calc-maint.el X cp calc-maint.el calc-maint.elc X X # Create an Emacs TAGS file tags: TAGS TAGS: X etags *.el X X # Delete .elc files and other reconstructible files. clean: clean.elc clean.info clean.tex X clean.elc: X $(REMOVE) calc-*.elc X $(REMOVE) macedit.elc X clean.info: X $(REMOVE) calc.info* X clean.tex: X $(REMOVE) calc.cp calc.fn calc.ky calc.pg calc.tp calc.vr X $(REMOVE) calc.cps calc.fns calc.kys calc.pgs calc.tps calc.vrs X $(REMOVE) calc.aux calc.log calc.toc calc.dvi X $(REMOVE) calcref.* X $(REMOVE) calctut.* X $(REMOVE) calcsum.* X X SHAR_EOF chmod 0644 Makefile || echo 'restore of Makefile failed' Wc_c="`wc -c < 'Makefile'`" test 4630 -eq "$Wc_c" || echo 'Makefile: original size 4630, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= README ============== if test -f 'README' -a X"$1" != X"-c"; then echo 'x - skipping README (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting README (Text)' sed 's/^X//' << 'SHAR_EOF' > 'README' && X This directory contains version 2.00 of Calc, an advanced desk calculator for GNU Emacs. X "Calc" Copyright 1990, 1991 Free Software Foundation, Inc. X Written and maintained by: Dave Gillespie X 256-80 Caltech X Pasadena CA 91125 X daveg@synaptics.com, uunet!synaptx!daveg X or: daveg@csvax.cs.caltech.edu, cit-vax!daveg X X X XFrom the introduction to the manual: X X "Calc" is an advanced calculator and mathematical tool that runs as X part of the GNU Emacs environment. Very roughly based on the HP-28/48 X series of calculators, its many features include: X X * Choice of algebraic or RPN (stack-based) entry of calculations. X X * Arbitrary precision integers and floating-point numbers. X X * Arithmetic on rational numbers, complex numbers (rectangular and X polar), error forms with standard deviations, open and closed X intervals, vectors and matrices, dates and times, infinities, X sets, quantities with units, and algebraic formulas. X X * Mathematical operations such as logarithms and trigonometric functions. X X * Programmer's features (bitwise operations, non-decimal numbers). X X * Financial functions such as future value and internal rate of return. X X * Number theoretical features such as prime factorization and X arithmetic modulo M for any M. X X * Algebraic manipulation features, including symbolic calculus. X X * Moving data to and from regular editing buffers. X X * "Embedded mode" for manipulating Calc formulas and data directly X inside any editing buffer. X X * Graphics using GNUPLOT, a versatile (and free) plotting program. X X * Easy programming using keyboard macros, algebraic formulas, X algebraic rewrite rules, or extended Emacs Lisp. X X X X To install Calc: X X 1. Type "uncompress calc-2.00.tar.Z" X X 2. Type "tar xvf calc-2.00.tar" X 1,2. Alternatively: "zcat calc-2.00.tar.Z | tar xvf -" X X 3. Note that the Calc tar file now creates a "calc-2.00" subdirectory X of the current directory in which to place its files. X X 4. Follow the instructions in the file "INSTALL". X X X Calc is written entirely in Emacs Lisp, for maximum portability. You do not need to recompile Emacs to install and use Calc. X You will need about eight megabytes of disk space to install Calc and its Info documentation. X See the file INSTALL for installation instructions. The instructions may seem long, but on typical systems you will only need to follow the steps shown in the first section. X Don't even try to run Calc in uncompiled (.el) form! It's far too slow. X X I am anxious to hear about your experiences using Calc. Send mail to "daveg@synaptics.com" or "daveg@csvax.cs.caltech.edu". A bug report is most useful if you include the exact input and output that occurred, any modes in effect (such as the current precision), and so on. If you find Calc is difficult to operate in any way, or if you have other suggestions, don't hesitate to let me know. If you find errors (including simple typos) in the manual, let me know. Even if you find no bugs at all I would love to hear your opinions. X The latest Calc tar files and patches are always available for anonymous FTP on csvax.cs.caltech.edu [131.215.131.131]. Look in the "pub" subdirectory. Calc may also be available soon on prep.ai.mit.edu. X Thanks, X X -- Dave X X X X X Summary of changes to "Calc" ------- -- ------- -- ---- X X Version 2.00: X X * First complete posting of Calc since 1.01. X X * Most parts of Calc have seen changes since version 1.07. See X section "New for Calc 2.00" in the manual for a summary. In X the FTP version of the Calc distribution, the file README.prev X contains a detailed change history from 1.00 up to 2.00. X SHAR_EOF chmod 0644 README || echo 'restore of README failed' Wc_c="`wc -c < 'README'`" test 3706 -eq "$Wc_c" || echo 'README: original size 3706, current size' "$Wc_c" rm -f _shar_wnt_.tmp fi # ============= calc.el ============== if test -f 'calc.el' -a X"$1" != X"-c"; then echo 'x - skipping calc.el (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting calc.el (Text)' sed 's/^X//' << 'SHAR_EOF' > 'calc.el' && ;; Calculator for GNU Emacs version 2.00, part I ;; Copyright (C) 1990, 1991 Free Software Foundation, Inc. ;; Written by Dave Gillespie, daveg@csvax.cs.caltech.edu. X ;; This file is part of GNU Emacs. X ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY. No author or distributor ;; accepts responsibility to anyone for the consequences of using it ;; or for whether it serves any particular purpose or works at all, ;; unless he says so in writing. Refer to the GNU Emacs General Public ;; License for full details. X ;; Everyone is granted permission to copy, modify and redistribute ;; GNU Emacs, but only under the conditions described in the ;; GNU Emacs General Public License. A copy of this license is ;; supposed to have been given to you along with GNU Emacs so you ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. X X X ;;; Calc is split into many files. This file is the main entry point. ;;; This file includes autoload commands for various other basic Calc ;;; facilities. The more advanced features are based in calc-ext, which ;;; in turn contains autoloads for the rest of the Calc files. This ;;; odd set of interactions is designed to make Calc's loading time ;;; be as short as possible when only simple calculations are needed. X ;;; Suggested usage: ;;; ;;; (autoload 'calc-dispatch "calc" "Emacs Calculator" t nil) ;;; (global-set-key "\e#" 'calc-dispatch) ;;; Type `M-# M-#' to start. ;;; ;;; The Calc home directory must be added to the Emacs load-path: ;;; ;;; (setq load-path (cons "/x/y/z/calc" load-path)) ;;; ;;; where "/x/y/z/calc" represents the full name of the Calc home directory. ;;; ;;; See the file INSTALL for a complete list of recommeded autoload ;;; commands (though only calc-dispatch is absolutely necessary). X X ;;; Author's address: ;;; Dave Gillespie, daveg@synaptics.com, uunet!synaptx!daveg. ;;; Synaptics, Inc., 2860 Zanker Rd #206, San Jose, CA 95134. ;;; ;;; The old address daveg@csvax.cs.caltech.edu will continue to ;;; work for the foreseeable future. ;;; ;;; The latest version of Calc is always available from anonymous FTP ;;; on csvax.cs.caltech.edu [131.215.131.131]; look in ~ftp/pub/calc*. ;;; It should also be available on prep.ai.mit.edu. ;;; ;;; Bug reports and suggestions are always welcome! X X ;;; All functions, macros, and Lisp variables defined here begin with one ;;; of the prefixes "math", "Math", or "calc", with the exceptions of ;;; "full-calc", "full-calc-keypad", "another-calc", "quick-calc", ;;; "report-calc-bug", and "defmath". User-accessible variables begin ;;; with "var-". X X X (provide 'calc) X X (defun calc-record-compilation-date () X (calc-record-compilation-date-macro) ) (calc-record-compilation-date) X X ;;; The "###autoload" comment will be used by Emacs version 19 for ;;; maintaining the loaddefs.el file automatically. X ;;;###autoload (defvar calc-info-filename "calc.info" X "*File name in which to look for the Calculator's Info documentation.") X ;;;###autoload (defvar calc-settings-file "~/.emacs" X "*File in which to record permanent settings; default is \"~/.emacs\".") X ;;;###autoload (defvar calc-autoload-directory nil X "Name of directory from which additional \".elc\" files for Calc should be loaded. Should include a trailing \"/\". If nil, use original installation directory. This can safely be nil as long as the Calc files are on the load-path.") X ;;;###autoload (defvar calc-gnuplot-name "gnuplot" X "*Name of GNUPLOT program, for calc-graph features.") X ;;;###autoload (defvar calc-gnuplot-plot-command nil X "*Name of command for displaying GNUPLOT output; %s = file name to print.") X ;;;###autoload (defvar calc-gnuplot-print-command "lp %s" X "*Name of command for printing GNUPLOT output; %s = file name to print.") X X ;; Address of the author of Calc, for use by report-calc-bug. ;; (The following address is probably more likely to be reachable from ;; distant sites than daveg@synaptics.com.) (defvar calc-bug-address "daveg@csvax.cs.caltech.edu") X X ;; If T, scan keymaps to find all DEL-like keys. ;; If NIL, only DEL itself is mapped to calc-pop. (defvar calc-scan-for-dels t) X X X (defvar calc-extensions-loaded nil) X X X ;;; IDEAS: ;;; ;;; Fix rewrite mechanism to do less gratuitous rearrangement of terms. ;;; Implement a pattern-based "refers" predicate. ;;; ;;; Make it possible to Undo a selection command. ;;; Figure out how to allow selecting rows of matrices. ;;; If cursor was in selection before, move it after j n, j p, j L, etc. ;;; Consider reimplementing calc-delete-selection using rewrites. ;;; ;;; Implement line-breaking in non-flat compositions (is this desirable?). ;;; Implement matrix formatting with multi-line components. ;;; ;;; Have "Z R" define a user command based on a set of rewrite rules. ;;; Support "incf" and "decf" in defmath definitions. ;;; Have defmath generate calls to calc-binary-op or calc-unary-op. ;;; Make some way to define algebraic functions using keyboard macros. ;;; ;;; Allow calc-word-size=0 => Common Lisp-style signed bitwise arithmetic. ;;; Consider digamma function (and thus arb. prec. Euler's gamma constant). ;;; May as well make continued-fractions stuff available to the user. ;;; ;;; How about matrix eigenvalues, SVD, pseudo-inverse, etc.? ;;; Should cache matrix inverses as well as decompositions. ;;; If dividing by a non-square matrix, use least-squares automatically. ;;; Consider supporting matrix exponentials. ;;; ;;; Have ninteg detect and work around singularities at the endpoints. ;;; Use an adaptive subdivision algorithm for ninteg. ;;; Provide nsum and nprod to go along with ninteg. ;;; ;;; Handle TeX-mode parsing of \matrix{ ... } where ... contains braces. ;;; Support AmS-TeX's \{d,t,}frac, \{d,t,}binom notations. ;;; Format and parse sums and products in Eqn and Math modes. ;;; ;;; Get math-read-big-expr to read sums, products, etc. ;;; Change calc-grab-region to use math-read-big-expr. ;;; Have a way to define functions using := in Embedded Mode. ;;; ;;; Support polar plotting with GNUPLOT. ;;; Make a calc-graph-histogram function. ;;; ;;; Replace hokey formulas for complex functions with formulas designed ;;; to minimize roundoff while maintaining the proper branch cuts. ;;; Test accuracy of advanced math functions over whole complex plane. ;;; Extend Bessel functions to provide arbitrary precision. ;;; Extend advanced math functions to handle error forms and intervals. ;;; Provide a better implementation for math-sin-cos-raw. ;;; Provide a better implementation for math-hypot. ;;; Provide a better implementation for math-make-frac. ;;; Provide a better implementation for calcFunc-prfac. ;;; Provide a better implementation for calcFunc-integ. ;;; Provide a better implementation for calcFunc-factor. ;;; ;;; Provide more examples in the tutorial section of the manual. ;;; Cover in the tutorial: simplification modes, declarations, ;;; bitwise stuff, selections, matrix mapping, financial functions. ;;; Provide more Lisp programming examples in the manual. ;;; Finish the Internals section of the manual (and bring it up to date). ;;; ;;; Tim suggests adding spreadsheet-like features. ;;; Implement language modes for Gnuplot, Lisp, Ada, APL, ...? ;;; X X ;;; For atan series, if x > tan(pi/12) (about 0.268) reduce using the identity ;;; atan(x) = atan((x * sqrt(3) - 1) / (sqrt(3) + x)) + pi/6. X X ;;; A better integration algorithm: ;;; Use breadth-first instead of depth-first search, as follows: ;;; The integral cache allows unfinished integrals in symbolic notation ;;; on the righthand side. An entry with no unfinished integrals on the ;;; RHS is "complete"; references to it elsewhere are replaced by the ;;; integrated value. More than one cache entry for the same integral ;;; may exist, though if one becomes complete, the others may be deleted. ;;; The integrator works by using every applicable rule (such as ;;; substitution, parts, linearity, etc.) to generate possible righthand ;;; sides, all of which are entered into the cache. Now, as long as the ;;; target integral is not complete (and the time limit has not run out) ;;; choose an incomplete integral from the cache and, for every integral ;;; appearing in its RHS's, add those integrals to the cache using the ;;; same substitition, parts, etc. rules. The cache should be organized ;;; as a priority queue, choosing the "simplest" incomplete integral at ;;; each step, or choosing randomly among equally simple integrals. ;;; Simplicity equals small size, and few steps removed from the original ;;; target integral. Note that when the integrator finishes, incomplete ;;; integrals can be left in the cache, so the algorithm can start where ;;; it left off if another similar integral is later requested. ;;; Breadth-first search would avoid the nagging problem of, e.g., whether ;;; to use parts or substitution first, and which decomposition is best. ;;; All are tried, and any path that diverges will quickly be put on the ;;; back burner by the priority queue. ;;; Note: Probably a good idea to call math-simplify-extended before ;;; measuring a formula's simplicity. X X X X X X ;; Calculator stack. ;; Entries are 3-lists: Formula, Height (in lines), Selection (or nil). (defvar calc-stack '((top-of-stack 1 nil))) X ;; Index into calc-stack of "top" of stack. ;; This is 1 unless calc-truncate-stack has been used. ;;(defvar calc-stack-top 1) X ;; If non-NIL, load the calc-ext module automatically when calc is loaded. ;;(defvar calc-always-load-extensions nil) X ;; If non-NIL, display line numbers in Calculator stack. ;;(defvar calc-line-numbering t) X ;; If non-NIL, break long values across multiple lines in Calculator stack. ;;(defvar calc-line-breaking t) X ;; If NIL, stack display is left-justified. ;; If 'right, stack display is right-justified. ;; If 'center, stack display is centered." ;;(defvar calc-display-just nil) X ;; Horizontal origin of displayed stack entries. ;; In left-justified mode, this is effectively indentation. (Default 0). ;; In right-justified mode, this is effectively window width. ;; In centered mode, center of stack entry is placed here. ;;(defvar calc-display-origin nil) X ;; Radix for entry and display of numbers in calc-mode, 2-36. ;;(defvar calc-number-radix 10) X ;; If non-NIL, leading zeros are provided to pad integers to calc-word-size. ;;(defvar calc-leading-zeros nil) X ;; If non-NIL, group digits in large displayed integers by inserting spaces. ;; If an integer, group that many digits at a time. ;; If 't', use 4 for binary and hex, 3 otherwise. ;;(defvar calc-group-digits nil) X ;; The character (in the form of a string) to be used for grouping digits. ;; This is used only when calc-group-digits mode is on. ;;(defvar calc-group-char ",") X ;; The character (in the form of a string) to be used as a decimal point. ;;(defvar calc-point-char ".") X ;; Format of displayed fractions; a string of one or two of ":" or "/". ;;(defvar calc-frac-format '(":" nil)) X ;; If non-NIL, prefer fractional over floating-point results. ;;(defvar calc-prefer-frac nil) X ;; Format of displayed hours-minutes-seconds angles, a format string. ;; String must contain three %s marks for hours, minutes, seconds respectively. ;;(defvar calc-hms-format "%s@ %s' %s\"") X ;; Format of displayed date forms. ;;(defvar calc-date-format '((H ":" mm ":" SS pp " ") Www " " Mmm " " D ", " YYYY)) X ;; Format to use for display of floating-point numbers in calc-mode. ;; Must be a list of one of the following forms: ;; (float 0) Floating point format, display full precision. ;; (float N) N > 0: Floating point format, at most N significant figures. ;; (float -N) -N < 0: Floating point format, calc-internal-prec - N figs. ;; (fix N) N >= 0: Fixed point format, N places after decimal point. ;; (sci 0) Scientific notation, full precision. ;; (sci N) N > 0: Scientific notation, N significant figures. ;; (sci -N) -N < 0: Scientific notation, calc-internal-prec - N figs. ;; (eng 0) Engineering notation, full precision. ;; (eng N) N > 0: Engineering notation, N significant figures. ;; (eng -N) -N < 0: Engineering notation, calc-internal-prec - N figs. ;;(defvar calc-float-format '(float 0)) X ;; Format to use when full precision must be displayed. ;;(defvar calc-full-float-format '(float 0)) X ;; Format to use for display of complex numbers in calc-mode. Must be one of: ;; nil Use (x, y) form. ;; i Use x + yi form. ;; j Use x + yj form. ;;(defvar calc-complex-format nil) X ;; Preferred form, either 'cplx or 'polar, for complex numbers. ;;(defvar calc-complex-mode 'cplx) X ;; If NIL, 1 / 0 is left unsimplified. ;; If 0, 1 / 0 is changed to inf (zeros are considered positive). ;; Otherwise, 1 / 0 is changed to uinf (undirected infinity). ;;(defvar calc-infinite-mode nil) X ;; If non-NIL, display vectors of byte-sized integers as strings. ;;(defvar calc-display-strings nil) X ;; If NIL, vector elements are left-justified. ;; If 'right, vector elements are right-justified. ;; If 'center, vector elements are centered." ;;(defvar calc-matrix-just 'center) X ;; If non-NIL, display vectors one element per line. ;;(defvar calc-break-vectors nil) X ;; If non-NIL, display long vectors in full. If NIL, use abbreviated form. ;;(defvar calc-full-vectors t) X ;; If non-NIL, display long vectors in full in the trail. ;;(defvar calc-full-trail-vectors t) X ;; If non-NIL, separate elements of displayed vectors with this string. ;;(defvar calc-vector-commas ",") X ;; If non-NIL, surround displayed vectors with these characters. ;;(defvar calc-vector-brackets "[]") X ;; A list of code-letter symbols that control "big" matrix display. ;; If 'R is present, display inner brackets for matrices. ;; If 'O is present, display outer brackets for matrices (above/below). ;; If 'C is present, display outer brackets for matrices (centered). ;;(defvar calc-matrix-brackets '(R O)) X ;; Language or format for entry and display of stack values. Must be one of: ;; nil Use standard Calc notation. ;; flat Use standard Calc notation, one-line format. ;; big Display formulas in 2-d notation (enter w/std notation). ;; unform Use unformatted display: add(a, mul(b,c)). ;; c Use C language notation. ;; pascal Use Pascal language notation. ;; fortran Use Fortran language notation. ;; tex Use TeX notation. ;; eqn Use eqn notation. ;; math Use Mathematica(tm) notation. ;; maple Use Maple notation. ;;(defvar calc-language nil) X ;; Numeric prefix argument for the command that set calc-language. ;;(defvar calc-language-option nil) X ;; Open-parenthesis string for function call notation. ;;(defvar calc-function-open "(") X ;; Close-parenthesis string for function call notation. ;;(defvar calc-function-close ")") X ;; Function through which to pass strings after formatting. ;;(defvar calc-language-output-filter nil) X ;; Function through which to pass strings before parsing. ;;(defvar calc-language-input-filter nil) X ;; Formatting function used for non-decimal numbers. ;;(defvar calc-radix-formatter nil) X ;; Label to display at left of formula. ;;(defvar calc-left-label "") X ;; Label to display at right of formula. ;;(defvar calc-right-label "") X ;; Minimum number of bits per word, if any, for binary operations in calc-mode. ;;(defvar calc-word-size 32) X ;; Most recently used value of M in a modulo form. ;;(defvar calc-previous-modulo nil) X ;; Type of simplification applied to results. ;; If 'none, results are not simplified when pushed on the stack. ;; If 'num, functions are simplified only when args are constant. ;; If NIL, only fast simplifications are applied. ;; If 'binary, math-clip is applied if appropriate. ;; If 'alg, math-simplify is applied. ;; If 'ext, math-simplify-extended is applied. ;; If 'units, math-simplify-units is applied. ;;(defvar calc-simplify-mode nil) X ;; If non-NIL, recompute evalto's automatically when necessary. ;;(defvar calc-auto-recompute t) X ;; If non-NIL, display shows unformatted Lisp exprs. (For debugging) ;;(defvar calc-display-raw nil) X ;; Number of digits of internal precision for calc-mode calculations. ;;(defvar calc-internal-prec 12) X ;; If non-NIL, next operation is Inverse. ;;(defvar calc-inverse-flag nil) X ;; If non-NIL, next operation is Hyperbolic. ;;(defvar calc-hyperbolic-flag nil) X ;; If non-NIL, next operation should not remove its arguments from stack. ;;(defvar calc-keep-args-flag nil) X ;; If deg, angles are in degrees; if rad, angles are in radians. ;; If hms, angles are in degrees-minutes-seconds. ;;(defvar calc-angle-mode 'deg) X ;; If non-NIL, numeric entry accepts whole algebraic expressions. ;; If NIL, algebraic expressions must be preceded by "'". ;;(defvar calc-algebraic-mode nil) X ;; Like calc-algebraic-mode except only affects ( and [ keys. ;;(defvar calc-incomplete-algebraic-mode nil) X ;; If non-NIL, inexact numeric computations like sqrt(2) are postponed. ;; If NIL, computations on numbers always yield numbers where possible. ;;(defvar calc-symbolic-mode nil) X ;; If 'matrix, variables are assumed to be matrix-valued. ;; If a number, variables are assumed to be NxN matrices. ;; If 'scalar, variables are assumed to be scalar-valued. ;; If NIL, symbolic math routines make no assumptions about variables. ;;(defvar calc-matrix-mode nil) X ;; If non-NIL, shifted letter keys are prefix keys rather than normal meanings. ;;(defvar calc-shift-prefix nil) X ;; Initial height of Calculator window. ;;(defvar calc-window-height 7) X ;; If non-NIL, M-x calc creates a window to display Calculator trail. ;;(defvar calc-display-trail t) X ;; If non-NIL, selected sub-formulas are shown by obscuring rest of formula. ;; If NIL, selected sub-formulas are highlighted by obscuring the sub-formulas. ;;(defvar calc-show-selections t) X ;; If non-NIL, commands operate only on selected portions of formulas. ;; If NIL, selections displayed but ignored. ;;(defvar calc-use-selections t) X ;; If non-NIL, selection hides deep structure of associative formulas. ;;(defvar calc-assoc-selections t) X ;; If non-NIL, display "Working..." for potentially slow Calculator commands. ;;(defvar calc-display-working-message 'lots) X ;; If non-NIL, automatically execute a "why" command to explain odd results. ;;(defvar calc-auto-why nil) X ;; If non-NIL, display timing information on each slow command. ;;(defvar calc-timing nil) X ;; Floating-point numbers with this positive exponent or higher above the ;; current precision are displayed in scientific notation in calc-mode. (defvar calc-display-sci-high 0) X ;; Floating-point numbers with this negative exponent or lower are displayed ;; scientific notation in calc-mode. (defvar calc-display-sci-low -3) X X ;; List of used-defined strings to append to Calculator mode line. (defvar calc-other-modes nil) X ;; List of strings for Y prefix help. (defvar calc-Y-help-msgs nil) X ;; T if calc-settings-file has been loaded yet. (defvar calc-loaded-settings-file nil) X X X (defconst calc-mode-var-list '((calc-always-load-extensions nil) X (calc-mode-save-mode local) X (calc-line-numbering t) X (calc-line-breaking t) X (calc-display-just nil) X (calc-display-origin nil) X (calc-left-label "") X (calc-right-label "") X (calc-number-radix 10) X (calc-leading-zeros nil) X (calc-group-digits nil) X (calc-group-char ",") X (calc-point-char ".") X (calc-frac-format (":" nil)) X (calc-prefer-frac nil) X (calc-hms-format "%s@ %s' %s\"") X (calc-date-format ((H ":" mm C SS pp " ") X Www " " Mmm " " D ", " YYYY)) X (calc-standard-date-formats X ("N" X "Www Mmm D, YYYY" X "D Mmm YYYY<, h:mm:SS>" X "Www Mmm BD< hh:mm:ss> YYYY" X "M/D/Y< H:mm:SSpp>" X "D.M.Y< h:mm:SS>" X "M-D-Y< H:mm:SSpp>" X "D-M-Y< h:mm:SS>" X "j<, h:mm:SS>" X "YYddd< hh:mm:ss>")) X (calc-float-format (float 0)) X (calc-full-float-format (float 0)) X (calc-complex-format nil) X (calc-matrix-just center) X (calc-full-vectors t) X (calc-full-trail-vectors t) X (calc-break-vectors nil) X (calc-vector-commas ",") X (calc-vector-brackets "[]") X (calc-matrix-brackets (R O)) X (calc-complex-mode cplx) X (calc-infinite-mode nil) X (calc-display-strings nil) X (calc-simplify-mode nil) X (calc-auto-recompute t) X (calc-word-size 32) X (calc-previous-modulo nil) X (calc-display-raw nil) X (calc-internal-prec 12) X (calc-angle-mode deg) X (calc-algebraic-mode nil) X (calc-incomplete-algebraic-mode nil) X (calc-symbolic-mode nil) X (calc-matrix-mode nil) X (calc-autorange-units nil) X (calc-shift-prefix nil) X (calc-window-height 7) X (calc-was-keypad-mode nil) X (calc-full-mode nil) X (calc-language nil) X (calc-language-option nil) X (calc-show-selections t) X (calc-use-selections t) X (calc-assoc-selections t) X (calc-display-trail t) X (calc-display-working-message lots) X (calc-auto-why 'maybe) X (calc-timing nil) X (calc-gnuplot-default-device "default") X (calc-gnuplot-default-output "STDOUT") X (calc-gnuplot-print-device "postscript") X (calc-gnuplot-print-output "auto") X (calc-gnuplot-geometry nil) X (calc-graph-default-resolution 15) X (calc-graph-default-resolution-3d 5) X (calc-invocation-macro nil))) X (defconst calc-local-var-list '(calc-stack X calc-stack-top X calc-undo-list X calc-redo-list X calc-always-load-extensions X calc-mode-save-mode X calc-display-raw X calc-line-numbering X calc-line-breaking X calc-display-just X calc-display-origin X calc-left-label X calc-right-label X calc-auto-why X calc-algebraic-mode X calc-incomplete-algebraic-mode X calc-symbolic-mode X calc-matrix-mode X calc-inverse-flag X calc-hyperbolic-flag X calc-keep-args-flag X calc-angle-mode X calc-number-radix X calc-leading-zeros X calc-group-digits X calc-group-char X calc-point-char X calc-frac-format X calc-prefer-frac X calc-hms-format X calc-date-format X calc-standard-date-formats X calc-float-format X calc-full-float-format X calc-complex-format X calc-matrix-just X calc-full-vectors X calc-full-trail-vectors X calc-break-vectors X calc-vector-commas X calc-vector-brackets X calc-matrix-brackets X calc-complex-mode X calc-infinite-mode X calc-display-strings X calc-simplify-mode X calc-auto-recompute X calc-autorange-units X calc-show-plain X calc-show-selections X calc-use-selections X calc-assoc-selections X calc-word-size X calc-internal-prec)) X X (defun calc-init-base () X X ;; Set up the standard keystroke (M-#) to run the Calculator, if that key X ;; has not yet been bound to anything. For best results, the user should X ;; do this before Calc is even loaded, so that M-# can auto-load Calc. X (or (global-key-binding "\e#") X (global-set-key "\e#" 'calc-dispatch)) X X ;; Set up the autoloading linkage. X (let ((name (and (fboundp 'calc-dispatch) X (eq (car-safe (symbol-function 'calc-dispatch)) 'autoload) X (nth 1 (symbol-function 'calc-dispatch)))) X (p load-path)) X X ;; If Calc files exist on the load-path, we're all set. X (while (and p (not (file-exists-p X (expand-file-name "calc-misc.elc" (car p))))) X (setq p (cdr p))) X (or p X X ;; If Calc is autoloaded using a path name, look there for Calc files. X ;; This works for both relative ("calc/calc.elc") and absolute paths. X (and name (file-name-directory name) X (let ((p2 load-path) X (name2 (concat (file-name-directory name) X "calc-misc.elc"))) X (while (and p2 (not (file-exists-p X (expand-file-name name2 (car p2))))) X (setq p2 (cdr p2))) X (if p2 X (setq load-path (nconc load-path X (list X (directory-file-name X (file-name-directory X (expand-file-name X name (car p2)))))))))) X X ;; If calc-autoload-directory is given, use that (and hope it works!). X (and calc-autoload-directory X (not (equal calc-autoload-directory "")) X (setq load-path (nconc load-path X (list (directory-file-name X calc-autoload-directory))))))) X X ;; The following modes use specially-formatted data. X (put 'calc-mode 'mode-class 'special) X (put 'calc-trail-mode 'mode-class 'special) X X ;; Define "inexact-result" as an e-lisp error symbol. X (put 'inexact-result 'error-conditions '(error inexact-result calc-error)) SHAR_EOF true || echo 'restore of calc.el failed' fi echo 'End of part 1' echo 'File calc.el is continued in part 2' echo 2 > _shar_seq_.tmp exit 0 exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.