Fonction Scilab
fr


write_header

Contenu du fichier


//write_header(u,builder_name,tt_path)
//Entrée : u file descriptor
//         builder_name : name of builder
//         tt_path : nom d'une variable globale du chemin de la toolbox
//         (ex tt_path='MODNUMSCI')
//Sortie : txt : le texte à éxecuter pour augmenter la taille de la pile scilab
function txt=write_header(u,builder_name,tt_path)
 tt_loader1=['//Loader Script of modnum for scilab'
             '//Generated by '+builder_name
             '//'+date()+' A.Layec';'';
             '//Redefine stacksize'
             'sz=stacksize(); //default 5e6';
             'while (sz(1)<50e6) then';
             '  ierr=execstr(''stacksize(sz(1)+5e6)'',''errcatch'');';
             '  if ierr<>0 then break, end';
             '  sz=stacksize();';
             'end';
             'clear sz;';
             'clear ierr;';'';
             '//Define modnum root path']
 if MSDOS then
   tt_loader=[tt_loader1;
              tt_path+'=get_absolute_file_path(''loader.sce'');';
              'if part('+tt_path+',length('+tt_path+'))==''\'' then';
              '  '+tt_path+'=part('+tt_path+',1:length('+tt_path+')-1);';
              'end'
              '//Search Scicoslab Version'
              'exec('+tt_path+'+''\macros\build_util\find_scilab_ver.sci'');'
              'exec('+tt_path+'+''\macros\build_util\get_modnumsci_version.sci'');']
 else
   tt_loader=[tt_loader1;
              tt_path+'=get_absolute_file_path(''loader.sce'');';
              'if part('+tt_path+',length('+tt_path+'))==''/'' then';
              '   '+tt_path+'=part('+tt_path+',1:length('+tt_path+')-1);';
              'end'
              '//Search Scicoslab Version'
              'exec('+tt_path+'+''/macros/build_util/find_scilab_ver.sci'');'
              'exec('+tt_path+'+''/macros/build_util/get_modnumsci_version.sci'');']
 end
 tt_loader=[tt_loader;
            '[ok,ver]=find_scilab_ver();'
            'if ~ok then'
            '  printf(""Modnum only work with ScicosLab\n"");'
            '  abort;'
            'end'
            ''
            'if ver<>'''+getversion()+''' then'
            '  ok=%f;'
            '  printf(""That version of Modnum has been built with ScicosLab '+getversion()+'.\n"");'
            '  printf(""Please use ScicosLab '+getversion()+', or try to recompile Modnum from source.\n"");'
            '  clear ver'
            '  abort;'
            'end'
            'clear ver'
            '']

 txt=tt_loader1;
 fprintf(u,"%s\n",tt_loader);
endfunction