generate_xml - create arbitrary xml file of scilab man page
txt = generate_xml(name,typ,lang)
- name : string. name of the XML file
- typ : string. set the type of man page
- 'block' : for interfacing function of scicos block
- 'pal' : for a palette (.cosf file)
- 'diagr' : for a scicos diagram (.cos file)
- 'scilib' : for a library of scilab macros
- 'sci' : for a scilab macro.
- 'rout' : for computational routine
- 'sim' : for scilab simulation script (_sim.sce file)
- 'sce' : for scilab script (.sce file)
- lang : string. set the lang of tex file
- 'eng' : to produce english man page
- 'fr' : to produce french man page
- txt : vector of strings. the output text of the XML file
//generate_xml
//Fonction qui génère un fichier xml
//Entrée : name : nom du fichier xml
// typ : type du fichier xml
// 'block'
// 'diagr'
// 'pal'
// 'scilib'
// 'sci'
// 'sim'
// 'sce'
// 'rout'
// lang : langue
// 'eng'
// 'fr'
//Sortie : txt : texte du fichier xml à produire
function txt=generate_xml(name,typ,lang)
[lsh,rsh]=argn(0)
if rsh<3 then
if ~exists('LANGUAGE') then
global LANGUAGE;lang=LANGUAGE;clear LANGUAGE;
else
lang=LANGUAGE;
end
end
if lang<>'fr'&lang<>'eng' then
printf("Documentation: Unsupported language %s, switch to eng.\n",lang);
lang='eng';
end
tt_param=[];
tt_pair_block=[];
tt_call_seq=[];
tt_rmk=[];
tt_ex=[];
tt_used_func=[];
select typ
case 'block'
typel='Scicos Block'
tt_typ=return_typ_block(name);
tt_lables=return_lables_block(name);
tt_param=['<PARAM>';' <PARAM_INDENT>';'']
if tt_typ<>[] then
for i=1:size(tt_lables,1)
tt_param=[tt_param;' <PARAM_ITEM>';
' <PARAM_NAME>'+tt_lables(i,1)+'</PARAM_NAME>';
' <PARAM_DESCRIPTION>';' <SP>';];
if lang=='fr' then
tt_param=[tt_param;
' : Type '''+tt_typ(i,1)+''' de taille '+tt_typ(i,2)+...
'. La description du paramètre '+string(i)+'.';]
else
tt_param=[tt_param;
' : Type '''+tt_typ(i,1)+''' of size '+tt_typ(i,2)+...
'. The parameter description '+string(i)+'.';]
end
tt_param=[tt_param;' </SP>';' </PARAM_DESCRIPTION>';' </PARAM_ITEM>';''];
end
end
tt_param=' '+[tt_param;'</PARAM_INDENT>';'</PARAM>']
tt_ex=' '+['<EXAMPLE>';'<P>';'Example'
'</P>';'</EXAMPLE>']
//tt_pair_block=' '+['<PAIR_BLOCK>';'<PAIR_BLOCK_ITEM> </PAIR_BLOCK_ITEM>';'</PAIR_BLOCK>']
tt_used_func=' '+['<USED_FUNCTIONS>';' <SP>';' </SP>';'</USED_FUNCTIONS>']
case 'pal'
typel='Scicos Palette'
case 'diagr'
typel='Scicos Diagram'
tt_ex=' '+['<EXAMPLE>';'<P>';'Example'
'</P>';'</EXAMPLE>']
case 'scilib'
typel='Scilab Library'
case 'sci'
prot=funcprot();funcprot(0);
ierr=execstr('txt=help_skeleton(name);','errcatch');
funcprot(prot);
if ierr==0 then
return
else
typel='Scilab Function'
tt_param=' '+['<PARAM>';'<PARAM_INDENT>';'';' <PARAM_ITEM>';
' <PARAM_NAME>Name of param 1</PARAM_NAME>';
' <PARAM_DESCRIPTION>';' <SP>';' : add here the parameter description';
' </SP>';' </PARAM_DESCRIPTION>';' </PARAM_ITEM>';'';'</PARAM_INDENT>';
'</PARAM>'];
tt_call_seq=' '+['<CALLING_SEQUENCE>';
'<CALLING_SEQUENCE_ITEM> </CALLING_SEQUENCE_ITEM>';
'</CALLING_SEQUENCE>']
tt_ex=' '+['<EXAMPLE><![CDATA[';
']]></EXAMPLE>']
tt_used_func=' '+['<USED_FUNCTIONS>';' <SP>';' </SP>';'</USED_FUNCTIONS>']
end
case 'rout'
typel='Low level routine'
tt_param=' '+['<PARAM>';'<PARAM_INDENT>';'';' <PARAM_ITEM>';
' <PARAM_NAME>Name of param 1</PARAM_NAME>';
' <PARAM_DESCRIPTION>';' <SP>';' : add here the parameter description';
' </SP>';' </PARAM_DESCRIPTION>';' </PARAM_ITEM>';'';'</PARAM_INDENT>';
'</PARAM>'];
tt_call_seq=' '+['<CALLING_SEQUENCE>';
'<CALLING_SEQUENCE_ITEM> </CALLING_SEQUENCE_ITEM>';
'</CALLING_SEQUENCE>']
tt_ex=' '+['<EXAMPLE><![CDATA[';
']]></EXAMPLE>']
tt_used_func=' '+['<USED_FUNCTIONS>';' <SP>';' </SP>';'</USED_FUNCTIONS>']
case 'sce'
typel='Scilab Script'
tt_used_func=' '+['<USED_FUNCTIONS>';' <SP>';' </SP>';'</USED_FUNCTIONS>']
tt_call_seq=' '+['<CALLING_SEQUENCE>';
'<CALLING_SEQUENCE_ITEM> </CALLING_SEQUENCE_ITEM>';
'</CALLING_SEQUENCE>']
case 'sim'
typel='Scilab simulation Script'
tt_used_func=' '+['<USED_FUNCTIONS>';' <SP>';' </SP>';'</USED_FUNCTIONS>']
end
txt=['<?xml version='"1.0'" encoding='"ISO-8859-1'" standalone='"no'"?>'
'<!DOCTYPE MAN SYSTEM '"'+SCI+'/man/man.dtd'">'
'<MAN>'
' <LANGUAGE>'+lang+'</LANGUAGE>'
' <TITLE>'+name+'</TITLE>'
' <TYPE>'+typel+'</TYPE>'
' <DATE>'+date()+'</DATE>'
' <SHORT_DESCRIPTION name='"'+name+''">'+name+' title</SHORT_DESCRIPTION>'
tt_call_seq
''
' <DESCRIPTION>'
' <DESCRIPTION_INDENT>'
' <DESCRIPTION_ITEM>'
' <P>'
' Add here a paragraph of the function description.'
' </P>'
' </DESCRIPTION_ITEM>'
' </DESCRIPTION_INDENT>'
' </DESCRIPTION>'
''
tt_rmk
''
tt_ex
''
tt_param
''
tt_pair_block
''
' <SEE_ALSO>'
' <SEE_ALSO_ITEM> </SEE_ALSO_ITEM>'
' </SEE_ALSO>'
''
' <AUTHORS>'
' <AUTHORS_ITEM label=''IRCOM Group''>'
' generate_xml'
' </AUTHORS_ITEM>'
' </AUTHORS>'
''
' <BIBLIO>'
' <SP>'
' </SP>'
' </BIBLIO>'
''
tt_used_func
''
'</MAN>'
]
endfunction
enter here the author name
Add here the author references