[1] | 1 | //----------------------------------------------------------- |
---|
| 2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
| 3 | // arnault@lal.in2p3.fr |
---|
| 4 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
| 5 | //----------------------------------------------------------- |
---|
| 6 | |
---|
| 7 | #include "cmt_syntax.h" |
---|
| 8 | #include "cmt.h" |
---|
| 9 | #include "cmt_symbol.h" |
---|
| 10 | #include "cmt_constituent.h" |
---|
| 11 | #include "cmt_pattern.h" |
---|
| 12 | #include "cmt_error.h" |
---|
| 13 | #include "cmt_branch.h" |
---|
| 14 | #include "cmt_error.h" |
---|
| 15 | #include "cmt_script.h" |
---|
| 16 | #include "cmt_language.h" |
---|
| 17 | #include "cmt_project.h" |
---|
| 18 | #include "cmt_cmtpath_pattern.h" |
---|
| 19 | |
---|
| 20 | void Kwd::action (const CmtSystem::cmt_string_vector& words, |
---|
| 21 | Project* project, |
---|
| 22 | const cmt_string& file_name, |
---|
| 23 | int line_number) |
---|
| 24 | { |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | class KwdAction : public Kwd |
---|
| 28 | { |
---|
| 29 | public: |
---|
| 30 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 31 | Use* use, |
---|
| 32 | const cmt_string& file_name, |
---|
| 33 | int line_number) |
---|
| 34 | { |
---|
| 35 | Symbol::action (words, CommandAction, use); |
---|
| 36 | } |
---|
| 37 | }; |
---|
| 38 | |
---|
| 39 | class KwdAlias : public Kwd |
---|
| 40 | { |
---|
| 41 | public: |
---|
| 42 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 43 | Use* use, |
---|
| 44 | const cmt_string& file_name, |
---|
| 45 | int line_number) |
---|
| 46 | { |
---|
| 47 | Symbol::action (words, CommandAlias, use); |
---|
| 48 | } |
---|
| 49 | }; |
---|
| 50 | |
---|
| 51 | class KwdApplication : public Kwd |
---|
| 52 | { |
---|
| 53 | public: |
---|
| 54 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 55 | Use* use, |
---|
| 56 | const cmt_string& file_name, |
---|
| 57 | int line_number) |
---|
| 58 | { |
---|
| 59 | if (use == &(Use::current ())) |
---|
| 60 | { |
---|
| 61 | Constituent::action (Application, words); |
---|
| 62 | } |
---|
| 63 | } |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | class KwdApplyPattern : public Kwd |
---|
| 67 | { |
---|
| 68 | public: |
---|
| 69 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 70 | Use* use, |
---|
| 71 | const cmt_string& file_name, |
---|
| 72 | int line_number) |
---|
| 73 | { |
---|
| 74 | ApplyPattern::action (words, use); |
---|
| 75 | } |
---|
| 76 | }; |
---|
| 77 | |
---|
| 78 | class KwdApplyTag : public Kwd |
---|
| 79 | { |
---|
| 80 | public: |
---|
| 81 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 82 | Use* use, |
---|
| 83 | const cmt_string& file_name, |
---|
| 84 | int line_number) |
---|
| 85 | { |
---|
| 86 | Tag::action_apply (words, use); |
---|
| 87 | } |
---|
| 88 | }; |
---|
| 89 | |
---|
| 90 | class KwdAuthor : public Kwd |
---|
| 91 | { |
---|
| 92 | public: |
---|
| 93 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 94 | Use* use, |
---|
| 95 | const cmt_string& file_name, |
---|
| 96 | int line_number) |
---|
| 97 | { |
---|
| 98 | use->author_action (words); |
---|
| 99 | } |
---|
| 100 | }; |
---|
| 101 | |
---|
| 102 | class KwdBranches : public Kwd |
---|
| 103 | { |
---|
| 104 | public: |
---|
| 105 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 106 | Use* use, |
---|
| 107 | const cmt_string& file_name, |
---|
| 108 | int line_number) |
---|
| 109 | { |
---|
| 110 | if (use == &(Use::current ())) |
---|
| 111 | { |
---|
| 112 | Branch::action (words); |
---|
| 113 | } |
---|
| 114 | } |
---|
| 115 | }; |
---|
| 116 | |
---|
| 117 | class KwdBuildStrategy : public Kwd |
---|
| 118 | { |
---|
| 119 | public: |
---|
| 120 | bool decode (const cmt_string& w, |
---|
| 121 | int& mask, |
---|
| 122 | int& strategy) |
---|
| 123 | { |
---|
| 124 | bool result = true; |
---|
| 125 | |
---|
| 126 | if (w == "prototypes") |
---|
| 127 | { |
---|
| 128 | mask = PrototypesMask; |
---|
| 129 | strategy = Prototypes; |
---|
| 130 | } |
---|
| 131 | else if (w == "no_prototypes") |
---|
| 132 | { |
---|
| 133 | mask = PrototypesMask; |
---|
| 134 | strategy = NoPrototypes; |
---|
| 135 | } |
---|
| 136 | else if (w == "keep_makefiles") |
---|
| 137 | { |
---|
| 138 | mask = KeepMakefilesMask; |
---|
| 139 | strategy = KeepMakefiles; |
---|
| 140 | } |
---|
| 141 | else if (w == "rebuild_makefiles") |
---|
| 142 | { |
---|
| 143 | mask = KeepMakefilesMask; |
---|
| 144 | strategy = RebuildMakefiles; |
---|
| 145 | } |
---|
| 146 | else if ((w == "with_installarea") || (w == "with_install_area")) |
---|
| 147 | { |
---|
| 148 | mask = InstallAreaMask; |
---|
| 149 | strategy = WithInstallArea; |
---|
| 150 | } |
---|
| 151 | else if ((w == "without_installarea") || (w == "without_install_area")) |
---|
| 152 | { |
---|
| 153 | mask = InstallAreaMask; |
---|
| 154 | strategy = WithoutInstallArea; |
---|
| 155 | } |
---|
| 156 | else |
---|
| 157 | { |
---|
| 158 | result = false; |
---|
| 159 | } |
---|
| 160 | |
---|
| 161 | return (result); |
---|
| 162 | } |
---|
| 163 | |
---|
| 164 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 165 | Use* use, |
---|
| 166 | const cmt_string& file_name, |
---|
| 167 | int line_number) |
---|
| 168 | { |
---|
| 169 | cmt_string cmtpath; |
---|
| 170 | cmt_string offset; |
---|
| 171 | |
---|
| 172 | use->get_cmtpath_and_offset (cmtpath, offset); |
---|
| 173 | |
---|
| 174 | Project* p = Project::find_by_cmtpath (cmtpath); |
---|
| 175 | |
---|
| 176 | for (int i = 1; i < words.size (); i++) |
---|
| 177 | { |
---|
| 178 | const cmt_string& w = words[i]; |
---|
| 179 | |
---|
| 180 | int mask = 0; |
---|
| 181 | int strategy = 0; |
---|
| 182 | |
---|
| 183 | bool in_error = false; |
---|
| 184 | |
---|
| 185 | if (!decode (w, mask, strategy)) |
---|
| 186 | { |
---|
| 187 | in_error = true; |
---|
| 188 | |
---|
| 189 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | if (mask != 0) |
---|
| 193 | { |
---|
| 194 | if (p == 0) Cmt::set_current_build_strategy (strategy); |
---|
| 195 | else p->set_build_strategy (mask, strategy); |
---|
| 196 | } |
---|
| 197 | |
---|
| 198 | if ((Cmt::get_action () == action_show_strategies) && !Cmt::get_quiet ()) |
---|
| 199 | { |
---|
| 200 | if (!in_error) |
---|
| 201 | { |
---|
| 202 | cerr << "# Package " << use->get_package_name () |
---|
| 203 | << " adds " << w << " to build strategy" << endl; |
---|
| 204 | } |
---|
| 205 | else |
---|
| 206 | { |
---|
| 207 | cerr << "# Error: Package " << use->get_package_name () |
---|
| 208 | << " uses unknown " << w << " keyword to build strategy" << endl; |
---|
| 209 | } |
---|
| 210 | } |
---|
| 211 | } |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 215 | Project* project, |
---|
| 216 | const cmt_string& file_name, |
---|
| 217 | int line_number) |
---|
| 218 | { |
---|
| 219 | for (int i = 1; i < words.size (); i++) |
---|
| 220 | { |
---|
| 221 | const cmt_string& w = words[i]; |
---|
| 222 | |
---|
| 223 | int mask = 0; |
---|
| 224 | int strategy = 0; |
---|
| 225 | |
---|
| 226 | bool in_error = false; |
---|
| 227 | |
---|
| 228 | if (!decode (w, mask, strategy)) |
---|
| 229 | { |
---|
| 230 | in_error = true; |
---|
| 231 | |
---|
| 232 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); |
---|
| 233 | } |
---|
| 234 | |
---|
| 235 | if (mask != 0) |
---|
| 236 | { |
---|
| 237 | if (project == 0) Cmt::set_current_build_strategy (strategy); |
---|
| 238 | else project->set_build_strategy (mask, strategy); |
---|
| 239 | } |
---|
| 240 | |
---|
| 241 | if ((Cmt::get_action () == action_show_strategies) && !Cmt::get_quiet ()) |
---|
| 242 | { |
---|
| 243 | if (!in_error) |
---|
| 244 | { |
---|
| 245 | cerr << "# Project " << project->get_name () |
---|
| 246 | << " adds " << w << " to build strategy" << endl; |
---|
| 247 | } |
---|
| 248 | else |
---|
| 249 | { |
---|
| 250 | cerr << "# Error: Project " << project->get_name () |
---|
| 251 | << " uses unknown " << w << " keyword to build strategy" << endl; |
---|
| 252 | } |
---|
| 253 | } |
---|
| 254 | } |
---|
| 255 | } |
---|
| 256 | }; |
---|
| 257 | |
---|
| 258 | class KwdCleanupScript : public Kwd |
---|
| 259 | { |
---|
| 260 | public: |
---|
| 261 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 262 | Use* use, |
---|
| 263 | const cmt_string& file_name, |
---|
| 264 | int line_number) |
---|
| 265 | { |
---|
| 266 | Script::action (words, CleanupScript, use); |
---|
| 267 | Symbol::action (words, CommandCleanupScript, use); |
---|
| 268 | } |
---|
| 269 | }; |
---|
| 270 | |
---|
| 271 | class KwdCmtPathPattern : public Kwd |
---|
| 272 | { |
---|
| 273 | public: |
---|
| 274 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 275 | Use* use, |
---|
| 276 | const cmt_string& /*file_name*/, |
---|
| 277 | int /*line_number*/) |
---|
| 278 | { |
---|
| 279 | CmtPathPattern::action (words, use); |
---|
| 280 | } |
---|
| 281 | }; |
---|
| 282 | |
---|
| 283 | class KwdDocument : public Kwd |
---|
| 284 | { |
---|
| 285 | public: |
---|
| 286 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 287 | Use* use, |
---|
| 288 | const cmt_string& file_name, |
---|
| 289 | int line_number) |
---|
| 290 | { |
---|
| 291 | if (use == &(Use::current ())) |
---|
| 292 | { |
---|
| 293 | Constituent::action (Document, words); |
---|
| 294 | } |
---|
| 295 | } |
---|
| 296 | }; |
---|
| 297 | |
---|
| 298 | class KwdEndPrivate : public Kwd |
---|
| 299 | { |
---|
| 300 | public: |
---|
| 301 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 302 | Use* use, |
---|
| 303 | const cmt_string& file_name, |
---|
| 304 | int line_number) |
---|
| 305 | { |
---|
| 306 | if (use != &(Use::current ())) |
---|
| 307 | { |
---|
| 308 | use->pop_scope_section (); |
---|
| 309 | } |
---|
| 310 | } |
---|
| 311 | }; |
---|
| 312 | |
---|
| 313 | class KwdEndPublic : public Kwd |
---|
| 314 | { |
---|
| 315 | public: |
---|
| 316 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 317 | Use* use, |
---|
| 318 | const cmt_string& file_name, |
---|
| 319 | int line_number) |
---|
| 320 | { |
---|
| 321 | if (use != &(Use::current ())) |
---|
| 322 | { |
---|
| 323 | use->pop_scope_section (); |
---|
| 324 | } |
---|
| 325 | } |
---|
| 326 | }; |
---|
| 327 | |
---|
| 328 | class KwdIgnorePattern : public Kwd |
---|
| 329 | { |
---|
| 330 | public: |
---|
| 331 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 332 | Use* use, |
---|
| 333 | const cmt_string& file_name, |
---|
| 334 | int line_number) |
---|
| 335 | { |
---|
| 336 | IgnorePattern::action (words, use); |
---|
| 337 | } |
---|
| 338 | }; |
---|
| 339 | |
---|
| 340 | class KwdIncludeDirs : public Kwd |
---|
| 341 | { |
---|
| 342 | public: |
---|
| 343 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 344 | Use* use, |
---|
| 345 | const cmt_string& file_name, |
---|
| 346 | int line_number) |
---|
| 347 | { |
---|
| 348 | Include::action (words, use); |
---|
| 349 | } |
---|
| 350 | }; |
---|
| 351 | |
---|
| 352 | class KwdIncludePath : public Kwd |
---|
| 353 | { |
---|
| 354 | public: |
---|
| 355 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 356 | Use* use, |
---|
| 357 | const cmt_string& file_name, |
---|
| 358 | int line_number) |
---|
| 359 | { |
---|
| 360 | if (words.size () > 1) |
---|
| 361 | { |
---|
| 362 | use->set_include_path (words[1]); |
---|
| 363 | } |
---|
| 364 | } |
---|
| 365 | }; |
---|
| 366 | |
---|
| 367 | class KwdLanguage : public Kwd |
---|
| 368 | { |
---|
| 369 | public: |
---|
| 370 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 371 | Use* use, |
---|
| 372 | const cmt_string& file_name, |
---|
| 373 | int line_number) |
---|
| 374 | { |
---|
| 375 | Language::action (words); |
---|
| 376 | } |
---|
| 377 | }; |
---|
| 378 | |
---|
| 379 | class KwdLibrary : public Kwd |
---|
| 380 | { |
---|
| 381 | public: |
---|
| 382 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 383 | Use* use, |
---|
| 384 | const cmt_string& file_name, |
---|
| 385 | int line_number) |
---|
| 386 | { |
---|
| 387 | if (use == &(Use::current ())) |
---|
| 388 | { |
---|
| 389 | Constituent::action (Library, words); |
---|
| 390 | } |
---|
| 391 | } |
---|
| 392 | }; |
---|
| 393 | |
---|
| 394 | class KwdMacro : public Kwd |
---|
| 395 | { |
---|
| 396 | public: |
---|
| 397 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 398 | Use* use, |
---|
| 399 | const cmt_string& file_name, |
---|
| 400 | int line_number) |
---|
| 401 | { |
---|
| 402 | Symbol::action (words, CommandMacro, use); |
---|
| 403 | } |
---|
| 404 | }; |
---|
| 405 | |
---|
| 406 | class KwdMacroPrepend : public Kwd |
---|
| 407 | { |
---|
| 408 | public: |
---|
| 409 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 410 | Use* use, |
---|
| 411 | const cmt_string& file_name, |
---|
| 412 | int line_number) |
---|
| 413 | { |
---|
| 414 | Symbol::action (words, CommandMacroPrepend, use); |
---|
| 415 | } |
---|
| 416 | }; |
---|
| 417 | |
---|
| 418 | class KwdMacroAppend : public Kwd |
---|
| 419 | { |
---|
| 420 | public: |
---|
| 421 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 422 | Use* use, |
---|
| 423 | const cmt_string& file_name, |
---|
| 424 | int line_number) |
---|
| 425 | { |
---|
| 426 | Symbol::action (words, CommandMacroAppend, use); |
---|
| 427 | } |
---|
| 428 | }; |
---|
| 429 | |
---|
| 430 | class KwdMacroRemove : public Kwd |
---|
| 431 | { |
---|
| 432 | public: |
---|
| 433 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 434 | Use* use, |
---|
| 435 | const cmt_string& file_name, |
---|
| 436 | int line_number) |
---|
| 437 | { |
---|
| 438 | Symbol::action (words, CommandMacroRemove, use); |
---|
| 439 | } |
---|
| 440 | }; |
---|
| 441 | |
---|
| 442 | class KwdMacroRemoveRegexp : public Kwd |
---|
| 443 | { |
---|
| 444 | public: |
---|
| 445 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 446 | Use* use, |
---|
| 447 | const cmt_string& file_name, |
---|
| 448 | int line_number) |
---|
| 449 | { |
---|
| 450 | Symbol::action (words, CommandMacroRemoveRegexp, use); |
---|
| 451 | } |
---|
| 452 | }; |
---|
| 453 | |
---|
| 454 | class KwdMacroRemoveAll : public Kwd |
---|
| 455 | { |
---|
| 456 | public: |
---|
| 457 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 458 | Use* use, |
---|
| 459 | const cmt_string& file_name, |
---|
| 460 | int line_number) |
---|
| 461 | { |
---|
| 462 | Symbol::action (words, CommandMacroRemoveAll, use); |
---|
| 463 | } |
---|
| 464 | }; |
---|
| 465 | |
---|
| 466 | class KwdMacroRemoveAllRegexp : public Kwd |
---|
| 467 | { |
---|
| 468 | public: |
---|
| 469 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 470 | Use* use, |
---|
| 471 | const cmt_string& file_name, |
---|
| 472 | int line_number) |
---|
| 473 | { |
---|
| 474 | Symbol::action (words, CommandMacroRemoveAllRegexp, use); |
---|
| 475 | } |
---|
| 476 | }; |
---|
| 477 | |
---|
| 478 | class KwdMakeFragment : public Kwd |
---|
| 479 | { |
---|
| 480 | public: |
---|
| 481 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 482 | Use* use, |
---|
| 483 | const cmt_string& file_name, |
---|
| 484 | int line_number) |
---|
| 485 | { |
---|
| 486 | Fragment::action (words, use); |
---|
| 487 | } |
---|
| 488 | }; |
---|
| 489 | |
---|
| 490 | class KwdManager : public Kwd |
---|
| 491 | { |
---|
| 492 | public: |
---|
| 493 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 494 | Use* use, |
---|
| 495 | const cmt_string& file_name, |
---|
| 496 | int line_number) |
---|
| 497 | { |
---|
| 498 | use->manager_action (words); |
---|
| 499 | } |
---|
| 500 | }; |
---|
| 501 | |
---|
| 502 | class KwdPackage : public Kwd |
---|
| 503 | { |
---|
| 504 | public: |
---|
| 505 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 506 | Use* use, |
---|
| 507 | const cmt_string& file_name, |
---|
| 508 | int line_number) |
---|
| 509 | { |
---|
| 510 | /* |
---|
| 511 | if (words.size () > 1) |
---|
| 512 | { |
---|
| 513 | if (use == &(Use::current())) |
---|
| 514 | { |
---|
| 515 | m_current_package = words[1]; |
---|
| 516 | build_prefix (m_current_package, m_current_prefix); |
---|
| 517 | |
---|
| 518 | if ((use->get_package_name () != "") && |
---|
| 519 | (use->get_package_name () != m_current_package)) |
---|
| 520 | { |
---|
| 521 | if (!m_quiet) |
---|
| 522 | { |
---|
| 523 | // cerr << "#CMT> package name mismatch in requirements of " << |
---|
| 524 | // use->get_package_name () << " " << |
---|
| 525 | // use->version << " line #" << line_number; |
---|
| 526 | // cerr << " : " << m_current_package << " versus " << |
---|
| 527 | // use->get_package_name () << endl; |
---|
| 528 | } |
---|
| 529 | } |
---|
| 530 | |
---|
| 531 | use->set (m_current_package, |
---|
| 532 | m_current_version, |
---|
| 533 | m_current_path, |
---|
| 534 | "", |
---|
| 535 | ""); |
---|
| 536 | |
---|
| 537 | use->change_path (m_current_path); |
---|
| 538 | use->style = m_current_style; |
---|
| 539 | } |
---|
| 540 | } |
---|
| 541 | */ |
---|
| 542 | } |
---|
| 543 | }; |
---|
| 544 | |
---|
| 545 | class KwdPath : public Kwd |
---|
| 546 | { |
---|
| 547 | public: |
---|
| 548 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 549 | Use* use, |
---|
| 550 | const cmt_string& file_name, |
---|
| 551 | int line_number) |
---|
| 552 | { |
---|
| 553 | Symbol::action (words, CommandPath, use); |
---|
| 554 | } |
---|
| 555 | }; |
---|
| 556 | |
---|
| 557 | class KwdPathAppend : public Kwd |
---|
| 558 | { |
---|
| 559 | public: |
---|
| 560 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 561 | Use* use, |
---|
| 562 | const cmt_string& file_name, |
---|
| 563 | int line_number) |
---|
| 564 | { |
---|
| 565 | Symbol::action (words, CommandPathAppend, use); |
---|
| 566 | } |
---|
| 567 | }; |
---|
| 568 | |
---|
| 569 | class KwdPathPrepend : public Kwd |
---|
| 570 | { |
---|
| 571 | public: |
---|
| 572 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 573 | Use* use, |
---|
| 574 | const cmt_string& file_name, |
---|
| 575 | int line_number) |
---|
| 576 | { |
---|
| 577 | Symbol::action (words, CommandPathPrepend, use); |
---|
| 578 | } |
---|
| 579 | }; |
---|
| 580 | |
---|
| 581 | class KwdPathRemove : public Kwd |
---|
| 582 | { |
---|
| 583 | public: |
---|
| 584 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 585 | Use* use, |
---|
| 586 | const cmt_string& file_name, |
---|
| 587 | int line_number) |
---|
| 588 | { |
---|
| 589 | Symbol::action (words, CommandPathRemove, use); |
---|
| 590 | } |
---|
| 591 | }; |
---|
| 592 | |
---|
| 593 | class KwdPathRemoveRegexp : public Kwd |
---|
| 594 | { |
---|
| 595 | public: |
---|
| 596 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 597 | Use* use, |
---|
| 598 | const cmt_string& file_name, |
---|
| 599 | int line_number) |
---|
| 600 | { |
---|
| 601 | Symbol::action (words, CommandPathRemoveRegexp, use); |
---|
| 602 | } |
---|
| 603 | }; |
---|
| 604 | |
---|
| 605 | class KwdPattern : public Kwd |
---|
| 606 | { |
---|
| 607 | public: |
---|
| 608 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 609 | Use* use, |
---|
| 610 | const cmt_string& file_name, |
---|
| 611 | int line_number) |
---|
| 612 | { |
---|
| 613 | Pattern::action (words, use); |
---|
| 614 | } |
---|
| 615 | }; |
---|
| 616 | |
---|
| 617 | class KwdPrivate : public Kwd |
---|
| 618 | { |
---|
| 619 | public: |
---|
| 620 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 621 | Use* use, |
---|
| 622 | const cmt_string& file_name, |
---|
| 623 | int line_number) |
---|
| 624 | { |
---|
| 625 | if (use != &(Use::current ())) |
---|
| 626 | { |
---|
| 627 | use->push_scope_section (ScopePrivate); |
---|
| 628 | } |
---|
| 629 | } |
---|
| 630 | }; |
---|
| 631 | |
---|
| 632 | class KwdProject : public Kwd |
---|
| 633 | { |
---|
| 634 | public: |
---|
| 635 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 636 | Use* use, |
---|
| 637 | const cmt_string& file_name, |
---|
| 638 | int line_number) |
---|
| 639 | { |
---|
| 640 | } |
---|
| 641 | |
---|
| 642 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 643 | Project* project, |
---|
| 644 | const cmt_string& file_name, |
---|
| 645 | int line_number) |
---|
| 646 | { |
---|
| 647 | } |
---|
| 648 | }; |
---|
| 649 | |
---|
| 650 | class KwdPublic : public Kwd |
---|
| 651 | { |
---|
| 652 | public: |
---|
| 653 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 654 | Use* use, |
---|
| 655 | const cmt_string& file_name, |
---|
| 656 | int line_number) |
---|
| 657 | { |
---|
| 658 | if (use != &(Use::current ())) |
---|
| 659 | { |
---|
| 660 | use->push_scope_section (ScopePublic); |
---|
| 661 | } |
---|
| 662 | } |
---|
| 663 | }; |
---|
| 664 | |
---|
| 665 | class KwdSet : public Kwd |
---|
| 666 | { |
---|
| 667 | public: |
---|
| 668 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 669 | Use* use, |
---|
| 670 | const cmt_string& file_name, |
---|
| 671 | int line_number) |
---|
| 672 | { |
---|
| 673 | Symbol::action (words, CommandSet, use); |
---|
| 674 | } |
---|
| 675 | }; |
---|
| 676 | |
---|
| 677 | class KwdSetAppend : public Kwd |
---|
| 678 | { |
---|
| 679 | public: |
---|
| 680 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 681 | Use* use, |
---|
| 682 | const cmt_string& file_name, |
---|
| 683 | int line_number) |
---|
| 684 | { |
---|
| 685 | Symbol::action (words, CommandSetAppend, use); |
---|
| 686 | } |
---|
| 687 | }; |
---|
| 688 | |
---|
| 689 | class KwdSetPrepend : public Kwd |
---|
| 690 | { |
---|
| 691 | public: |
---|
| 692 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 693 | Use* use, |
---|
| 694 | const cmt_string& file_name, |
---|
| 695 | int line_number) |
---|
| 696 | { |
---|
| 697 | Symbol::action (words, CommandSetPrepend, use); |
---|
| 698 | } |
---|
| 699 | }; |
---|
| 700 | |
---|
| 701 | class KwdSetRemove : public Kwd |
---|
| 702 | { |
---|
| 703 | public: |
---|
| 704 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 705 | Use* use, |
---|
| 706 | const cmt_string& file_name, |
---|
| 707 | int line_number) |
---|
| 708 | { |
---|
| 709 | Symbol::action (words, CommandSetRemove, use); |
---|
| 710 | } |
---|
| 711 | }; |
---|
| 712 | |
---|
| 713 | class KwdSetRemoveRegexp : public Kwd |
---|
| 714 | { |
---|
| 715 | public: |
---|
| 716 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 717 | Use* use, |
---|
| 718 | const cmt_string& file_name, |
---|
| 719 | int line_number) |
---|
| 720 | { |
---|
| 721 | Symbol::action (words, CommandSetRemoveRegexp, use); |
---|
| 722 | } |
---|
| 723 | }; |
---|
| 724 | |
---|
| 725 | class KwdSetupScript : public Kwd |
---|
| 726 | { |
---|
| 727 | public: |
---|
| 728 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 729 | Use* use, |
---|
| 730 | const cmt_string& file_name, |
---|
| 731 | int line_number) |
---|
| 732 | { |
---|
| 733 | Script::action (words, SetupScript, use); |
---|
| 734 | Symbol::action (words, CommandSetupScript, use); |
---|
| 735 | } |
---|
| 736 | }; |
---|
| 737 | |
---|
| 738 | class KwdSetupStrategy : public Kwd |
---|
| 739 | { |
---|
| 740 | public: |
---|
| 741 | bool decode (const cmt_string& w, int& mask, int& strategy) |
---|
| 742 | { |
---|
| 743 | bool result = true; |
---|
| 744 | |
---|
| 745 | if (w == "config") |
---|
| 746 | { |
---|
| 747 | mask = SetupConfigMask; |
---|
| 748 | strategy = SetupConfig; |
---|
| 749 | } |
---|
| 750 | else if (w == "no_config") |
---|
| 751 | { |
---|
| 752 | mask = SetupConfigMask; |
---|
| 753 | strategy = SetupNoConfig; |
---|
| 754 | } |
---|
| 755 | else if (w == "root") |
---|
| 756 | { |
---|
| 757 | mask = SetupRootMask; |
---|
| 758 | strategy = SetupRoot; |
---|
| 759 | } |
---|
| 760 | else if (w == "no_root") |
---|
| 761 | { |
---|
| 762 | mask = SetupRootMask; |
---|
| 763 | strategy = SetupNoRoot; |
---|
| 764 | } |
---|
| 765 | else if (w == "cleanup") |
---|
| 766 | { |
---|
| 767 | mask = SetupCleanupMask; |
---|
| 768 | strategy = SetupCleanup; |
---|
| 769 | } |
---|
| 770 | else if (w == "no_cleanup") |
---|
| 771 | { |
---|
| 772 | mask = SetupCleanupMask; |
---|
| 773 | strategy = SetupNoCleanup; |
---|
| 774 | } |
---|
| 775 | else |
---|
| 776 | { |
---|
| 777 | result = false; |
---|
| 778 | } |
---|
| 779 | |
---|
| 780 | return (result); |
---|
| 781 | } |
---|
| 782 | |
---|
| 783 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 784 | Use* use, |
---|
| 785 | const cmt_string& file_name, |
---|
| 786 | int line_number) |
---|
| 787 | { |
---|
| 788 | cmt_string cmtpath; |
---|
| 789 | cmt_string offset; |
---|
| 790 | |
---|
| 791 | use->get_cmtpath_and_offset (cmtpath, offset); |
---|
| 792 | |
---|
| 793 | Project* p = Project::find_by_cmtpath (cmtpath); |
---|
| 794 | |
---|
| 795 | for (int i = 1; i < words.size (); i++) |
---|
| 796 | { |
---|
| 797 | const cmt_string& w = words[i]; |
---|
| 798 | |
---|
| 799 | int mask = 0; |
---|
| 800 | int strategy = 0; |
---|
| 801 | |
---|
| 802 | bool in_error = false; |
---|
| 803 | |
---|
| 804 | if (!decode (w, mask, strategy)) |
---|
| 805 | { |
---|
| 806 | in_error = true; |
---|
| 807 | |
---|
| 808 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); |
---|
| 809 | } |
---|
| 810 | |
---|
| 811 | if (mask != 0) |
---|
| 812 | { |
---|
| 813 | if (p == 0) Cmt::set_current_setup_strategy (strategy); |
---|
| 814 | else p->set_setup_strategy (mask, strategy); |
---|
| 815 | } |
---|
| 816 | |
---|
| 817 | if ((Cmt::get_action () == action_show_strategies) && !Cmt::get_quiet ()) |
---|
| 818 | { |
---|
| 819 | if (!in_error) |
---|
| 820 | { |
---|
| 821 | cerr << "# Package " << use->get_package_name () |
---|
| 822 | << " adds " << w << " to setup strategy" << endl; |
---|
| 823 | } |
---|
| 824 | else |
---|
| 825 | { |
---|
| 826 | cerr << "# Error: Package " << use->get_package_name () |
---|
| 827 | << " uses unknown " << w << " keyword to setup strategy" << endl; |
---|
| 828 | } |
---|
| 829 | } |
---|
| 830 | } |
---|
| 831 | } |
---|
| 832 | |
---|
| 833 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 834 | Project* project, |
---|
| 835 | const cmt_string& file_name, |
---|
| 836 | int line_number) |
---|
| 837 | { |
---|
| 838 | for (int i = 1; i < words.size (); i++) |
---|
| 839 | { |
---|
| 840 | const cmt_string& w = words[i]; |
---|
| 841 | |
---|
| 842 | int mask = 0; |
---|
| 843 | int strategy = 0; |
---|
| 844 | |
---|
| 845 | bool in_error = false; |
---|
| 846 | |
---|
| 847 | if (!decode (w, mask, strategy)) |
---|
| 848 | { |
---|
| 849 | in_error = true; |
---|
| 850 | |
---|
| 851 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword"); |
---|
| 852 | } |
---|
| 853 | |
---|
| 854 | if (mask != 0) |
---|
| 855 | { |
---|
| 856 | if (project == 0) Cmt::set_current_setup_strategy (strategy); |
---|
| 857 | else project->set_setup_strategy (mask, strategy); |
---|
| 858 | } |
---|
| 859 | |
---|
| 860 | if ((Cmt::get_action () == action_show_strategies) && !Cmt::get_quiet ()) |
---|
| 861 | { |
---|
| 862 | if (!in_error) |
---|
| 863 | { |
---|
| 864 | cerr << "# Project " << project->get_name () |
---|
| 865 | << " adds " << w << " to setup strategy" << endl; |
---|
| 866 | } |
---|
| 867 | else |
---|
| 868 | { |
---|
| 869 | cerr << "# Error: Project " << project->get_name () |
---|
| 870 | << " uses unknown " << w << " keyword to setup strategy" << endl; |
---|
| 871 | } |
---|
| 872 | } |
---|
| 873 | } |
---|
| 874 | } |
---|
| 875 | }; |
---|
| 876 | |
---|
| 877 | class KwdTag : public Kwd |
---|
| 878 | { |
---|
| 879 | public: |
---|
| 880 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 881 | Use* use, |
---|
| 882 | const cmt_string& file_name, |
---|
| 883 | int line_number) |
---|
| 884 | { |
---|
| 885 | Tag::action (words, use); |
---|
| 886 | } |
---|
| 887 | }; |
---|
| 888 | |
---|
| 889 | class KwdTagExclude : public Kwd |
---|
| 890 | { |
---|
| 891 | public: |
---|
| 892 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 893 | Use* use, |
---|
| 894 | const cmt_string& file_name, |
---|
| 895 | int line_number) |
---|
| 896 | { |
---|
| 897 | Tag::action_exclude (words, use); |
---|
| 898 | } |
---|
| 899 | }; |
---|
| 900 | |
---|
| 901 | class KwdUse : public Kwd |
---|
| 902 | { |
---|
| 903 | public: |
---|
| 904 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 905 | Use* use, |
---|
| 906 | const cmt_string& file_name, |
---|
| 907 | int line_number) |
---|
| 908 | { |
---|
| 909 | Use::action (words, use); |
---|
| 910 | } |
---|
| 911 | }; |
---|
| 912 | |
---|
| 913 | class KwdVersionStrategy : public Kwd |
---|
| 914 | { |
---|
| 915 | public: |
---|
| 916 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 917 | Use* use, |
---|
| 918 | const cmt_string& file_name, |
---|
| 919 | int line_number) |
---|
| 920 | { |
---|
| 921 | cerr << "# Package " << use->get_package_name () << |
---|
| 922 | " sets obsolescent version strategy" << endl; |
---|
| 923 | } |
---|
| 924 | }; |
---|
| 925 | |
---|
| 926 | class KwdVersion : public Kwd |
---|
| 927 | { |
---|
| 928 | public: |
---|
| 929 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 930 | Use* use, |
---|
| 931 | const cmt_string& file_name, |
---|
| 932 | int line_number) |
---|
| 933 | { |
---|
| 934 | } |
---|
| 935 | }; |
---|
| 936 | |
---|
| 937 | class KwdDefault : public Kwd |
---|
| 938 | { |
---|
| 939 | public: |
---|
| 940 | void action (const CmtSystem::cmt_string_vector& words, |
---|
| 941 | Use* use, |
---|
| 942 | const cmt_string& file_name, |
---|
| 943 | int line_number) |
---|
| 944 | { |
---|
| 945 | /* |
---|
| 946 | Unknown keyword : just ignore the line |
---|
| 947 | */ |
---|
| 948 | if (!Cmt::get_quiet ()) |
---|
| 949 | { |
---|
| 950 | cerr << "#CMT> bad syntax in requirements of " << use->get_package_name () |
---|
| 951 | << " " << use->version << " line #" << line_number; |
---|
| 952 | cerr << " [" << words[0] << "...]" << endl; |
---|
| 953 | } |
---|
| 954 | |
---|
| 955 | CmtError::set (CmtError::syntax_error, "ParseRequirements> "); |
---|
| 956 | } |
---|
| 957 | }; |
---|
| 958 | |
---|
| 959 | SyntaxParser& SyntaxParser::instance () |
---|
| 960 | { |
---|
| 961 | static SyntaxParser p; |
---|
| 962 | |
---|
| 963 | return (p); |
---|
| 964 | } |
---|
| 965 | |
---|
| 966 | /** |
---|
| 967 | * Parse the input file, rejecting comments and |
---|
| 968 | * rebuilding complete lines (from sections separated by |
---|
| 969 | * \ characters. |
---|
| 970 | * |
---|
| 971 | * Each reformatted line is parsed by filter_line |
---|
| 972 | */ |
---|
| 973 | void SyntaxParser::parse_requirements (const cmt_string& file_name, Use* use) |
---|
| 974 | { |
---|
| 975 | SyntaxParser& me = instance (); |
---|
| 976 | |
---|
| 977 | if (use != 0) |
---|
| 978 | { |
---|
| 979 | cmt_string buffer; |
---|
| 980 | |
---|
| 981 | use->fill_standard_macros (buffer); |
---|
| 982 | |
---|
| 983 | AccessMode saved_current_access = Cmt::get_current_access (); |
---|
| 984 | Cmt::set_current_access (UserMode); |
---|
| 985 | me.do_parse_text (buffer, "", package_context, use, 0); |
---|
| 986 | Cmt::set_current_access (saved_current_access); |
---|
| 987 | } |
---|
| 988 | |
---|
| 989 | me.do_parse_requirements (file_name, use); |
---|
| 990 | |
---|
| 991 | if (use != 0) |
---|
| 992 | { |
---|
| 993 | use->close_scope_sections (); |
---|
| 994 | } |
---|
| 995 | } |
---|
| 996 | |
---|
| 997 | /** |
---|
| 998 | */ |
---|
| 999 | void SyntaxParser::parse_project_file_text (const cmt_string& text, |
---|
| 1000 | const cmt_string& file_name, |
---|
| 1001 | Project* project) |
---|
| 1002 | { |
---|
| 1003 | SyntaxParser& me = instance (); |
---|
| 1004 | me.do_parse_text (text, file_name, project_context, 0, project); |
---|
| 1005 | } |
---|
| 1006 | |
---|
| 1007 | /** |
---|
| 1008 | * Parse a text, rejecting comments and |
---|
| 1009 | * rebuilding complete lines (from sections separated by |
---|
| 1010 | * \ characters. |
---|
| 1011 | * |
---|
| 1012 | * Each reformatted line is parsed by filter_line |
---|
| 1013 | */ |
---|
| 1014 | void SyntaxParser::parse_requirements_text (const cmt_string& text, |
---|
| 1015 | const cmt_string& file_name, |
---|
| 1016 | Use* use) |
---|
| 1017 | { |
---|
| 1018 | SyntaxParser& me = instance (); |
---|
| 1019 | |
---|
| 1020 | /** |
---|
| 1021 | * |
---|
| 1022 | * We have to preserve m_current_access since it reflects whether |
---|
| 1023 | * the current cmt action is run in the context of the current package. |
---|
| 1024 | * (the opposite is when the cmt command specifies the current package |
---|
| 1025 | * in its arguments -use=... therefore the pwd is NOT the directory |
---|
| 1026 | * of the current package) |
---|
| 1027 | * |
---|
| 1028 | * m_current_access is Developer when pwd = current |
---|
| 1029 | * User when pwd != current |
---|
| 1030 | * |
---|
| 1031 | * Therefore, as soon as we reach a used package, this must be switched to User |
---|
| 1032 | * |
---|
| 1033 | * On the other hand, Cmt::scope reflects the status of the public/private |
---|
| 1034 | * statements. By default, we are in public context when entering a new requirements |
---|
| 1035 | * file. |
---|
| 1036 | * |
---|
| 1037 | */ |
---|
| 1038 | |
---|
| 1039 | AccessMode saved_current_access; |
---|
| 1040 | |
---|
| 1041 | saved_current_access = Cmt::get_current_access (); |
---|
| 1042 | |
---|
| 1043 | if (use == 0) use = &(Use::current ()); |
---|
| 1044 | |
---|
| 1045 | if (use != &(Use::current ())) |
---|
| 1046 | { |
---|
| 1047 | Cmt::set_current_access (UserMode); |
---|
| 1048 | } |
---|
| 1049 | else |
---|
| 1050 | { |
---|
| 1051 | Cmt::set_current_access (DeveloperMode); |
---|
| 1052 | } |
---|
| 1053 | |
---|
| 1054 | me.do_parse_text (text, file_name, package_context, use, 0); |
---|
| 1055 | |
---|
| 1056 | Cmt::set_current_access (saved_current_access); |
---|
| 1057 | } |
---|
| 1058 | |
---|
| 1059 | /** |
---|
| 1060 | * Apply the basic parser to one single line : |
---|
| 1061 | * |
---|
| 1062 | * o Append to global text if previous back_slash |
---|
| 1063 | * o Split into words |
---|
| 1064 | * o Apply the generic Select operator |
---|
| 1065 | */ |
---|
| 1066 | void SyntaxParser::parse_requirements_line (const cmt_string& line, |
---|
| 1067 | Use* use, |
---|
| 1068 | const cmt_string& file_name, |
---|
| 1069 | int line_number) |
---|
| 1070 | { |
---|
| 1071 | SyntaxParser& me = instance (); |
---|
| 1072 | me.do_parse_line (line, file_name, line_number, package_context, use, 0); |
---|
| 1073 | } |
---|
| 1074 | |
---|
| 1075 | SyntaxParser::SyntaxParser () |
---|
| 1076 | { |
---|
| 1077 | m_keywords.add ("action", new KwdAction ()); |
---|
| 1078 | m_keywords.add ("alias", new KwdAlias ()); |
---|
| 1079 | m_keywords.add ("application", new KwdApplication ()); |
---|
| 1080 | m_keywords.add ("apply_pattern", new KwdApplyPattern ()); |
---|
| 1081 | m_keywords.add ("apply_tag", new KwdApplyTag ()); |
---|
| 1082 | m_keywords.add ("author", new KwdAuthor ()); |
---|
| 1083 | m_keywords.add ("branches", new KwdBranches ()); |
---|
| 1084 | m_keywords.add ("build_strategy", new KwdBuildStrategy ()); |
---|
| 1085 | m_keywords.add ("cleanup_script", new KwdCleanupScript ()); |
---|
| 1086 | m_keywords.add ("cmtpath_pattern", new KwdCmtPathPattern ()); |
---|
| 1087 | m_keywords.add ("document", new KwdDocument ()); |
---|
| 1088 | m_keywords.add ("end_private", new KwdEndPrivate ()); |
---|
| 1089 | m_keywords.add ("end_public", new KwdEndPublic ()); |
---|
| 1090 | m_keywords.add ("ignore_pattern", new KwdIgnorePattern ()); |
---|
| 1091 | m_keywords.add ("include_dirs", new KwdIncludeDirs ()); |
---|
| 1092 | m_keywords.add ("include_path", new KwdIncludePath ()); |
---|
| 1093 | m_keywords.add ("language", new KwdLanguage ()); |
---|
| 1094 | m_keywords.add ("library", new KwdLibrary ()); |
---|
| 1095 | m_keywords.add ("macro", new KwdMacro ()); |
---|
| 1096 | m_keywords.add ("macro+", new KwdMacroAppend ()); |
---|
| 1097 | m_keywords.add ("macro_prepend", new KwdMacroPrepend ()); |
---|
| 1098 | m_keywords.add ("macro_append", new KwdMacroAppend ()); |
---|
| 1099 | m_keywords.add ("macro_remove", new KwdMacroRemove ()); |
---|
| 1100 | m_keywords.add ("macro_remove_regexp", new KwdMacroRemoveRegexp ()); |
---|
| 1101 | m_keywords.add ("macro_remove_all", new KwdMacroRemoveAll ()); |
---|
| 1102 | m_keywords.add ("macro_remove_all_regexp", new KwdMacroRemoveAllRegexp ()); |
---|
| 1103 | m_keywords.add ("make_fragment", new KwdMakeFragment ()); |
---|
| 1104 | m_keywords.add ("manager", new KwdManager ()); |
---|
| 1105 | m_keywords.add ("package", new KwdPackage ()); |
---|
| 1106 | m_keywords.add ("path", new KwdPath ()); |
---|
| 1107 | m_keywords.add ("path_append", new KwdPathAppend ()); |
---|
| 1108 | m_keywords.add ("path_prepend", new KwdPathPrepend ()); |
---|
| 1109 | m_keywords.add ("path_remove", new KwdPathRemove ()); |
---|
| 1110 | m_keywords.add ("path_remove_regexp", new KwdPathRemoveRegexp ()); |
---|
| 1111 | m_keywords.add ("pattern", new KwdPattern ()); |
---|
| 1112 | m_keywords.add ("public", new KwdPublic ()); |
---|
| 1113 | m_keywords.add ("private", new KwdPrivate ()); |
---|
| 1114 | m_keywords.add ("project", new KwdProject ()); |
---|
| 1115 | m_keywords.add ("set", new KwdSet ()); |
---|
| 1116 | m_keywords.add ("set_append", new KwdSetAppend ()); |
---|
| 1117 | m_keywords.add ("set_prepend", new KwdSetPrepend ()); |
---|
| 1118 | m_keywords.add ("set_remove", new KwdSetRemove ()); |
---|
| 1119 | m_keywords.add ("set_remove_regexp", new KwdSetRemoveRegexp ()); |
---|
| 1120 | m_keywords.add ("setup_script", new KwdSetupScript ()); |
---|
| 1121 | m_keywords.add ("setup_strategy", new KwdSetupStrategy ()); |
---|
| 1122 | m_keywords.add ("tag", new KwdTag ()); |
---|
| 1123 | m_keywords.add ("tag_exclude", new KwdTagExclude ()); |
---|
| 1124 | m_keywords.add ("use", new KwdUse ()); |
---|
| 1125 | m_keywords.add ("version_strategy", new KwdVersionStrategy ()); |
---|
| 1126 | m_keywords.add ("version", new KwdVersion ()); |
---|
| 1127 | |
---|
| 1128 | m_project_keywords.add ("build_strategy", new KwdBuildStrategy ()); |
---|
| 1129 | m_project_keywords.add ("project", new KwdProject ()); |
---|
| 1130 | m_project_keywords.add ("setup_strategy", new KwdSetupStrategy ()); |
---|
| 1131 | } |
---|
| 1132 | |
---|
| 1133 | void SyntaxParser::do_parse_requirements (const cmt_string& file_name, Use* use) |
---|
| 1134 | { |
---|
| 1135 | cmt_string actual_file_name = file_name; |
---|
| 1136 | cmt_string text; |
---|
| 1137 | |
---|
| 1138 | CmtError::clear (); |
---|
| 1139 | |
---|
| 1140 | if (!CmtSystem::test_file (actual_file_name)) |
---|
| 1141 | { |
---|
| 1142 | actual_file_name = ".."; |
---|
| 1143 | actual_file_name += CmtSystem::file_separator (); |
---|
| 1144 | actual_file_name += "cmt"; |
---|
| 1145 | actual_file_name += CmtSystem::file_separator (); |
---|
| 1146 | actual_file_name += file_name; |
---|
| 1147 | |
---|
| 1148 | if (!CmtSystem::test_file (actual_file_name)) |
---|
| 1149 | { |
---|
| 1150 | actual_file_name = ".."; |
---|
| 1151 | actual_file_name += CmtSystem::file_separator (); |
---|
| 1152 | actual_file_name += "mgr"; |
---|
| 1153 | actual_file_name += CmtSystem::file_separator (); |
---|
| 1154 | actual_file_name += file_name; |
---|
| 1155 | |
---|
| 1156 | if (!CmtSystem::test_file (actual_file_name)) |
---|
| 1157 | { |
---|
| 1158 | return; |
---|
| 1159 | } |
---|
| 1160 | } |
---|
| 1161 | } |
---|
| 1162 | |
---|
| 1163 | text.read (actual_file_name); |
---|
| 1164 | |
---|
| 1165 | SyntaxParser::parse_requirements_text (text, actual_file_name, use); |
---|
| 1166 | } |
---|
| 1167 | |
---|
| 1168 | /** |
---|
| 1169 | * Parse a text, rejecting comments and |
---|
| 1170 | * rebuilding complete lines (from sections separated by |
---|
| 1171 | * \ characters. |
---|
| 1172 | * |
---|
| 1173 | * Each reformatted line is parsed by filter_line |
---|
| 1174 | */ |
---|
| 1175 | void SyntaxParser::do_parse_text (const cmt_string& text, |
---|
| 1176 | const cmt_string& file_name, |
---|
| 1177 | ContextType context, |
---|
| 1178 | Use* use, |
---|
| 1179 | Project* project) |
---|
| 1180 | { |
---|
| 1181 | cmt_string line; |
---|
| 1182 | int pos; |
---|
| 1183 | int max_pos; |
---|
| 1184 | int line_number = 1; |
---|
| 1185 | |
---|
| 1186 | if (context == package_context) |
---|
| 1187 | { |
---|
| 1188 | if (use == 0) use = &(Use::current ()); |
---|
| 1189 | } |
---|
| 1190 | |
---|
| 1191 | m_filtered_text.erase (0); |
---|
| 1192 | |
---|
| 1193 | pos = 0; |
---|
| 1194 | max_pos = text.size (); |
---|
| 1195 | |
---|
| 1196 | for (pos = 0; pos < max_pos;) |
---|
| 1197 | { |
---|
| 1198 | int cr = text.find (pos, "\r\n"); |
---|
| 1199 | int nl = text.find (pos, '\n'); |
---|
| 1200 | int first = nl; |
---|
| 1201 | int length = 1; |
---|
| 1202 | |
---|
| 1203 | if (cr != cmt_string::npos) |
---|
| 1204 | { |
---|
| 1205 | if (nl == cmt_string::npos) |
---|
| 1206 | { |
---|
| 1207 | first = cr; |
---|
| 1208 | length = 2; |
---|
| 1209 | } |
---|
| 1210 | else |
---|
| 1211 | { |
---|
| 1212 | first = (nl < cr) ? nl : cr; |
---|
| 1213 | length = (nl < cr) ? 1 : 2; |
---|
| 1214 | } |
---|
| 1215 | } |
---|
| 1216 | |
---|
| 1217 | if (first == cmt_string::npos) |
---|
| 1218 | { |
---|
| 1219 | text.substr (pos, line); |
---|
| 1220 | pos = max_pos; |
---|
| 1221 | } |
---|
| 1222 | else if (first > pos) |
---|
| 1223 | { |
---|
| 1224 | text.substr (pos, first - pos, line); |
---|
| 1225 | pos = first + length; |
---|
| 1226 | } |
---|
| 1227 | else |
---|
| 1228 | { |
---|
| 1229 | line.erase (0); |
---|
| 1230 | pos += length; |
---|
| 1231 | } |
---|
| 1232 | |
---|
| 1233 | do_parse_line (line, file_name, line_number, context, use, project); |
---|
| 1234 | |
---|
| 1235 | if ((Cmt::get_action () == action_check_configuration) && CmtError::has_pending_error ()) |
---|
| 1236 | { |
---|
| 1237 | //break; |
---|
| 1238 | } |
---|
| 1239 | |
---|
| 1240 | line_number++; |
---|
| 1241 | } |
---|
| 1242 | } |
---|
| 1243 | |
---|
| 1244 | void SyntaxParser::do_parse_line (const cmt_string& line, |
---|
| 1245 | const cmt_string& file_name, |
---|
| 1246 | int line_number, |
---|
| 1247 | ContextType context, |
---|
| 1248 | Use* use, |
---|
| 1249 | Project* project) |
---|
| 1250 | { |
---|
| 1251 | int length; |
---|
| 1252 | int nl; |
---|
| 1253 | int back_slash; |
---|
| 1254 | cmt_string temp_line = line; |
---|
| 1255 | |
---|
| 1256 | if (temp_line.size () == 0) return; |
---|
| 1257 | if (temp_line[0] == '#') return; |
---|
| 1258 | |
---|
| 1259 | nl = temp_line.find_last_of ('\n'); |
---|
| 1260 | if (nl != cmt_string::npos) temp_line.erase (nl); |
---|
| 1261 | |
---|
| 1262 | length = temp_line.size (); |
---|
| 1263 | if (length == 0) return; |
---|
| 1264 | |
---|
| 1265 | // |
---|
| 1266 | // We scan the line for handling backslashes. |
---|
| 1267 | // |
---|
| 1268 | // o Really terminating backslashes (ie those only followed by spaces/tabs |
---|
| 1269 | // mean continued line |
---|
| 1270 | // |
---|
| 1271 | // |
---|
| 1272 | |
---|
| 1273 | bool finished = true; |
---|
| 1274 | |
---|
| 1275 | length = temp_line.size (); |
---|
| 1276 | |
---|
| 1277 | back_slash = temp_line.find_last_of ('\\'); |
---|
| 1278 | |
---|
| 1279 | if (back_slash != cmt_string::npos) |
---|
| 1280 | { |
---|
| 1281 | // |
---|
| 1282 | // This is the last backslash |
---|
| 1283 | // check if there are only space chars after it |
---|
| 1284 | // |
---|
| 1285 | |
---|
| 1286 | bool at_end = true; |
---|
| 1287 | |
---|
| 1288 | for (int i = (back_slash + 1); i < length; i++) |
---|
| 1289 | { |
---|
| 1290 | char c = temp_line[i]; |
---|
| 1291 | if ((c != ' ') && (c != '\t')) |
---|
| 1292 | { |
---|
| 1293 | at_end = false; |
---|
| 1294 | break; |
---|
| 1295 | } |
---|
| 1296 | } |
---|
| 1297 | |
---|
| 1298 | if (at_end) |
---|
| 1299 | { |
---|
| 1300 | temp_line.erase (back_slash); |
---|
| 1301 | finished = false; |
---|
| 1302 | } |
---|
| 1303 | else |
---|
| 1304 | { |
---|
| 1305 | // This was not a trailing backslash. |
---|
| 1306 | finished = true; |
---|
| 1307 | } |
---|
| 1308 | } |
---|
| 1309 | |
---|
| 1310 | m_filtered_text += temp_line; |
---|
| 1311 | |
---|
| 1312 | if (!finished) |
---|
| 1313 | { |
---|
| 1314 | // We still need to accumulate forthcoming lines |
---|
| 1315 | // before parsing the resulting text. |
---|
| 1316 | return; |
---|
| 1317 | } |
---|
| 1318 | |
---|
| 1319 | /* |
---|
| 1320 | Here a full line (possibly accumulating several lines |
---|
| 1321 | ended by backslashes) is parsed : |
---|
| 1322 | |
---|
| 1323 | o Special characters are filtered now : |
---|
| 1324 | |
---|
| 1325 | <cmt:tab/> \t |
---|
| 1326 | <cmt:cr/> \r |
---|
| 1327 | <cmt:lf/> \n |
---|
| 1328 | |
---|
| 1329 | o Split into words (a word is a string not containing |
---|
| 1330 | spaces or enclosed in quotes) |
---|
| 1331 | |
---|
| 1332 | o Parse the word array (function Select) |
---|
| 1333 | |
---|
| 1334 | */ |
---|
| 1335 | |
---|
| 1336 | m_filtered_text.replace_all ("<cmt:tab/>", "\t"); |
---|
| 1337 | m_filtered_text.replace_all ("<cmt:cr/>", "\r"); |
---|
| 1338 | m_filtered_text.replace_all ("<cmt:lf/>", "\n"); |
---|
| 1339 | |
---|
| 1340 | if (Cmt::get_debug ()) |
---|
| 1341 | { |
---|
| 1342 | cout << "parse_requirements_line [" << m_filtered_text << "]" << endl; |
---|
| 1343 | } |
---|
| 1344 | |
---|
| 1345 | static CmtSystem::cmt_string_vector words; |
---|
| 1346 | |
---|
| 1347 | CmtSystem::split (m_filtered_text, " \t", words); |
---|
| 1348 | |
---|
| 1349 | if (words.size () != 0) |
---|
| 1350 | { |
---|
| 1351 | switch (context) |
---|
| 1352 | { |
---|
| 1353 | case project_context: |
---|
| 1354 | do_parse_words (words, file_name, line_number, project); |
---|
| 1355 | break; |
---|
| 1356 | case package_context: |
---|
| 1357 | do_parse_words (words, file_name, line_number, use); |
---|
| 1358 | break; |
---|
| 1359 | } |
---|
| 1360 | } |
---|
| 1361 | |
---|
| 1362 | m_filtered_text.erase (0); |
---|
| 1363 | } |
---|
| 1364 | |
---|
| 1365 | void SyntaxParser::do_parse_words (const CmtSystem::cmt_string_vector& words, |
---|
| 1366 | const cmt_string& file_name, |
---|
| 1367 | int line_number, |
---|
| 1368 | Use* use) |
---|
| 1369 | { |
---|
| 1370 | CmtError::clear (); |
---|
| 1371 | |
---|
| 1372 | if (words.size () == 0) return; |
---|
| 1373 | |
---|
| 1374 | const cmt_string& command = words[0]; |
---|
| 1375 | |
---|
| 1376 | if (command.size () == 0) return; |
---|
| 1377 | |
---|
| 1378 | // |
---|
| 1379 | // First analyze the syntax |
---|
| 1380 | // |
---|
| 1381 | |
---|
| 1382 | Kwd* keyword = m_keywords.find (command); |
---|
| 1383 | if (keyword == 0) |
---|
| 1384 | { |
---|
| 1385 | /* |
---|
| 1386 | |
---|
| 1387 | When the first word of the line is not a keyword, it may be an |
---|
| 1388 | implicit pattern application. |
---|
| 1389 | |
---|
| 1390 | */ |
---|
| 1391 | |
---|
| 1392 | Pattern* p = Pattern::find (command); |
---|
| 1393 | if (p == 0) |
---|
| 1394 | { |
---|
| 1395 | CmtError::set (CmtError::syntax_error, "ParseRequirements> "); |
---|
| 1396 | } |
---|
| 1397 | else |
---|
| 1398 | { |
---|
| 1399 | keyword = m_keywords.find ("apply_pattern"); |
---|
| 1400 | } |
---|
| 1401 | } |
---|
| 1402 | |
---|
| 1403 | if (CmtError::has_pending_error ()) |
---|
| 1404 | { |
---|
| 1405 | if (!Cmt::get_quiet ()) |
---|
| 1406 | { |
---|
| 1407 | cerr << "#CMT> bad syntax in requirements of " << use->get_package_name () |
---|
| 1408 | << " " << use->version |
---|
| 1409 | << " " << use->specified_path |
---|
| 1410 | << " line #" << line_number; |
---|
| 1411 | cerr << " [" << command << " ...]" << endl; |
---|
| 1412 | } |
---|
| 1413 | |
---|
| 1414 | return; |
---|
| 1415 | } |
---|
| 1416 | |
---|
| 1417 | // |
---|
| 1418 | // Then interpret the action |
---|
| 1419 | // |
---|
| 1420 | |
---|
| 1421 | keyword->action (words, use, file_name, line_number); |
---|
| 1422 | } |
---|
| 1423 | |
---|
| 1424 | void SyntaxParser::do_parse_words (const CmtSystem::cmt_string_vector& words, |
---|
| 1425 | const cmt_string& file_name, |
---|
| 1426 | int line_number, |
---|
| 1427 | Project* project) |
---|
| 1428 | { |
---|
| 1429 | CmtError::clear (); |
---|
| 1430 | |
---|
| 1431 | if (words.size () == 0) return; |
---|
| 1432 | |
---|
| 1433 | const cmt_string& command = words[0]; |
---|
| 1434 | |
---|
| 1435 | if (command.size () == 0) return; |
---|
| 1436 | |
---|
| 1437 | // |
---|
| 1438 | // First analyze the syntax |
---|
| 1439 | // |
---|
| 1440 | |
---|
| 1441 | Kwd* keyword = m_project_keywords.find (command); |
---|
| 1442 | if (keyword == 0) |
---|
| 1443 | { |
---|
| 1444 | CmtError::set (CmtError::syntax_error, "ParseRequirements> "); |
---|
| 1445 | } |
---|
| 1446 | |
---|
| 1447 | if (CmtError::has_pending_error ()) |
---|
| 1448 | { |
---|
| 1449 | if (!Cmt::get_quiet ()) |
---|
| 1450 | { |
---|
| 1451 | cerr << "#CMT> bad syntax in project file of " << project->get_name () |
---|
| 1452 | << " line #" << line_number; |
---|
| 1453 | cerr << " [" << command << " ...]" << endl; |
---|
| 1454 | } |
---|
| 1455 | |
---|
| 1456 | return; |
---|
| 1457 | } |
---|
| 1458 | |
---|
| 1459 | // |
---|
| 1460 | // Then interpret the action |
---|
| 1461 | // |
---|
| 1462 | |
---|
| 1463 | keyword->action (words, project, file_name, line_number); |
---|
| 1464 | } |
---|
| 1465 | |
---|
| 1466 | |
---|
| 1467 | |
---|
| 1468 | |
---|
| 1469 | /* |
---|
| 1470 | |
---|
| 1471 | class Cmd |
---|
| 1472 | { |
---|
| 1473 | public: |
---|
| 1474 | virtual void action (int argc, char* argv[], CmtSystem::cmt_string_vector& arguments) = 0; |
---|
| 1475 | } |
---|
| 1476 | |
---|
| 1477 | class CmdAwk : public Cmd |
---|
| 1478 | { |
---|
| 1479 | public: |
---|
| 1480 | void action (int argc, char* argv[], CmtSystem::cmt_string_vector& arguments) |
---|
| 1481 | { |
---|
| 1482 | argc--; |
---|
| 1483 | argv++; |
---|
| 1484 | while (argc > 1) |
---|
| 1485 | { |
---|
| 1486 | cmt_string& s = arguments.add (); |
---|
| 1487 | s = argv[1]; |
---|
| 1488 | argc--; |
---|
| 1489 | argv++; |
---|
| 1490 | } |
---|
| 1491 | |
---|
| 1492 | m_action = action_awk; |
---|
| 1493 | } |
---|
| 1494 | } |
---|
| 1495 | |
---|
| 1496 | class CmdBroadcast : public Cmd |
---|
| 1497 | { |
---|
| 1498 | public: |
---|
| 1499 | void action (int argc, char* argv[], CmtSystem::cmt_string_vector& arguments) |
---|
| 1500 | { |
---|
| 1501 | argc--; |
---|
| 1502 | argv++; |
---|
| 1503 | while (argc > 1) |
---|
| 1504 | { |
---|
| 1505 | cmt_string& s = arguments.add (); |
---|
| 1506 | s = argv[1]; |
---|
| 1507 | argc--; |
---|
| 1508 | argv++; |
---|
| 1509 | } |
---|
| 1510 | |
---|
| 1511 | m_action = action_broadcast; |
---|
| 1512 | } |
---|
| 1513 | } |
---|
| 1514 | |
---|
| 1515 | */ |
---|
| 1516 | |
---|
| 1517 | CommandParser::HelpMap& CommandParser::get_help () |
---|
| 1518 | { |
---|
| 1519 | static CommandParser& me = instance (); |
---|
| 1520 | |
---|
| 1521 | return (me.m_help); |
---|
| 1522 | } |
---|
| 1523 | |
---|
| 1524 | CommandParser::HelpTexts& CommandParser::get_help_texts () |
---|
| 1525 | { |
---|
| 1526 | static CommandParser& me = instance (); |
---|
| 1527 | |
---|
| 1528 | return (me.m_help_texts); |
---|
| 1529 | } |
---|
| 1530 | |
---|
| 1531 | const cmt_string& CommandParser::get_help_text (ActionType key) |
---|
| 1532 | { |
---|
| 1533 | static const HelpTexts& help = get_help_texts (); |
---|
| 1534 | |
---|
| 1535 | const cmt_string& h = help[key]; |
---|
| 1536 | return (h); |
---|
| 1537 | } |
---|
| 1538 | |
---|
| 1539 | void CommandParser::show_all () |
---|
| 1540 | { |
---|
| 1541 | static HelpTexts& help_texts = get_help_texts (); |
---|
| 1542 | |
---|
| 1543 | cerr << "#> cmt command [option...]" << endl; |
---|
| 1544 | cerr << "# command :" << endl; |
---|
| 1545 | |
---|
| 1546 | int i; |
---|
| 1547 | |
---|
| 1548 | for (i = 0; ; i++) |
---|
| 1549 | { |
---|
| 1550 | const cmt_string& s = help_texts[i]; |
---|
| 1551 | if (s == "") break; |
---|
| 1552 | cerr << "# " << s << endl; |
---|
| 1553 | } |
---|
| 1554 | |
---|
| 1555 | cerr << "# global options :" << endl; |
---|
| 1556 | |
---|
| 1557 | cerr << "# -quiet : don't print errors" << endl; |
---|
| 1558 | cerr << "# -use=<p>:<v>:<path> : set package version path" << endl; |
---|
| 1559 | cerr << "# -pack=<package> : set package" << endl; |
---|
| 1560 | cerr << "# -version=<version> : set version" << endl; |
---|
| 1561 | cerr << "# -path=<path> : set root path" << endl; |
---|
| 1562 | cerr << "# -f=<requirement-file> : set input file" << endl; |
---|
| 1563 | cerr << "# -e=<statement> : add a one line statement" << endl; |
---|
| 1564 | cerr << "# -tag=<tag-list> : select a new tag-set" << endl; |
---|
| 1565 | cerr << "# -tag_add=<tag-list> : add specific comma-separated tag(s)" << endl; |
---|
| 1566 | cerr << "# -tag_remove=<tag-list> : remove specific comma-separated tag(s)" << endl; |
---|
| 1567 | cerr << "# -with_version_directory : reset to default structuring style" << endl; |
---|
| 1568 | cerr << "# -without_version_directory : switch structuring style" << endl; |
---|
| 1569 | cerr << "# -cleanup : activate install area cleanup" << endl; |
---|
| 1570 | cerr << "# -no_cleanup : inhibit install area cleanup" << endl; |
---|
| 1571 | } |
---|
| 1572 | |
---|
| 1573 | void CommandParser::show (ActionType action) |
---|
| 1574 | { |
---|
| 1575 | static HelpTexts& help_texts = get_help_texts (); |
---|
| 1576 | |
---|
| 1577 | if (action == action_build) |
---|
| 1578 | { |
---|
| 1579 | int i; |
---|
| 1580 | |
---|
| 1581 | for (i = action_build_constituent_makefile; i <= action_build_windefs; i++) |
---|
| 1582 | { |
---|
| 1583 | const cmt_string& s = help_texts[i]; |
---|
| 1584 | cerr << "# " << s << endl; |
---|
| 1585 | } |
---|
| 1586 | } |
---|
| 1587 | if (action == action_check) |
---|
| 1588 | { |
---|
| 1589 | int i; |
---|
| 1590 | |
---|
| 1591 | for (i = action_check_configuration; i <= action_check_version; i++) |
---|
| 1592 | { |
---|
| 1593 | const cmt_string& s = help_texts[i]; |
---|
| 1594 | cerr << "# " << s << endl; |
---|
| 1595 | } |
---|
| 1596 | } |
---|
| 1597 | else if (action == action_show) |
---|
| 1598 | { |
---|
| 1599 | int i; |
---|
| 1600 | |
---|
| 1601 | for (i = (action_show + 1); i <= action_show_versions; i++) |
---|
| 1602 | { |
---|
| 1603 | const cmt_string& s = help_texts[i]; |
---|
| 1604 | cerr << "# " << s << endl; |
---|
| 1605 | } |
---|
| 1606 | } |
---|
| 1607 | else |
---|
| 1608 | { |
---|
| 1609 | const cmt_string& s = get_help_text (action); |
---|
| 1610 | cerr << "#" << s << endl; |
---|
| 1611 | } |
---|
| 1612 | } |
---|
| 1613 | |
---|
| 1614 | CommandParser& CommandParser::instance () |
---|
| 1615 | { |
---|
| 1616 | static CommandParser me; |
---|
| 1617 | return (me); |
---|
| 1618 | } |
---|
| 1619 | |
---|
| 1620 | CommandParser::CommandParser () |
---|
| 1621 | { |
---|
| 1622 | static HelpMap& help = m_help; |
---|
| 1623 | |
---|
| 1624 | static HelpTexts& help_texts = m_help_texts; |
---|
| 1625 | |
---|
| 1626 | help_texts.clear (); |
---|
| 1627 | |
---|
| 1628 | help_texts.add () = "none"; |
---|
| 1629 | help_texts.add () = "awk"; |
---|
| 1630 | help_texts.add () = "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages"; |
---|
| 1631 | help_texts.add () = "build <option> : build actions. (Try cmt help build)"; |
---|
| 1632 | help_texts.add () = "build constituent_makefile <constituent> : generate constituent Makefile fragment"; |
---|
| 1633 | help_texts.add () = "build constituents_makefile : generate constituents.make"; |
---|
| 1634 | help_texts.add () = "build dependencies : generate dependencies"; |
---|
| 1635 | help_texts.add () = "build library_links : build symbolic links towards all imported libraries"; |
---|
| 1636 | help_texts.add () = "build make_setup : build a compiled version of setup scripts"; |
---|
| 1637 | help_texts.add () = "build msdev : generate MSDEV files"; |
---|
| 1638 | help_texts.add () = "build CMT_pacman : generate PACMAN manifest file for CMT"; |
---|
| 1639 | help_texts.add () = "build vsnet : generate VS.NET files"; |
---|
| 1640 | help_texts.add () = "build os9_makefile : generate Makefile for OS9"; |
---|
| 1641 | help_texts.add () = "build prototype : generate prototype file"; |
---|
| 1642 | help_texts.add () = "build readme : generate README.html"; |
---|
| 1643 | help_texts.add () = "build tag_makefile : generate tag specific Makefile"; |
---|
| 1644 | help_texts.add () = "build temporary_name : generate a name for a temprary file"; |
---|
| 1645 | help_texts.add () = "build triggers <constituent> : generate library trigger file"; |
---|
| 1646 | help_texts.add () = "build windefs <library_name> : generate def file for Windows shared libraries"; |
---|
| 1647 | help_texts.add () = "check <option> : check actions. (Try cmt help check)"; |
---|
| 1648 | help_texts.add () = "check configuration : check configuration"; |
---|
| 1649 | help_texts.add () = "check files <old> <new> : compare two files and overrides <old> by <new> if different"; |
---|
| 1650 | help_texts.add () = "check version <name> : check if a name follows a version tag syntax "; |
---|
| 1651 | help_texts.add () = "co | checkout : perform a cvs checkout over a CMT package"; |
---|
| 1652 | help_texts.add () = "cleanup [-csh|-sh|-bat] : generate a cleanup script"; |
---|
| 1653 | help_texts.add () = "config : generate setup and cleanup scripts"; |
---|
| 1654 | help_texts.add () = "create <package> <version> [<path>] : create and configure a new package"; |
---|
| 1655 | help_texts.add () = "create_project <project> : create and configure a new project"; |
---|
| 1656 | help_texts.add () = "cvsbranches <module> : display the subdirectories for a module"; |
---|
| 1657 | help_texts.add () = "cvssubpackagess <module> : display the subpackages for a module"; |
---|
| 1658 | help_texts.add () = "cvstags <module> : display the CVS tags for a module"; |
---|
| 1659 | help_texts.add () = "do <action> [<param>=<value>] ... : Execute an action"; |
---|
| 1660 | help_texts.add () = "expand model <model> : "; |
---|
| 1661 | help_texts.add () = "filter <in> <out> : filter a file against CMT macros and env. variables"; |
---|
| 1662 | help_texts.add () = "help | -help | --help : display this help"; |
---|
| 1663 | help_texts.add () = "load"; |
---|
| 1664 | help_texts.add () = "lock [<p> <v> [<path>]] : lock a package"; |
---|
| 1665 | help_texts.add () = "remove <package> <version> [<path>] : remove a package version"; |
---|
| 1666 | help_texts.add () = "remove library_links : remove symbolic links towards all imported libraries"; |
---|
| 1667 | help_texts.add () = "run '<command>' : apply a command"; |
---|
| 1668 | help_texts.add () = "run_sequence <sequence file> : execute a cmt equence file"; |
---|
| 1669 | help_texts.add () = "set version <version> : generate a version file in the current package"; |
---|
| 1670 | help_texts.add () = "set versions : generate version files into packages"; |
---|
| 1671 | help_texts.add () = "setup [-csh|-sh|-bat] : generate a setup script"; |
---|
| 1672 | help_texts.add () = "show <option> : query actions. (Try cmt help show)"; |
---|
| 1673 | help_texts.add () = "show action <name> : a formatted action definition"; |
---|
| 1674 | help_texts.add () = "show action_value <name> : a raw action definition"; |
---|
| 1675 | help_texts.add () = "show action_names : all action names"; |
---|
| 1676 | help_texts.add () = "show actions : all action definitions"; |
---|
| 1677 | help_texts.add () = "show all_tags : all defined tags"; |
---|
| 1678 | help_texts.add () = "show applied_patterns : all patterns actually applied"; |
---|
| 1679 | help_texts.add () = "show author : package author"; |
---|
| 1680 | help_texts.add () = "show branches : added branches"; |
---|
| 1681 | help_texts.add () = "show clients : package clients"; |
---|
| 1682 | help_texts.add () = "show cmtpath_patterns : cmtpath_patterns"; |
---|
| 1683 | help_texts.add () = "show constituent <name>: constituent definition"; |
---|
| 1684 | help_texts.add () = "show constituent_names : constituent names"; |
---|
| 1685 | help_texts.add () = "show constituents : constituent definitions"; |
---|
| 1686 | help_texts.add () = "show cycles : cycles in the use graph"; |
---|
| 1687 | help_texts.add () = "show fragment <name> : one fragment definition"; |
---|
| 1688 | help_texts.add () = "show fragments : fragment definitions"; |
---|
| 1689 | help_texts.add () = "show groups : group definitions"; |
---|
| 1690 | help_texts.add () = "show include_dirs : "; |
---|
| 1691 | help_texts.add () = "show language <name> : language definition"; |
---|
| 1692 | help_texts.add () = "show languages : language definitions"; |
---|
| 1693 | help_texts.add () = "show macro <name> : a formatted macro definition"; |
---|
| 1694 | help_texts.add () = "show macro_value <name> : a raw macro definition"; |
---|
| 1695 | help_texts.add () = "show macro_names : all macro names"; |
---|
| 1696 | help_texts.add () = "show macros : all macro definitions"; |
---|
| 1697 | help_texts.add () = "show manager : package manager"; |
---|
| 1698 | help_texts.add () = "show packages : packages reachable from the current context"; |
---|
| 1699 | help_texts.add () = "show path : the package search list"; |
---|
| 1700 | help_texts.add () = "show pattern <name> : the pattern definition and usages"; |
---|
| 1701 | help_texts.add () = "show pattern_names : pattern names"; |
---|
| 1702 | help_texts.add () = "show patterns : the pattern definitions"; |
---|
| 1703 | help_texts.add () = "show projects : project definitions"; |
---|
| 1704 | help_texts.add () = "show setup : setup definitions"; |
---|
| 1705 | help_texts.add () = "show pwd : filtered current directory"; |
---|
| 1706 | help_texts.add () = "show set <name> : a formatted set definition"; |
---|
| 1707 | help_texts.add () = "show set_names : set names"; |
---|
| 1708 | help_texts.add () = "show set_value <name> : a raw set definition"; |
---|
| 1709 | help_texts.add () = "show sets : set definitions"; |
---|
| 1710 | help_texts.add () = "show strategies : all strategies (build & version)"; |
---|
| 1711 | help_texts.add () = "show tags : all currently active tags"; |
---|
| 1712 | help_texts.add () = "show use_paths <pack> : all paths to the used package"; |
---|
| 1713 | help_texts.add () = "show uses : used packages"; |
---|
| 1714 | help_texts.add () = "show version : version of the current package"; |
---|
| 1715 | help_texts.add () = "show versions <name> : visible versions of the selected package"; |
---|
| 1716 | help_texts.add () = "system : display the system tag"; |
---|
| 1717 | help_texts.add () = "unlock [<p> <v> [<path>]] : unlock a package"; |
---|
| 1718 | help_texts.add () = "version : version of CMT"; |
---|
| 1719 | help_texts.add () = ""; |
---|
| 1720 | |
---|
| 1721 | //"build <key> : build various components :" |
---|
| 1722 | //"show <key> : display various infos on :" |
---|
| 1723 | |
---|
| 1724 | help.add (action_none, help_texts[action_none]); |
---|
| 1725 | help.add (action_awk, help_texts[action_awk]); |
---|
| 1726 | help.add (action_broadcast, help_texts[action_broadcast]); |
---|
| 1727 | help.add (action_build, help_texts[action_build]); |
---|
| 1728 | help.add (action_build_constituent_makefile, help_texts[action_build_constituent_makefile]); |
---|
| 1729 | help.add (action_build_constituents_makefile, help_texts[action_build_constituents_makefile]); |
---|
| 1730 | help.add (action_build_dependencies, help_texts[action_build_dependencies]); |
---|
| 1731 | help.add (action_build_library_links, help_texts[action_build_library_links]); |
---|
| 1732 | help.add (action_build_make_setup, help_texts[action_build_make_setup]); |
---|
| 1733 | help.add (action_build_msdev, help_texts[action_build_msdev]); |
---|
| 1734 | help.add (action_build_CMT_pacman, help_texts[action_build_CMT_pacman]); |
---|
| 1735 | help.add (action_build_vsnet, help_texts[action_build_vsnet]); |
---|
| 1736 | help.add (action_build_os9_makefile, help_texts[action_build_os9_makefile]); |
---|
| 1737 | help.add (action_build_prototype, help_texts[action_build_prototype]); |
---|
| 1738 | help.add (action_build_readme, help_texts[action_build_readme]); |
---|
| 1739 | help.add (action_build_tag_makefile, help_texts[action_build_tag_makefile]); |
---|
| 1740 | help.add (action_build_temporary_name, help_texts[action_build_temporary_name]); |
---|
| 1741 | help.add (action_build_triggers, help_texts[action_build_triggers]); |
---|
| 1742 | help.add (action_build_windefs, help_texts[action_build_windefs]); |
---|
| 1743 | help.add (action_check_configuration, help_texts[action_check_configuration]); |
---|
| 1744 | help.add (action_check_files, help_texts[action_check_files]); |
---|
| 1745 | help.add (action_check_version, help_texts[action_check_version]); |
---|
| 1746 | help.add (action_checkout, help_texts[action_checkout]); |
---|
| 1747 | help.add (action_cleanup, help_texts[action_cleanup]); |
---|
| 1748 | help.add (action_config, help_texts[action_config]); |
---|
| 1749 | help.add (action_create, help_texts[action_create]); |
---|
| 1750 | help.add (action_create_project, help_texts[action_create_project]); |
---|
| 1751 | help.add (action_cvsbranches, help_texts[action_cvsbranches]); |
---|
| 1752 | help.add (action_cvssubpackages, help_texts[action_cvssubpackages]); |
---|
| 1753 | help.add (action_cvstags, help_texts[action_cvstags]); |
---|
| 1754 | help.add (action_do, help_texts[action_do]); |
---|
| 1755 | help.add (action_expand_model, help_texts[action_expand_model]); |
---|
| 1756 | help.add (action_filter, help_texts[action_filter]); |
---|
| 1757 | help.add (action_help, help_texts[action_help]); |
---|
| 1758 | help.add (action_load, help_texts[action_load]); |
---|
| 1759 | help.add (action_lock, help_texts[action_lock]); |
---|
| 1760 | help.add (action_remove, help_texts[action_remove]); |
---|
| 1761 | help.add (action_remove_library_links, help_texts[action_remove_library_links]); |
---|
| 1762 | help.add (action_run, help_texts[action_run]); |
---|
| 1763 | help.add (action_run_sequence, help_texts[action_run_sequence]); |
---|
| 1764 | help.add (action_set_version, help_texts[action_set_version]); |
---|
| 1765 | help.add (action_set_versions, help_texts[action_set_versions]); |
---|
| 1766 | help.add (action_setup, help_texts[action_setup]); |
---|
| 1767 | help.add (action_show, help_texts[action_show]); |
---|
| 1768 | help.add (action_show_action, help_texts[action_show_action]); |
---|
| 1769 | help.add (action_show_action_value, help_texts[action_show_action_value]); |
---|
| 1770 | help.add (action_show_action_names, help_texts[action_show_action_names]); |
---|
| 1771 | help.add (action_show_actions, help_texts[action_show_actions]); |
---|
| 1772 | help.add (action_show_all_tags, help_texts[action_show_all_tags]); |
---|
| 1773 | help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]); |
---|
| 1774 | help.add (action_show_author, help_texts[action_show_author]); |
---|
| 1775 | help.add (action_show_branches, help_texts[action_show_branches]); |
---|
| 1776 | help.add (action_show_clients, help_texts[action_show_clients]); |
---|
| 1777 | help.add (action_show_cmtpath_patterns, help_texts[action_show_cmtpath_patterns]); |
---|
| 1778 | help.add (action_show_constituent, help_texts[action_show_constituent]); |
---|
| 1779 | help.add (action_show_constituent_names, help_texts[action_show_constituent_names]); |
---|
| 1780 | help.add (action_show_constituents, help_texts[action_show_constituents]); |
---|
| 1781 | help.add (action_show_cycles, help_texts[action_show_cycles]); |
---|
| 1782 | help.add (action_show_fragment, help_texts[action_show_fragment]); |
---|
| 1783 | help.add (action_show_fragments, help_texts[action_show_fragments]); |
---|
| 1784 | help.add (action_show_groups, help_texts[action_show_groups]); |
---|
| 1785 | help.add (action_show_include_dirs, help_texts[action_show_include_dirs]); |
---|
| 1786 | help.add (action_show_language, help_texts[action_show_language]); |
---|
| 1787 | help.add (action_show_languages, help_texts[action_show_languages]); |
---|
| 1788 | help.add (action_show_macro, help_texts[action_show_macro]); |
---|
| 1789 | help.add (action_show_macro_value, help_texts[action_show_macro_value]); |
---|
| 1790 | help.add (action_show_macro_names, help_texts[action_show_macro_names]); |
---|
| 1791 | help.add (action_show_macros, help_texts[action_show_macros]); |
---|
| 1792 | help.add (action_show_manager, help_texts[action_show_manager]); |
---|
| 1793 | help.add (action_show_packages, help_texts[action_show_packages]); |
---|
| 1794 | help.add (action_show_path, help_texts[action_show_path]); |
---|
| 1795 | help.add (action_show_pattern, help_texts[action_show_pattern]); |
---|
| 1796 | help.add (action_show_pattern_names, help_texts[action_show_pattern_names]); |
---|
| 1797 | help.add (action_show_patterns, help_texts[action_show_patterns]); |
---|
| 1798 | help.add (action_show_projects, help_texts[action_show_projects]); |
---|
| 1799 | help.add (action_show_setup, help_texts[action_show_setup]); |
---|
| 1800 | help.add (action_show_pwd, help_texts[action_show_pwd]); |
---|
| 1801 | help.add (action_show_set, help_texts[action_show_set]); |
---|
| 1802 | help.add (action_show_set_names, help_texts[action_show_set_names]); |
---|
| 1803 | help.add (action_show_set_value, help_texts[action_show_set_value]); |
---|
| 1804 | help.add (action_show_sets, help_texts[action_show_sets]); |
---|
| 1805 | help.add (action_show_strategies, help_texts[action_show_strategies]); |
---|
| 1806 | help.add (action_show_tags, help_texts[action_show_tags]); |
---|
| 1807 | help.add (action_show_use_paths, help_texts[action_show_use_paths]); |
---|
| 1808 | help.add (action_show_uses, help_texts[action_show_uses]); |
---|
| 1809 | help.add (action_show_version, help_texts[action_show_version]); |
---|
| 1810 | help.add (action_show_versions, help_texts[action_show_versions]); |
---|
| 1811 | help.add (action_system, help_texts[action_system]); |
---|
| 1812 | help.add (action_unlock, help_texts[action_unlock]); |
---|
| 1813 | help.add (action_version, help_texts[action_version]); |
---|
| 1814 | } |
---|
| 1815 | |
---|