Analyser/Preformat_All [ Functions ]
FUNCTION
Process... (TODO) SYNPOPSIS
INPUTS
- arg_item -- the item to be pre-formatted.
- source -- is it a source item ?
SOURCE
{ int i; int preformatted = FALSE; char *line = NULL; if ( arg_item->no_lines > 0 ) { i = 0; /* Skip any pipe stuff */ for ( ; ( i < arg_item->no_lines ) && ( arg_item->lines[i]->kind == ITEM_LINE_PIPE ); ++i ) { /* Empty */ } line = arg_item->lines[i]->line; if ( ( arg_item->lines[i]->kind == ITEM_LINE_RAW ) || ( arg_item->lines[i]->kind == ITEM_LINE_PLAIN ) ) { arg_item->lines[i]->format |= RBILA_BEGIN_PRE | ( source ? RBILA_BEGIN_SOURCE : 0 ); preformatted = TRUE; for ( ++i; i < arg_item->no_lines; i++ ) { if ( arg_item->lines[i]->kind == ITEM_LINE_PIPE ) { /* Temporarily end the preformatting to allow * the piping to happen */ arg_item->lines[i]->format |= RBILA_END_PRE | ( source ? RBILA_END_SOURCE : 0 ); /* Find the end of the pipe stuff */ for ( ; ( i < arg_item->no_lines ) && ( arg_item->lines[i]->kind == ITEM_LINE_PIPE ); ++i ) { /* Empty */ }; /* Every item ends with an ITEM_LINE_END, so: */ assert( i < arg_item->no_lines ); /* And re-enable preformatting */ arg_item->lines[i]->format |= RBILA_BEGIN_PRE | ( source ? RBILA_BEGIN_SOURCE : 0 ); } if ( arg_item->lines[i]->kind == ITEM_LINE_END ) { /* If the last line ends with a begin_pre remove * it, otherwise a begin and end pre will be * generated, in the wrong order, on the same line in the output. */ if ( arg_item->lines[i]->format & RBILA_BEGIN_PRE ) { arg_item->lines[i]->format &= ~( RBILA_BEGIN_PRE ); } else { arg_item->lines[i]->format |= RBILA_END_PRE; } arg_item->lines[i]->format |= ( source ? RBILA_END_SOURCE : 0 ); } } } } }