|
@@ -838,6 +838,8 @@ r_expand_variable(const string &str, size_t &vp,
|
|
|
return expand_length(params);
|
|
return expand_length(params);
|
|
|
} else if (funcname == "substr") {
|
|
} else if (funcname == "substr") {
|
|
|
return expand_substr(params);
|
|
return expand_substr(params);
|
|
|
|
|
+ } else if (funcname == "findstring") {
|
|
|
|
|
+ return expand_findstring(params);
|
|
|
} else if (funcname == "dir") {
|
|
} else if (funcname == "dir") {
|
|
|
return expand_dir(params);
|
|
return expand_dir(params);
|
|
|
} else if (funcname == "notdir") {
|
|
} else if (funcname == "notdir") {
|
|
@@ -1515,6 +1517,8 @@ expand_shell(const string ¶ms) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: PPScope::expand_standardize
|
|
// Function: PPScope::expand_standardize
|
|
|
// Access: Private
|
|
// Access: Private
|
|
@@ -2099,6 +2103,31 @@ expand_subst(const string ¶ms) {
|
|
|
return str;
|
|
return str;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: PPScope::expand_findstrnig
|
|
|
|
|
+// Access: Private
|
|
|
|
|
+// Description: Expands the "findstring" function variable.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+string PPScope::
|
|
|
|
|
+expand_findstring(const string ¶ms) {
|
|
|
|
|
+ // Split the string up into tokens based on the commas.
|
|
|
|
|
+ vector<string> tokens;
|
|
|
|
|
+ tokenize_params(params, tokens, true);
|
|
|
|
|
+
|
|
|
|
|
+ if (tokens.size() != 2) {
|
|
|
|
|
+ cerr << "findstring requires two parameters.\n";
|
|
|
|
|
+ return string();
|
|
|
|
|
+ }
|
|
|
|
|
+ string str = tokens.back();
|
|
|
|
|
+ const string &srchstr = tokens[0];
|
|
|
|
|
+ size_t q = 0;
|
|
|
|
|
+ size_t p = str.find(srchstr, q);
|
|
|
|
|
+ if(p == string::npos)
|
|
|
|
|
+ str = "";
|
|
|
|
|
+
|
|
|
|
|
+ return str;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: PPScope::expand_wordsubst
|
|
// Function: PPScope::expand_wordsubst
|
|
|
// Access: Private
|
|
// Access: Private
|