VirtualBox

Changeset 56533 in vbox for trunk/src


Ignore:
Timestamp:
Jun 18, 2015 6:15:51 PM (10 years ago)
Author:
vboxsync
Message:

VBoxManage generated help updates, manual/Makefile.kmk hacking, related stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r56479 r56533  
    4444enum HELP_CMD_VBOXMANAGE    g_enmCurCommand = HELP_CMD_VBOXMANAGE_INVALID;
    4545/** The scope maskt for the current subcommand. */
    46 uint64_t                    g_fCurSubcommandScope = UINT64_MAX;
    47 
     46uint64_t                    g_fCurSubcommandScope = REFENTRYSTR_SCOPE_GLOBAL;
     47/** String of spaces that can be used for indentation.   */
     48static const char           g_szSpaces[] = "                                                ";
    4849
    4950/**
     
    5859    Assert(g_enmCurCommand == HELP_CMD_VBOXMANAGE_INVALID);
    5960    g_enmCurCommand       = enmCommand;
    60     g_fCurSubcommandScope = UINT64_MAX;
     61    g_fCurSubcommandScope = REFENTRYSTR_SCOPE_GLOBAL;
    6162}
    6263
     
    104105 * @param   psz             The string table string to print.
    105106 * @param   cchMaxWidth     The maximum output width.
    106  */
    107 static uint32_t printString(PRTSTREAM pStrm, const char *psz, uint32_t cchMaxWidth)
     107 * @param   fFlags          String flags that may affect formatting.
     108 */
     109static uint32_t printString(PRTSTREAM pStrm, const char *psz, uint32_t cchMaxWidth, uint64_t fFlags)
    108110{
    109111    uint32_t    cLinesWritten;
     
    142144        while (*psz == ' ')
    143145            cchIndent++, psz++;
     146        Assert(cchIndent + 4 + 1 <= RT_ELEMENTS(g_szSpaces));
     147
    144148        if (cchIndent + 8 >= cchMaxWidth)
    145149            cchMaxWidth += cchIndent + 8;
    146150
    147151        /* Work our way thru the string, line by line. */
     152        uint32_t cchHangingIndent = 0;
    148153        cLinesWritten = 0;
    149154        do
    150155        {
    151             RTStrmWrite(pStrm, pszIndent, cchIndent);
    152             size_t offLine       = cchIndent;
    153             bool   fPendingSpace = false;
     156            RTStrmWrite(pStrm, g_szSpaces, cchIndent + cchHangingIndent);
     157            size_t   offLine       = cchIndent + cchHangingIndent;
     158            bool     fPendingSpace = false;
    154159            do
    155160            {
     
    183188            RTStrmPutCh(pStrm, '\n');
    184189            cLinesWritten++;
     190
     191            /* Set up hanging indent if relevant. */
     192            if (fFlags & REFENTRYSTR_FLAGS_SYNOPSIS)
     193                cchHangingIndent = 4;
    185194        } while (*psz != '\0');
    186195    }
     
    223232    {
    224233        uint64_t fCurScope = pStrTab->paStrings[i].fScope;
    225         if (fCurScope == REFENTRYSTR_SCOPE_SAME)
    226             fCurScope = fPrevScope;
    227         if (fCurScope & fScope)
     234        if ((fCurScope & REFENTRYSTR_SCOPE_MASK) == REFENTRYSTR_SCOPE_SAME)
     235        {
     236            fCurScope &= ~REFENTRYSTR_SCOPE_MASK;
     237            fCurScope |= (fPrevScope & REFENTRYSTR_SCOPE_MASK);
     238        }
     239        if (fCurScope & REFENTRYSTR_SCOPE_MASK & fScope)
    228240        {
    229241            const char *psz = pStrTab->paStrings[i].psz;
     
    236248                    cLinesWritten++;
    237249                }
    238                 cLinesWritten += printString(pStrm, psz, cchWidth);
     250                cLinesWritten += printString(pStrm, psz, cchWidth, fCurScope & REFENTRYSTR_FLAGS_MASK);
    239251            }
    240252            else
     
    255267 * @returns Number of lines written.
    256268 * @param   enmCommand          The command.
    257  * @param   fSubcommandScope    The subcommand scope, UINT64_MAX for all.
     269 * @param   fSubcommandScope    The subcommand scope, REFENTRYSTR_SCOPE_GLOBAL
     270 *                              for all.
    258271 * @param   pStrm               The output stream.
    259272 */
     
    301314 *
    302315 * @param   enmCommand          The command.
    303  * @param   fSubcommandScope    The subcommand scope, UINT64_MAX for all.
     316 * @param   fSubcommandScope    The subcommand scope, REFENTRYSTR_SCOPE_GLOBAL
     317 *                              for all.
    304318 * @param   pStrm               The output stream.
    305319 */
     
    343357{
    344358    Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
    345     Assert(g_fCurSubcommandScope == UINT64_MAX);
     359    Assert(g_fCurSubcommandScope == REFENTRYSTR_SCOPE_GLOBAL);
    346360
    347361    return errorSyntax("No subcommand specified");
     
    360374{
    361375    Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
    362     Assert(g_fCurSubcommandScope == UINT64_MAX);
     376    Assert(g_fCurSubcommandScope == REFENTRYSTR_SCOPE_GLOBAL);
    363377
    364378    /* check if help was requested. */
     
    387401{
    388402    Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID);
    389     Assert(g_fCurSubcommandScope != UINT64_MAX);
     403    Assert(g_fCurSubcommandScope != REFENTRYSTR_SCOPE_GLOBAL);
    390404
    391405    /* check if help was requested. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette