- if (newline_locations_[lo] > pos_str0)
- return 1;
-
- if (newline_locations_[hi-1] < pos_str0)
- return hi;
-
- binary_search_bounds (newline_locations_,
- pos_str0,
- Link_array<char>::default_compare,
- &lo, &hi);
-
- if (*pos_str0 == '\n')
- lo--;
- return lo + 2;
+ /* this will find the '\n' character at the end of our line */
+ vsize lo = lower_bound (newline_locations_,
+ pos_str0,
+ less<char const*> ());
+
+ /* the return value will be indexed from 1 */
+ return lo + 1 + line_offset_;
+}
+
+void
+Source_file::set_line (char const *pos_str0, int line)
+{
+ int current_line = get_line (pos_str0);
+ line_offset_ += line - current_line;
+
+ assert (line == get_line (pos_str0));