Analyser/RB_Analyse_Items [ Functions ]
FUNCTION
Locate the items in the header and create RB_Item structures for them. SYNPOPSIS
SOURCE
{ int line_nr; enum ItemType item_type = NO_ITEM; struct RB_Item *new_item; struct RB_Item *cur_item; RB_Item_Lock_Reset( ); /* find the first item */ for ( line_nr = 0; line_nr < arg_header->no_lines; ++line_nr ) { item_type = RB_Is_ItemName( arg_header->lines[line_nr].line ); if ( item_type != NO_ITEM ) { break; } } /* and all the others */ while ( ( item_type != NO_ITEM ) && ( line_nr < arg_header->no_lines ) ) { new_item = RB_Create_Item( item_type ); new_item->begin_index = line_nr; /* Add the item to the end of the list of items. */ if ( arg_header->items ) { for ( cur_item = arg_header->items; cur_item->next; cur_item = cur_item->next ) { /* Empty */ } cur_item->next = new_item; } else { arg_header->items = new_item; } /* Find the next item */ for ( ++line_nr; line_nr < arg_header->no_lines; ++line_nr ) { item_type = RB_Is_ItemName( arg_header->lines[line_nr].line ); if ( item_type != NO_ITEM ) { break; } } /* This points to the last line in the item */ new_item->end_index = line_nr - 1; assert( new_item->end_index >= new_item->begin_index ); /* Now analyse and copy the lines */ Copy_Lines_To_Item( arg_header, new_item ); Analyse_Item_Format( new_item ); /* Handy for debugging wiki formatting * Dump_Item( new_item ); */ } return 0; }