From octave-maintainers-request at bevo dot che dot wisc dot edu Sun Jan 5 21:27:50 2003 Subject: Re: mkpkgadd From: "John W. Eaton" To: Andy Adler Cc: octave-maintainers at bevo dot che dot wisc dot edu Date: Sun, 5 Jan 2003 21:27:47 -0600 On 5-Jan-2003, Andy Adler wrote: | On Sun, 5 Jan 2003, Paul Kienzle wrote: | > I've started adding PKGADD stuff to octave-forge. | | I'm sorry, I haven't heard about PKGADD before. | It seems to be a fairly important thing to understand. | | Could anyone refer me to a place where I could learn | about what PKGADD is and how to deal with it? This feature is new with the most recent snapshots and current CVS sources. Now when Octave adds a directory to the load path, it looks for a file called PKG_ADD in that directory, and if it exists, reads it and executes any commands found in it. Any valid Octave code can go in these files, so it is like a per-directory octaverc file. The motivation for adding this feature was to have a place to put the new "mark_as_command" declaration statements that allow us to mark M-file functions as commands so they can be called as (for example) grid on instead of grid ("on") Currently, the only things in any PKG_ADD files that are installed with Octave are a few "mark_as_command" statements, but we may use these files for more in the future. There is a script in the CVS archive (I accidentally omitted it from the latest snapshot files, but it will be in 2.1.44) called mkpkgadd that is used when installing M-files. It looks for lines like ## PKG_ADD: ... code ... in M-files and copies the "... code ..." part to the PKG_ADD file that goes in the directory where the M-files are installed. You'll have to look at the Makefiles in the scripts directory to see how it is used. Also, when a directory removed from the load path, Octave looks for a file called PKG_DEL in the directory that is being removed, and runs commands found there. So far we are not using this feature, but it could be useful if you want to clean up after a package that has been removed from the load path (for example, to remove global variables, or close and clean up temporary files, etc.). jwe