Add license header
[scilab.git] / scilab / modules / helptools / macros / help.sci
1
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2008 - INRIA
4 //
5 // This file must be used under the terms of the CeCILL.
6 // This source file is licensed as described in the file COPYING, which
7 // you should have received as part of this distribution.  The terms
8 // are also available at
9 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10
11 function help(key)
12         
13         //for compatibility with toolboxes making use of old cat files
14         
15         if (fileinfo('SCI/modules/helptools/help') <> []) then
16                 
17                 global %browsehelp
18                 nwniarg=find(sciargs()=="-nwni");
19                 texmacsarg=find(sciargs()=="--texmacs");
20                 noguiarg=find(sciargs()=="-nogui");
21                 
22                 if (%browsehelp<>[])&(nwniarg == [])&(texmacsarg == [])&(noguiarg == []) then
23                         
24                         change_old_man()
25                         INDEX=make_help_index()
26                         
27                         if argn(2)==0 then
28                                 browsehelp(INDEX,"index");
29                                 return
30                         end
31                         
32                         key=stripblanks(key)
33                         
34                         if or(part(key,1)==['(',')','[',']','{','}','%','''','""',':','*','/', ...
35                                 '\','.','<','>','&','^','|','~','+','-']) then
36                                 key="symbols";
37                         end
38                         
39                         path=gethelpfile(key)
40                         
41                         if path<>[] then
42                                 browsehelp(path,key)
43                         else
44                                 apropos(key)
45                         end
46                         
47                 else
48                         if (%browsehelp == []) then
49                                 warning('%browsehelp not correctly defined. help browser disabled. ');
50                                 return;
51                         end
52                         
53                         errmsg='help browser disabled in this mode : ';
54                         
55                         if ( nwniarg <> []) then
56                                 errmsg=errmsg+'-nwni';
57                                 warning(errmsg);
58                                 return;
59                         end
60                         
61                         if ( texmacsarg <> []) then
62                                 errmsg=errmsg+ '--texmacs';
63                                 warning(errmsg);
64                                 return;
65                         end
66                         
67                         if ( noguiarg <> [] ) then
68                                 errmsg=errmsg+ '-nogui';
69                                 warning(errmsg);
70                                 return;
71                         end
72                 end
73         else
74                 warning('Help not installed');
75         end
76         
77 endfunction
78
79
80
81
82
83
84
85
86