1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr>
3 // Copyright (C) 2009-2010 - DIGITEO - Allan CORNET
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.1-en.txt
11 function generated_files = xmltochm(dirs,titles,directory_language,default_language)
13 warnobsolete(scilabRemovedVersion="5.5.1");
17 if getos() <> "Windows" then
18 warning(msprintf(gettext("%s: This function is only supported on Windows platforms.\n"),"xmltochm"));
28 generated_files = xmltoformat("chm");
32 generated_files = xmltoformat("chm", dirs);
35 generated_files = xmltoformat("chm", dirs, titles);
38 generated_files = xmltoformat("chm", dirs, titles, directory_language);
41 generated_files = xmltoformat("chm", dirs, titles, directory_language, default_language);
44 error(msprintf(gettext("%s: Wrong number of input argument(s): At most %d expected.\n"), "xmltochm", 4));
51 if getos() == "Windows" then
52 if (generated_files <> []) then
53 if (getHHCpath() <> "") then
54 for i = 1:size(generated_files, "*")
56 [path,fname,extension] = fileparts(getshortpathname(generated_files(i)));
58 cmdline = getHHCpath() + " " + fname + extension;
59 [msg,err] = dos(cmdline);
61 chm_origin = "htmlhelp.chm";
63 chm_name = tokens(generated_files(i), filesep());
64 chm_name = chm_name($-1);
65 chm_name = chm_name + ".chm";
67 chm_src = strsubst(generated_files(i), "htmlhelp.hhp", chm_origin);
68 dir_src_idx = strindex(chm_src, filesep());
69 dir_src_chm = part(chm_src,1:dir_src_idx($));
71 if all_scilab_help then
73 dir_dest_chm = part(chm_src,1:dir_src_idx($-2)) + "chm" + filesep();
75 dir_dest_chm = part(chm_src,1:dir_src_idx($-3)) + "chm" + filesep();
78 dir_dest_chm = part(chm_src,1:dir_src_idx($-3)) + "chm" + filesep();
81 chm_destination = dir_dest_chm + chm_name;
83 copyfile(chm_src, chm_destination);
84 generated_files(i) = chm_destination;
87 warning(msprintf(gettext("%s: hhc.exe not found.\n"), "xmltochm"));
90 warning(msprintf(gettext("%s: no file generate.\n"), "xmltochm"));
96 function HHC_path = getHHCpath()
99 std_path = getshortpathname(getenv("ProgramFiles(x86)", "") + filesep() + "HTML Help Workshop" + filesep() + "hhc.exe");
101 std_path = getshortpathname(std_path = getenv("ProgramFiles", "") + filesep() + "HTML Help Workshop" + filesep() + "hhc.exe");
104 if (fileinfo(std_path) == []) then