1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
|
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) 2008 - INRIA
// Copyright (C) 2009 - DIGITEO - Allan CORNET
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
function txt = help_skeleton(funname, path, language)
[lhs,rhs] = argn(0);
if rhs > 3 | rhs < 1 then
error(39);
end
if type(funname) <> 10 then
error(999,msprintf(gettext("%s: Wrong type for input argument #%d: A string expected.\n"),'help_skeleton',1));
end
if size(funname, '*') <> 1 then
error(999,msprintf(gettext("%s: Wrong size for input argument #%d: A string expected.\n"),'help_skeleton',1));
end
if rhs > 1 then
if type(path) <> 10 then
error(55,2);
end
end
previouslangage = getlanguage();
if rhs == 3 then
if type(language) <> 10 then
error(55,3);
end
setlanguage(language);
else
language = getlanguage();
end
txt = [];
vars = macrovar(evstr(funname));
inputs = vars(1);
outputs = vars(2);
context = vars(3);
Call = '';
if size(outputs,'*') == 1 then
Call = outputs + ' = '
elseif size(outputs,'*') > 1 then
Call = '['+strcat(outputs,',')+'] = ';
end
Call = Call + funname;
if size(inputs,'*') >= 1 then
Call = Call+'('+strcat(inputs,',')+')';
end
args = [inputs(:);outputs(:)];
// date management
// --------------------------------------------------------------------------------
w = getdate();
xml_date = msprintf(_("%02d-%02d-%04d"),w(6),w(2),w(1));
//header
// --------------------------------------------------------------------------------
xmlns = 'xmlns=""http://docbook.org/ns/docbook""'
xlink = 'xmlns:xlink=""http://www.w3.org/1999/xlink""'
svg = 'xmlns:svg=""http://www.w3.org/2000/svg""'
mml = ' xmlns:mml=""http://www.w3.org/1998/Math/MathML""'
db = 'xmlns:db=""http://docbook.org/ns/docbook""'
vers = 'version=""5.0-subset Scilab""'
refs = strcat([xmlns xlink svg mml db vers],' ')
txt=['<?xml version=""1.0"" encoding='"UTF-8""?>'
'<!--'
_(' * Add some comments about XML file');
'-->'
'<refentry ' + refs + ' xml:lang=""'+ language + '"" xml:id=""' + funname + '"">'
' <info>'
' <pubdate>$LastChangedDate: ' + xml_date + ' $</pubdate>'
' </info>'
' <refnamediv>'
' <refname>'+ funname + '</refname>'
' <refpurpose>' + _('Add short description here.') + ' </refpurpose>'
' </refnamediv>'
' <refsynopsisdiv>'
' <title>' + _('Calling Sequence') + '</title>'
' <synopsis>' + Call + '</synopsis>'
' </refsynopsisdiv>'];
//Arguments
if size(args,'*') >0 then
txt=[txt;
' <refsection>'
' <title>' + _('Parameters') + '</title>'
' <variablelist>']
for a=args'
txt=[txt;
' <varlistentry>'
' <term>' + a + '</term>'
' <listitem>'
' <para>'
_(' Add here the parameter description.')
' </para>'
' </listitem>'
' </varlistentry>']
end
txt=[txt;
' </variablelist>'
' </refsection>'];
end
//Description
txt=[txt;
' <refsection>'
' <title>' + _('Description') + '</title>'
' <para>'
_(' Add here a paragraph of the function description. ')
_(' Other paragraph can be added ')
' </para>'
' </refsection>'];
//Example
txt=[txt;
' <refsection>'
' <title>' + _('Examples') + '</title>'
' <programlisting role=""example""><![CDATA['
_(' Add here scilab instructions and comments')
' ]]></programlisting>'
' </refsection>'];
//See Also
txt=[txt;
' <refsection>'
' <title>' + _('See Also') + '</title>'
' <simplelist type=""inline"">'
' <member>'
' <link linkend=""' + _('add a reference name') + '"" >' + _('add a reference') + '</link>'
' </member>'
' <member>'
' <link linkend=""' + _('add a reference name') + '"">' + _('add a reference') + '</link>'
' </member>'
' </simplelist>'
' </refsection>'];
//Authors
txt=[txt;
' <refsection>'
' <title>' + _('Authors') + '</title>'
' <simplelist type=""vert"">'
' <member>' + _('add the author name and author reference') + '</member>'
' <member>' + _('add another author name and it''s reference') + '</member>'
' </simplelist>'
' </refsection>'];
//Bibliography
txt = [txt;
' <refsection>'
' <title>' + _('Bibliography') + '</title>'
' <para>'
_(' Add here the function bibliography')
' </para>'
' </refsection>'];
//Used functions
txt=[txt;
' <refsection>'
' <title>' + _('Used Functions') + '</title>'
' <para>'
_(' Add here the Scilab, C,... used code references')
' </para>'
' </refsection>'];
//footer
txt=[txt;
'</refentry>'];
setlanguage(previouslangage);
if rhs >= 2 then
mputl(txt, pathconvert(path,%t,%f) + funname + '.xml');
txt = pathconvert(path,%t,%f) + funname + '.xml';
end
endfunction
|