function out = getInfo(h)

%   Copyright 2014 The MathWorks, Inc.

comment = '#';
hP = coder.make.internal.Printer( comment );
% --------------------------------------
% Start writing
% --------------------------------------
% Heading
hP.printBorder();
hP.printComment( 'Build Tool: %s', h.Name )
hP.printBorder();
% General
printGeneralInfo();
% Include files
printIncludeFiles();
% Command
printCommands();
% Directives
printDirectives();
% File extensions
printFileExtensions();
out = hP.Buffer;
% --------------------------------------
% Helpers
% --------------------------------------
    function printGeneralInfo
        hP.printBlankLine();
        hP.println( 'Language              : ''%s''', h.Language )
        hP.println( 'OptionsRegistry       : {%s}', coder.make.internal.cell2str( h.OptionsRegistry, ',', '''' ) );
        hP.println( 'InputFileExtensions   : {%s}', coder.make.internal.cell2str( h.InputFileExtensions, ',', '''' ) );
        hP.println( 'OutputFileExtensions  : {%s}', coder.make.internal.cell2str( h.OutputFileExtensions, ',', '''' ) );
        hP.println( 'DerivedFileExtensions : {%s}', coder.make.internal.cell2str( h.DerivedFileExtensions, ',', '''' ) );
        if iscellstr( h.SupportedOutputs )
            str = h.SupportedOutputs;
            quote = '''';
        else
            num = numel( h.SupportedOutputs );
            str = cell( 1, num );
            for i = 1:num
                str{ i } = h.SupportedOutputs{ i };
                if isa( str{ i }, 'coder.make.enum.BuildOutput' )
                    str{ i } = [ 'coder.make.enum.BuildOutput.', char( str{ i } ) ];
                else
                    str{ i } = [ '''', str{ i }, '''' ];
                end
            end
            quote = '';
        end
        hP.println( 'SupportedOutputs      : {%s}', coder.make.internal.cell2str( str, ',', quote ) );
        hP.println( 'CommandPattern        : ''%s''', h.CommandPattern );
    end
    function printIncludeFiles
        for idx = 1:numel( h.IncludeFiles )
            if idx==1
                hP.printBlankLine();
            end
            incs = h.IncludeFiles;
            hP.println( '%s %s', h.getDirective( 'IncludeFile' ), incs{ idx } )
        end
    end
    function printCommands
        hP.printSectionTitle( 'Command' );
        printPathCommand();
    end
    function printPathCommand
        hP.printNameAndValue( h.Command );
        hP.printNameAndValue( h.Path )
    end
    function printDirectives
        hP.printSectionTitle( 'Directives' );
        extList = h.Directives.keys();
        extValueObjs = h.Directives.values();
        num = numel( extList );
        if num==0
            hP.println( '(none)' );
            return
        end
        extValues = cell( 1, num );
        for k = 1:num
            extValues{ k } = extValueObjs{ k }.getValue();
        end
        hP.printAlignedMacrosAndValues( extList, extValues );
    end
    function printFileExtensions
        hP.printSectionTitle( 'File Extensions' );
        extList = h.FileExtensions.keys();
        extValueObjs = h.FileExtensions.values();
        num = numel( extList );
        if num==0
            hP.println( '(none)' );
            return
        end
        extValues = cell( 1, num );
        for k = 1:num
            extValues{ k } = extValueObjs{ k }.getValue();
        end
        hP.printAlignedMacrosAndValues( extList, extValues );
    end
end
