Fonction Scilab
eng - fr


generate_aux_tex_file - crée les fichiers tex auxiliaires pour la documentation de la boîte à outils

Librairie

Séquence d'appel

lisf = generate_aux_tex_file(lisf,flag,typdoc,lang)

Paramètres

Description

Add here a paragraph of the function description. Other paragraph can be added

Add here a paragraph of the function description

Exemple

Add here scilab instructions and comments

Contenu du fichier


//generate_aux_tex_file
//fonction qui génère les fichiers tex auxiliaires nécessaires
//au fichier final tex de documentation dans un répertoire spécifique.
//Dans un premier temps, elle teste la présence d'un fichier .xml correspondant 
//au(x) fichiers traités 
//
//Une fois le fichier xml trouvé ou crée, elle génère les fichiers tex grâce 
//à la fonction xml2tex puis elle regarde la présence d'un répertoire 
//man/tex (tex_path) correspondant au(x) fichier(s) traité(s).
//Si un tel répertoire existe alors elle teste la présence
//d'un fichier Makefile, et s'il existe alors elle éxecute
//la tâche 'all'.
//Dans ces deux cas elle recopie l'intégralité des fichiers et
//répertoires dans le répertoire spécifique.
//Si une tâche 'make all' est exécutée alors à l'issue
//de la copie, elle exécute la tâche 'clean' dans le répertoire man/tex.
//
//Entrée : lisf : un vecteur de chaîne de caratères de taille n,1 
//                qui contient le nom de fichier xml à traiter 
//                (sans extension).
//         flag : 'block' pour une fonction d'interface scicos
//                'pal' pour un fichier palette scicos (cosf)
//                'diagr' pour un diagramme de simulation scicos 
//                'scilib' pour une librairie de fonctions scilab
//                'sci' pour une fonction scilab.
//                'rout' pour une routine bas niveau
//                'sim' pour un script de simulation scilab
//                'sce' pour un script scilab
//       typdoc : 'html' (default) pour des pages d'aide html
//                'guide' pour des pages d'aides papier 
//       lang   : 'eng' (default) pour de l'anglais
//                'fr' pour du français
//Sortie : lisf : une matrice de chaîne de caratères de taile n,2
//                qui contient le nom de fichier xml traité et sa
//                description courte correspondante.
//
function [lisf]=generate_aux_tex_file(lisf,flag,typdoc,lang)

[lsh,rsh]=argn(0)
if rsh<4 then
  if ~exists('lang') then
    lang='eng'
  elseif lang<>'eng' & lang<>'fr' then
    lang='eng'
  end
end
if rsh<3 then
  typdoc='html'
end

ierr=execstr('GetVar_fun=TCL_GetVar','errcatch');
if ierr<>0 then GetVar_fun=TK_GetVar, end;
ierr=execstr('EvalStr_fun=TCL_EvalStr','errcatch');
if ierr<>0 then EvalStr_fun=TK_EvalStr, end;

for i=1:size(lisf,1)
  if fileinfo(xml_path+lang+'/'+lisf(i,1)+'.xml')==[] then
     printf("%s.xml not found.\n",lisf(i,1))
     printf("Generate an empty xml file... ");
     txt=generate_xml(lisf(i,1),flag) 
     mputl(txt,xml_path+lang+'/'+lisf(i,1)+'.xml')
     printf("Done\n");
  else
     printf("%s.xml found.\n",lisf(i,1))
  end

  if flag=='block'|flag=='pal'|flag=='diagr'|flag=='scilib'|flag=='sci'|flag=='rout'|flag=='sim'|flag=='sce' then
   xml2tex(lisf(i,1),flag,typdoc);
  else
   printf("flag %s is not supported\n",flag);
   abort
  end

  lisf(i,2)=return_xml_sdesc(xml_path+lang+'/'+lisf(i,1)+'.xml');
  lisf(i,3)=return_xml_type(xml_path+lang+'/'+lisf(i,1)+'.xml');

  select flag
    case 'block' then
     ext=''
    case 'pal' then
     ext='_cosf' 
    case 'diagr' then
     ext='_cos'
    case 'scilib' then
     ext='_scilib'
    case 'sci' then
     ext='_sci'
    case 'rout' then
     ext='_rout'
    case 'sim' then
     ext=''
    case 'sce' then
     ext='_sce'
  end

  //For block  : generate _dial_box.tex, _sblock_equiv.text
  if flag=='block' then
    ///////////////////////
    //Create  .eps
    ///////////////////////
    //SPECIALDESC
    l_blk=return_size_scs_diagr(lisf(i,1),typdoc,'lblock')
    dessin_block(lisf(i,1),typdoc,l_blk)

    ///////////////////////
    //Create  _blocks.tex
    ///////////////////////
    if fileinfo(lisf(i,1)+'/'+lisf(i,1)+'.eps')<>[] then //figure block
      txt=['\begin{center}'
           '\epsfig{file='+lisf(i,1)+'.eps,width=90.00pt}'
           '\end{center}']
    end
    mputl(txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'_blocks.tex');
    ///////////////////////
    //Create  _dial_box.tex
    ///////////////////////
    if with_gui then //Do a capture (need X session)
      //////////////////////////////
      load SCI/macros/scicos/lib
      exec(loadpallibs,-1)
      %scicos_prob=%f;
      alreadyran=%f
      needcompile=4
      //////////////////////////////
      prot=funcprot();
      funcprot(0);
      getvalue=mtk_getvalue
      EvalStr_fun(' set title """" ')
      funcprot(prot);
      ierror=execstr('blk='+lisf(i,1)+'(''define'')','errcatch')
      if ierror<>0 then
        x_message(['Error in GUI function';lasterror()] )
        disp(lisf(i,1))
        fct=[]
        return
      end
      ierror=execstr('blk='+lisf(i,1)+'(''set'',blk)','errcatch')
      if ierror <>0 then
        x_message(['Error in GUI function';lasterror()] )
        disp(lisf(i,1))
        fct=[]
        return
      end
      //tempo 
      time1=getdate();time2=time1;
      while etime(time2,time1)<0.2, time2=getdate(); end;
      //récupère titre de la fenêtre
      title=GetVar_fun('title');
      if title<>"" then
       tt=unix_g('xwd -name ''Set Block properties'' | convert - ./'+lisf(i,1)+'/'+lisf(i,1)+'_gui.eps');

       if tt==[] then
         txt=['\begin{figure}'
              '\begin{center}'
              '\epsfig{file='+lisf(i,1)+'_gui.eps,width=300pt}'
              '\end{center}'
              '\end{figure}']
         if typdoc=='guide' then
           txt(1)=['\begin{figure}[!h]']
         end
          //SPECIALDESC
          size_dial=return_size_dial(lisf(i,1),typdoc)
          if size_dial<>[] then
            txt=strsubst(txt,'width=300pt',size_dial)
          end
       else
         txt=[];
       end
       EvalStr_fun('catch {destroy $w}') 
      else  
        txt=[]
      end
    else //Create a table
      title=latexsubst(return_desc_block(lisf(i,1)))
      ini=return_ini_block(lisf(i,1));
      ini=latexsubst(ini)
      lables=return_lables_block(lisf(i,1))
      lables=latexsubst(lables)
      if ini<>[]&lables<>[] then
       mat=[]
       for j=1:size(ini,2)
         mat=[mat;lables(j)+' & '+ini(j) + '\\']
       end
       txt=['\documentclass[11pt]{article}'
            '\usepackage{times,amsmath,amssymb}'
            '\pagestyle{empty}'
            '\usepackage{color}'
            '\pagecolor{white}'
            '\begin{document}'
            '\begin{center}'
            '\begin{tabular}{|c|}'
            '\hline'
            title+'\\'
            '\hline'
            '\begin{tabular}{c|c}'
            mat
           '\end{tabular} \\'
           '\hline'
           '\end{tabular}'
           '\end{center}'
           '\end{document}']
           mputl(txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'_dial_box.tex');
           repaa=pwd()
           chdir('./'+lisf(i,1));
           unix_g(latex_cmd+lisf(i,1)+'_dial_box.tex');
           unix_g(dvips_cmd+lisf(i,1)+'_dial_box.dvi');
           chdir(repaa)
           txt=['\begin{center}'
                '\epsfig{file='+lisf(i,1)+'_dial_box.ps}'
                '\end{center}']
      else
       txt=[]
      end
    end
    if txt<>[] then
      mputl(txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'_dial_box.tex');
    end

    ///////////////////////
    //Create  _param.tex
    ///////////////////////
    txt_spec_param=return_dial_param(lisf(i,1),typdoc);
    if txt_spec_param<>[] then
      nb_new_dial=size(txt_spec_param)

      //Ecrit fichier _param.tex
      txt=return_xml_param2(xml_path+lang+'/'+lisf(i,1)+'.xml');
      if txt<>[] then
        txt=latexsubst(txt)
        tt=['\begin{itemize}'];
        for l=1:size(txt,'r')
          if typdoc=='html' then
            tt=[tt;'\item{\textbf{'+txt(l,1)+':}}\linebreak'];
          else
            tt=[tt;'\item{\textbf{'+txt(l,1)+':}}\\'];
          end
          tt=[tt;txt(l,2);''];
          for j=1:nb_new_dial
             if l==txt_spec_param(j)(1) then
               tt=[tt;'If set '+txt_spec_param(j)(2)];
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////   
               if with_gui then //Do a capture (need X session)
                //////////////////////////////
                load SCI/macros/scicos/lib
                exec(loadpallibs,-1)
                %scicos_prob=%f;
                alreadyran=%f
                needcompile=4
                //////////////////////////////
                prot=funcprot();
                funcprot(0);
                getvalue=mtk_getvalue2
                EvalStr_fun(' set title """" ')
                funcprot(prot);
                ierror=execstr('blk='+lisf(i,1)+'(''define'')','errcatch')
                if ierror<>0 then
                  x_message(['Error in GUI function';lasterror()] )
                  disp(lisf(i,1))
                  fct=[]
                  return
                end
                execstr(txt_spec_param(j)(3))
                ierror=execstr('blk='+lisf(i,1)+'(''set'',blk)','errcatch')
                if ierror <>0 then
                  x_message(['Error in GUI function';lasterror()] )
                  disp(lisf(i,1))
                  fct=[]
                  return
                end
                //tempo 
                time1=getdate();time2=time1;
                while etime(time2,time1)<0.2, time2=getdate(); end;
                  //récupère titre de la fenêtre
                  title=GetVar_fun('title');
                  if title<>"" then
                    name_fic_dial=lisf(i,1)+'_'+string(l)+'_'+string(j);
                    titi=unix_g('xwd -name ''Set Block properties'' | convert - ./'+lisf(i,1)+'/'+name_fic_dial+'_gui.eps');       
                    if titi==[] then
                      txt2=['\begin{figure}'
                            '\begin{center}'
                            '\epsfig{file='+name_fic_dial+'_gui.eps,width=300pt}'
                            '\end{center}'
                            '\end{figure}']
                      if typdoc=='guide' then
                         txt2(1)=['\begin{figure}[!h]']
                      end
                      if txt_spec_param(j)(5)<>[] then
                        txt2=strsubst(txt2,'width=300pt',txt_spec_param(j)(5))
                      end
                    else
                      txt2=[];
                    end
                    EvalStr_fun('catch {destroy $w}') 
                  else  
                    txt2=[]
                  end
               else //Create a table
                 title=latexsubst(return_desc_block2(lisf(i,1),txt_spec_param(j)(3)));
                 ini=return_ini_block2(lisf(i,1),txt_spec_param(j)(3));
                 ini=latexsubst(ini);
                 lables=return_lables_block2(lisf(i,1),txt_spec_param(j)(3));
                 lables=latexsubst(lables);
                 typ=return_typ_block2(lisf(i,1),txt_spec_param(j)(3));
                 if ini<>[]&lables<>[] then
                   mat=[];
                   for e=1:size(ini,2)
                     mat=[mat;lables(e)+' & '+ini(e) + '\\'];
                   end
                   txt2=['\documentclass[11pt]{article}'
                         '\usepackage{times,amsmath,amssymb}'
                         '\pagestyle{empty}'
                         '\usepackage{color}'
                         '\pagecolor{white}'
                         '\begin{document}'
                         '\begin{center}'
                         '\begin{tabular}{|c|}'
                         '\hline'
                         title+'\\'
                         '\hline'
                         '\begin{tabular}{c|c}'
                         mat
                         '\end{tabular} \\'
                         '\hline'
                         '\end{tabular}'
                         '\end{center}'
                         '\end{document}'];
                   name_fic_dial=lisf(i,1)+'_'+string(l)+'_'+string(j);
                   mputl(txt2,'./'+lisf(i,1)+'/'+name_fic_dial+'_dial_box.tex');
                   repaa=pwd();
                   chdir('./'+lisf(i,1));
                   unix_g(latex_cmd+name_fic_dial+'_dial_box.tex');
                   unix_g(dvips_cmd+name_fic_dial+'_dial_box.dvi');
                   chdir(repaa);
                   txt2=['\begin{center}'
                         '\epsfig{file='+name_fic_dial+'_dial_box.ps}'
                         '\end{center}'];
                 else
                   txt2=[];
                 end
               end
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
               tt=[tt;txt2]
               lables=return_lables_block2(lisf(i,1),txt_spec_param(j)(3));
               lables=latexsubst(lables);
               typ=return_typ_block2(lisf(i,1),txt_spec_param(j)(3));
               tt=[tt;'';'\begin{itemize}']
               for e=1:size(lables,1)
                  if typdoc=='html' then
                     tt=[tt;'\item{\textbf{'+lables(e,1)+':}}\linebreak'];
                  else
                     tt=[tt;'\item{\textbf{'+lables(e,1)+':}}\\'];
                  end
                if lang=='eng'
                   tt=[tt;'Type '+typ(e,1)+' of size '+typ(e,2)+'. '+txt_spec_param(j)(4)(e);'']
                elseif lang=='fr'
                   tt=[tt;'Type '+typ(e,1)+' de taille '+typ(e,2)+'. '+txt_spec_param(j)(4)(e);'']
                end
               end
               tt=[tt;'\end{itemize}'] 
             end
          end
        end    
      end
      tt=[tt;'\end{itemize}'];
      mputl(tt,'./'+lisf(i,1)+'/'+lisf(i,1)+'_param.tex');
      clear nb_new_dial;
    end
    clear txt_spec_param;

    ///////////////////////
    //Create  _def_prop.tex
    ///////////////////////
    prop=return_prop_block(lisf(i,1),lang);
    if lang=='fr' then
    txt=['\begin{itemize}'
         '\item \textbf{toujours actif:} '+prop(1)
         '\item \textbf{direct-feedthrough:} '+prop(2)
         '\item \textbf{détection de passage à zéro:} '+prop(3)
         '\item \textbf{mode:} '+prop(4)
         '\item \textbf{nombre/taille des entrées régulières:} '+prop(5)
         '\item \textbf{nombre/taille des sorties sorties régulières:} '+prop(6)
         '\item \textbf{nombre/taille des entrées évènementielles:} '+prop(7)
         '\item \textbf{nombre/taille des sorties évènementielles:} '+prop(8)
         '\item \textbf{possède un état continu:} '+prop(9)
         '\item \textbf{possède un état discret:} '+prop(10)
         '\item \textbf{nom de la fonction de calcul:} {\em '+latexsubst(prop(12))+'}'
         '\end{itemize}'
        ]
    else
    txt=['\begin{itemize}'
         '\item \textbf{always active:} '+prop(1)
         '\item \textbf{direct-feedthrough:} '+prop(2)
         '\item \textbf{zero-crossing:} '+prop(3)
         '\item \textbf{mode:} '+prop(4)
         '\item \textbf{number/sizes of inputs:} '+prop(5)
         '\item \textbf{number/sizes of outputs:} '+prop(6)
         '\item \textbf{number/sizes of activation inputs:} '+prop(7)
         '\item \textbf{number/sizes of activation outputs:} '+prop(8)
         '\item \textbf{continuous-time state:} '+prop(9)
         '\item \textbf{discrete-time state:} '+prop(10)
         '\item \textbf{name of computational function:} {\em '+latexsubst(prop(12))+'}'
         '\end{itemize}'
        ]
     end
     mputl(txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'_def_prop.tex');

    ///////////////////////////
    //Create  _sblock_equiv.tex
    ///////////////////////////
    if fileinfo(sbeq_path+lisf(i,1)+'_sblock_equiv.cos')<>[] then
      printf("Super block '+lisf(i,1)+' found\n")
      export_diagr(sbeq_path,lisf(i,1)+'_sblock_equiv.cos',typdoc);
      unix_g("mv "+lisf(i,1)+"_sblock_equiv/"+lisf(i,1)+"_sblock_equiv.eps ./"+lisf(i,1))
      unix_g("rm -fr "+lisf(i,1)+"_sblock_equiv/");
      txt=['\begin{center}'
           '\epsfig{file='+lisf(i,1)+'_sblock_equiv.eps,width=400.00pt}'
           '\end{center}']
      //SPECIALDESC
      size_diagr=return_size_scs_diagr(lisf(i,1),typdoc,'sbeq')
      size_diagr=strsubst(size_diagr,'[',''); //for compatibility with \includegraphics
      size_diagr=strsubst(size_diagr,']','');
      if size_diagr~=[] then
        txt=strsubst(txt,'width=400.00pt',size_diagr)
      end
      mputl(txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'_sblock_equiv.tex');
    end

    //////////////////////////
    //Create  _comput_func.tex
    //////////////////////////
    comput=[]
    prop=return_prop_block(lisf(i,1));
    func=prop(12);
    if func<>'csuper' then
      if fileinfo(rout_path+func+'.f')<>[] then
        comput=rout_path+func+'.f'
      elseif fileinfo(rout_path+func+'.c')<>[] then
        comput=rout_path+func+'.c'
      elseif strindex(lisf(i,1),'_c')<>[] then
        comput=rout_path+'code_gen/'+func+'/'+func+'.c'
      elseif fileinfo(SCI+'/routines/scicos/'+func+'.f')<>[] then
        comput=SCI+'/routines/scicos/'+func+'.f'
      elseif fileinfo(SCI+'/routines/scicos/'+func+'.c')<>[] then
        comput=SCI+'/routines/scicos/'+func+'.c'

      end
      if comput<>[] then
        //pause
        if type(prop(13))<>10 then
           typb=0
        else
           typb=prop(13)
        end
        if lang=='fr' then
          txt=['\subsection{Fonction de calcul (type '+string(typb)+')}']
        else
          txt=['\subsection{Computational function (type '+string(typb)+')}']
        end
        txt=[txt;'{\tiny'
             '\verbatiminput{'+comput+'}'
             '}']
      end
    else
      tt=return_rpar_block(lisf(i,1))
      dessin_scs_m(tt,lisf(i,1)+'_super',typdoc)
      unix_g("mv "+lisf(i,1)+"_super/"+lisf(i,1)+"_super.eps ./"+lisf(i,1))
      unix_g("rm -fr "+lisf(i,1)+"_super/");
      if lang=='fr' then
        txt=['\subsection{Contenu du super-bloc compilé}'];
      else
        txt=['\subsection{Compiled Super Block content}'];
      end
      txt=[txt;'\epsfig{file='+lisf(i,1)+'_super.eps,width=150.00pt}']
    end
     mputl(txt,'./'+lisf(i,1)+'/'+lisf(i,1)+'_comput_func.tex');
  end

  //For palette
  if flag=='pal' then
    ///////////////////////
    //Create  .eps
    ///////////////////////
    dessin_pal(pal_path+lisf(i,1)+'.cosf',typdoc);

    ///////////////////////
    //Create  _pals.tex
    ///////////////////////
    if fileinfo('./'+lisf(i,1)+'_cosf/'+lisf(i,1)+'_cosf.eps')<>[] then //figure of palette
       txt=['\begin{center}'
            '\epsfig{file='+lisf(i,1)+'_cosf.eps,width=350.00pt}'
            '\end{center}']
       //SPECIALDESC
       size_diagr=return_size_scs_diagr(lisf(i,1)+'_cosf',typdoc,'pal')
       size_diagr=strsubst(size_diagr,'[',''); //for compatibility with \includegraphics
       size_diagr=strsubst(size_diagr,']','');
       if size_diagr~=[] then
         txt=strsubst(txt,'width=350.00pt',size_diagr)
       end
       mputl(txt,'./'+lisf(i,1)+'_cosf/'+lisf(i,1)+'_pals.tex');
    end 
    ///////////////////////
    //Create  _blocks.tex
    ///////////////////////
    mod_num_block=return_block_pal(pal_path+lisf(i,1)+'.cosf','mod_num',1)
    if mod_num_block<>[] then 
       txt=['\begin{itemize}']
       for g=1:size(mod_num_block,1)
           txt2=return_xml_sdesc(xml_path+lang+'/'+mod_num_block(g)+'.xml');
           txt=[txt;'\item{\htmladdnormallink{'+latexsubst(mod_num_block(g))+...
           ' - '+txt2+'}{'+mod_num_block(g)+'.htm}}']
       end
       txt=[txt;'\end{itemize}'];
       mputl(txt,'./'+lisf(i,1)+'_cosf/'+lisf(i,1)+'_blocks.tex');
    end

  end

  //For scicos diagram
  if flag=='diagr' then
    //Find path of cos file in diagr_all list
    path=return_dir_cos(lisf(i,1),diagr_all)

    ///////////////////////
    //Create  _diagr.tex
    ///////////////////////
    printf("Export figure of diagram... ")
    export_diagr(path,lisf(i,1)+'.cos',typdoc);
    if fileinfo('./'+lisf(i,1)+'/'+lisf(i,1)+'.eps')<>[] then
      unix_g(mv_cmd+'./'+lisf(i,1)+'/'+lisf(i,1)+'.eps ./'+lisf(i,1)+ext+'/'+lisf(i,1)+ext+'.eps');
      unix_g(rm_cmd+'./'+lisf(i,1));
    end
    printf("Done\n");
    //SPECIALDESC
    size_diagr=return_size_scs_diagr(lisf(i,1),typdoc)
    if size_diagr==[] then size_diagr='width=400pt', end;
    size_diagr=strsubst(size_diagr,'[','');
    size_diagr=strsubst(size_diagr,']','');
    if typdoc=='html' then
      txt=['\begin{center}' //figure block
           '\epsfig{file='+lisf(i,1)+'_cos.eps,'+size_diagr+'}'
           '\end{center}']
    else
      txt=[]; //TO BE DONE
      txt=['\begin{center}' //figure block
           '\epsfig{file='+lisf(i,1)+'_cos.eps,'+size_diagr+'}'
           '\end{center}']
    end
    mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_diagr.tex');

    ///////////////////////
    //Create  _context.tex
    ///////////////////////
    printf("Export context of diagram... ");
    context=return_context_diagr(path+lisf(i,1)+'.cos');
    if context<>[] then
      mputl(context,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_context.tex');
    end
    printf("Done\n");

    ///////////////////////
    //Create  _block.tex
    ///////////////////////
    //Find mod_num block in scs_m
    mod_num_block=return_block_cos(path+lisf(i,1)+'.cos','mod_num',1);
    if mod_num_block<>[] then 
      printf("Export list of mod_num block of diagram... ");
      txt=['\begin{itemize}']
      for g=1:size(mod_num_block,1)
        txt2=return_xml_sdesc(xml_path+lang+'/'+mod_num_block(g)+'.xml');
        if typdoc=='html' then
          txt=[txt;'\item{\htmladdnormallink{'+latexsubst(mod_num_block(g))+...
                   ' - '+latexsubst(txt2)+'}{'+mod_num_block(g)+'.htm}}']
        else
          txt=[txt;'\item '+latexsubst(mod_num_block(g))+' - '+latexsubst(txt2)];
        end
      end
      txt=[txt;'\end{itemize}'];
      mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_block.tex');
      printf("Done\n");
    end

    ////////////////////
    //Create  _scop.tex
    ////////////////////
    printf("Launch simulation of diagram... ");
    //Launch simulation
    number_scope=scop_results_cos(path+lisf(i,1)+'.cos');
    printf("Done\n");
    if number_scope<>0 then
      printf("Export figures of scope... ");
      //Define true name of diagram
      CosName=return_cos_name_cos(path+lisf(i,1)+'.cos');
      //mv eps file to documentation directory
      for k=1:number_scope
       unix_g('mv '+CosName+'_scope_'+string(k)+'.eps ./'+...
              lisf(i,1)+ext+'/'+lisf(i,1)+'_scope_'+string(k)+'.eps');
      end
      printf("Done\n");
      //sort scope
      if number_scope>1 then
        //SPECIALDESC
        if fileinfo(tex_path+lang+'/'+lisf(i,1)+'/SPECIALDESC')<>[] then
          printf("Sort figure of scope... ");
          make_scope_order(tex_path+lang+'/'+lisf(i,1),lisf(i,1),ext)
          printf("Done\n");
        end
      end
      //retrieve caption
      printf("Give caption of scope... ");
      capt=return_capt(tex_path+lang+'/'+lisf(i,1))
      if capt==[] then
        for k=1:number_scope
          if lang=='fr' then
             capt(k)='Résultats des ''scopes'''
          else
             capt(k)='Scope results'
          end
        end
      end
      printf("Done\n");
      //write _scop.tex
      txt=[];
      sub_index=0;
      for k=1:number_scope
         if typdoc=='html' then
            txt=[txt;
                 '\begin{figure}'
                 '\begin{center}'
                 '\epsfig{file='+lisf(i,1)+'_scope_'+string(k)+'.eps,width=300.00pt}'
                 '\end{center}'
                 '\caption{'+capt(k)+'}'
                 '\end{figure}'];
         else
            capt(k)=strsubst(capt(k),'\\',' ');
            if sub_index==0 then
               txt=[txt;'\begin{figure}[!h]';
                    '\centering';]
            end
            txt=[txt;'\subfigure['+capt(k)+']{\epsfig{file='+lisf(i,1)+'_scope_'+string(k)+'.eps,width=230.00pt}}']
            sub_index=sub_index+1;
            if sub_index==2 then
               sub_index=0;
               txt=[txt;'\end{figure}']
            end
         end
      end

      if typdoc=='guide' then
         if sub_index==1 then
            txt=[txt;'\end{figure}']
         end
      end
      mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_scop.tex');
    end
  end

  //For scilab simulation script
  if flag=='sim' then
    //define path of the simulation script
    path=simu_path+lisf(i,1)+'/';

    ///////////////////
    //Create _diagr.tex
    ///////////////////

    //export figure of diagram
    lisf_cos=return_ext_file_in_dir(tt_ml,path,'.cos')
    if lisf_cos<>[] then
      printf("Export figure of diagram... ");
      for j=1:size(lisf_cos,1)
        export_diagr(path,lisf_cos(j,1),typdoc);
        filef=basename(lisf_cos(j,1));
        if filef<>lisf(i,1) then
          if fileinfo('./'+filef+'/'+filef+'.eps')<>[] then
            unix_g(mv_cmd+'./'+filef+'/'+filef+'.eps ./'+lisf(i,1));
            unix_g(rm_cmd+'./'+filef);
          end
        end
      end
      printf("Done\n");

      //SPECIALDESC
      size_diagr=return_size_scs_diagr2(lisf(i,1),typdoc);
      if size_diagr==[]|size(size_diagr,1)<>size(lisf_cos,1) then
        for j=1:size(lisf_cos,1) size_diagr(j)='width=400pt'; end;
      end

      //write _diagr.tex file
      txt=[];
      printf("Write a _diagr.tex file... ");
      for j=1:size(lisf_cos,1)
        filef=basename(lisf_cos(j,1));
        if typdoc=='html' then
          txt=[txt;
               '\begin{center}' //figure block
               '\epsfig{file='+filef+'.eps,'+size_diagr(j)+'}'
               '\end{center}'
               '\begin{center}'
               '\textbf{'+lisf_cos(j,1)+'}'
               '\end{center}']
        else
          txt=[]; //TO BE DONE
          txt=[txt;
               '\begin{center}' //figure block
               '\epsfig{file='+filef+'.eps,'+size_diagr(j)+'}'
               '\end{center}'
               '\begin{center}'
               '\textbf{'+latexsubst(lisf_cos(j,1))+'}'
               '\end{center}']
        end
      end
      mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_diagr.tex');
      printf("Done\n"); 
    end

    /////////////////////
    //Create _context.tex
    /////////////////////
    lisf_ctxt=return_ext_file_in_dir(tt_ml,path,'_ctxt.sce')
    if lisf_ctxt<>[] then
      printf("Write a _context.tex file... ");
      txt=[];
      for j=1:size(lisf_ctxt,1)
        if typdoc=='html' then
          txt=[txt;
                '\verbatiminput{'+path+lisf_ctxt(j,1)+'}'];
        else
          txt=[txt;'\begin{small}'
               '\verbatiminput{'+path+lisf_ctxt(j,1)+'}'
               '\end{small}'];
        end
        txt=[txt;
             '\begin{center}'
             '\textbf{'+latexsubst(lisf_ctxt(j,1))+'}'
             '\end{center}']
      end
      mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_context.tex');
      printf("Done\n"); 
    end

    ////////////////////////
    //Create _sim_script.tex
    ////////////////////////
    lisf_sce=return_ext_file_in_dir(tt_ml,path,'.sce')
    if lisf_sce<>[] then
      printf("Write a _sim_script.tex file... ");
      txt=[];
      for j=1:size(lisf_sce,1)
        if strindex(lisf_sce(j,1),'_ctxt.sce')==[] then
          if typdoc=='html' then
             txt=[txt;
                  '\verbatiminput{'+path+lisf_sce(j,1)+'}']
          else
             txt=[txt;'\begin{small}'
                  '\verbatiminput{'+path+lisf_sce(j,1)+'}'
                  '\end{small}']
          end
          txt=[txt;'\begin{center}'
               '\textbf{'+latexsubst(lisf_sce(j,1))+'}'
               '\end{center}']
        end
      end
      mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_sim_script.tex');
      printf("Done\n");
    end

    ///////////////////
    //Create _scop.tex
    //////////////////
    if fileinfo(path+lisf(i,1)+'.sce')<>[] then
      if with_sim then //test define in loader.sce
        printf("Launch simulation... ");
        number_scope=scop_results_sim(path+lisf(i,1)+'.sce');
        printf("Done\n");
        if number_scope<>0 then
          titlef=basename(path+lisf(i,1)+'.sce')
          printf("Export figures of scope... ");
          //mv eps file to documentation directory
          for k=1:number_scope
            unix_g('mv '+titlef+'_scope_'+string(k)+'.eps ./'+...
               lisf(i,1)+ext+'/'+lisf(i,1)+'_scope_'+string(k)+'.eps');
          end
          printf("Done\n");
          //sort scope
          if number_scope>1 then
            //SPECIALDESC
            if fileinfo(tex_path+lang+'/'+lisf(i,1)+'/SPECIALDESC')<>[] then
              printf("Sort figure of scope... ");
              make_scope_order(tex_path+lang+'/'+lisf(i,1),lisf(i,1),ext)
              printf("Done\n");
            end
          end
          //retrieve caption
          printf("Give caption of scope... ");
          capt=return_capt(tex_path+lang+'/'+lisf(i,1))
          if capt==[] then
            for k=1:number_scope
              if lang=='fr' then
                capt(k)='Résultats des ''scopes'''
              else
                capt(k)='Scope results'
              end
            end
          end
          printf("Done\n");
          //write _scop.tex
          txt=[];
          sub_index=0;
          for k=1:number_scope
             if typdoc=='html' then
                txt=[txt;
                     '\begin{figure}'
                     '\begin{center}'
                     '\epsfig{file='+lisf(i,1)+'_scope_'+string(k)+'.eps,width=300.00pt}'
                     '\end{center}'
                     '\caption{'+latexsubst(capt(k))+'}'
                     '\end{figure}'];
             else
                capt(k)=strsubst(capt(k),'\\',' ');
                if sub_index==0 then
                  txt=[txt;'\begin{figure}[!h]';
                       '\centering';]
                end
                txt=[txt;'\subfigure['+capt(k)+']{\epsfig{file='+lisf(i,1)+'_scope_'+string(k)+'.eps,width=230.00pt}}']
                sub_index=sub_index+1;
                if sub_index==2 then
                  sub_index=0;
                  txt=[txt;'\end{figure}']
                end
             end
          end

          if typdoc=='guide' then
             if sub_index==1 then
                txt=[txt;'\end{figure}']
             end
          end
          mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_scop.tex');
        end
      end
    end

    ////////////////////
    //Create  _block.tex
    ////////////////////
    lisf_cos=return_ext_file_in_dir(tt_ml,path,'.cos')
    if lisf_cos<>[] then
      printf("Export list of mod_num block of diagram... ");
      txt=[];
      for j=1:size(lisf_cos,1)
        mod_num_block=return_block_cos(path+lisf_cos(j,1),'mod_num',1);
        if mod_num_block<>[] then 
          for g=1:size(mod_num_block,1)
            txt2=return_xml_sdesc(xml_path+lang+'/'+mod_num_block(g)+'.xml');
            if typdoc=='html' then
              txt=[txt;'\item{\htmladdnormallink{'+latexsubst(mod_num_block(g))+...
                       ' - '+latexsubst(txt2)+'}{'+mod_num_block(g)+'.htm}}']
            else
              txt=[txt;'\item '+latexsubst(mod_num_block(g))+' - '+latexsubst(txt2)]
            end
          end
        end
      end
      if txt<>[] then
        //Elimine les doublons
        //TO BE DONE
        txt=['\begin{itemize}';txt;'\end{itemize}'];
        printf("Done\n");
        mputl(txt,'./'+lisf(i,1)+ext+'/'+lisf(i,1)+'_block.tex');
      end
    end

  end

  //For all : look at for a tex directory
  if fileinfo(tex_path+lang+'/'+lisf(i,1)+'/')<>[] then
   printf("Tex directory '+lisf(i,1)+' found : process it\n")

    if fileinfo(tex_path+lang+'/'+lisf(i,1)+'/Makefile')<>[] then
      printf("Makefile in Tex directory found : process it (all+clean)\n")
      repi=pwd()
      chdir(tex_path+lang+'/'+lisf(i,1)+'/')
      unix_g('make all')
      fc=unix_g(cp_cmd+tex_path+lang+'/'+lisf(i,1)+'/* '+repi+'/'+lisf(i,1)+ext);
      unix_g('make clean')
      chdir(repi)
    else
      fc=unix_g(cp_cmd+tex_path+lang+'/'+lisf(i,1)+'/* ./'+lisf(i,1)+ext);
    end
  end

end
endfunction

Fonction(s) utilisée(s)

Add here the used function name and references

Auteurs

enter here the author name Add here the author references