This is octave.info, produced by makeinfo version 4.2 from octave.texi. START-INFO-DIR-ENTRY * Octave: (octave). Interactive language for numerical computations. END-INFO-DIR-ENTRY Copyright (C) 1996, 1997 John W. Eaton. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.  File: octave.info, Node: Installation Problems, Up: Installation Installation Problems ===================== This section contains a list of problems (and some apparent problems that don't really mean anything is wrong) that may show up during installation of Octave. * On some SCO systems, `info' fails to compile if `HAVE_TERMIOS_H' is defined int `config.h'. Simply removing the definition from `info/config.h' should allow it to compile. * If `configure' finds `dlopen', `dlsym', `dlclose', and `dlerror', but not the header file `dlfcn.h', you need to find the source for the header file and install it in the directory `usr/include'. This is reportedly a problem with Slackware 3.1. For Linux/GNU systems, the source for `dlfcn.h' is in the `ldso' package. * Building `.oct' files doesn't work. You should probably have a shared version of `libstdc++'. A patch is needed to build shared versions of version 2.7.2 of `libstdc++' on the HP-PA architecture. You can find the patch at . * On some alpha systems there may be a problem with the `libdxml' library, resulting in floating point errors and/or segmentation faults in the linear algebra routines called by Octave. If you encounter such problems, then you should modify the configure script so that `SPECIAL_MATH_LIB' is not set to `-ldxml'. * On FreeBSD systems Octave may hang while initializing some internal constants. The fix appears to be to use options GPL_MATH_EMULATE rather than options MATH_EMULATE in the kernel configuration files (typically found in the directory `/sys/i386/conf'. After making this change, you'll need to rebuild the kernel, install it, and reboot. * If you encounter errors like passing `void (*)()' as argument 2 of `octave_set_signal_handler(int, void (*)(int))' or warning: ANSI C++ prohibits conversion from `(int)' to `(...)' while compiling `sighandlers.cc', you may need to edit some files in the `gcc' include subdirectory to add proper prototypes for functions there. For example, Ultrix 4.2 needs proper declarations for the `signal' function and the `SIG_IGN' macro in the file `signal.h'. On some systems the `SIG_IGN' macro is defined to be something like this: #define SIG_IGN (void (*)())1 when it should really be something like: #define SIG_IGN (void (*)(int))1 to match the prototype declaration for the `signal' function. This change should also be made for the `SIG_DFL' and `SIG_ERR' symbols. It may be necessary to change the definitions in `sys/signal.h' as well. The `gcc' `fixincludes' and `fixproto' scripts should probably fix these problems when `gcc' installs its modified set of header files, but I don't think that's been done yet. *You should not change the files in `/usr/include'*. You can find the `gcc' include directory tree by running the command gcc -print-libgcc-file-name The directory of `gcc' include files normally begins in the same directory that contains the file `libgcc.a'. * Some of the Fortran subroutines may fail to compile with older versions of the Sun Fortran compiler. If you get errors like zgemm.f: zgemm: warning: unexpected parent of complex expression subtree zgemm.f, line 245: warning: unexpected parent of complex expression subtree warning: unexpected parent of complex expression subtree zgemm.f, line 304: warning: unexpected parent of complex expression subtree warning: unexpected parent of complex expression subtree zgemm.f, line 327: warning: unexpected parent of complex expression subtree pcc_binval: missing IR_CONV in complex op make[2]: *** [zgemm.o] Error 1 when compiling the Fortran subroutines in the `libcruft' subdirectory, you should either upgrade your compiler or try compiling with optimization turned off. * On NeXT systems, if you get errors like this: /usr/tmp/cc007458.s:unknown:Undefined local symbol LBB7656 /usr/tmp/cc007458.s:unknown:Undefined local symbol LBE7656 when compiling `Array.cc' and `Matrix.cc', try recompiling these files without `-g'. * Some people have reported that calls to shell_cmd and the pager do not work on SunOS systems. This is apparently due to having `G_HAVE_SYS_WAIT' defined to be 0 instead of 1 when compiling `libg++'. * On NeXT systems, linking to `libsys_s.a' may fail to resolve the following functions _tcgetattr _tcsetattr _tcflow which are part of `libposix.a'. Unfortunately, linking Octave with `-posix' results in the following undefined symbols. .destructors_used .constructors_used _objc_msgSend _NXGetDefaultValue _NXRegisterDefaults .objc_class_name_NXStringTable .objc_class_name_NXBundle One kluge around this problem is to extract `termios.o' from `libposix.a', put it in Octave's `src' directory, and add it to the list of files to link together in the makefile. Suggestions for better ways to solve this problem are welcome! * If Octave crashes immediately with a floating point exception, it is likely that it is failing to initialize the IEEE floating point values for infinity and NaN. If your system actually does support IEEE arithmetic, you should be able to fix this problem by modifying the function `octave_ieee_init' in the file `lo-ieee.cc' to correctly initialize Octave's internal infinity and NaN variables. If your system does not support IEEE arithmetic but Octave's configure script incorrectly determined that it does, you can work around the problem by editing the file `config.h' to not define `HAVE_ISINF', `HAVE_FINITE', and `HAVE_ISNAN'. In any case, please report this as a bug since it might be possible to modify Octave's configuration script to automatically determine the proper thing to do. * After installing the binary distribution of Octave in an alternate directory, the Emacs command `run-octave' doesn't work. Emacs hangs in `accept-process-output' in `inferior-octave-startup'. This seems to be a problem with executing a shell script using the comint package. You can avoid the problem by changing the way Octave is installed to eliminate the need for the shell script. You can either compile and install Octave using the source distribution, reinstall the binary distribution in the default directory, or copy the commands in the octave shell script wrapper to your shell startup files (and the shell startup files for anyone else who is using Octave) and then rename the file `octave.bin' to be `octave'.  File: octave.info, Node: Emacs, Next: Grammar, Prev: Installation, Up: Top Emacs Octave Support ******************** The development of Octave code can greatly be facilitated using Emacs with Octave mode, a major mode for editing Octave files which can e.g. automatically indent the code, do some of the typing (with Abbrev mode) and show keywords, comments, strings, etc. in different faces (with Font-lock mode on devices that support it). It is also possible to run Octave from within Emacs, either by directly entering commands at the prompt in a buffer in Inferior Octave mode, or by interacting with Octave from within a file with Octave code. This is useful in particular for debugging Octave code. Finally, you can convince Octave to use the Emacs info reader for `help -i'. All functionality is provided by the Emacs Lisp package EOS (for "Emacs Octave Support"). This chapter describes how to set up and use this package. Please contact if you have any questions or suggestions on using EOS. * Menu: * Installing EOS:: * Using Octave Mode:: * Running Octave From Within Emacs:: * Using the Emacs Info Reader for Octave::  File: octave.info, Node: Installing EOS, Next: Using Octave Mode, Up: Emacs Installing EOS ============== The Emacs package EOS consists of the three files `octave-mod.el', `octave-inf.el', and `octave-hlp.el'. These files, or better yet their byte-compiled versions, should be somewhere in your Emacs load-path. If you have GNU Emacs with a version number at least as high as 19.35, you are all set up, because EOS is respectively will be part of GNU Emacs as of version 19.35. Otherwise, copy the three files from the `emacs' subdirectory of the Octave distribution to a place where Emacs can find them (this depends on how your Emacs was installed). Byte-compile them for speed if you want.  File: octave.info, Node: Using Octave Mode, Next: Running Octave From Within Emacs, Prev: Installing EOS, Up: Emacs Using Octave Mode ================= If you are lucky, your sysadmins have already arranged everything so that Emacs automatically goes into Octave mode whenever you visit an Octave code file as characterized by its extension `.m'. If not, proceed as follows. 1. To begin using Octave mode for all `.m' files you visit, add the following lines to a file loaded by Emacs at startup time, typically your `~/.emacs' file: (autoload 'octave-mode "octave-mod" nil t) (setq auto-mode-alist (cons '("\\.m$" . octave-mode) auto-mode-alist)) 2. Finally, to turn on the abbrevs, auto-fill and font-lock features automatically, also add the following lines to one of the Emacs startup files: (add-hook 'octave-mode-hook (lambda () (abbrev-mode 1) (auto-fill-mode 1) (if (eq window-system 'x) (font-lock-mode 1)))) See the Emacs manual for more information about how to customize Font-lock mode. In Octave mode, the following special Emacs commands can be used in addition to the standard Emacs commands. `C-h m' Describe the features of Octave mode. `LFD' Reindent the current Octave line, insert a newline and indent the new line (`octave-reindent-then-newline-and-indent'). An abbrev before point is expanded if `abbrev-mode' is non-`nil'. `TAB' Indents current Octave line based on its contents and on previous lines (`indent-according-to-mode'). `;' Insert an "electric" semicolon (`octave-electric-semi'). If `octave-auto-indent' is non-`nil', reindent the current line. If `octave-auto-newline' is non-`nil', automagically insert a newline and indent the new line. ``' Start entering an abbreviation (`octave-abbrev-start'). If Abbrev mode is turned on, typing ``C-h' or ``?' lists all abbrevs. Any other key combination is executed normally. Note that all Octave abbrevs start with a grave accent. `M-LFD' Break line at point and insert continuation marker and alignment (`octave-split-line'). `M-TAB' Perform completion on Octave symbol preceding point, comparing that symbol against Octave's reserved words and builtin variables (`octave-complete-symbol'). `M-C-a' Move backward to the beginning of a function (`octave-beginning-of-defun'). With prefix argument N, do it that many times if N is positive; otherwise, move forward to the N-th following beginning of a function. `M-C-e' Move forward to the end of a function (`octave-end-of-defun'). With prefix argument N, do it that many times if N is positive; otherwise, move back to the N-th preceding end of a function. `M-C-h' Puts point at beginning and mark at the end of the current Octave function, i.e., the one containing point or following point (`octave-mark-defun'). `M-C-q' Properly indents the Octave function which contains point (`octave-indent-defun'). `M-;' If there is no comment already on this line, create a code-level comment (started by two comment characters) if the line is empty, or an in-line comment (started by one comment character) otherwise (`octave-indent-for-comment'). Point is left after the start of the comment which is properly aligned. `C-c ;' Puts the comment character `#' (more precisely, the string value of `octave-comment-start') at the beginning of every line in the region (`octave-comment-region'). With just `C-u' prefix argument, uncomment each line in the region. A numeric prefix argument N means use N comment characters. `C-c :' Uncomments every line in the region (`octave-uncomment-region'). `C-c C-p' Move one line of Octave code backward, skipping empty and comment lines (`octave-previous-code-line'). With numeric prefix argument N, move that many code lines backward (forward if N is negative). `C-c C-n' Move one line of Octave code forward, skipping empty and comment lines (`octave-next-code-line'). With numeric prefix argument N, move that many code lines forward (backward if N is negative). `C-c C-a' Move to the `real' beginning of the current line (`octave-beginning-of-line'). If point is in an empty or comment line, simply go to its beginning; otherwise, move backwards to the beginning of the first code line which is not inside a continuation statement, i.e., which does not follow a code line ending in `...' or `\', or is inside an open parenthesis list. `C-c C-e' Move to the `real' end of the current line (`octave-end-of-line'). If point is in a code line, move forward to the end of the first Octave code line which does not end in `...' or `\' or is inside an open parenthesis list. Otherwise, simply go to the end of the current line. `C-c M-C-n' Move forward across one balanced begin-end block of Octave code (`octave-forward-block'). With numeric prefix argument N, move forward across N such blocks (backward if N is negative). `C-c M-C-p' Move back across one balanced begin-end block of Octave code (`octave-backward-block'). With numeric prefix argument N, move backward across N such blocks (forward if N is negative). `C-c M-C-d' Move forward down one begin-end block level of Octave code (`octave-down-block'). With numeric prefix argument, do it that many times; a negative argument means move backward, but still go down one level. `C-c M-C-u' Move backward out of one begin-end block level of Octave code (`octave-backward-up-block'). With numeric prefix argument, do it that many times; a negative argument means move forward, but still to a less deep spot. `C-c M-C-h' Put point at the beginning of this block, mark at the end (`octave-mark-block'). The block marked is the one that contains point or follows point. `C-c ]' Close the current block on a separate line (`octave-close-block'). An error is signaled if no block to close is found. `C-c f' Insert a function skeleton, prompting for the function's name, arguments and return values which have to be entered without parens (`octave-insert-defun'). `C-c C-h' Search the function, operator and variable indices of all info files with documentation for Octave for entries (`octave-help'). If used interactively, the entry is prompted for with completion. If multiple matches are found, one can cycle through them using the standard `,' (`Info-index-next') command of the Info reader. The variable `octave-help-files' is a list of files to search through and defaults to `'("octave")'. If there is also an Octave Local Guide with corresponding info file, say, `octave-LG', you can have `octave-help' search both files by (setq octave-help-files '("octave" "octave-LG")) in one of your Emacs startup files. A common problem is that the key does _not_ indent the line to where the new text should go after inserting the newline. This is because the standard Emacs convention is that (aka `C-m') just adds a newline, whereas (aka `C-j') adds a newline and indents it. This is particularly inconvenient for users with keyboards which do not have a special key at all; in such cases, it is typically more convenient to use as the key (rather than typing `C-j'). You can make do this by adding (define-key octave-mode-map "\C-m" 'octave-reindent-then-newline-and-indent) to one of your Emacs startup files. Another, more generally applicable solution is (defun RET-behaves-as-LFD () (let ((x (key-binding "\C-j"))) (local-set-key "\C-m" x))) (add-hook 'octave-mode-hook 'RET-behaves-as-LFD) (this works for all modes by adding to the startup hooks, without having to know the particular binding of in that mode!). Similar considerations apply for using as . As Barry A. Warsaw says in the documentation for his `cc-mode', "This is a very common question. `:-)' If you want this to be the default behavior, don't lobby me, lobby RMS!" The following variables can be used to customize Octave mode. `octave-auto-indent' Non-`nil' means auto-indent the current line after a semicolon or space. Default is `nil'. `octave-auto-newline' Non-`nil' means auto-insert a newline and indent after semicolons are typed. The default value is `nil'. `octave-blink-matching-block' Non-`nil' means show matching begin of block when inserting a space, newline or `;' after an else or end keyword. Default is `t'. This is an extremely useful feature for automatically verifying that the keywords match--if they don't, an error message is displayed. `octave-block-offset' Extra indentation applied to statements in block structures. Default is 2. `octave-continuation-offset' Extra indentation applied to Octave continuation lines. Default is 4. `octave-continuation-string' String used for Octave continuation lines. Normally `\'. `octave-mode-startup-message' If `t' (default), a startup message is displayed when Octave mode is called. If Font Lock mode is enabled, Octave mode will display * strings in `font-lock-string-face' * comments in `font-lock-comment-face' * the Octave reserved words (such as all block keywords) and the text functions (such as `cd' or `who') which are also reserved using `font-lock-keyword-face' * the builtin operators (`&&', `<>', ...) using `font-lock-reference-face' * the builtin variables (such as `prefer_column_vectors', `NaN' or `LOADPATH') in `font-lock-variable-name-face' * and the function names in function declarations in `font-lock-function-name-face'. There is also rudimentary support for Imenu (currently, function names can be indexed). You can generate TAGS files for Emacs from Octave `.m' files using the shell script `otags' that is installed alongside your copy of Octave. Customization of Octave mode can be performed by modification of the variable `octave-mode-hook'. If the value of this variable is non-`nil', turning on Octave mode calls its value. If you discover a problem with Octave mode, you can conveniently send a bug report using `C-c C-b' (`octave-submit-bug-report'). This automatically sets up a mail buffer with version information already added. You just need to add a description of the problem, including a reproducible test case and send the message.  File: octave.info, Node: Running Octave From Within Emacs, Next: Using the Emacs Info Reader for Octave, Prev: Using Octave Mode, Up: Emacs Running Octave From Within Emacs ================================ The package `octave' provides commands for running an inferior Octave process in a special Emacs buffer. Use M-x run-octave to directly start an inferior Octave process. If Emacs does not know about this command, add the line (autoload 'run-octave "octave-inf" nil t) to your `.emacs' file. This will start Octave in a special buffer the name of which is specified by the variable `inferior-octave-buffer' and defaults to `"*Inferior Octave*"'. From within this buffer, you can interact with the inferior Octave process `as usual', i.e., by entering Octave commands at the prompt. The buffer is in Inferior Octave mode, which is derived from the standard Comint mode, a major mode for interacting with an inferior interpreter. See the documentation for `comint-mode' for more details, and use `C-h b' to find out about available special keybindings. You can also communicate with an inferior Octave process from within files with Octave code (i.e., buffers in Octave mode), using the following commands. `C-c i l' Send the current line to the inferior Octave process (`octave-send-line'). With positive prefix argument N, send that many lines. If `octave-send-line-auto-forward' is non-`nil', go to the next unsent code line. `C-c i b' Send the current block to the inferior Octave process (`octave-send-block'). `C-c i f' Send the current function to the inferior Octave process (`octave-send-defun'). `C-c i r' Send the region to the inferior Octave process (`octave-send-region'). `C-c i s' Make sure that `inferior-octave-buffer' is displayed (`octave-show-process-buffer'). `C-c i h' Delete all windows that display the inferior Octave buffer (`octave-hide-process-buffer'). `C-c i k' Kill the inferior Octave process and its buffer (`octave-kill-process'). The effect of the commands which send code to the Octave process can be customized by the following variables. `octave-send-echo-input' Non-`nil' means echo input sent to the inferior Octave process. Default is `t'. `octave-send-show-buffer' Non-`nil' means display the buffer running the Octave process after sending a command (but without selecting it). Default is `t'. If you send code and there is no inferior Octave process yet, it will be started automatically. The startup of the inferior Octave process is highly customizable. The variable `inferior-octave-startup-args' can be used for specifying command lines arguments to be passed to Octave on startup as a list of strings. For example, to suppress the startup message and use `traditional' mode, set this to `'("-q" "--traditional")'. You can also specify a startup file of Octave commands to be loaded on startup; note that these commands will not produce any visible output in the process buffer. Which file to use is controlled by the variable `inferior-octave-startup-file'. If this is `nil', the file `~/.emacs-octave' is used if it exists. And finally, `inferior-octave-mode-hook' is run after starting the process and putting its buffer into Inferior Octave mode. Hence, if you like the up and down arrow keys to behave in the interaction buffer as in the shell, and you want this buffer to use nice colors, add (add-hook 'inferior-octave-mode-hook (lambda () (turn-on-font-lock) (define-key inferior-octave-mode-map [up] 'comint-previous-input) (define-key inferior-octave-mode-map [down] 'comint-next-input))) to your `.emacs' file. You could also swap the roles of `C-a' (`beginning-of-line') and `C-c C-a' (`comint-bol') using this hook. *Note:* If you set your Octave prompts to something different from the defaults, make sure that `inferior-octave-prompt' matches them. Otherwise, _nothing_ will work, because Emacs will have no idea when Octave is waiting for input, or done sending output.  File: octave.info, Node: Using the Emacs Info Reader for Octave, Prev: Running Octave From Within Emacs, Up: Emacs Using the Emacs Info Reader for Octave ====================================== You can also set up the Emacs Info reader for dealing with the results of Octave's `help -i'. For this, the package `gnuserv' needs to be installed, which unfortunately still does not come with GNU Emacs (it does with XEmacs). It can be retrieved from any GNU Emacs Lisp Code Directory archive, e.g. , in the `packages' subdirectory. A recent version of gnuserv is available from . If `gnuserv' is installed, add the lines (autoload 'octave-help "octave-hlp" nil t) (require 'gnuserv) (gnuserv-start) to your `.emacs' file. You can use either `plain' Emacs Info or the function `octave-help' as your Octave info reader (for `help -i'). In the former case, set the Octave variable `INFO_PROGRAM' to `"info-emacs-info"'. The latter is perhaps more attractive because it allows to look up keys in the indices of _several_ info files related to Octave (provided that the Emacs variable `octave-help-files' is set correctly). In this case, set `INFO_PROGRAM' to `"info-emacs-octave-help"'. If you use Octave from within Emacs, these settings are best done in the `~/.emacs-octave' startup file (or the file pointed to by the Emacs variable `inferior-octave-startup-file').  File: octave.info, Node: Grammar, Next: Copying, Prev: Emacs, Up: Top Grammar ******* Someday I hope to expand this to include a semi-formal description of Octave's language. * Menu: * Keywords::  File: octave.info, Node: Keywords, Up: Grammar Keywords ======== The following identifiers are keywords, and may not be used as variable or function names: all_va_args endwhile break for case function catch global continue gplot else gsplot elseif if end otherwise end_try_catch return end_unwind_protect switch endfor try endfunction unwind_protect endif unwind_protect_cleanup endswitch while The following command-like functions are also speical. They may be used as simple variable names, but not as formal parameters for functions, or as the names of structure variables. Failed assignments leave them undefined (you can recover the orginal definition as a function using clear). casesen echo load show cd edit_history ls type chdir format more which clear help run_history who diary history save whos dir hold set  File: octave.info, Node: Copying, Next: Concept Index, Prev: Grammar, Up: Top GNU GENERAL PUBLIC LICENSE ************************** Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs ======================================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) 19YY NAME OF AUTHOR 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; either version 2 of the License, or (at your option) any later version. 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. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. SIGNATURE OF TY COON, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.