301
* This function does the same actions as print_half_line(),
302
* but takes as first argument a simple pointer to
306
display_half_line (const char* line, unsigned int indent,
307
unsigned int out_bound)
310
register unsigned int in_position = 0;
311
register unsigned int out_position = 0;
312
register const char *text_pointer = line;
313
register const char *text_limit = line;
315
for (; *text_limit != '\0'; text_limit++);
316
while (text_pointer < text_limit)
318
register unsigned char c = *text_pointer++;
324
unsigned int spaces = TAB_WIDTH - in_position % TAB_WIDTH;
325
if (in_position == out_position)
327
unsigned int tabstop = out_position + spaces;
330
if (out_bound < tabstop)
332
for (; out_position < tabstop; out_position++)
336
if (tabstop < out_bound)
338
out_position = tabstop;
342
in_position += spaces;
349
tab_from_to (0, indent);
350
in_position = out_position = 0;
355
if (in_position != 0 && --in_position < out_bound)
357
if (out_position <= in_position)
358
/* Add spaces to make up for suppressed tab past out_bound. */
359
for (; out_position < in_position; out_position++)
363
out_position = in_position;
372
if (in_position < out_bound)
378
goto control_character;
381
if (in_position++ < out_bound)
383
out_position = in_position;
397
* Print side by side lines with a separator in the middle.
398
* 0 parameters are taken to indicate white space text.
399
* Blank lines that can easily be caught are reduced to a single newline.
400
* This function works almost like print_1sdiff_line() (see above),
401
* but the parameter list is slightly different.
402
* In addition, different separators are used
406
print_1overview_line (const char *left, int are_different,
410
unsigned int hw = sdiff_half_width, c2o = sdiff_column2_offset;
411
unsigned int col = 0;
412
bool put_newline = 0;
413
register const char *end_of_left = left;
414
register const char *end_of_right = right;
415
const char *sep = ":!:";
419
for (; *end_of_left != '\0'; end_of_left++);
420
if (end_of_left != left)
422
put_newline |= *end_of_left == '\n';
423
col = display_half_line (left, 0, hw);
433
col = tab_from_to (col, (hw + c2o - 3) / 2) + 3;
439
for (; *end_of_right != '\0'; end_of_right++);
440
if (end_of_right != right)
442
put_newline |= (*end_of_right == '\n');
445
col = tab_from_to (col, c2o);
446
display_half_line (right, col, hw);