Esempio n. 1
0
void expose_commands_clusters( Tcl::interpreter &i )
{
  using namespace Tcl;

  i.def( "tf_clusters_tcc", &tf_clusters_tcc::create, factory( "trajectory_func" ) );

  i.def( "tf_clusters_tcc9A", &tcc9A, factory( "trajectory_func" ) );
  i.def( "tf_clusters_tcc11A", &tcc11A, factory( "trajectory_func" ) );
  i.def( "tf_clusters_tcc13A", &tcc13A, factory( "trajectory_func" ) );
  i.def( "tf_clusters_tccBCC9", &tccBCC9, factory( "trajectory_func" ) );
}
Esempio n. 2
0
Profiles::RuleNameCollection Profiles::getListOfScriptNamesTcl(
  const Vera::Plugins::Profiles::ProfileName & profile)
{
    RuleNameCollection allRules;

    // name of the profile is also the name of the profile file

    const Vera::Plugins::RootDirectory::DirectoryName veraRoot =
            Vera::Plugins::RootDirectory::getRootDirectory();

    std::string fileName(veraRoot + "/profiles/");
    fileName += profile;

    std::ifstream profileFile(fileName.c_str());
    if (profileFile.is_open() == false)
    {
        std::ostringstream ss;
        ss << "Cannot open profile description for profile '" << profile
            << "': "<< strerror(errno);
        throw Vera::Plugins::ProfileError(ss.str());
    }

    Tcl::interpreter interp;
    interp.eval(profileFile);
    if (profileFile.bad())
    {
        throw std::runtime_error(
            "Cannot read from " + fileName + ": " + strerror(errno));
    }

    const Tcl::object ruleList = interp.eval("set rules");

    const size_t ruleListLength = ruleList.length(interp);
    for (size_t i = 0; i != ruleListLength; ++i)
    {
        const Vera::Plugins::Rules::RuleName rName = ruleList.at(interp, i).get();
        allRules.push_back(rName);
    }

    return allRules;
}
Esempio n. 3
0
void Exclusions::setExclusions(const ExclusionFileName & fileName)
{
    std::ifstream exclusionsFile(fileName.c_str());
    if (exclusionsFile.is_open() == false)
    {
        std::ostringstream ss;
        ss << "Cannot open exclusions file " << fileName << ": "
           << strerror(errno);
        throw ExclusionError(ss.str());
    }

    Tcl::interpreter interp;
    interp.eval(exclusionsFile);
    if (exclusionsFile.bad())
    {
        throw std::ios::failure(
            "Cannot read from " + fileName + ": " + strerror(errno));
    }

    const Tcl::object ruleNames = interp.eval("array names ruleExclusions");
    const size_t ruleNamesLength = ruleNames.length(interp);
    for (size_t i = 0; i != ruleNamesLength; ++i)
    {
        const std::string ruleName = ruleNames.at(interp, i).get();

        const Tcl::object exceptionList = interp.eval("set ruleExclusions(" + ruleName + ")");
        const size_t exceptionListLength = exceptionList.length(interp);

        FileNameSet files;
        for (size_t j = 0; j != exceptionListLength; ++j)
        {
            const Structures::SourceFiles::FileName file = exceptionList.at(interp, j).get();
            files.insert(file);
        }

        exclusions[ruleName] = files;
    }
}