generate_rout_tex_file - create main tex file of low-level routines
txt = generate_rout_tex_file(namef,flag,lang)
- namef : string. name of the routine
- flag : string. set the type of tex files to produce
- 'html' : to produce tex file for html format
- 'guide' : to produce tex file for paper format
- 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 tex file
//generate_rout_tex_file
//Entrée : namef un vecteur de chaine de caractère
// flag 'html' ou 'guide'
//txt = le texte du fichier .tex principal
function txt=generate_rout_tex_file(namef,flag,lang)
//verify the 'lang' right parameter
[lsh,rsh]=argn(0)
if rsh<3 then
if ~exists('lang') then
lang='eng'
elseif lang<>'eng' & lang<>'fr' then
lang='eng'
end
end
//tt1 : header
//tt2 : library
//tt3 : calling Sequence
//tt4 : parameters
//tt5 : description
//tt6 : example
//tt7 : text of function
//tt8 : used functions
//tt9 : see also
//tt10 : Authors
//tt11 : Bibliography
//tt12 : end of tex file
//define title of paragraph
tt_title=[
'' //tt1 : header du fichier tex
'Library' //tt2 : library
'Calling Sequence' //tt3 : calling sequence
'Parameters' //tt4 : parameters
'Description' //tt5 : Description (_long)
'Example' //tt6 : Example (_ex)
'File content' //tt7 : text of funtion
'Used function(s)' //tt8 : Used functions (_used_func)
'See Also' //tt9 : See Also (_see_also)
'Authors' //tt10 : Authors (_authors)
'' //tt11 : Bibliography (_bib)
'' //tt12 : End of tex file
]
//change language of title
if lang=='fr' then
tt_title=change_lang_title(lang,tt_title);
end
//define level of paragraph
if flag=='html' then
tex_title='\subsection{'+tt_title+'}'
else
tex_title='\subsection{'+tt_title+'}'
end
//Generate auxiliary tex files
namef=generate_aux_tex_file(namef,'rout',flag,lang);
for i=1:size(namef,1)
for j=1:12 execstr('tt'+string(j)+'=[]'),end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_call_seq.tex')<>[] then
tt3=[tex_title(3) //Calling sequence
'\input{'+namef(i,1)+'_call_seq}']
end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_param.tex')<>[] then
tt4=[tex_title(4) //parameters
'\input{'+namef(i,1)+'_param}']
end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_long.tex')<>[] then
tt5=[tex_title(5) //description
''
'\input{'+namef(i,1)+'_long}']
end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_ex.tex')<>[] then
tt6=[tex_title(6) //Example
'\input{'+namef(i,1)+'_ex}']
end
tt_rep=return_ext_file(tt_ml,namef(i,1)+'.c');
if tt_rep<>[] then
if size(tt_rep,1)==1 then
tt7=[tex_title(7) //file content
'{\tiny'
'\verbatiminput{'+tt_rep(1)+tt_rep(2)+'}'
'}']
elseif size(tt_rep,1)<>1 then
for l=1:size(tt_rep,1)
if namef(i,1)+'.c'==tt_rep(l,2) then
tt7=[tex_title(7) //file content
'{\tiny'
'\verbatiminput{'+tt_rep(l,1)+tt_rep(l,2)+'}'
'}']
break;
end
end
end
end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_used_func.tex')<>[] then
tt8=[tex_title(8) //Used function
'\input{'+namef(i,1)+'_used_func}']
end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_see_also.tex')<>[] then
tt9=[tex_title(9) //See also
'\input{'+namef(i,1)+'_see_also}']
end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_bib.tex')<>[] then
tt11=['\input{'+namef(i,1)+'_bib.tex}'] //bibliography
end
if flag=='guide' then
//TO BE DONE
tt1=['\section{'+latexsubst(namef(i,1))+'\label{'+namef(i,1)+'}} ';
'\begin{itemize}';]
if lang=='fr' then
tt1=[tt1;'\item \textbf{Description courte:} '+latexsubst(namef(i,2))];
else
tt1=[tt1;'\item \textbf{Short description:} '+latexsubst(namef(i,2))];
end
LibName=mod_num_rout_lib;
tta=return_xml_sdesc(xml_path+lang+'/'+LibName+'.xml')
if tta<>[] then
tt1=[tt1;'\item \textbf{'+tt_title(2)+':} '+latexsubst(LibName)+...
' - '+latexsubst(tta)];
end
tt1=[tt1;'\end{itemize}'];
elseif flag=='html' then
if lang=='fr' then //Header of tex file
tt1=['\documentclass[11pt,frenchb]{article}']
else
tt1=['\documentclass[11pt]{article}']
end
tt1=[tt1;
'\usepackage{makeidx,graphics,fullpage}'
'\usepackage{verbatim,times,amsmath,amssymb,epsfig,color}'
'\usepackage{html}'
'\begin{document}'];
if lang<>'fr' then
tt1=[tt1;'\begin{center}'+latexsubst(namef(i,3))+'\\'];
else
tt1=[tt1;'\begin{center}Routine de calcul bas-niveau\\'];
end
tt1=[tt1
'\htmladdnormallink{eng}{../eng/'+namef(i,1)+'.htm}\hspace{2mm}-'+...
'\hspace{2mm}\htmladdnormallink{fr}{../fr/'+namef(i,1)+'.htm}}'
'\end{center}'];
tt1=[tt1;'\section{\textbf{'+latexsubst(namef(i,1))+...
'} - '+latexsubst(namef(i,2))+'}\label{'+namef(i,1)+'}'];
LibName=mod_num_rout_lib;
tta=return_xml_sdesc(xml_path+lang+'/'+LibName+'.xml')
if tta<>[] then
tt2=[tex_title(2) //Library
'\begin{itemize}'
'\item{\htmladdnormallink{'+latexsubst(LibName)+...
' - '+latexsubst(tta)+'}{'+LibName+'.htm}}'
'\end{itemize}']
end
if fileinfo(namef(i,1)+'_rout/'+namef(i,1)+'_authors.tex')<>[] then
tt10=[tex_title(10) //authors
'\input{'+namef(i,1)+'_authors}']
end
tt12=['\htmlinfo*';'\end{document}']
end
txt=[];
for j=1:12 txt=[txt;evstr('tt'+string(j))], end;
mputl(txt,namef(i,1)+'_rout/'+namef(i,1)+'.tex');
end
endfunction
IRCOM Group
Alan Layec