X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkInterpreterVirtual.cxx;h=58552fc160db1b8ee27dd2a1a0ebd7577d1fbcc3;hb=3dcc408acd2264664ca6431a501378ea64233dd6;hp=d49124b09bbb407119b2ce2de452f84890b6c551;hpb=4cb6c59ce12259b0f61bd465aac75fe8c822952f;p=bbtk.git diff --git a/kernel/src/bbtkInterpreterVirtual.cxx b/kernel/src/bbtkInterpreterVirtual.cxx index d49124b..58552fc 100644 --- a/kernel/src/bbtkInterpreterVirtual.cxx +++ b/kernel/src/bbtkInterpreterVirtual.cxx @@ -1,4 +1,31 @@ -/*========================================================================= +/* + # --------------------------------------------------------------------- + # + # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image + # pour la SantÈ) + # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton + # Previous Authors : Laurent Guigues, Jean-Pierre Roux + # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil + # + # This software is governed by the CeCILL-B license under French law and + # abiding by the rules of distribution of free software. You can use, + # modify and/ or redistribute the software under the terms of the CeCILL-B + # license as circulated by CEA, CNRS and INRIA at the following URL + # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html + # or in the file LICENSE.txt. + # + # As a counterpart to the access to the source code and rights to copy, + # modify and redistribute granted by the license, users are provided only + # with a limited warranty and the software's author, the holder of the + # economic rights, and the successive licensors have only limited + # liability. + # + # The fact that you are presently reading this means that you have had + # knowledge of the CeCILL-B license and that you accept its terms. + # ------------------------------------------------------------------------ */ + + +/*========================================================================= Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ Language: C++ @@ -6,27 +33,7 @@ Version: $Revision: 1.88 $ =========================================================================*/ -/* --------------------------------------------------------------------- - -* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale) -* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux -* -* This software is governed by the CeCILL-B license under French law and -* abiding by the rules of distribution of free software. You can use, -* modify and/ or redistribute the software under the terms of the CeCILL-B -* license as circulated by CEA, CNRS and INRIA at the following URL -* http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -* or in the file LICENSE.txt. -* -* As a counterpart to the access to the source code and rights to copy, -* modify and redistribute granted by the license, users are provided only -* with a limited warranty and the software's author, the holder of the -* economic rights, and the successive licensors have only limited -* liability. -* -* The fact that you are presently reading this means that you have had -* knowledge of the CeCILL-B license and that you accept its terms. -* ------------------------------------------------------------------------ */ + /** * \file @@ -339,7 +346,6 @@ namespace bbtk */ - } //======================================================================= @@ -797,8 +803,7 @@ namespace bbtk //======================================================================= void InterpreterVirtual::DoInterpretLine( const std::string& line ) - { - + { bbtkDebugMessage("interpreter",6,"==> InterpreterVirtual::DoInterpretLine(\"" < words; @@ -1123,7 +1128,7 @@ namespace bbtk bbtkDebugMessage("interpreter",6,"<== InterpreterVirtual::DoInterpretLine(\"" <.bbs std::vector Filenames; - + std::string tmpFilenames; + // The following is *NOT* a debug time message : // It's a user intended message. // Please don't remove it. @@ -1332,6 +1338,7 @@ namespace bbtk i++) { std::string full_path(*i); +printf("EED InterpreterVirtual::SwitchToFile 1. >>%s\n", full_path.c_str() ); // we *really* want '.' to be the current working directory if (full_path == ".") { @@ -1362,16 +1369,43 @@ namespace bbtk std::vector::iterator i; for (i=script_paths.begin();i!=script_paths.end();i++) { + +printf("EED InterpreterVirtual::SwitchToFile (1) >> %s\n", (*i).c_str() ); + bbtkMessage("interpreter",1, "--> Looking in '" << *i << "'" << std::endl); Filenames.clear(); //int nbFiles = Utilities::Explore(*i, false, Filenames); - + + int iFilesnames,jFilesnames,sizeFilenames; + sizeFilenames=Filenames.size(); + + + // EEDd 30 sept 2012 + //Sorting list of files + for (iFilesnames=0;iFilesnames Filenames[jFilesnames] ) + { + tmpFilenames = Filenames[iFilesnames]; + Filenames[iFilesnames] = Filenames[jFilesnames]; + Filenames[jFilesnames] = tmpFilenames; + } // if Filesnames + } // for iFilesnames + } // for iFilesnames + + + for (std::vector::iterator j = Filenames.begin(); j!= Filenames.end(); ++j) { + +printf("EED InterpreterVirtual::SwitchToFile (2) >> %s\n", (*j).c_str() ); + int lgr = (*j).size(); if (lgr < 5) continue; // ignore non .bbp file @@ -1466,6 +1500,7 @@ namespace bbtk } std::string tfullPathScriptName = Utilities::MakePkgnameFromPath(path, name, false); + //Addition JCP tfullPathScriptName.size()>=4 if(tfullPathScriptName.size()>=4){ if (tfullPathScriptName.substr(tfullPathScriptName.size()-4, 3)==".bb") @@ -1526,9 +1561,15 @@ namespace bbtk bbtkError("No ["<SetCurrentFileName(fullPathScriptName); - if (source) SetCurrentFileName(fullPathScriptName); + if (source) + { + // Over writing the fullpath of the bbp file. + SetCurrentFileName( fullPathScriptName ); + SetTypeOfScript_Application(); + } } return; @@ -1541,6 +1582,14 @@ namespace bbtk } //======================================================================= + + //======================================================================= + void InterpreterVirtual::SetTypeOfScript_Application( ) + { + } + //======================================================================= + + //======================================================================= void InterpreterVirtual::SwitchToStream( std::stringstream* stream ) { @@ -1956,7 +2005,7 @@ void InterpreterVirtual::SwitchToStream( std::stringstream* stream ) ter.c_cc[VTIME]=0; tcsetattr(0,TCSANOW,&ter); #endif - + mCommandLine = true; bool again = true; // bool insideComment = false; // for multiline comment