cmStringCommand.cxx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #include "cmStringCommand.h"
  14. #include <cmsys/RegularExpression.hxx>
  15. #include <cmsys/SystemTools.hxx>
  16. #include <stdlib.h> // required for atoi
  17. #include <ctype.h>
  18. #include <time.h>
  19. //----------------------------------------------------------------------------
  20. bool cmStringCommand
  21. ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
  22. {
  23. if(args.size() < 1)
  24. {
  25. this->SetError("must be called with at least one argument.");
  26. return false;
  27. }
  28. const std::string &subCommand = args[0];
  29. if(subCommand == "REGEX")
  30. {
  31. return this->HandleRegexCommand(args);
  32. }
  33. else if(subCommand == "REPLACE")
  34. {
  35. return this->HandleReplaceCommand(args);
  36. }
  37. else if(subCommand == "TOLOWER")
  38. {
  39. return this->HandleToUpperLowerCommand(args, false);
  40. }
  41. else if(subCommand == "TOUPPER")
  42. {
  43. return this->HandleToUpperLowerCommand(args, true);
  44. }
  45. else if(subCommand == "COMPARE")
  46. {
  47. return this->HandleCompareCommand(args);
  48. }
  49. else if(subCommand == "ASCII")
  50. {
  51. return this->HandleAsciiCommand(args);
  52. }
  53. else if(subCommand == "CONFIGURE")
  54. {
  55. return this->HandleConfigureCommand(args);
  56. }
  57. else if(subCommand == "LENGTH")
  58. {
  59. return this->HandleLengthCommand(args);
  60. }
  61. else if(subCommand == "SUBSTRING")
  62. {
  63. return this->HandleSubstringCommand(args);
  64. }
  65. else if(subCommand == "STRIP")
  66. {
  67. return this->HandleStripCommand(args);
  68. }
  69. else if(subCommand == "RANDOM")
  70. {
  71. return this->HandleRandomCommand(args);
  72. }
  73. std::string e = "does not recognize sub-command "+subCommand;
  74. this->SetError(e.c_str());
  75. return false;
  76. }
  77. //----------------------------------------------------------------------------
  78. bool cmStringCommand::HandleToUpperLowerCommand(
  79. std::vector<std::string> const& args, bool toUpper)
  80. {
  81. if ( args.size() < 3 )
  82. {
  83. this->SetError("no output variable specified");
  84. return false;
  85. }
  86. std::string outvar = args[2];
  87. std::string output;
  88. if (toUpper)
  89. {
  90. output = cmSystemTools::UpperCase(args[1]);
  91. }
  92. else
  93. {
  94. output = cmSystemTools::LowerCase(args[1]);
  95. }
  96. // Store the output in the provided variable.
  97. this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
  98. return true;
  99. }
  100. //----------------------------------------------------------------------------
  101. bool cmStringCommand::HandleAsciiCommand(std::vector<std::string> const& args)
  102. {
  103. if ( args.size() < 3 )
  104. {
  105. this->SetError("No output variable specified");
  106. return false;
  107. }
  108. std::string::size_type cc;
  109. std::string outvar = args[args.size()-1];
  110. std::string output = "";
  111. for ( cc = 1; cc < args.size()-1; cc ++ )
  112. {
  113. int ch = atoi(args[cc].c_str());
  114. if ( ch > 0 && ch < 256 )
  115. {
  116. output += static_cast<char>(ch);
  117. }
  118. else
  119. {
  120. std::string error = "Character with code ";
  121. error += ch;
  122. error += " does not exist.";
  123. this->SetError(error.c_str());
  124. return false;
  125. }
  126. }
  127. // Store the output in the provided variable.
  128. this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
  129. return true;
  130. }
  131. //----------------------------------------------------------------------------
  132. bool cmStringCommand::HandleConfigureCommand(
  133. std::vector<std::string> const& args)
  134. {
  135. if ( args.size() < 2 )
  136. {
  137. this->SetError("No input string specified.");
  138. return false;
  139. }
  140. else if ( args.size() < 3 )
  141. {
  142. this->SetError("No output variable specified.");
  143. return false;
  144. }
  145. // Parse options.
  146. bool escapeQuotes = false;
  147. bool atOnly = false;
  148. for(unsigned int i = 3; i < args.size(); ++i)
  149. {
  150. if(args[i] == "@ONLY")
  151. {
  152. atOnly = true;
  153. }
  154. else if(args[i] == "ESCAPE_QUOTES")
  155. {
  156. escapeQuotes = true;
  157. }
  158. else
  159. {
  160. cmOStringStream err;
  161. err << "Unrecognized argument \"" << args[i] << "\"";
  162. this->SetError(err.str().c_str());
  163. return false;
  164. }
  165. }
  166. // Configure the string.
  167. std::string output;
  168. this->Makefile->ConfigureString(args[1], output, atOnly, escapeQuotes);
  169. // Store the output in the provided variable.
  170. this->Makefile->AddDefinition(args[2].c_str(), output.c_str());
  171. return true;
  172. }
  173. //----------------------------------------------------------------------------
  174. bool cmStringCommand::HandleRegexCommand(std::vector<std::string> const& args)
  175. {
  176. if(args.size() < 2)
  177. {
  178. this->SetError("sub-command REGEX requires a mode to be specified.");
  179. return false;
  180. }
  181. std::string mode = args[1];
  182. if(mode == "MATCH")
  183. {
  184. if(args.size() < 5)
  185. {
  186. this->SetError("sub-command REGEX, mode MATCH needs "
  187. "at least 5 arguments total to command.");
  188. return false;
  189. }
  190. return this->RegexMatch(args);
  191. }
  192. else if(mode == "MATCHALL")
  193. {
  194. if(args.size() < 5)
  195. {
  196. this->SetError("sub-command REGEX, mode MATCHALL needs "
  197. "at least 5 arguments total to command.");
  198. return false;
  199. }
  200. return this->RegexMatchAll(args);
  201. }
  202. else if(mode == "REPLACE")
  203. {
  204. if(args.size() < 6)
  205. {
  206. this->SetError("sub-command REGEX, mode REPLACE needs "
  207. "at least 6 arguments total to command.");
  208. return false;
  209. }
  210. return this->RegexReplace(args);
  211. }
  212. std::string e = "sub-command REGEX does not recognize mode "+mode;
  213. this->SetError(e.c_str());
  214. return false;
  215. }
  216. //----------------------------------------------------------------------------
  217. bool cmStringCommand::RegexMatch(std::vector<std::string> const& args)
  218. {
  219. //"STRING(REGEX MATCH <regular_expression> <output variable>
  220. // <input> [<input>...])\n";
  221. std::string regex = args[2];
  222. std::string outvar = args[3];
  223. // Concatenate all the last arguments together.
  224. std::string input = args[4];
  225. for(unsigned int i=5; i < args.size(); ++i)
  226. {
  227. input += args[i];
  228. }
  229. this->ClearMatches(this->Makefile);
  230. // Compile the regular expression.
  231. cmsys::RegularExpression re;
  232. if(!re.compile(regex.c_str()))
  233. {
  234. std::string e =
  235. "sub-command REGEX, mode MATCH failed to compile regex \""+regex+"\".";
  236. this->SetError(e.c_str());
  237. return false;
  238. }
  239. // Scan through the input for all matches.
  240. std::string output;
  241. if(re.find(input.c_str()))
  242. {
  243. this->StoreMatches(this->Makefile, re);
  244. std::string::size_type l = re.start();
  245. std::string::size_type r = re.end();
  246. if(r-l == 0)
  247. {
  248. std::string e =
  249. "sub-command REGEX, mode MATCH regex \""+regex+
  250. "\" matched an empty string.";
  251. this->SetError(e.c_str());
  252. return false;
  253. }
  254. output = input.substr(l, r-l);
  255. }
  256. // Store the output in the provided variable.
  257. this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
  258. return true;
  259. }
  260. //----------------------------------------------------------------------------
  261. bool cmStringCommand::RegexMatchAll(std::vector<std::string> const& args)
  262. {
  263. //"STRING(REGEX MATCHALL <regular_expression> <output variable> <input>
  264. // [<input>...])\n";
  265. std::string regex = args[2];
  266. std::string outvar = args[3];
  267. // Concatenate all the last arguments together.
  268. std::string input = args[4];
  269. for(unsigned int i=5; i < args.size(); ++i)
  270. {
  271. input += args[i];
  272. }
  273. this->ClearMatches(this->Makefile);
  274. // Compile the regular expression.
  275. cmsys::RegularExpression re;
  276. if(!re.compile(regex.c_str()))
  277. {
  278. std::string e =
  279. "sub-command REGEX, mode MATCHALL failed to compile regex \""+
  280. regex+"\".";
  281. this->SetError(e.c_str());
  282. return false;
  283. }
  284. // Scan through the input for all matches.
  285. std::string output;
  286. const char* p = input.c_str();
  287. while(re.find(p))
  288. {
  289. this->StoreMatches(this->Makefile, re);
  290. std::string::size_type l = re.start();
  291. std::string::size_type r = re.end();
  292. if(r-l == 0)
  293. {
  294. std::string e = "sub-command REGEX, mode MATCHALL regex \""+
  295. regex+"\" matched an empty string.";
  296. this->SetError(e.c_str());
  297. return false;
  298. }
  299. if(output.length() > 0)
  300. {
  301. output += ";";
  302. }
  303. output += std::string(p+l, r-l);
  304. p += r;
  305. }
  306. // Store the output in the provided variable.
  307. this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
  308. return true;
  309. }
  310. //----------------------------------------------------------------------------
  311. bool cmStringCommand::RegexReplace(std::vector<std::string> const& args)
  312. {
  313. //"STRING(REGEX REPLACE <regular_expression> <replace_expression>
  314. // <output variable> <input> [<input>...])\n"
  315. std::string regex = args[2];
  316. std::string replace = args[3];
  317. std::string outvar = args[4];
  318. // Pull apart the replace expression to find the escaped [0-9] values.
  319. std::vector<RegexReplacement> replacement;
  320. std::string::size_type l = 0;
  321. while(l < replace.length())
  322. {
  323. std::string::size_type r = replace.find("\\", l);
  324. if(r == std::string::npos)
  325. {
  326. r = replace.length();
  327. replacement.push_back(replace.substr(l, r-l));
  328. }
  329. else
  330. {
  331. if(r-l > 0)
  332. {
  333. replacement.push_back(replace.substr(l, r-l));
  334. }
  335. if(r == (replace.length()-1))
  336. {
  337. this->SetError("sub-command REGEX, mode REPLACE: "
  338. "replace-expression ends in a backslash.");
  339. return false;
  340. }
  341. if((replace[r+1] >= '0') && (replace[r+1] <= '9'))
  342. {
  343. replacement.push_back(replace[r+1]-'0');
  344. }
  345. else if(replace[r+1] == 'n')
  346. {
  347. replacement.push_back("\n");
  348. }
  349. else if(replace[r+1] == '\\')
  350. {
  351. replacement.push_back("\\");
  352. }
  353. else
  354. {
  355. std::string e = "sub-command REGEX, mode REPLACE: Unknown escape \"";
  356. e += replace.substr(r, 2);
  357. e += "\"in replace-expression.";
  358. this->SetError(e.c_str());
  359. return false;
  360. }
  361. r += 2;
  362. }
  363. l = r;
  364. }
  365. // Concatenate all the last arguments together.
  366. std::string input = args[5];
  367. for(unsigned int i=6; i < args.size(); ++i)
  368. {
  369. input += args[i];
  370. }
  371. this->ClearMatches(this->Makefile);
  372. // Compile the regular expression.
  373. cmsys::RegularExpression re;
  374. if(!re.compile(regex.c_str()))
  375. {
  376. std::string e =
  377. "sub-command REGEX, mode REPLACE failed to compile regex \""+
  378. regex+"\".";
  379. this->SetError(e.c_str());
  380. return false;
  381. }
  382. // Scan through the input for all matches.
  383. std::string output;
  384. std::string::size_type base = 0;
  385. while(re.find(input.c_str()+base))
  386. {
  387. this->StoreMatches(this->Makefile, re);
  388. std::string::size_type l2 = re.start();
  389. std::string::size_type r = re.end();
  390. // Concatenate the part of the input that was not matched.
  391. output += input.substr(base, l2);
  392. // Make sure the match had some text.
  393. if(r-l2 == 0)
  394. {
  395. std::string e = "sub-command REGEX, mode REPLACE regex \""+
  396. regex+"\" matched an empty string.";
  397. this->SetError(e.c_str());
  398. return false;
  399. }
  400. // Concatenate the replacement for the match.
  401. for(unsigned int i=0; i < replacement.size(); ++i)
  402. {
  403. if(replacement[i].number < 0)
  404. {
  405. // This is just a plain-text part of the replacement.
  406. output += replacement[i].value;
  407. }
  408. else
  409. {
  410. // Replace with part of the match.
  411. int n = replacement[i].number;
  412. std::string::size_type start = re.start(n);
  413. std::string::size_type end = re.end(n);
  414. std::string::size_type len = input.length()-base;
  415. if((start != std::string::npos) && (end != std::string::npos) &&
  416. (start <= len) && (end <= len))
  417. {
  418. output += input.substr(base+start, end-start);
  419. }
  420. else
  421. {
  422. std::string e =
  423. "sub-command REGEX, mode REPLACE: replace expression \""+
  424. replace+"\" contains an out-of-range escape for regex \""+
  425. regex+"\".";
  426. this->SetError(e.c_str());
  427. return false;
  428. }
  429. }
  430. }
  431. // Move past the match.
  432. base += r;
  433. }
  434. // Concatenate the text after the last match.
  435. output += input.substr(base, input.length()-base);
  436. // Store the output in the provided variable.
  437. this->Makefile->AddDefinition(outvar.c_str(), output.c_str());
  438. return true;
  439. }
  440. //----------------------------------------------------------------------------
  441. void cmStringCommand::ClearMatches(cmMakefile* mf)
  442. {
  443. for (unsigned int i=0; i<10; i++)
  444. {
  445. char name[128];
  446. sprintf(name, "CMAKE_MATCH_%d", i);
  447. mf->AddDefinition(name, "");
  448. }
  449. }
  450. //----------------------------------------------------------------------------
  451. void cmStringCommand::StoreMatches(cmMakefile* mf,cmsys::RegularExpression& re)
  452. {
  453. for (unsigned int i=0; i<10; i++)
  454. {
  455. char name[128];
  456. sprintf(name, "CMAKE_MATCH_%d", i);
  457. mf->AddDefinition(name, re.match(i).c_str());
  458. }
  459. }
  460. //----------------------------------------------------------------------------
  461. bool cmStringCommand::HandleCompareCommand(std::vector<std::string> const&
  462. args)
  463. {
  464. if(args.size() < 2)
  465. {
  466. this->SetError("sub-command COMPARE requires a mode to be specified.");
  467. return false;
  468. }
  469. std::string mode = args[1];
  470. if((mode == "EQUAL") || (mode == "NOTEQUAL") ||
  471. (mode == "LESS") || (mode == "GREATER"))
  472. {
  473. if(args.size() < 5)
  474. {
  475. std::string e = "sub-command COMPARE, mode ";
  476. e += mode;
  477. e += " needs at least 5 arguments total to command.";
  478. this->SetError(e.c_str());
  479. return false;
  480. }
  481. const std::string& left = args[2];
  482. const std::string& right = args[3];
  483. const std::string& outvar = args[4];
  484. bool result;
  485. if(mode == "LESS")
  486. {
  487. result = (left < right);
  488. }
  489. else if(mode == "GREATER")
  490. {
  491. result = (left > right);
  492. }
  493. else if(mode == "EQUAL")
  494. {
  495. result = (left == right);
  496. }
  497. else // if(mode == "NOTEQUAL")
  498. {
  499. result = !(left == right);
  500. }
  501. if(result)
  502. {
  503. this->Makefile->AddDefinition(outvar.c_str(), "1");
  504. }
  505. else
  506. {
  507. this->Makefile->AddDefinition(outvar.c_str(), "0");
  508. }
  509. return true;
  510. }
  511. std::string e = "sub-command COMPARE does not recognize mode "+mode;
  512. this->SetError(e.c_str());
  513. return false;
  514. }
  515. //----------------------------------------------------------------------------
  516. bool cmStringCommand::HandleReplaceCommand(std::vector<std::string> const&
  517. args)
  518. {
  519. if(args.size() < 5)
  520. {
  521. this->SetError("sub-command REPLACE requires four arguments.");
  522. return false;
  523. }
  524. const std::string& matchExpression = args[1];
  525. const std::string& replaceExpression = args[2];
  526. const std::string& variableName = args[3];
  527. std::string input = args[4];
  528. for(unsigned int i=5; i < args.size(); ++i)
  529. {
  530. input += args[i];
  531. }
  532. cmsys::SystemTools::ReplaceString(input, matchExpression.c_str(),
  533. replaceExpression.c_str());
  534. this->Makefile->AddDefinition(variableName.c_str(), input.c_str());
  535. return true;
  536. }
  537. //----------------------------------------------------------------------------
  538. bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
  539. args)
  540. {
  541. if(args.size() != 5)
  542. {
  543. this->SetError("sub-command REPLACE requires four arguments.");
  544. return false;
  545. }
  546. const std::string& stringValue = args[1];
  547. int begin = atoi(args[2].c_str());
  548. int end = atoi(args[3].c_str());
  549. const std::string& variableName = args[4];
  550. size_t stringLength = stringValue.size();
  551. int intStringLength = static_cast<int>(stringLength);
  552. if ( begin < 0 || begin > intStringLength )
  553. {
  554. cmOStringStream ostr;
  555. ostr << "begin index: " << begin << " is out of range 0 - "
  556. << stringLength;
  557. this->SetError(ostr.str().c_str());
  558. return false;
  559. }
  560. int leftOverLength = intStringLength - begin;
  561. if ( end < 0 || end > leftOverLength )
  562. {
  563. cmOStringStream ostr;
  564. ostr << "end index: " << end << " is out of range " << 0 << " - "
  565. << leftOverLength;
  566. this->SetError(ostr.str().c_str());
  567. return false;
  568. }
  569. this->Makefile->AddDefinition(variableName.c_str(),
  570. stringValue.substr(begin, end).c_str());
  571. return true;
  572. }
  573. //----------------------------------------------------------------------------
  574. bool cmStringCommand
  575. ::HandleLengthCommand(std::vector<std::string> const& args)
  576. {
  577. if(args.size() != 3)
  578. {
  579. this->SetError("sub-command LENGTH requires two arguments.");
  580. return false;
  581. }
  582. const std::string& stringValue = args[1];
  583. const std::string& variableName = args[2];
  584. size_t length = stringValue.size();
  585. char buffer[1024];
  586. sprintf(buffer, "%d", static_cast<int>(length));
  587. this->Makefile->AddDefinition(variableName.c_str(), buffer);
  588. return true;
  589. }
  590. //----------------------------------------------------------------------------
  591. bool cmStringCommand::HandleStripCommand(
  592. std::vector<std::string> const& args)
  593. {
  594. if(args.size() != 3)
  595. {
  596. this->SetError("sub-command LENGTH requires two arguments.");
  597. return false;
  598. }
  599. const std::string& stringValue = args[1];
  600. const std::string& variableName = args[2];
  601. size_t inStringLength = stringValue.size();
  602. size_t startPos = inStringLength + 1;
  603. size_t endPos = 0;
  604. const char* ptr = stringValue.c_str();
  605. size_t cc;
  606. for ( cc = 0; cc < inStringLength; ++ cc )
  607. {
  608. if ( !isspace(*ptr) )
  609. {
  610. if ( startPos > inStringLength )
  611. {
  612. startPos = cc;
  613. }
  614. endPos = cc;
  615. }
  616. ++ ptr;
  617. }
  618. size_t outLength = 0;
  619. // if the input string didn't contain any non-space characters, return
  620. // an empty string
  621. if (startPos > inStringLength)
  622. {
  623. outLength = 0;
  624. startPos = 0;
  625. }
  626. else
  627. {
  628. outLength=endPos - startPos + 1;
  629. }
  630. this->Makefile->AddDefinition(variableName.c_str(),
  631. stringValue.substr(startPos, outLength).c_str());
  632. return true;
  633. }
  634. //----------------------------------------------------------------------------
  635. bool cmStringCommand
  636. ::HandleRandomCommand(std::vector<std::string> const& args)
  637. {
  638. if(args.size() < 2 || args.size() == 3 || args.size() == 5)
  639. {
  640. this->SetError("sub-command RANDOM requires at least one argument.");
  641. return false;
  642. }
  643. int length = 5;
  644. const char cmStringCommandDefaultAlphabet[] = "qwertyuiopasdfghjklzxcvbnm"
  645. "QWERTYUIOPASDFGHJKLZXCVBNM"
  646. "0123456789";
  647. std::string alphabet;
  648. if ( args.size() > 3 )
  649. {
  650. size_t i = 1;
  651. size_t stopAt = args.size() - 2;
  652. for ( ; i < stopAt; ++i )
  653. {
  654. if ( args[i] == "LENGTH" )
  655. {
  656. ++i;
  657. length = atoi(args[i].c_str());
  658. }
  659. else if ( args[i] == "ALPHABET" )
  660. {
  661. ++i;
  662. alphabet = args[i];
  663. }
  664. }
  665. }
  666. if ( !alphabet.size() )
  667. {
  668. alphabet = cmStringCommandDefaultAlphabet;
  669. }
  670. double sizeofAlphabet = alphabet.size();
  671. if ( sizeofAlphabet < 1 )
  672. {
  673. this->SetError("sub-command RANDOM invoked with bad alphabet.");
  674. return false;
  675. }
  676. if ( length < 1 )
  677. {
  678. this->SetError("sub-command RANDOM invoked with bad length.");
  679. return false;
  680. }
  681. const std::string& variableName = args[args.size()-1];
  682. std::vector<char> result;
  683. srand((int)time(NULL));
  684. const char* alphaPtr = alphabet.c_str();
  685. int cc;
  686. for ( cc = 0; cc < length; cc ++ )
  687. {
  688. int idx=(int) (sizeofAlphabet* rand()/(RAND_MAX+1.0));
  689. result.push_back(*(alphaPtr + idx));
  690. }
  691. result.push_back(0);
  692. this->Makefile->AddDefinition(variableName.c_str(), &*result.begin());
  693. return true;
  694. }