1 |
Macro uman: | — called: | 4 times | — spent time: | 3.87 s | — instrs: | 551 | — covered: | 38% | | — branches: | 307 | — covered: | 23% | |
function uman(varargin)
| 3.87 s |
| |
2 |
tmp = getversion("scilab"); | |
| |
3 |
sci6 = tmp(1) > 5; | |
| |
4 |
| |
| |
5 |
RelCharWidth = 1; | |
| |
6 |
| |
| |
7 |
noWebBrowserMsg = _("uman", "uman: don''t kown how to open your web browser\n"); | |
| |
8 |
| |
| |
9 |
| |
| |
10 |
if argn(2) == 0 then | |
0% | 100% |
11 |
uman("uman", "e"); | |
| |
12 |
return; | |
| |
13 |
end | | | |
14 |
if argn(2) == 3 then | |
0% | 100% |
15 |
tmp = convstr(varargin(3)); | |
| |
16 |
if grep(tmp, "l") <> [] then | |
0% | 0% |
17 |
varargin(1) = varargin(1) + tmp; | |
| |
18 |
else | | | |
19 |
varargin(1) = ("-" + tmp) + part(varargin(1), 2:$); | |
| |
20 |
end | | | |
21 |
end | | | |
22 |
if argn(2) == 1 then | 20 ms |
50% | 50% |
23 |
if varargin(1) == "-" then | 10 ms |
0% | 100% |
24 |
fun0 = "-"; | |
| |
25 |
options = ""; | |
| |
26 |
else | | | |
27 |
if part(varargin(1), 1) == "-" then | 10 ms |
0% | 100% |
28 |
if grep(varargin(1), "c") <> [] then | |
0% | 0% |
29 |
clc; | |
| |
30 |
end | | | |
31 |
uman("uman"); | |
| |
32 |
return; | |
| |
33 |
else | | | |
34 |
fun0 = varargin(1); | 10 ms |
| |
35 |
options = ""; | |
| |
36 |
end | | | |
37 |
end | | | |
38 |
else | | | |
39 |
if (varargin(1) == "-") || (part(varargin(1), 1) <> "-") then | |
100% | 0% |
40 |
fun0 = varargin(1); | |
| |
41 |
options = varargin(2); | |
| |
42 |
else | | | |
43 |
fun0 = varargin(2); | |
| |
44 |
options = varargin(1); | |
| |
45 |
end | | | |
46 |
end | | | |
47 |
options = convstr(options); | |
| |
48 |
options0 = options; | |
| |
49 |
| |
| |
50 |
[options, LANG] = uman_splitOptionsLang(options); | |
| |
51 |
| |
| |
52 |
if (grep(options, "@") <> []) && (length(strsubst(options, "@", "")) > 0) then | |
0% | 100% |
53 |
options = strsubst(options, "@", ""); | |
| |
54 |
end | | | |
55 |
| |
| |
56 |
| |
| |
57 |
| |
| |
58 |
if grep(options, "@") <> [] then | |
0% | 100% |
59 |
| |
| |
60 |
MailingListsQuery = "http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=search_page&node=2602239&query="; | |
| |
61 |
| |
| |
62 |
| |
| |
63 |
| |
| |
64 |
| |
| |
65 |
| |
| |
66 |
| |
| |
67 |
| |
| |
68 |
| |
| |
69 |
| |
| |
70 |
| |
| |
71 |
| |
| |
72 |
| |
| |
73 |
| |
| |
74 |
| |
| |
75 |
| |
| |
76 |
| |
| |
77 |
| |
| |
78 |
| |
| |
79 |
| |
| |
80 |
s = "+"; | |
| |
81 |
fun = fun0; | |
| |
82 |
if part(fun, $) == "!" then | |
0% | 0% |
83 |
| |
| |
84 |
s = "+subject%3A"; | |
| |
85 |
fun = part(fun, 1:($ - 1)); | |
| |
86 |
else | | | |
87 |
| |
| |
88 |
end | | | |
89 |
d = "!"; | |
| |
90 |
| |
| |
91 |
| |
| |
92 |
tmp = tokens(fun, ">"); | |
| |
93 |
if size(tmp, 1) > 1 then | |
0% | 0% |
94 |
authors = strcat(("author:" + stripblanks(tokens(tmp(1), "|"))) + " "); | |
| |
95 |
fun = " " + strcat(tmp(2:$), ">"); | |
| |
96 |
else | | | |
97 |
authors = ""; | |
| |
98 |
end | | | |
99 |
| |
| |
100 |
tmp = tokens(fun, "<"); | |
| |
101 |
if size(tmp, 1) > 1 then | |
0% | 0% |
102 |
max_age = "&days=" + tmp($); | |
| |
103 |
fun = strcat(tmp(1:($ - 1)), "<"); | |
| |
104 |
else | | | |
105 |
max_age = ""; | |
| |
106 |
end | | | |
107 |
fun = stripblanks(fun); | |
| |
108 |
| |
| |
109 |
if fun <> "" then | |
0% | 0% |
110 |
if (grep(fun, "&") == []) & (sum(grep(fun, ["~","(",")"])) < 2) then | |
0% | 0% |
111 |
fun = ("(" + fun) + ")"; | |
| |
112 |
end | | | |
113 |
tmp = ["%","!","?","#","[","]","-","+","*","/","^","$"]; | |
| |
114 |
tmp = uman_strsubst(fun, tmp, "%" + dec2hex(ascii(tmp))); | |
| |
115 |
| |
| |
116 |
tmp = uman_strsubst(tmp, ":", "%5C%3A"); | |
| |
117 |
| |
| |
118 |
tmp = uman_strsubst(tmp, ["(",")"], ["{","}"]); | |
| |
119 |
tmp = uman_strsubst(tmp, (d + ["\s*\&\s*\~\{(.+)\}","\&?\s*\~\s*"]) + d, [("+NOT" + s) + "{$1}","+NOT" + s], "r"); | |
| |
120 |
tmp = uman_strsubst(tmp, (d + ["\s*\|\s*"]) + d, ["+OR+"], "r"); | |
| |
121 |
tmp = uman_strsubst(tmp, (d + ["\s*&\s*","\{\s*?(.+?)\s*\}"]) + d, [s,"($1)"], "r"); | |
| |
122 |
if grep(tmp, ((d + "^\") + ["+NOT\+",s]) + d, "r") == [] then | |
0% | 0% |
123 |
tmp = s + tmp; | |
| |
124 |
end | | | |
125 |
else | | | |
126 |
tmp = ""; | |
| |
127 |
end | | | |
128 |
tmp = (authors + part(tmp, 2:$)) + max_age; | |
| |
129 |
MailingListsQuery = MailingListsQuery + tmp; | |
| |
130 |
| |
| |
131 |
uman_openURL(MailingListsQuery, noWebBrowserMsg); | |
| |
132 |
| |
| |
133 |
return; | |
| |
134 |
end | | | |
135 |
| |
| |
136 |
| |
| |
137 |
| |
| |
138 |
| |
| |
139 |
| |
| |
140 |
| |
| |
141 |
components = []; | |
| |
142 |
authors = []; | |
| |
143 |
urlQuery = ""; | |
| |
144 |
tmp = strsplit(fun0, ">"); | 11 ms |
| |
145 |
if size(tmp, 1) > 1 then | |
0% | 100% |
146 |
trail = strcat(tmp(2:$), ">"); | |
| |
147 |
tmp = stripblanks(strsplit(tmp(1), "/")); | |
| |
148 |
if (size(tmp, 1) == 1) & (tmp <> "") then | |
0% | 0% |
149 |
authors = stripblanks(tokens(tmp, "|")); | |
| |
150 |
else | | | |
151 |
components = stripblanks(tokens(tmp(1), "|")); | |
| |
152 |
if (size(components, 1) == 1) & (components == "") then | |
0% | 0% |
153 |
components = []; | |
| |
154 |
end | | | |
155 |
authors = stripblanks(tokens(tmp(2), "|")); | |
| |
156 |
if (size(authors, 1) == 1) & (authors == "") then | |
0% | 0% |
157 |
authors = []; | |
| |
158 |
end | | | |
159 |
end | | | |
160 |
| |
| |
161 |
components = strcat(components, ","); | |
| |
162 |
compaliases = (((((((((((((((((("atomssys:atoms,atomsgui:ATOMS GUI," + "atomsportal:Atoms Portal&product=Scilab websites") + "&product=Atoms Portal&component=Miscellaneous,") + "atoms:atoms&component=atoms gui") + "&product=Scilab websites&component=Atoms Portal") + "&product=ATOMS Portal&component=Miscellaneous,") + "api:api_scilab,call:call_scilab,") + "codeimprove:Code improvement,cli:Console as CLI,") + "iodata:Data import/export,demos:Demonstrations,ide:desktop,") + "helppages:Documentation pages,helpsys:Documentation system,") + "link:Dynamic Link,editvar:Editvar/Browsevar,") + "browsevar:Editvar/Browsevar,varbrowser:Editvar/Browsevar,") + "filebrowser:File browser,graphicsexport:Graphics export,") + "io:Input / output,instal:Install,java:Java features,") + "translation:Localization,matlab2scilab:m2sci,matfiles:Mat files,") + "maths:Numerical Math,math:Numerical Math,scipad:Old editor (Scipad),") + "optim:Optimization,") + "parser:Parser/Lexer,parse:Parser/Lexer,lexer:Parser/Lexer,") + "parallel:PVM,editor:SciNotes,stat:Statistics,text:Strings,") + "tests:Tests & Testing system,uicomp:uicontrol"; | |
| |
163 |
compaliases = matrix(tokens(compaliases, [",",":"]), 2, -1); | |
| |
164 |
components = uman_strsubst(("," + components) + ",", ("," + compaliases(1, :)) + ",", ("," + compaliases(2, :)) + ","); | |
| |
165 |
components = tokens(components, ","); | |
| |
166 |
else | | | |
167 |
trail = tmp; | |
| |
168 |
end | | | |
169 |
| |
| |
170 |
if components <> [] then | |
0% | 100% |
171 |
urlQuery = urlQuery + strcat(("component=" + components) + "&"); | |
| |
172 |
end | | | |
173 |
| |
| |
174 |
i = 1; | |
| |
175 |
for tmp = authors' do | |
×0 |
176 |
tmp2 = msprintf("f%d=commenter&o%d=substring&v%d=%s&", i, i, i, tmp); | |
| |
177 |
tmp3 = msprintf("f%d=reporter&o%d=substring&v%d=%s&", i + 1, i + 1, i + 1, tmp); | |
| |
178 |
urlQuery = (urlQuery + tmp2) + tmp3; | |
| |
179 |
i = i + 2; | |
| |
180 |
end | | | |
181 |
if authors <> [] then | |
0% | 100% |
182 |
urlQuery = urlQuery + "j_top=OR&"; | |
| |
183 |
end | | | |
184 |
| |
| |
185 |
tmp = strsplit(trail, "<"); | |
| |
186 |
if size(tmp, 1) == 1 then | |
100% | 0% |
187 |
fun0 = stripblanks(trail); | |
| |
188 |
else | | | |
189 |
if isnum(tmp($)) then | |
0% | 0% |
190 |
fun0 = strcat(tmp(1:($ - 1)), "<"); | |
| |
191 |
urlQuery = (urlQuery + msprintf("chfieldfrom=%dd&", evstr(tmp($)))) + "chfieldto=Now&"; | |
| |
192 |
else | | | |
193 |
fun0 = stripblanks(trail); | |
| |
194 |
end | | | |
195 |
end | | | |
196 |
| |
| |
197 |
| |
| |
198 |
| |
| |
199 |
if isdef("umanDefaultOptions", "n") then | |
0% | 100% |
200 |
dopt = convstr(umanDefaultOptions); | |
| |
201 |
dopt = uman_strsubst(dopt, ["w","@"], ""); | |
| |
202 |
| |
| |
203 |
[dopt, dLANG] = uman_splitOptionsLang(dopt); | |
| |
204 |
| |
| |
205 |
if (grep(options, ["d","e","h","b","a","u"]) <> []) & (grep(dopt, ["a","s"]) <> []) then | |
0% | 0% |
206 |
dopt = uman_strsubst(dopt, ["a","s"], ""); | |
| |
207 |
end | | | |
208 |
| |
| |
209 |
if (grep(options, ["d","e","h","b","a","s"]) <> []) & (grep(dopt, "u") <> []) then | |
0% | 0% |
210 |
dopt = uman_strsubst(dopt, "u", ""); | |
| |
211 |
end | | | |
212 |
| |
| |
213 |
if (grep(options, "u") <> []) & (grep(dopt, ["d","e","h","b","a"]) <> []) then | |
0% | 0% |
214 |
dopt = uman_strsubst(dopt, ["d","e","h","b","a"], ""); | |
| |
215 |
end | | | |
216 |
options = options + dopt; | |
| |
217 |
end | | | |
218 |
| |
| |
219 |
| |
| |
220 |
if LANG == "" then | |
100% | 0% |
221 |
if ~isdef("dLANG", "l") || (dLANG == "") then | |
100% | 0% |
222 |
LANG = part(getlanguage(), 1:2); | |
| |
223 |
else | | | |
224 |
LANG = dLANG; | |
| |
225 |
end | | | |
226 |
end | | | |
227 |
| |
| |
228 |
| |
| |
229 |
fun = fun0; | |
| |
230 |
if grep(options, "a") <> [] then | |
25% | 75% |
231 |
options = strsubst(options, "a", "deh"); | |
| |
232 |
end | | | |
233 |
fun = uman_strsubst(fun, "/^%/", "percent", "r"); | 1 ms |
| |
234 |
| |
| |
235 |
| |
| |
236 |
| |
| |
237 |
| |
| |
238 |
| |
| |
239 |
if grep(options, "s") <> [] then | |
25% | 75% |
240 |
options = uman_strsubst(options, ["b","w","@"], ""); | |
| |
241 |
end | | | |
242 |
| |
| |
243 |
if grep(options, "u") <> [] then | |
0% | 100% |
244 |
options = uman_strsubst(options, ["d","e","b","h","a","s","g"], ""); | |
| |
245 |
end | | | |
246 |
bugOnWeb = (grep(options, "w") <> []) & (grep(options, "b") <> []); | |
| |
247 |
| |
| |
248 |
| |
| |
249 |
supportedLANG = ["en_US","fr_FR","ja_JP","de_DE","pt_BR","ru_RU","zh_CN","fa_IR"]; | |
| |
250 |
i = grep(supportedLANG, ("/^" + LANG) + "_/", "r"); | |
| |
251 |
if i == [] then | |
0% | 100% |
252 |
LANG = "en_US"; | |
| |
253 |
else | | | |
254 |
LANG = supportedLANG(i); | |
| |
255 |
end | | | |
256 |
| |
| |
257 |
| |
| |
258 |
if ~bugOnWeb then | 25 ms |
100% | 0% |
259 |
fun = uman_strsubst(fun, ["/\{/","/\}/"], ["[","]"], "r"); | 11 ms |
| |
260 |
sub = "assignation,great, > , < , [ , ] , : , // ,"; | |
| |
261 |
ids = "insertion ,less ,less,less,brackets,brackets,colon,comments,"; | |
| |
262 |
sub = sub + " <> , ~= , <= , >= ,"; | |
| |
263 |
ids = ids + "comparison,comparison,comparison,comparison,"; | |
| |
264 |
sub = sub + " = , == ,"; | |
| |
265 |
ids = ids + "equal,comparison,"; | |
| |
266 |
| |
| |
267 |
| |
| |
268 |
sub = sub + " & , | , ~ , $ , . , [] ,"; | |
| |
269 |
ids = ids + "and_op,or_op,not,dollar,dot,empty,"; | |
| |
270 |
| |
| |
271 |
sub = sub + " - , + , * , .* , / , ./ , /. , .^ , ** , ^ , .*., \ ,"; | |
| |
272 |
ids = ids + "minus,plus,star,star,slash,slash,slash,power,power,hat,kron,backslash,"; | |
| |
273 |
sub = sub + " \. , *. , ./. , .\. ,"; | |
| |
274 |
ids = ids + "overloading,overloading,overloading,overloading,"; | |
| |
275 |
sub = sub + " '' , ; "; | |
| |
276 |
ids = ids + "quote,semicolon"; | |
| |
277 |
sub = sub + ""; | |
| |
278 |
ids = ids + ""; | |
| |
279 |
sub = [stripblanks(strsplit(sub, ","));","]; | 12 ms |
| |
280 |
ids = [stripblanks(strsplit(ids, ","));"comma"]; | 2 ms |
| |
281 |
i = find(fun == sub); | |
| |
282 |
if i <> [] then | |
0% | 100% |
283 |
fun = ids(i(1)); | |
| |
284 |
end | | | |
285 |
if grep(fun, " ") then | |
0% | 100% |
286 |
fun = strsubst(fun, " ", "_"); | |
| |
287 |
end | | | |
288 |
end | | | |
289 |
| |
| |
290 |
| |
| |
291 |
if (grep(convstr(fun), "propert") <> []) && (grep(options, "d") == []) then | |
0% | 100% |
292 |
options = "d" + options; | |
| |
293 |
end | | | |
294 |
| |
| |
295 |
| |
| |
296 |
| |
| |
297 |
if convstr(fun) == fun then | |
50% | 50% |
298 |
casse = "-C"; | |
| |
299 |
| |
| |
300 |
else | | | |
301 |
casse = ""; | |
| |
302 |
| |
| |
303 |
end | | | |
304 |
| |
| |
305 |
if getos() == "Windows" then | |
100% | 0% |
306 |
unzip = ((pathconvert(SCI + "\tools\zip\") + "unzip.exe ") + casse) + " -o -q "; | |
| |
307 |
| |
| |
308 |
else | | | |
309 |
unzip = ("unzip " + casse) + " "; | |
| |
310 |
end | | | |
311 |
| |
| |
312 |
fs = filesep(); | |
| |
313 |
unzippedFile = ""; | |
| |
314 |
| |
| |
315 |
| |
| |
316 |
| |
| |
317 |
| |
| |
318 |
manDir = pathconvert(SCIHOME + "\uman\"); | |
| |
319 |
if fileinfo(manDir) == [] then | |
0% | 100% |
320 |
mkdir(manDir); | |
| |
321 |
end | | | |
322 |
| |
| |
323 |
manScilabDir = pathconvert(manDir + "HTML_pages_Scilab\"); | |
| |
324 |
if fileinfo(manScilabDir) == [] then | |
0% | 100% |
325 |
mkdir(manScilabDir); | |
| |
326 |
| |
| |
327 |
end | | | |
328 |
| |
| |
329 |
manAtomsDir = pathconvert(manDir + "HTML_pages_Contrib\"); | |
| |
330 |
if fileinfo(manAtomsDir) == [] then | |
0% | 100% |
331 |
mkdir(manAtomsDir); | |
| |
332 |
else | | | |
333 |
| |
| |
334 |
if grep(options, "r") <> [] then | |
0% | 100% |
335 |
rmdir(manAtomsDir, "s"); | |
| |
336 |
mkdir(manAtomsDir); | |
| |
337 |
end | | | |
338 |
end | | | |
339 |
| |
| |
340 |
| |
| |
341 |
| |
| |
342 |
| |
| |
343 |
| |
| |
344 |
jarListFile = manDir + "jarListe.txt"; | |
| |
345 |
i = fileinfo(jarListFile); | 1 ms |
| |
346 |
| |
| |
347 |
| |
| |
348 |
if (i == []) || (grep(options, "r") <> []) then | |
0% | 100% |
349 |
| |
| |
350 |
| |
| |
351 |
| |
| |
352 |
function flist = dirjar(path) | | | |
353 |
| | | |
354 |
if isdir(path) then | | | |
355 |
if getos() == "Windows" then | | | |
356 |
flist = unix_g(("dir /s /b " + path) + "scilab_*_help.jar 2> nul"); | | | |
357 |
else | | | |
358 |
if getos() == "Linux" then | | | |
359 |
flist = unix_g(("find " + path) + " -name scilab_*_help.jar 2> /dev/null"); | | | |
360 |
else | | | |
361 |
flist = unix_g(("find 2>/dev/null " + path) + "scilab_*_help.jar"); | | | |
362 |
end | | | |
363 |
end | | | |
364 |
if flist == "" then | | | |
365 |
flist = []; | | | |
366 |
end | | | |
367 |
else | | | |
368 |
flist = []; | | | |
369 |
end | | | |
370 |
endfunction | | | |
371 |
| |
| |
372 |
jarList = []; | |
| |
373 |
| |
| |
374 |
path = pathconvert(pathconvert(SCI) + "modules\helptools\jar\"); | |
| |
375 |
jarList = [jarList;dirjar(path)]; | |
| |
376 |
| |
| |
377 |
path = pathconvert(pathconvert(SCI) + "contrib\"); | |
| |
378 |
jarList = [jarList;dirjar(path)]; | |
| |
379 |
| |
| |
380 |
path = pathconvert(pathconvert(SCIHOME) + "atoms\"); | |
| |
381 |
jarList = [jarList;dirjar(path)]; | |
| |
382 |
| |
| |
383 |
path = pathconvert(pathconvert(SCIHOME) + "contrib\"); | |
| |
384 |
jarList = [jarList;dirjar(path)]; | |
| |
385 |
| |
| |
386 |
global("umanUserPaths"); | |
| |
387 |
if (umanUserPaths <> []) & (type(umanUserPaths) == 10) then | |
0% | 0% |
388 |
for p = umanUserPaths(:)' do | |
×0 |
389 |
if isdir(p) then | |
0% | 0% |
390 |
jarList = [jarList;dirjar(pathconvert(p))]; | |
| |
391 |
end | | | |
392 |
end | | | |
393 |
end | | | |
394 |
| |
| |
395 |
csvWrite(jarList, jarListFile, ascii(9)); | |
| |
396 |
else | | | |
397 |
jarList = mgetl(jarListFile); | |
| |
398 |
end | | | |
399 |
| |
| |
400 |
| |
| |
401 |
module = ""; | |
| |
402 |
clang = getlanguage(); | |
| |
403 |
| |
| |
404 |
| |
| |
405 |
| |
| |
406 |
| |
| |
407 |
| |
| |
408 |
jhmListFile = manDir + "jhmListe.txt"; | |
| |
409 |
mapDir = (manDir + "jhelpMaps") + fs; | |
| |
410 |
if ~isdir(mapDir) then | |
0% | 100% |
411 |
mkdir(mapDir); | |
| |
412 |
mkdir((mapDir + "scilab") + fs); | |
| |
413 |
| |
| |
414 |
else | | | |
415 |
if grep(options, "r") <> [] then | |
0% | 100% |
416 |
mdelete(mapDir + "*.jhm"); | |
| |
417 |
end | | | |
418 |
end | | | |
419 |
if (i == []) || (grep(options, "r") <> []) then | |
0% | 100% |
420 |
| |
| |
421 |
| |
| |
422 |
| |
| |
423 |
| |
| |
424 |
fs = filesep(); | |
| |
425 |
pattern = pathconvert("\modules\helptools\jar\scilab_", %F); | |
| |
426 |
jhmListe = []; | |
| |
427 |
for jar = jarList' do | |
×0 |
428 |
| |
| |
429 |
if grep(jar, pattern) <> [] then | |
0% | 0% |
430 |
module = "scilab"; | |
| |
431 |
else | | | |
432 |
| |
| |
433 |
| |
| |
434 |
tmp = fullpath((dirname(jar) + fs) + "..\etc\*.start"); | |
| |
435 |
tmp = dir(tmp); | |
| |
436 |
startfile = tmp.name(1); | |
| |
437 |
module = basename(startfile); | |
| |
438 |
end | | | |
439 |
lang = uman_strsubst(jar, "|.*?_([a-z]{2}_[A-Z]{2})_help.jar|", "$1", "r"); | |
| |
440 |
subDir = (("scilab_" + lang) + "_help") + fs; | |
| |
441 |
zippedMap = subDir + "jhelpmap.jhm"; | |
| |
442 |
if getos() == "Windows" then | |
0% | 0% |
443 |
jar = getshortpathname(jar); | |
| |
444 |
| |
| |
445 |
end | | | |
446 |
| |
| |
447 |
command = (((unzip + jar) + " ") + zippedMap) + " -d "; | |
| |
448 |
if module == "scilab" then | |
0% | 0% |
449 |
command = command + manScilabDir; | |
| |
450 |
unzippedMapFrom = (manScilabDir + subDir) + "jhelpmap.jhm"; | |
| |
451 |
unzippedMapTo = (((("scilab" + fs) + module) + "_") + lang) + ".jhm"; | |
| |
452 |
else | | | |
453 |
command = command + manAtomsDir; | |
| |
454 |
unzippedMapFrom = (manAtomsDir + subDir) + "jhelpmap.jhm"; | |
| |
455 |
unzippedMapTo = ((module + "_") + lang) + ".jhm"; | |
| |
456 |
end | | | |
457 |
status = host(command); | |
| |
458 |
[s, m] = movefile(unzippedMapFrom, mapDir + unzippedMapTo); | |
| |
459 |
jhmListe = [jhmListe;[module,unzippedMapTo,jar]]; | |
| |
460 |
end | | | |
461 |
| |
| |
462 |
jhmListe = jhmListe($:1, :); | |
| |
463 |
[tmp, k] = unique(jhmListe(:, 2)); | |
| |
464 |
jhmListe = jhmListe(gsort(k, "g", "i"), :); | |
| |
465 |
csvWrite(jhmListe, jhmListFile); | |
| |
466 |
else | | | |
467 |
jhmListe = csvRead(jhmListFile, [], [], "string"); | |
| |
468 |
end | | | |
469 |
| |
| |
470 |
| |
| |
471 |
| |
| |
472 |
function k = uman_orderJhmHMapsByLang(c, external?) | | | |
473 |
| | | |
474 |
| | | |
475 |
| | | |
476 |
| | | |
477 |
| | | |
478 |
| | | |
479 |
| | | |
480 |
if external? then | | | |
481 |
| | | |
482 |
k = grep(c, ((("|^[^\" + fs) + "]+_") + LANG) + "\.jhm|", "r"); | | | |
483 |
| | | |
484 |
if clang <> LANG then | | | |
485 |
k = [k,grep(c, ((("|^[^\" + fs) + "]+_") + clang) + "\.jhm|", "r")]; | | | |
486 |
end | | | |
487 |
| | | |
488 |
if (LANG <> "en_US") & (clang <> "en_US") then | | | |
489 |
k = [k,grep(c, ("|^[^\" + fs) + "]+_en_US\.jhm|", "r")]; | | | |
490 |
end | | | |
491 |
else | | | |
492 |
k = find(c == (((("scilab" + fs) + "scilab_") + LANG) + ".jhm")); | | | |
493 |
if clang <> LANG then | | | |
494 |
k = [k,find(c == (((("scilab" + fs) + "scilab_") + clang) + ".jhm"))]; | | | |
495 |
end | | | |
496 |
if (LANG <> "en_US") & (clang <> "en_US") then | | | |
497 |
k = [k,find(c == (("scilab" + fs) + "scilab_en_US.jhm"))]; | | | |
498 |
end | | | |
499 |
end | | | |
500 |
endfunction | | | |
501 |
| |
| |
502 |
k = find(jhmListe(:, 1) == "scilab"); | |
| |
503 |
tmp = jhmListe(k, :); | |
| |
504 |
k2 = uman_orderJhmHMapsByLang(tmp(:, 2), %F); | |
| |
505 |
jhmScilab = jhmListe(k(k2), :); | |
| |
506 |
| |
| |
507 |
k = find(jhmListe(:, 1) <> "scilab"); | |
| |
508 |
tmp = jhmListe(k, :); | |
| |
509 |
if tmp <> [] then | 10 ms |
100% | 0% |
510 |
k2 = uman_orderJhmHMapsByLang(tmp(:, 2), %T); | 10 ms |
| |
511 |
jhmModules = jhmListe(k(k2), :); | |
| |
512 |
else | | | |
513 |
jhmModules = []; | |
| |
514 |
end | | | |
515 |
| |
| |
516 |
| |
| |
517 |
htmlName = ""; | |
| |
518 |
localMacro = ""; | |
| |
519 |
webId = ""; | |
| |
520 |
| |
| |
521 |
jhmLine = []; | |
| |
522 |
if casse == "-C" then | |
50% | 50% |
523 |
grepCase = "i"; | |
| |
524 |
else | | | |
525 |
grepCase = ""; | |
| |
526 |
end | | | |
527 |
if grep(fun, ["|","/","\","*",":","[","("]) == [] then | 539.005 ms |
100% | 0% |
528 |
| |
| |
529 |
| |
| |
530 |
funR = ""; | |
| |
531 |
if grep(options, "x") == [] then | 539.005 ms |
100% | 0% |
532 |
| |
| |
533 |
| |
| |
534 |
| |
| |
535 |
| |
| |
536 |
| |
| |
537 |
| |
| |
538 |
| |
| |
539 |
[fun1s, optmp] = uman_get_equiv(fun, options, "shortcuts"); | 82.001 ms |
| |
540 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun1s, jhmScilab, mapDir, grepCase); | 457.003 ms |
| |
541 |
if htmlName == "" then | |
0% | 100% |
542 |
| |
| |
543 |
[fun2s, optmp] = uman_get_equiv(fun, options, "ex2in"); | |
| |
544 |
if fun2s <> fun1s then | |
0% | 0% |
545 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun2s, jhmScilab, mapDir, grepCase); | |
| |
546 |
if htmlName <> "" then | |
0% | 0% |
547 |
funR = fun2s; | |
| |
548 |
options = optmp; | |
| |
549 |
end | | | |
550 |
end | | | |
551 |
else | | | |
552 |
funR = fun1s; | |
| |
553 |
options = optmp; | |
| |
554 |
end | | | |
555 |
| |
| |
556 |
if (htmlName == "") && (jhmModules <> []) then | |
0% | 100% |
557 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun, jhmModules, mapDir, grepCase); | |
| |
558 |
if htmlName <> "" then | |
0% | 0% |
559 |
funR = fun; | |
| |
560 |
end | | | |
561 |
end | | | |
562 |
| |
| |
563 |
if htmlName == "" then | |
0% | 100% |
564 |
localMacro = uman_find_localMacro(fun); | |
| |
565 |
if localMacro <> "" then | |
0% | 0% |
566 |
funR = fun; | |
| |
567 |
end | | | |
568 |
end | | | |
569 |
| |
| |
570 |
if ((htmlName == "") && (localMacro == "")) && (jhmModules <> []) then | |
0% | 100% |
571 |
[fun2m, optmp] = uman_get_equiv(fun, options, "ex2ex"); | |
| |
572 |
if fun2m <> fun then | |
0% | 0% |
573 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun2m, jhmModules, mapDir, grepCase); | |
| |
574 |
if htmlName <> "" then | |
0% | 0% |
575 |
funR = fun2m; | |
| |
576 |
options = optmp; | |
| |
577 |
end | | | |
578 |
end | | | |
579 |
end | | | |
580 |
| |
| |
581 |
| |
| |
582 |
else | | | |
583 |
| |
| |
584 |
| |
| |
585 |
| |
| |
586 |
| |
| |
587 |
| |
| |
588 |
| |
| |
589 |
| |
| |
590 |
| |
| |
591 |
| |
| |
592 |
if jhmModules <> [] then | |
0% | 0% |
593 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun, jhmModules, mapDir, grepCase); | |
| |
594 |
end | | | |
595 |
| |
| |
596 |
if htmlName == "" then | |
0% | 0% |
597 |
[fun1s, optmp] = uman_get_equiv(fun, options, "exin2in"); | |
| |
598 |
[fun1s, optmp] = uman_get_equiv(fun1s, options, "ex2in"); | |
| |
599 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun1s, jhmScilab, mapDir, grepCase); | |
| |
600 |
if htmlName <> "" then | |
0% | 0% |
601 |
funR = fun1s; | |
| |
602 |
options = optmp; | |
| |
603 |
end | | | |
604 |
end | | | |
605 |
| |
| |
606 |
if (htmlName == "") & (jhmModules <> []) then | |
0% | 0% |
607 |
[fun1m, optmp] = uman_get_equiv(fun, options, "ex2ex"); | |
| |
608 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun1m, jhmModules, mapDir, grepCase); | |
| |
609 |
if htmlName <> "" then | |
0% | 0% |
610 |
funR = fun1m; | |
| |
611 |
options = optmp; | |
| |
612 |
end | | | |
613 |
end | | | |
614 |
| |
| |
615 |
if htmlName == "" then | |
0% | 0% |
616 |
localMacro = uman_find_localMacro(fun); | |
| |
617 |
if localMacro <> "" then | |
0% | 0% |
618 |
funR = fun; | |
| |
619 |
end | | | |
620 |
end | | | |
621 |
| |
| |
622 |
if (htmlName == "") & (localMacro == "") then | |
0% | 0% |
623 |
[fun2s, optmp] = uman_get_equiv(fun, options, "shortcuts"); | |
| |
624 |
if fun2s <> fun1s then | |
0% | 0% |
625 |
[htmlName, jhmLine] = uman_findItemInJHelpMaps(fun2s, jhmScilab, mapDir, grepCase); | |
| |
626 |
if htmlName <> "" then | |
0% | 0% |
627 |
funR = fun2s; | |
| |
628 |
options = optmp; | |
| |
629 |
end | | | |
630 |
end | | | |
631 |
end | | | |
632 |
end | | | |
633 |
| |
| |
634 |
| |
| |
635 |
if (htmlName == "") && (localMacro == "") then | |
0% | 100% |
636 |
[fun3, optmp] = uman_get_equiv(fun, options, "ex2key"); | |
| |
637 |
funR = fun3; | |
| |
638 |
options = optmp; | |
| |
639 |
end | | | |
640 |
fun = funR; | |
| |
641 |
end | | | |
642 |
| |
| |
643 |
| |
| |
644 |
module = ""; | |
| |
645 |
if jhmLine <> [] then | |
100% | 0% |
646 |
module = jhmLine(1); | |
| |
647 |
end | | | |
648 |
| |
| |
649 |
AF = uman_get_atoms_forge(); | 143.001 ms |
| |
650 |
AFid = AF(:, 2); | 1 ms |
| |
651 |
webRef = []; | |
| |
652 |
if module <> "scilab" then | |
0% | 100% |
653 |
k = []; | |
| |
654 |
if module <> "" then | |
0% | 0% |
655 |
k = find(AFid == module); | |
| |
656 |
if k == [] then | |
0% | 0% |
657 |
k = find(convstr(AFid) == convstr(module)); | |
| |
658 |
end | | | |
659 |
else | | | |
660 |
if fun == convstr(fun) then | |
0% | 0% |
661 |
k = find(convstr(AFid) == fun); | |
| |
662 |
else | | | |
663 |
k = find(AFid == fun); | |
| |
664 |
end | | | |
665 |
if k == [] then | |
0% | 0% |
666 |
| |
| |
667 |
fun1e = uman_get_equiv(fun, options, "ex2ex"); | |
| |
668 |
if fun1e == convstr(fun1e) then | |
0% | 0% |
669 |
k = find(convstr(AFid) == fun1e); | |
| |
670 |
else | | | |
671 |
k = find(AFid == fun1e); | |
| |
672 |
end | | | |
673 |
end | | | |
674 |
end | | | |
675 |
if k <> [] then | |
0% | 0% |
676 |
webRef = AF(k, :); | |
| |
677 |
| |
| |
678 |
module = webRef(2); | |
| |
679 |
end | | | |
680 |
end | | | |
681 |
| |
| |
682 |
| |
| |
683 |
atomsInstalled = atomsGetInstalled(); | 42 ms |
| |
684 |
if atomsInstalled <> [] then | |
100% | 0% |
685 |
atomsInstalled(:, 4) = getshortpathname(pathconvert(atomsInstalled(:, 4))); | |
| |
686 |
end | | | |
687 |
isATOMSinstalled = find(atomsInstalled(:, 1) == module) <> []; | |
| |
688 |
| |
| |
689 |
| |
| |
690 |
| |
| |
691 |
| |
| |
692 |
| |
| |
693 |
| |
| |
694 |
| |
| |
695 |
| |
| |
696 |
| |
| |
697 |
| |
| |
698 |
| |
| |
699 |
| |
| |
700 |
BugzillaSearch = ((("http://bugzilla.scilab.org/buglist.cgi" + "?product=Scilab software&query_format=advanced") + "&short_desc_type=regexp&short_desc=(^|[^a-zA-Z_])£([^0-9a-zA-Z_%3D%3B]|$)") + "&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED") + "&bug_status=RESOLVED&"; | |
| |
701 |
| |
| |
702 |
| |
| |
703 |
BugzillaSearch = (BugzillaSearch + urlQuery) + "order=resolution,bug_id DESC"; | |
| |
704 |
| |
| |
705 |
| |
| |
706 |
| |
| |
707 |
| |
| |
708 |
BugReport = ""; | |
| |
709 |
if bugOnWeb then | |
0% | 100% |
710 |
| |
| |
711 |
| |
| |
712 |
if grep(fun0, "/^[0-9]+$/", "r") == 1 then | |
0% | 0% |
713 |
| |
| |
714 |
url = "http://bugzilla.scilab.org/" + fun0; | |
| |
715 |
uman_openURL(url, noWebBrowserMsg); | |
| |
716 |
return; | |
| |
717 |
end | | | |
718 |
| |
| |
719 |
| |
| |
720 |
| |
| |
721 |
if (module <> "scilab") && (webRef <> []) then | |
0% | 0% |
722 |
| |
| |
723 |
| |
| |
724 |
if webRef(3) <> "" then | |
0% | 0% |
725 |
BugReport = ("http://forge.scilab.org/index.php/p/" + webRef(3)) + "/issues/"; | |
| |
726 |
BugzillaSearch = BugReport + "search/?q="; | |
| |
727 |
if htmlName <> "" then | |
0% | 0% |
728 |
BugzillaSearch = BugzillaSearch + fun; | |
| |
729 |
else | | | |
730 |
BugzillaSearch = BugzillaSearch + fun0; | |
| |
731 |
end | | | |
732 |
else | | | |
733 |
| |
| |
734 |
if webRef(1) == "a" then | |
0% | 0% |
735 |
tmp = ("http://atoms.scilab.org/toolboxes/" + module) + "/#comments_remove"; | |
| |
736 |
else | | | |
737 |
if webRef(1) == "fe" then | |
0% | 0% |
738 |
| |
| |
739 |
tmp = stripblanks(webRef(4)) + "/#comments_remove"; | |
| |
740 |
else | | | |
741 |
if webRef(1) == "fo" then | |
0% | 0% |
742 |
| |
| |
743 |
tmp = ("http://forge.scilab.org/index.php/p/" + stripblanks(webRef(2))) + "/issues/search/?q="; | |
| |
744 |
if htmlName <> "" then | |
0% | 0% |
745 |
tmp = tmp + fun; | |
| |
746 |
else | | | |
747 |
tmp = tmp + fun0; | |
| |
748 |
end | | | |
749 |
else | | | |
750 |
| |
| |
751 |
tmp = stripblanks(webRef(4)); | |
| |
752 |
end | | | |
753 |
end | | | |
754 |
end | | | |
755 |
BugReport = tmp; | |
| |
756 |
BugzillaSearch = tmp; | |
| |
757 |
end | | | |
758 |
| |
| |
759 |
else | | | |
760 |
if isATOMSinstalled then | |
0% | 0% |
761 |
tmp = ("http://atoms.scilab.org/toolboxes/" + module) + "/#comments_remove"; | |
| |
762 |
BugReport = tmp; | |
| |
763 |
BugzillaSearch = tmp; | |
| |
764 |
| |
| |
765 |
else | | | |
766 |
if (module <> "scilab") && (htmlName <> "") then | |
0% | 0% |
767 |
BugzillaSearch = ""; | |
| |
768 |
end | | | |
769 |
end | | | |
770 |
end | | | |
771 |
if BugzillaSearch <> "" then | |
0% | 0% |
772 |
fun = strsubst(fun, "/^percent/", "%", "r"); | |
| |
773 |
| |
| |
774 |
if grep(fun, "/") <> [] then | |
0% | 0% |
775 |
delim = "!"; | |
| |
776 |
else | | | |
777 |
delim = "/"; | |
| |
778 |
end | | | |
779 |
tmp = uman_strsubst(fun, (delim + ["\\","&","\*","\.","\-","\:","\|\|","\]","\[","\(","\)","\$","\^","/"]) + delim, ["\\\\","%26","\\*","\\.","\\-","\\:","\\|\\|","\\]","\\[","\\(","\\)","\\%24","\\^","%2F"], "r"); | |
| |
780 |
if tmp <> fun then | |
0% | 0% |
781 |
if tmp == "" then | |
0% | 0% |
782 |
tmp = ".*"; | |
| |
783 |
end | | | |
784 |
url = strsubst(BugzillaSearch, "£", ("(" + tmp) + ")"); | |
| |
785 |
| |
| |
786 |
else | | | |
787 |
tmp = fun0; | |
| |
788 |
if fun0 == "" then | |
0% | 0% |
789 |
tmp = ".*"; | |
| |
790 |
end | | | |
791 |
url = strsubst(BugzillaSearch, "£", ("(" + tmp) + ")"); | |
| |
792 |
end | | | |
793 |
uman_openURL(url, noWebBrowserMsg); | |
| |
794 |
else | | | |
795 |
| |
| |
796 |
end | | | |
797 |
return; | |
| |
798 |
end | | | |
799 |
| |
| |
800 |
| |
| |
801 |
| |
| |
802 |
printWeb = ((grep(options, "w") <> []) & (grep(options, "b") == [])) | ((unzippedFile == "") & (grep(options0, "w") <> [])); | |
| |
803 |
if printWeb then | |
0% | 100% |
804 |
url = ""; | |
| |
805 |
if webRef <> [] then | |
0% | 0% |
806 |
| |
| |
807 |
if webRef(1) == "a" then | |
0% | 0% |
808 |
url = "https://atoms.scilab.org/toolboxes/" + webRef(2); | |
| |
809 |
| |
| |
810 |
else | | | |
811 |
if webRef(1) == "fe" then | |
0% | 0% |
812 |
url = webRef(4); | |
| |
813 |
| |
| |
814 |
else | | | |
815 |
if webRef(1) == "fo" then | |
0% | 0% |
816 |
url = "http://forge.scilab.org/index.php/p/" + webRef(2); | |
| |
817 |
| |
| |
818 |
else | | | |
819 |
url = webRef(4); | |
| |
820 |
end | | | |
821 |
end | | | |
822 |
end | | | |
823 |
else | | | |
824 |
if or(module == ["","scilab"]) then | |
0% | 0% |
825 |
url = "https://help.scilab.org/docs/current/"; | |
| |
826 |
supported_online = ["en_US","fr_FR","pt_BR","ru_RU","ja_JP"]; | |
| |
827 |
if and(LANG <> supported_online) then | |
0% | 0% |
828 |
langH = "en_US"; | |
| |
829 |
else | | | |
830 |
langH = LANG; | |
| |
831 |
end | | | |
832 |
| |
| |
833 |
if htmlName <> "" then | |
0% | 0% |
834 |
| |
| |
835 |
| |
| |
836 |
| |
| |
837 |
if grep(htmlName, "/.+\-[0-9a-f]{32}\.html/", "r") then | |
0% | 0% |
838 |
htmlName = strsubst(htmlName, "/\-[0-9a-f]{32}/", "", "r"); | |
| |
839 |
end | | | |
840 |
url = ((url + langH) + "/") + htmlName; | |
| |
841 |
else | | | |
842 |
| |
| |
843 |
url = ((url + langH) + "/search/") + fun0; | |
| |
844 |
end | | | |
845 |
end | | | |
846 |
end | | | |
847 |
if url <> "" then | |
0% | 0% |
848 |
uman_openURL(url, noWebBrowserMsg); | |
| |
849 |
else | | | |
850 |
disp("NO WEB REFERENCE AVAILABLE"); | |
| |
851 |
end | | | |
852 |
| |
| |
853 |
end | | | |
854 |
| |
| |
855 |
| |
| |
856 |
| |
| |
857 |
| |
| |
858 |
| |
| |
859 |
printConsole = (grep(options, ["w","@"]) == []) | (~bugOnWeb & (module <> "scilab")); | |
| |
860 |
if printConsole && (grep(options, "j") == []) then | |
100% | 0% |
861 |
diary([], "pause"); | |
| |
862 |
| |
| |
863 |
end | | | |
864 |
noContent = %F; | |
| |
865 |
| |
| |
866 |
| |
| |
867 |
| |
| |
868 |
if htmlName <> "" then | |
100% | 0% |
869 |
jar = jhmLine(3); | |
| |
870 |
| |
| |
871 |
[tmp, tmp, tmp, lang] = regexp(jhmLine(2), "|_(.._..)\.jhm|"); | |
| |
872 |
subDir = ("scilab_" + lang) + "_help"; | |
| |
873 |
| |
| |
874 |
zippedFile = (subDir + fs) + htmlName; | |
| |
875 |
if module == "scilab" then | |
100% | 0% |
876 |
outDir = manScilabDir; | |
| |
877 |
| |
| |
878 |
else | | | |
879 |
| |
| |
880 |
outDir = manAtomsDir; | |
| |
881 |
| |
| |
882 |
end | | | |
883 |
unzipped = ((outDir + subDir) + fs) + htmlName; | |
| |
884 |
if isfile(unzipped) && (grep(options, "r") == []) then | |
100% | 0% |
885 |
unzippedFile = unzipped; | |
| |
886 |
else | | | |
887 |
if isfile(unzipped) then | |
0% | 0% |
888 |
deletefile(unzipped); | |
| |
889 |
end | | | |
890 |
if jar <> [] then | |
0% | 0% |
891 |
| |
| |
892 |
command = ((((unzip + jar) + " ") + zippedFile) + " -d ") + outDir; | |
| |
893 |
status = host(command); | |
| |
894 |
if status == 0 then | |
0% | 0% |
895 |
| |
| |
896 |
unzippedFile = unzipped; | |
| |
897 |
end | | | |
898 |
else | | | |
899 |
status = 9; | |
| |
900 |
| |
| |
901 |
end | | | |
902 |
end | | | |
903 |
end | | | |
904 |
| |
| |
905 |
| |
| |
906 |
| |
| |
907 |
if unzippedFile <> "" then | 3.077 s |
100% | 0% |
908 |
| |
| |
909 |
r = uman_grab(unzippedFile, fun, LANG); | 2.937 s |
| |
910 |
r.fun = fun0; | |
| |
911 |
| |
| |
912 |
| |
| |
913 |
msg2 = ""; | |
| |
914 |
if printConsole then | 140 ms |
100% | 0% |
915 |
if grep(options, "c") <> [] then | 10 ms |
25% | 75% |
916 |
clc(); | 10 ms |
| |
917 |
else | | | |
918 |
if grep(options, "u") == [] then | |
100% | 0% |
919 |
| |
| |
920 |
tmp = lines(); | |
| |
921 |
write(%io(2), part("=", ones(1, tmp(1)))); | |
| |
922 |
end | | | |
923 |
end | | | |
924 |
| |
| |
925 |
| |
| |
926 |
msg0 = ""; | |
| |
927 |
if grep(options, "s") == [] then | 130 ms |
75% | 25% |
928 |
if module <> "scilab" then | |
0% | 100% |
929 |
if webRef(1) == "a" then | |
0% | 0% |
930 |
r.bug_report = BugReport; | |
| |
931 |
r.bugs_known = BugzillaSearch; | |
| |
932 |
else | | | |
933 |
r.bug_report = ""; | |
| |
934 |
r.bugs_known = ""; | |
| |
935 |
end | | | |
936 |
end | | | |
937 |
| |
| |
938 |
uman_disp(r, options); | 70 ms |
| |
939 |
| |
| |
940 |
| |
| |
941 |
else | | | |
942 |
tmp = strsplit(unzippedFile, fs); | |
| |
943 |
zippedFile = ((tmp($ - 1) + fs) + r.parentSummary) + ".html"; | |
| |
944 |
tmp = strsplit(unzippedFile, fs); | 10 ms |
| |
945 |
outDir = strcat(tmp(1:($ - 2)), fs); | |
| |
946 |
unzippedFile = ((dirname(unzippedFile) + fs) + r.parentSummary) + ".html"; | |
| |
947 |
if fileinfo(unzippedFile) == [] then | |
0% | 100% |
948 |
command = ((((unzip + jar) + " ") + zippedFile) + " -d ") + outDir; | |
| |
949 |
status = host(command); | |
| |
950 |
| |
| |
951 |
end | | | |
952 |
| |
| |
953 |
html = mgetl(unzippedFile); | |
| |
954 |
search = ["<html>"; | |
| |
955 |
"<body>"; | |
| |
956 |
"<head>.*?</head>"; | |
| |
957 |
"<div class=""manualnavbar"">.*?</div>"; | |
| |
958 |
"</body>"; | |
| |
959 |
"</html>"; | |
| |
960 |
"<br />"]; | |
| |
961 |
search = ("|" + search) + "|"; | |
| |
962 |
replace = ["<div>","","","","","</div>",ascii(10)]; | |
| |
963 |
html2 = uman_strsubst(strcat(html, " "), search, replace, "r"); | |
| |
964 |
tmp = xmlReadStr(html2); | |
| |
965 |
simpleContent = %T; | |
| |
966 |
| |
| |
967 |
| |
| |
968 |
| |
| |
969 |
lang = part(LANG, 1:2); | |
| |
970 |
if or(lang == ["ja","zh"]) then | |
0% | 100% |
971 |
tmp2 = tmp.root.children(3).content; | |
| |
972 |
| |
| |
973 |
RelCharWidth = uman_setRelCharWidth(tmp2, lang); | |
| |
974 |
end | | | |
975 |
text = uman_xml2txt(tmp.root, " "); | 50 ms |
| |
976 |
tmp2 = strsplit(text(1), ">"); | |
| |
977 |
if grep(tmp2(1), "Scilab") <> [] then | |
100% | 0% |
978 |
tmp2(1) = "Scilab"; | |
| |
979 |
end | | | |
980 |
tmp2 = stripblanks(tmp2); | |
| |
981 |
tmp2(find(tmp2 == "")) = []; | |
| |
982 |
if (size(tmp2, "*") > 1) && (tmp2(1) == tmp2(2)) then | |
0% | 100% |
983 |
tmp2(2) = []; | |
| |
984 |
end | | | |
985 |
text(1) = strcat(tmp2, " > ") + ascii(10); | |
| |
986 |
text(2) = []; | |
| |
987 |
| |
| |
988 |
i = find(text == " "); | |
| |
989 |
text(i) = []; | |
| |
990 |
| |
| |
991 |
write(%io(2), text); | |
| |
992 |
xmlDelete(tmp); | |
| |
993 |
end | | | |
994 |
| |
| |
995 |
end | | | |
996 |
else | | | |
997 |
| |
| |
998 |
| |
| |
999 |
if grep(options, "w") == [] then | |
0% | 0% |
1000 |
| |
| |
1001 |
| |
| |
1002 |
if localMacro <> "" then | |
0% | 0% |
1003 |
if grep(options, "c") <> [] then | |
0% | 0% |
1004 |
clc(); | |
| |
1005 |
mprintf("-> uman %s %s\n\n", fun0, options0); | |
| |
1006 |
end | | | |
1007 |
head_comments(localMacro); | |
| |
1008 |
| |
| |
1009 |
else | | | |
1010 |
| |
| |
1011 |
| |
| |
1012 |
msg = _("uman", " %s: ""%s"" has no dedicated page.\n"); | |
| |
1013 |
mprintf(msg, "uman", fun0); | |
| |
1014 |
if webRef <> [] then | |
0% | 0% |
1015 |
msg = _("uman %s w%s // should work.\n"); | |
| |
1016 |
mprintf(msg, fun0, options0); | |
| |
1017 |
end | | | |
1018 |
noContent = %T; | |
| |
1019 |
end | | | |
1020 |
end | | | |
1021 |
end | | | |
1022 |
if printConsole && (grep(options, "j") == []) then | |
100% | 0% |
1023 |
diary([], "resume"); | |
| |
1024 |
| |
| |
1025 |
end | | | |
1026 |
msg1 = ""; | |
| |
1027 |
| |
| |
1028 |
| |
| |
1029 |
| |
| |
1030 |
if grep(options, "g") <> [] then | |
0% | 100% |
1031 |
global("%helps"); | |
| |
1032 |
if ((module == "scilab") | (isATOMSinstalled & atomsIsLoaded(module))) | (find(convstr(%helps(:, 2)) == convstr(module)) <> []) then | |
0% | 0% |
1033 |
| |
| |
1034 |
if grep(options, "s") <> [] then | |
0% | 0% |
1035 |
tmp = r.parentSummary; | |
| |
1036 |
else | | | |
1037 |
if htmlName <> "" then | |
0% | 0% |
1038 |
tmp = basename(htmlName); | |
| |
1039 |
end | | | |
1040 |
end | | | |
1041 |
helpbrowser(%helps(:, 1), tmp, LANG, %F); | |
| |
1042 |
| |
| |
1043 |
else | | | |
1044 |
if module == "" then | |
0% | 0% |
1045 |
| |
| |
1046 |
| |
| |
1047 |
| |
| |
1048 |
| |
| |
1049 |
if grep(options, "x") == [] then | |
0% | 0% |
1050 |
helpbrowser(%helps(:, 1), fun, LANG, %F); | |
| |
1051 |
if fun <> fun0 then | |
0% | 0% |
1052 |
msg1 = _("uman", " uman %s %s // used. Run: uman %s x%s // to really target ""%s""\n"); | |
| |
1053 |
msg1 = msprintf(msg1, fun, options0, fun0, options0, fun0); | |
| |
1054 |
end | | | |
1055 |
else | | | |
1056 |
helpbrowser(%helps(:, 1), fun0, LANG, %F); | |
| |
1057 |
tmp = uman_get_equiv(fun0, options, "scilabFirst"); | |
| |
1058 |
| |
| |
1059 |
if tmp <> fun0 then | |
0% | 0% |
1060 |
msg1 = _("uman", " You may try: uman %s %s\n"); | |
| |
1061 |
msg1 = msprintf(msg1, tmp, strsubst(options, "x", "")); | |
| |
1062 |
end | | | |
1063 |
end | | | |
1064 |
else | | | |
1065 |
if module <> "" then | |
0% | 0% |
1066 |
| |
| |
1067 |
msg1 = _("uman", " [%s] module NOT LOADED => UNVAILABLE in HELP BROWSER\n"); | |
| |
1068 |
msg1 = msprintf(msg1, module); | |
| |
1069 |
end | | | |
1070 |
end | | | |
1071 |
end | | | |
1072 |
end | | | |
1073 |
| |
| |
1074 |
| |
| |
1075 |
msg2 = ""; | |
| |
1076 |
if (((grep(options, "w") <> []) && (module <> "")) && (module <> "scilab")) && (webRef(1) == "a") then | |
0% | 100% |
1077 |
msg2 = ((" [" + module) + "] ") + _("uman", "module EXTERNAL => ONLINE help page UNAVAILABLE"); | |
| |
1078 |
end | | | |
1079 |
tmp = " " + part("-~", ones(1, max(length([msg1,msg2])) / 2) .*. [1,2]); | |
| |
1080 |
if (tmp <> "") && ((msg1 <> "") || (msg2 <> "")) then | |
0% | 100% |
1081 |
msg0 = (((" uman " + fun0) + " ") + options0) + " :"; | |
| |
1082 |
if ~noContent then | |
0% | 0% |
1083 |
write(%io(2), tmp); | |
| |
1084 |
if msg0 <> "" then | |
0% | 0% |
1085 |
write(%io(2), msg0); | |
| |
1086 |
end | | | |
1087 |
end | | | |
1088 |
if msg1 <> "" then | |
0% | 0% |
1089 |
write(%io(2), msg1); | |
| |
1090 |
end | | | |
1091 |
if msg2 <> "" then | |
0% | 0% |
1092 |
write(%io(2), msg2); | |
| |
1093 |
end | | | |
1094 |
if ~noContent then | |
0% | 0% |
1095 |
write(%io(2), tmp); | |
| |
1096 |
end | | | |
1097 |
end | | | |
1098 |
endfunction | | | |