Document/RB_Document_Determine_DocFilePaths [ Functions ]

FUNCTION

Determine the path of each of the documentation files based on the path of the source file and the documentation root path and the source root path.

SYNOPSIS

void RB_Document_Determine_DocFilePaths(
    struct RB_Document *document )

EXAMPLE

srcpath = ./test/mysrc/sub1/sub2 srcroot = ./test/mysrc/ docroot = ./test/mydoc/

     ==>

docpath = ./test/mydoc/sub1/sub2

SOURCE

{
    struct RB_Path     *path;
    int                 docroot_length;
    int                 srcroot_length;
    int                 length;

    assert( document->srctree );
    assert( document->srcroot );
    assert( document->docroot );

    docroot_length = strlen( document->docroot->name );
    srcroot_length = strlen( document->srcroot->name );

    for ( path = document->srctree->first_path; path; path = path->next )
    {
        char               *name;
        char               *new_name;
        char               *tail;

        name = path->name;
        length = strlen( name );
        assert( length >= srcroot_length );
        tail = name + srcroot_length;
        new_name = calloc( docroot_length +
                           ( length - srcroot_length ) + 1, sizeof( char ) );
        assert( new_name );
        strcat( new_name, document->docroot->name );
        if ( document->actions.do_no_subdirectories )
        {
            /* No subdirectory */
        }
        else
        {
            strcat( new_name, tail );
        }
        path->docname = new_name;
    }
}