Fonction Scilab
eng - fr


export_file_to_data - export les paragraphes xml dans les fichers de données

Librairie

Séquence d'appel

export_file_to_data(rep_xml,flag,rep_data)

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


//export_file_to_data
// flag un vecteur de chaîne de caractères
// 'param'
// 'sdesc'
// 'see_also'
// 'authors'
// 'ex'
// 'desc'
// 'biblio'
// 'used_func'
// 'SPECIALDESC'
// 'all'
// 'call_seq'
// rep_xml :  répertoire de stockage des fichiers 
//            xml (ex:rep_xml=xml_path)
// rep_data : répertoire de stockage des fichiers 
//            de données
function export_file_to_data(rep_xml,flag,rep_data)

 //Verifie cohérence des paramètres
 [lsh,rsh]=argn();
 if rsh<3 then 
   rep_data=man_path
 else
   rep_data=pathconvert(rep_data,%t)
 end;
 if flag=='all' then
  flag=['param';'sdesc';'see_also';
        'authors';'ex';'desc';'used_func';
        'biblio';'SPECIALDESC';'call_seq']
 end
 
 //def des noms de fichiers de donées
 file_param='MODNUM_data_param';
 file_sdesc='MODNUM_data_sdesc';
 file_see_also='MODNUM_data_see_also';
 file_authors='MODNUM_data_authors';
 file_ex='MODNUM_data_ex';
 file_desc='MODNUM_data_desc';
 file_call_seq='MODNUM_data_call_seq';
 file_used_func='MODNUM_data_used_func';
 file_biblio='MODNUM_data_biblio';
 file_spec_desc='MODNUM_SPECIALDESC';
 
 //cherche tous les fichiers xml présents
 //dans xml_path
 lisf=return_ext_file_in_dir(tt_ml,rep_xml,'.xml');
  

 for z=1:size(flag,1)
  flagn=flag(z);
  
  //param
  if flagn=='param' then
    tt=[];
    for ij=1:size(lisf,1)
      txt_list=return_xml_param3(rep_xml+lisf(ij,1));
      tt=[tt;'<FILE '+lisf(ij,1)+'>'];
      tt_param=[];
      if txt_list<>[] then
        //tt=[tt;'<FILE '+lisf(i,1)+'>'];
        //trouve le nbre de paramètres
        nb_param=0;
        for l=1:size(txt_list)
          nb_param=nb_param+size(txt_list(l)(2),1);
        end 
        //initialise une nouvelle liste
        n=list()
        for i=1:nb_param
           n(i)=list();
           n(i)(1)=0;
           n(i)(2)=""
           n(i)(3)=""
        end
        //Creation d'un nouvelle liste
        for i=1:size(txt_list)
           for j=1:size(txt_list(i)(1),1)
              n(txt_list(i)(1)(j,1))(1)=i;
              n(txt_list(i)(1)(j,1))(2)=txt_list(i)(2)(j,1);
              n(txt_list(i)(1)(j,1))(3)=txt_list(i)(2)(j,2);
           end
        end
        //pause
        pre_i=0; //indentation précédente
        for i=1:size(n)
           dif_i=n(i)(1)-pre_i;
           if dif_i<>0 then
              if dif_i>0 then
                 for j=1:dif_i
                    tt_param=[tt_param;'<INDENT>'];
                 end
              elseif dif_i<0 then
                 for j=-1:-1:dif_i
                    tt_param=[tt_param;'</INDENT>'];
                 end
              end
           end 
           pre_i=n(i)(1);
           tt_param=[tt_param;
                     'TITLE='+n(i)(2);
                     'DESC='+n(i)(3)];
        end
        dif_i=-pre_i;
        if dif_i<0 then
           for j=-1:-1:dif_i
              tt_param=[tt_param;'</INDENT>'];
           end
        end
      end
      tt=[tt;tt_param;'</FILE '+lisf(ij,1)+'>';''];
    end
    if tt<>[] then
      printf("Export xml parameters... ");
      mputl(tt,rep_data+file_param);
      printf("Done\n")
    else
      printf("No files found with parameters\n")
    end
  
  //param_old
  elseif flagn=='param_old' then
    filen='MODNUM_xml_param_old'
    printf("Export xml parameters... ");
    tt=[];
    for i=1:size(lisf,1)
      tt=[tt;'<FILE '+lisf(i,1)+'>'];
      txt=return_xml_param(rep_xml+lisf(i,1));
      tt=[tt;string(size(txt,1))];
      tt=[tt;txt(:,1);txt(:,2)];
      tt=[tt;'</FILE '+lisf(i,1)+'>';''];
    end
    mputl(tt,rep_data+filen);
    printf("Done\n")  
    
  //sdesc
  elseif flagn=='sdesc'
    tt=[];
    for i=1:size(lisf,1)
      txt=return_xml_sdesc(rep_xml+lisf(i,1));
      if txt<>[] then
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        tt=[tt;txt]
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      end
    end
    if tt<>[] then
      printf("Export xml short descriptions... ");
      mputl(tt,rep_data+file_sdesc);
      printf("Done\n")
    else
      printf("No files found with short description\n")
    end
    
  //see_also
  elseif flagn=='see_also'
    tt=[];
    for i=1:size(lisf,1)
      txt=return_xml_see_also(rep_xml+lisf(i,1));
      if txt<>[] then
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        tt=[tt;txt]
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      end
    end
    if tt<>[] then
      printf("Export xml see_also... ");
      mputl(tt,rep_data+file_see_also);
      printf("Done\n")
    else
      printf("No files found with see also paragraph\n")
    end
    
  //authors
  elseif flagn=='authors' then
    tt=[];
    for i=1:size(lisf,1)
      txt=return_xml_authors2(rep_xml+lisf(i,1));
      if txt<>[] then
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        tt=[tt;string(size(txt,1))];
        tt=[tt;txt(:,1);txt(:,2)];
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      end
    end
    if tt<>[] then
      printf("Export xml authors... ");
      mputl(tt,rep_data+file_authors);
      printf("Done\n")
    else
      printf("No files found with authors paragraph\n")      
    end
  
  //used_func
  elseif flagn=='used_func' then
    tt=[];
    for i=1:size(lisf,1)
      txt=return_xml_used_func(rep_xml+lisf(i,1));
      if txt<>[] then
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        tt=[tt;txt(:,1)];
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      end
    end
    if tt<>[] then
      printf("Export xml used functions... ");
      mputl(tt,rep_data+file_used_func);
      printf("Done\n")
    else
      printf("No files found with used function paragraph\n")      
    end
       
  //biblio
  elseif flagn=='biblio' then
    tt=[];
    for i=1:size(lisf,1)
      name=basename(lisf(i,1))
      if fileinfo(tex_path+lang+'/'+name+'/'+name+'_bib.tex')<>[]
        txt=mgetl(tex_path+lang+'/'+name+'/'+name+'_bib.tex');
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        tt=[tt;'<LaTeX>';txt(:,1)];
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      else
        txt=return_xml_biblio(rep_xml+lisf(i,1));
        if txt<>[] then
          tt=[tt;'<FILE '+lisf(i,1)+'>'];
          tt=[tt;txt(:,1)];
          tt=[tt;'</FILE '+lisf(i,1)+'>';''];
        end
      end
    end
    if tt<>[] then
      printf("Export xml & latex bibliography... ");
      mputl(tt,rep_data+file_biblio);
      printf("Done\n")
    else
      printf("No files found with bibliography\n") 
    end
       
  //ex
  elseif flagn=='ex' then
    tt=[];
    for i=1:size(lisf,1)
      name=basename(lisf(i,1))
      if fileinfo(tex_path+lang+'/'+name+'/'+name+'_ex.tex')<>[]
        txt=mgetl(tex_path+lang+'/'+name+'/'+name+'_ex.tex');
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        tt=[tt;'<LaTeX>';txt(:,1)];
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      else
        txt=return_xml_ex(rep_xml+lisf(i,1));
        if txt<>[] then
          tt=[tt;'<FILE '+lisf(i,1)+'>'];
          tt=[tt;txt(:,1)];
          tt=[tt;'</FILE '+lisf(i,1)+'>';''];
        end
      end
    end
    if tt<>[] then
      printf("Export xml & latex example... ");
      mputl(tt,rep_data+file_ex);
      printf("Done\n")
    else
      printf("No files found with exemples\n") 
    end
    
  //desc
  elseif flagn=='desc' then
    tt=[];
    for i=1:size(lisf,1)
      name=basename(lisf(i,1))
      if fileinfo(tex_path+lang+'/'+name+'/'+name+'_long.tex')<>[]
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        txt=mgetl(tex_path+lang+'/'+name+'/'+name+'_long.tex');
        tt=[tt;'<LaTeX>';txt(:,1)];
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      else
        txt_list=return_xml_desc3(rep_xml+lisf(i,1));
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        if txt_list<>list(list()) then
          tt=[tt;string(size(txt_list))]
          for a=1:size(txt_list)
            tt=[tt;'INDENT='+string(txt_list(a)(1))]
            tt=[tt;'TITLE='+string(txt_list(a)(2))]
            tt=[tt;'<TEXT>';txt_list(a)(3);'</TEXT>']
          end
        end
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      end
    end
    if tt<>[] then
      printf("Export xml & latex long description... ");
      mputl(tt,rep_data+file_desc);
      printf("Done\n")
    else
      printf("No files found with long descriptions\n") 
    end    

  //SPECIALDESC
  elseif flagn=='SPECIALDESC' then
    printf("Export latex special description... ");
    tt=[];
    for i=1:size(lisf,1)
      tt=[tt;'<FILE '+lisf(i,1)+'>'];
      name=basename(lisf(i,1))
      if fileinfo(tex_path+lang+'/'+name)<>[] then
        if fileinfo(tex_path+lang+'/'+name+'/SPECIALDESC')<>[] then
          txt=mgetl(tex_path+lang+'/'+name+'/SPECIALDESC');
          tt=[tt;txt(:,1)];
        end
      end
      tt=[tt;'</FILE '+lisf(i,1)+'>';''];
    end
    mputl(tt,rep_data+file_spec_desc);
    printf("Done\n")

  //call_seq
  elseif flagn=='call_seq'
    tt=[];
    for i=1:size(lisf,1)
      txt=return_xml_call_seq(rep_xml+lisf(i,1));
      if txt<>[] then
        tt=[tt;'<FILE '+lisf(i,1)+'>'];
        tt=[tt;txt]
        tt=[tt;'</FILE '+lisf(i,1)+'>';''];
      end
    end
    if tt<>[] then
      printf("Export xml call_seq... ");
      mputl(tt,rep_data+file_call_seq);
      printf("Done\n")
    else
      printf("No files found with see also paragraph\n")
    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