Scilab Function
eng


generate_modnum_dem

File content


//fonction qui genère les fichiers demo
function tt=generate_modnum_dem()
  if ~exists('demos_path') then
    demos_path=MODNUM+'/man/demos/';
  end

  txt=generate_sim_dem();
  mputl(txt,demos_path+'sim.dem');
  txt=generate_scs_diagr_dem();
  mputl(txt,demos_path+'scs_diagr.dem');

  tt=['if ~exists(''LANGUAGE'') then'
      '   global LANGUAGE;lang=LANGUAGE;clear LANGUAGE;'
      'else'
      '   lang=LANGUAGE;'
      'end'
      ''
      'if lang==''fr'' then'
      '    l_i=2;'
      'else'
      '    l_i=1;'
      'end'
      ''
      'tt_title=[''Scilab simulation scripts'',''Scripts Scilab de simulations'''
      '          ''Scicos Diagrams'',''Diagrammes Scicos'''
      '          ''Choose a demo'',''Choisissez une démo'']'
      'demolist=['
      'tt_title(1,l_i),''sim.dem'';'
      'tt_title(2,l_i),''scs_diagr.dem''];'
      ''
      'demos_path=MODNUM+''/man/demos/''';
      ''
      'fun=x_choose'
      'if exists(''with_tk'') then'
      ' if whereis(''tk_choose'')<>[] then'
      '   if with_tk() then fun=tk_choose, end;'
      ' end'
      'end'
      ''
      'while %t then';
      'num0=fun(demolist(:,1),tt_title(3,l_i));'
      '   if num0==0 then ';
      '      return';
      '   else';
      '      exec(demos_path+demolist(num0,2),-1)';
      '   end';
      'end';
      ];

  mputl(tt,demos_path+'modnum.dem');

endfunction