@@ -375,7 +375,7 @@ namespace attributes {
375
375
class SourceFileAttributesParser : public SourceFileAttributes {
376
376
public:
377
377
explicit SourceFileAttributesParser (const std::string& sourceFile,
378
- bool localIncludes );
378
+ bool parseDependencies );
379
379
380
380
private:
381
381
// prohibit copying
@@ -426,9 +426,9 @@ namespace attributes {
426
426
return embeddedR_;
427
427
}
428
428
429
- // Get local includes
430
- const std::vector<FileInfo>& localIncludes () const {
431
- return localIncludes_ ;
429
+ // Get source dependencies
430
+ const std::vector<FileInfo>& sourceDependencies () const {
431
+ return sourceDependencies_ ;
432
432
};
433
433
434
434
private:
@@ -461,7 +461,7 @@ namespace attributes {
461
461
std::vector<Attribute> attributes_;
462
462
std::vector<std::string> modules_;
463
463
std::vector<std::string> embeddedR_;
464
- std::vector<FileInfo> localIncludes_ ;
464
+ std::vector<FileInfo> sourceDependencies_ ;
465
465
std::vector<std::vector<std::string> > roxygenChunks_;
466
466
std::vector<std::string> roxygenBuffer_;
467
467
};
@@ -737,23 +737,23 @@ namespace attributes {
737
737
}
738
738
}
739
739
740
- bool addUniqueInclude (Rcpp::CharacterVector include,
741
- std::vector<FileInfo>* pLocalIncludes ) {
740
+ bool addUniqueDependency (Rcpp::CharacterVector include,
741
+ std::vector<FileInfo>* pDependencies ) {
742
742
743
743
// return false if we already have this include
744
744
std::string path = Rcpp::as<std::string>(include);
745
- for (size_t i = 0 ; i<pLocalIncludes ->size (); ++i) {
746
- if (pLocalIncludes ->at (i).path () == path)
745
+ for (size_t i = 0 ; i<pDependencies ->size (); ++i) {
746
+ if (pDependencies ->at (i).path () == path)
747
747
return false ;
748
748
}
749
749
750
750
// add it and return true
751
- pLocalIncludes ->push_back (FileInfo (path));
751
+ pDependencies ->push_back (FileInfo (path));
752
752
return true ;
753
753
}
754
754
755
- void parseLocalIncludes (const std::string& sourceFile,
756
- std::vector<FileInfo>* pLocalIncludes ) {
755
+ void parseSourceDependencies (const std::string& sourceFile,
756
+ std::vector<FileInfo>* pDependencies ) {
757
757
758
758
// import R functions
759
759
Rcpp::Environment baseEnv = Rcpp::Environment::base_env ();
@@ -782,7 +782,7 @@ namespace attributes {
782
782
783
783
// accumulate local includes (skip commented sections)
784
784
CommentState commentState;
785
- std::vector<FileInfo> newIncludes ;
785
+ std::vector<FileInfo> newDependencies ;
786
786
for (int i = 0 ; i<matches.size (); i++) {
787
787
std::string line = lines[i];
788
788
commentState.submitLine (line);
@@ -797,28 +797,28 @@ namespace attributes {
797
797
LogicalVector exists = fileExists (include);
798
798
if (exists[0 ]) {
799
799
include = normalizePath (include);
800
- if (addUniqueInclude (include, pLocalIncludes )) {
801
- newIncludes .push_back (
800
+ if (addUniqueDependency (include, pDependencies )) {
801
+ newDependencies .push_back (
802
802
FileInfo (Rcpp::as<std::string>(include)));
803
803
}
804
804
}
805
805
}
806
806
}
807
807
}
808
808
809
- // look for includes recursively
810
- for (size_t i = 0 ; i<newIncludes .size (); i++) {
811
- FileInfo include = newIncludes [i];
812
- parseLocalIncludes (include .path (), pLocalIncludes );
809
+ // look for dependencies recursively
810
+ for (size_t i = 0 ; i<newDependencies .size (); i++) {
811
+ FileInfo dependency = newDependencies [i];
812
+ parseSourceDependencies (dependency .path (), pDependencies );
813
813
}
814
814
}
815
815
816
- // parse the local includes from the passed lines
817
- std::vector<FileInfo> parseLocalIncludes (
816
+ // parse the source dependencies from the passed lines
817
+ std::vector<FileInfo> parseSourceDependencies (
818
818
const std::string& sourceFile) {
819
- std::vector<FileInfo> localIncludes ;
820
- parseLocalIncludes (sourceFile, &localIncludes );
821
- return localIncludes ;
819
+ std::vector<FileInfo> dependencies ;
820
+ parseSourceDependencies (sourceFile, &dependencies );
821
+ return dependencies ;
822
822
}
823
823
824
824
// Parse embedded R code chunks from a file (receives the lines of the
@@ -993,7 +993,7 @@ namespace attributes {
993
993
// Parse the attributes from a source file
994
994
SourceFileAttributesParser::SourceFileAttributesParser (
995
995
const std::string& sourceFile,
996
- bool localIncludes )
996
+ bool parseDependencies )
997
997
: sourceFile_(sourceFile)
998
998
{
999
999
// First read the entire file into a std::stringstream so we can check
@@ -1084,18 +1084,18 @@ namespace attributes {
1084
1084
// Parse embedded R
1085
1085
embeddedR_ = parseEmbeddedR (lines_, lines);
1086
1086
1087
- // Recursively parse local includes if requested
1088
- if (localIncludes ) {
1087
+ // Recursively parse dependencies if requested
1088
+ if (parseDependencies ) {
1089
1089
1090
1090
// get local includes
1091
- localIncludes_ = parseLocalIncludes (sourceFile);
1091
+ sourceDependencies_ = parseSourceDependencies (sourceFile);
1092
1092
1093
1093
// parse attributes and modules from each local include
1094
- for (size_t i = 0 ; i<localIncludes_ .size (); i++) {
1094
+ for (size_t i = 0 ; i<sourceDependencies_ .size (); i++) {
1095
1095
1096
1096
// perform parse
1097
- std::string include = localIncludes_ [i].path ();
1098
- SourceFileAttributesParser parser (include , false );
1097
+ std::string dependency = sourceDependencies_ [i].path ();
1098
+ SourceFileAttributesParser parser (dependency , false );
1099
1099
1100
1100
// copy to base attributes
1101
1101
std::copy (parser.begin (),
@@ -2730,10 +2730,10 @@ namespace {
2730
2730
if (!FileInfo (dynlibPath ()).exists ())
2731
2731
return true ;
2732
2732
2733
- // variation in local includes means we're dirty
2734
- std::vector<FileInfo> localIncludes = parseLocalIncludes (
2733
+ // variation in source dependencies means we're dirty
2734
+ std::vector<FileInfo> sourceDependencies = parseSourceDependencies (
2735
2735
cppSourcePath_);
2736
- if (localIncludes != localIncludes_ )
2736
+ if (sourceDependencies != sourceDependencies_ )
2737
2737
return true ;
2738
2738
2739
2739
// not dirty
@@ -2814,8 +2814,8 @@ namespace {
2814
2814
// capture embededded R
2815
2815
embeddedR_ = sourceAttributes.embeddedR ();
2816
2816
2817
- // capture local includes
2818
- localIncludes_ = sourceAttributes.localIncludes ();
2817
+ // capture source dependencies
2818
+ sourceDependencies_ = sourceAttributes.sourceDependencies ();
2819
2819
}
2820
2820
2821
2821
const std::string& contextId () const {
@@ -2945,7 +2945,7 @@ namespace {
2945
2945
std::vector<std::string> depends_;
2946
2946
std::vector<std::string> plugins_;
2947
2947
std::vector<std::string> embeddedR_;
2948
- std::vector<FileInfo> localIncludes_ ;
2948
+ std::vector<FileInfo> sourceDependencies_ ;
2949
2949
};
2950
2950
2951
2951
// Dynlib cache that allows lookup by either file path or code contents
0 commit comments