function lhelp(func) // Display or generate help files for functions defined in the local directory. // Parameters: // func - function name // Description: // lhelp (local help) display help files for functions defined in // the local directory. // // If no help files are available, a subdirectory called ./doc is // created and help files are generated for all functions defined in .sci // files in the local directory. // // Help files are generated using the sci2htm function (see sci2htm.sci). // Examples: // lhelp() // lhelp lhelp // // See also: // sci2htm, // Copyright (C) 2003 Torbjørn Pettersen. // $Id: lhelp.sci,v 1.2 2003/11/02 07:27:16 top Exp top $ // 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 if argn(2), if fileinfo("doc/"+func+".htm")<>[] then browsehelp("doc/"+func+".htm",""); return else if fileinfo(func+".sci")<>[] then sci2htm(func); unix_w("mv "+func+".htm doc/."); browsehelp("doc/"+func+".htm",""); else x_message("Error: "+func+" does not exist!"); end return end end // If a ./doc directory exists, find all helpfiles there. if isdir('doc') then if MSDOS then hf=unix_g('dir doc\*.htm') else hf=unix_g('ls doc/*.htm') end hf=strsubst(hf,'doc/',''); hf=strsubst(hf,'.htm',''); else // If ./doc does not exsit, create it and create help files... unix_w("mkdir doc"); end // Check if all functions in current directory have a help file in ./doc. // If not create the missing help files. // Display the help file chooser num=x_choose(hf,['Click to view documentation';'(see also the source code)']); if num, browsehelp("doc/"+hf(num)+".htm",""); end endfunction