| 1136 | } |
| 1137 | |
| 1138 | bool Library::isFloatArgValid(const Token *ftok, int argnr, double argvalue, const Settings& settings) const |
| 1139 | { |
| 1140 | const ArgumentChecks *ac = getarg(ftok, argnr); |
| 1141 | if (!ac || ac->valid.empty()) |
| 1142 | return true; |
| 1143 | TokenList tokenList(settings, ftok->isCpp() ? Standards::Language::CPP : Standards::Language::C); |
| 1144 | gettokenlistfromvalid(ac->valid, tokenList); |
| 1145 | for (const Token *tok = tokenList.front(); tok; tok = tok->next()) { |
| 1146 | if (Token::Match(tok, "%num% : %num%") && argvalue >= MathLib::toDoubleNumber(tok) && argvalue <= MathLib::toDoubleNumber(tok->tokAt(2))) |
| 1147 | return true; |
| 1148 | if (Token::Match(tok, "%num% : ,") && argvalue >= MathLib::toDoubleNumber(tok)) |
| 1149 | return true; |
| 1150 | if ((!tok->previous() || tok->strAt(-1) == ",") && Token::Match(tok,": %num%") && argvalue <= MathLib::toDoubleNumber(tok->tokAt(1))) |
| 1151 | return true; |
| 1152 | if (Token::Match(tok, "%num%") && MathLib::isFloat(tok->str()) && MathLib::isEqual(tok->str(), MathLib::toString(argvalue))) |
| 1153 | return true; |
| 1154 | if (Token::Match(tok, "! %num%") && MathLib::isFloat(tok->strAt(1))) |
| 1155 | return MathLib::isNotEqual(tok->strAt(1), MathLib::toString(argvalue)); |
| 1156 | } |
| 1157 | return false; |
| 1158 | } |
| 1159 | |
| 1160 | std::string Library::getFunctionName(const Token *ftok, bool &error) const |
| 1161 | { |