if_diff/src/idfLocation.cxx
//============================================================================
// idf_location_precedes(const locationStruct *, const locationStruct *, int &order)
//----------------------------------------------------------------------------
// Compare two locations, determining whether the first precedes the second.
// Returns false if they are not comparable due to one being line/column
// and the other byte position, etc.
// Sets 'order' to compare with 0 as the end of l1 compares with 
// the start of l2. (0 means that they meet but don't overlap.)
//
// An omitted end location is handled as if the length were 0 bytes.
//============================================================================
idf_location_precedes(const locationStruct *, const locationStruct *, int ℴ)
Compare two locations, determining whether the first precedes the second.
Returns false if they are not comparable due to one being line/column
and the other byte position, etc.
Sets 'order' to compare with 0 as the end of l1 compares with
the start of l2. (0 means that they meet but don't overlap.)

An omitted end location is handled as if the length were 0 bytes.
idf_location_precedes ( const locationStruct * const locationStruct * int ℴ ) Compare two locations determining whether the first precedes the second . Returns false if they are not comparable due to one being line / column and the other byte position etc . Sets ' order ' to compare with 0 as the end of l1 compares with the start of l2 . ( 0 means that they meet but don ' t overlap . ) An omitted end location is handled as if the length were 0 bytes .
boolean idf_location_precedes(const locationStruct *l1,
      	      	      	      const locationStruct *l2,
      	      	      	      int &order)
{
  if (l1 == NULL || l2 == NULL) {
    return false;
  }
  if (!idf_filename_match(l1->filename, l2->filename)) {
    return false;
  }
  if (l1->start_line < 0 || l2->start_line < 0) {
    return false;
  }
  int end_line1;
  int end_column1;
  canonical_end(*l1, end_line1, end_column1);
  if ((end_line1 == 0) != (l2->start_line == 0)) {
    return false;
  }
  if (end_line1 < l2->start_line) {
    order = -1;
  }
  else if (end_line1 == l2->start_line) {
    int start_column2 = l2->start_column - 1;
    order = end_column1 < start_column2 ? -1 : (end_column1 == start_column2 ? 0 : 1);
  }
  else {
    order = 1;
  }
  return true;
}
boolean idf_location_precedes ( const locationStruct * l1 , const locationStruct * l2 , int & order ) { if ( l1 == NULL || l2 == NULL ) { return false ; } if ( ! idf_filename_match ( l1 -> filename , l2 -> filename ) ) { return false ; } if ( l1 -> start_line < 0 || l2 -> start_line < 0 ) { return false ; } int end_line1 ; int end_column1 ; canonical_end ( * l1 , end_line1 , end_column1 ) ; if ( ( end_line1 == 0 ) != ( l2 -> start_line == 0 ) ) { return false ; } if ( end_line1 < l2 -> start_line ) { order = -1 ; } else if ( end_line1 == l2 -> start_line ) { int start_column2 = l2 -> start_column - 1 ; order = end_column1 < start_column2 ? -1 : ( end_column1 == start_column2 ? 0 : 1 ) ; } else { order = 1 ; } return true ; }
idf_location_precedes(const locationStruct *, const locationStruct *, int &order)
Compare two locations, determining whether the first precedes the second.
idf_location_precedes ( const locationStruct * const locationStruct * int &order ) Compare two locations determining whether the first precedes the second .
// Put the end lines and columns into a consistent form for comparison. // Locations are not comparable since one is byte-based and // the other is row/column based.