Changeset 360


Ignore:
Timestamp:
Jan 31, 2007, 3:18:12 PM (17 years ago)
Author:
garonne
Message:

see C.L 321

Location:
CMT/HEAD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r325 r360  
     1
     22007-31-01 Vincent Garonne <garonne@lal.in2p3.fr> 321
     3
     4        * cmt_deps_builder.cxx:  Add support for space, line continuing character, etc.
     5
    162006-15-11 Vincent Garonne <garonne@lal.in2p3.fr> 320
    27
  • CMT/HEAD/source/cmt_deps_builder.cxx

    r79 r360  
    118118                              CmtSystem::cmt_string_vector& deps)
    119119{
     120
    120121  char term = 0;
     122  // To ignore leading spaces and tabs
     123  while ( (*ptr == ' ') or (*ptr == '\t'))
     124  {
     125    ptr++;
     126  }
    121127
    122128  if (*ptr == '#')
     
    133139          ptr += 7;
    134140
    135           while (*ptr == ' ') ptr++;
     141          while ((*ptr == ' ') or (*ptr == '\t')) ptr++;
     142         
    136143          if (*ptr == '<')
    137144            {
     
    351358{
    352359  char* pattern = ptr + strlen (ptr);
    353   int length = 0;
    354 
    355   /*
     360  int length    = 0;
     361  char* pos;
     362 
     363
     364    /*
    356365    Even if we are inside a comment, we must detect strings since comment markers may
    357366    be written inside them.
    358    */
    359 
    360   char* pos = strchr (ptr, '"');
     367 
     368  pos = strchr (ptr, '"');
     369 
    361370  if ((pos != 0) && (pos < pattern) && (pos > ptr) && (*(pos-1) != '\\'))
    362371    {
     
    373382      length = 1;
    374383    }
    375 
     384 */
    376385  pos = strstr (ptr, "*/");
    377386  if ((pos != 0) && (pos < pattern))
    378387    {
    379       state = in_line;
     388      state   = in_line;
    380389      pattern = pos;
    381       length = 2;
     390      length  = 2;
    382391    }
    383392
     
    443452static char* in_line_comment_action (char* ptr, state_def& state)
    444453{
    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 
    448463  return (ptr);
    449464}
     
    467482      << dir_name << log_endl;
    468483
     484
     485  // erase of continuation character
    469486  pos = 0;
    470487  max_pos = strlen (text);
    471 
    472488  char* current = text;
    473489  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;
    474530
    475531  state_def state = at_start;
     532 
    476533
    477534  while (current < last)
    478535    {
     536             
    479537      char marker;
    480538      char* marker_pos = 0;
     
    516574      if (first == 0)
    517575        {
    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;
    521578        }
    522579      else
    523580        {
    524           marker_pos = first;
    525           marker = *marker_pos;
    526           *marker_pos = 0;
     581          marker_pos = first;
     582              marker = *marker_pos;
     583              *marker_pos = 0;
    527584        }
    528585
     
    581638        }
    582639    }
     640           
    583641}
    584642
Note: See TracChangeset for help on using the changeset viewer.