Changeset 360 for CMT/HEAD/source/cmt_deps_builder.cxx
- Timestamp:
- Jan 31, 2007, 3:18:12 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_deps_builder.cxx
r79 r360 118 118 CmtSystem::cmt_string_vector& deps) 119 119 { 120 120 121 char term = 0; 122 // To ignore leading spaces and tabs 123 while ( (*ptr == ' ') or (*ptr == '\t')) 124 { 125 ptr++; 126 } 121 127 122 128 if (*ptr == '#') … … 133 139 ptr += 7; 134 140 135 while (*ptr == ' ') ptr++; 141 while ((*ptr == ' ') or (*ptr == '\t')) ptr++; 142 136 143 if (*ptr == '<') 137 144 { … … 351 358 { 352 359 char* pattern = ptr + strlen (ptr); 353 int length = 0; 354 355 /* 360 int length = 0; 361 char* pos; 362 363 364 /* 356 365 Even if we are inside a comment, we must detect strings since comment markers may 357 366 be written inside them. 358 */359 360 char* pos = strchr (ptr, '"');367 368 pos = strchr (ptr, '"'); 369 361 370 if ((pos != 0) && (pos < pattern) && (pos > ptr) && (*(pos-1) != '\\')) 362 371 { … … 373 382 length = 1; 374 383 } 375 384 */ 376 385 pos = strstr (ptr, "*/"); 377 386 if ((pos != 0) && (pos < pattern)) 378 387 { 379 state = in_line;388 state = in_line; 380 389 pattern = pos; 381 length = 2;390 length = 2; 382 391 } 383 392 … … 443 452 static char* in_line_comment_action (char* ptr, state_def& state) 444 453 { 445 ptr += strlen (ptr); 446 state = in_line; 447 454 char * pos = strchr (ptr, '\\'); 455 /* Extend this part to deal with continuation character */ 456 if ( (pos == NULL) || ( (ptr + strlen(ptr)-1)!=pos )) 457 { 458 state = in_line; 459 } 460 461 ptr += strlen (ptr); 462 448 463 return (ptr); 449 464 } … … 467 482 << dir_name << log_endl; 468 483 484 485 // erase of continuation character 469 486 pos = 0; 470 487 max_pos = strlen (text); 471 472 488 char* current = text; 473 489 char* last = text + max_pos; 490 while (current < last) 491 { 492 493 char* crnl = strstr (current, "\\\r\n"); 494 char* nl = strstr (current, "\\\n"); 495 496 if ( (crnl==0) && (nl ==0)) break; 497 498 int length = 0; 499 500 char * ptr = 0; 501 if (nl==0) //crnl > 0 502 { 503 length = 3; 504 ptr = crnl; 505 } 506 else if (crnl==0) //nl > 0 507 { 508 length = 2; 509 ptr = nl; 510 } 511 else if (crnl < nl) 512 { 513 length = 3; 514 ptr = crnl; 515 } 516 else // (crnl > nl) 517 { 518 length = 2; 519 ptr = nl; 520 } 521 strcpy (ptr, ptr+length); 522 current = ptr; 523 last -= length; 524 } 525 526 pos = 0; 527 max_pos = strlen (text); 528 current = text; 529 last = text + max_pos; 474 530 475 531 state_def state = at_start; 532 476 533 477 534 while (current < last) 478 535 { 536 479 537 char marker; 480 538 char* marker_pos = 0; … … 516 574 if (first == 0) 517 575 { 518 // neither nl nor cr+nl found => this is the last line 519 520 marker_pos = 0; 576 // neither nl nor cr+nl found => this is the last line 577 marker_pos = 0; 521 578 } 522 579 else 523 580 { 524 marker_pos = first;525 marker = *marker_pos;526 *marker_pos = 0;581 marker_pos = first; 582 marker = *marker_pos; 583 *marker_pos = 0; 527 584 } 528 585 … … 581 638 } 582 639 } 640 583 641 } 584 642
Note: See TracChangeset
for help on using the changeset viewer.