- Timestamp:
- Jun 10, 2015 10:58:10 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100933
- Location:
- trunk/doc/manual
- Files:
-
- 2 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/Makefile.kmk
r56301 r56344 861 861 862 862 863 ########################################################################################## 864 # 865 # VBoxManage man pages. 866 # 867 ########################################################################################## 863 # 864 # VBoxManage man pages. 865 # 868 866 $(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-man.xsl,) 869 867 … … 877 875 878 876 $(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-C-help.xsl,) 879 877 $(evalcall2 def_vbox_replace_paths_in_xslt,docbook-refentry-to-H-help.xsl,) 878 879 880 # 881 # VBoxManage built-in help. 882 # 883 # Note! Generating the stuff here is a bit annoying, but currently the most 884 # practical way I can come up with. 885 # 886 OTHERS += \ 887 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \ 888 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h 889 OTHER_CLEAN += \ 890 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \ 891 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h 880 892 help-experiment: \ 881 $(VBOX_PATH_MANUAL_SRC)/en_US/man_VBoxManage_extpack.xml \ 893 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp \ 894 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h 895 896 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.cpp: \ 882 897 $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-C-help.xsl \ 883 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) 884 $(VBOX_XSLTPROC_WITH_CAT) --xinclude --nonet --output /tmp/vboxmanage-help.cpp \ 885 $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-C-help.xsl \ 886 $(VBOX_PATH_MANUAL_SRC)/en_US/man_VBoxManage_extpack.xml 898 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(filter man_VBoxManage_%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \ 899 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) 900 $(call MSG_GENERATE,,$@,$<) 901 $(QUIET)$(APPEND) -tn "$@" \ 902 '/* Autogenerated by $<, do not edit! */' \ 903 '' \ 904 '#include <iprt/types.h>' \ 905 '#include "VBoxManageBuiltInHelp.h"' \ 906 '' 907 $(foreach refentry,$(filter %.xml,$^) \ 908 ,$(NLTAB)$(QUIET)$(REDIRECT) -a+to "$@" -- $(VBOX_XSLTPROC_WITH_CAT) --xinclude --nonet $< $(refentry)) 909 $(QUIET)$(APPEND) -n "$@" \ 910 '' \ 911 'PCREFENTRY g_apHelpEntries[] = ' \ 912 '{' \ 913 $(foreach refentry,$(filter %.xml,$^), ' &g_$(tolower $(patsubst man_%,%,$(notdir $(basename $(refentry))))), ') \ 914 '};' \ 915 'const uint32_t g_cHelpEntries = RT_ELEMENTS(g_apHelpEntries);' \ 916 '' 917 918 $(VBOX_PATH_MANUAL_OUTBASE)/VBoxManageBuiltInHelp.h: \ 919 $(VBOX_PATH_MANUAL_OUTBASE)/docbook-refentry-to-H-help.xsl \ 920 $(addprefix $(VBOX_PATH_MANUAL_SRC)/en_US/,$(filter man_VBoxManage_%,$(VBOX_MANUAL_XML_REFENTRY_FILES))) \ 921 $(VBOX_XML_CATALOG) $(VBOX_XML_CATALOG_DOCBOOK) $(MAKEFILE) 922 $(call MSG_GENERATE,,$@,$<) 923 $(QUIET)$(APPEND) -tn "$@" \ 924 '/* Autogenerated by $<, do not edit! */' \ 925 '' \ 926 '#ifndef ___VBoxManageBuiltInHelp_h___' \ 927 '#define ___VBoxManageBuiltInHelp_h___' \ 928 '' \ 929 '#include <VBox/refentry.h>' \ 930 '' \ 931 'RT_C_DECLS_BEGIN' \ 932 '' \ 933 'typedef enum HELP_CMD_VBOXMANAGE' \ 934 '{' \ 935 ' HELP_CMD_VBOXMANAGE_INVALID = 0,' 936 $(foreach refentry,$(filter %.xml,$^) \ 937 ,$(NLTAB)$(QUIET)$(REDIRECT) -a+to "$@" -- $(VBOX_XSLTPROC_WITH_CAT) --xinclude --nonet \ 938 --stringparam 'g_sMode' 'cmd' $< $(refentry)) 939 $(QUIET)$(APPEND) -n "$@" \ 940 ' HELP_CMD_VBOXMANAGE_END' \ 941 '} HELP_CMD_VBOXMANAGE;' 942 $(foreach refentry,$(filter %.xml,$^) \ 943 ,$(NLTAB)$(QUIET)$(REDIRECT) -a+to "$@" -- $(VBOX_XSLTPROC_WITH_CAT) --xinclude --nonet \ 944 --stringparam 'g_sMode' 'subcmd' $< $(refentry)) 945 $(QUIET)$(APPEND) -n "$@" \ 946 '' \ 947 'extern PCREFENTRY g_apHelpEntries[];' \ 948 'extern const uint32_t g_cHelpEntries;' \ 949 '' \ 950 'RT_C_DECLS_END' \ 951 '' \ 952 '#endif' \ 953 '' 887 954 888 955 -
trunk/doc/manual/docbook-refentry-to-C-help.xsl
r56231 r56344 62 62 <xsl:message terminate="yes">The refsynopsisdiv/cmdsynopsis elements must have an id starting with 'synopsis-'.</xsl:message> 63 63 </xsl:if> 64 <xsl:if test="not(starts-with(substring-after(@id, '-'), $sBaseId))"> 65 <xsl:message terminate="yes">The refsynopsisdiv/cmdsynopsis elements @id is expected to include the refentry @id.</xsl:message> 66 </xsl:if> 64 67 <xsl:if test="not(../../refsect1/refsect2[@id=./@id])"> 65 68 <xsl:message terminate="yes">No refsect2 with id="<xsl:value-of select="@id"/>" found.</xsl:message> … … 82 85 <!-- We start by combining the refentry title and the refpurpose into a short description. --> 83 86 <xsl:text> 84 { </xsl:text><xsl:call-template name="calc-scope "/><xsl:text>,87 { </xsl:text><xsl:call-template name="calc-scope-for-refentry"/><xsl:text>, 85 88 "</xsl:text> 86 89 <xsl:apply-templates select="./refentryinfo/title/node()"/> … … 122 125 static const REFENTRY </xsl:text><xsl:value-of select="$sDataBaseSym"/><xsl:text> = 123 126 { 124 /* .id internal = */ HELP_CMD_</xsl:text>127 /* .idInternal = */ HELP_CMD_</xsl:text> 125 128 <xsl:call-template name="str:to-upper"> 126 129 <xsl:with-param name="text" select="translate(substring-after(@id, '-'), '-', '_')"/> 127 130 </xsl:call-template> 128 131 <xsl:text>, 129 /* .Synopsis = */ { </xsl:text>130 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_synopsis , RT_ELEMENTS(</xsl:text>131 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_synopsis )},132 /* .Help = */ { </xsl:text>133 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_full_help , RT_ELEMENTS(</xsl:text>134 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_full_help )},132 /* .Synopsis = */ { RT_ELEMENTS(</xsl:text> 133 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_synopsis), 0, </xsl:text> 134 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_synopsis }, 135 /* .Help = */ { RT_ELEMENTS(</xsl:text> 136 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_full_help), 0, </xsl:text> 137 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_full_help }, 135 138 /* pszBrief = */ "</xsl:text> 136 139 <xsl:apply-templates select="./refnamediv/refpurpose/node()"/> 140 <!-- TODO: Add the command name too. --> 137 141 <xsl:text>" 138 142 }; … … 209 213 <!-- title / command synopsis - sets the scope. --> 210 214 <xsl:text> 211 { </xsl:text><xsl:call-template name="calc-scope-refsect2"/><xsl:text>, 215 { </xsl:text><xsl:call-template name="calc-scope-refsect2"/><xsl:text>, "" }, 216 { REFENTRYSTR_SCOPE_SAME, 212 217 "</xsl:text><xsl:call-template name="emit-indentation"/> 213 218 <xsl:choose> 214 219 <xsl:when test="name(./*[1]) = 'cmdsynopsis'"> 215 < xsl:text> </xsl:text>220 <!--xsl:text>* </xsl:text--> 216 221 <xsl:apply-templates select="./cmdsynopsis/node()|./cmdsynopsis/@*"/> 217 222 </xsl:when> … … 229 234 <xsl:apply-templates select="./*[position() > 1]"/> 230 235 231 <!-- Add a blank line, unless we're the last element in this refsect1. -->236 <!-- Add two blank lines, unless we're the last element in this refsect1. --> 232 237 <xsl:if test="position() != last()"> 233 238 <xsl:text> … … 255 260 <xsl:if test="*[not(self::varlistentry)]|text()"> 256 261 <xsl:message terminate="yes">Only varlistentry elements are supported in variablelist</xsl:message> 262 </xsl:if> 263 <xsl:if test="position() != 1"> 264 <xsl:text> 265 { REFENTRYSTR_SCOPE_SAME, "" },</xsl:text> 257 266 </xsl:if> 258 267 <xsl:for-each select="./varlistentry"> … … 412 421 413 422 414 <!-- TODO: scoping must be reworked! --> 423 <!-- 424 Element specific scoping. 425 --> 426 427 <xsl:template name="calc-scope-for-refentry"> 428 <xsl:call-template name="calc-scope-const-from-id"/> 429 </xsl:template> 430 415 431 <!-- Figures out the scope of a refsect1 element. --> 416 432 <xsl:template name="calc-scope-refsect1"> … … 420 436 </xsl:when> 421 437 <xsl:otherwise> 422 <xsl:call-template name="calc-scope "/>438 <xsl:call-template name="calc-scope-from-remark-or-id"/> 423 439 </xsl:otherwise> 424 440 </xsl:choose> … … 428 444 <xsl:template name="calc-scope-refsect2"> 429 445 <xsl:choose> 430 <xsl:when test=" 0">431 <xsl: text>REFENTRYSTR_SCOPE_GLOBAL</xsl:text>432 </xsl:when> 433 <xsl:otherwise> 434 <xsl: call-template name="calc-scope"/>446 <xsl:when test="@id or remark[@role='help-scope']"> 447 <xsl:call-template name="calc-scope-from-remark-or-id"/> 448 </xsl:when> 449 <xsl:otherwise> 450 <xsl:text>REFENTRYSTR_SCOPE_SAME</xsl:text> 435 451 </xsl:otherwise> 436 452 </xsl:choose> … … 441 457 <xsl:choose> 442 458 <xsl:when test="ancestor::refsynopsisdiv"> 443 <xsl:call-template name="calc-scope"/> 459 <xsl:call-template name="calc-scope-from-remark-or-id"> 460 <xsl:with-param name="sId" select="substring-after(@id, '-')"/> 461 </xsl:call-template> 444 462 </xsl:when> 445 463 <xsl:otherwise> … … 449 467 </xsl:template> 450 468 451 <!-- Figures out the scope of an element. --> 452 < xsl:template name="calc-scope">453 <xsl:param name="a_Element" select="."/>454 <xsl:param name="a_cRecursions" select="'1'"/>455 <xsl:variable name="ScopeRemark" select="$a_Element/remark[@role='help-scope']"/> 456 457 <xsl:choose>458 <!-- Check for an explicit scope remark: <remark role='scope' condition='uninstall'/> -->459 <xsl:when test="$ScopeRemark">460 <xsl:if test="not($ScopeRemark/@condition)">461 <xsl:message terminate="yes">remark[role=scope] element must have a condition attribute.</xsl:message>462 </xsl:if>463 464 <xsl:call-template name="calc-scope-const ">465 <xsl:with-param name="sId" select=" concat(concat(ancestor::refentry[1]/@id, '-'), $ScopeRemark/@condition)"/>469 470 <!-- 471 Scoping worker functions. 472 --> 473 474 <!-- Calculates the current scope from the scope remark or @id. --> 475 <xsl:template name="calc-scope-from-remark-or-id"> 476 <xsl:param name="sId" select="@id"/> 477 <xsl:choose> 478 <xsl:when test="remark[@role='help-scope']"> 479 <xsl:call-template name="calc-scope-consts-from-remark"/> 480 </xsl:when> 481 <xsl:when test="$sId != ''"> 482 <xsl:call-template name="calc-scope-const-from-id"> 483 <xsl:with-param name="sId" select="$sId"/> 466 484 </xsl:call-template> 467 485 </xsl:when> 468 469 <!-- Try derive it from the @id tag, if any. --> 470 <xsl:when test="substring(@id, 1, 3) = 'vbox'"> 471 <xsl:call-template name="calc-scope-const"> 472 <xsl:with-param name="sId" select="$a_Element/@id"/> 473 </xsl:call-template> 474 </xsl:when> 475 <xsl:when test="@id"> 476 <xsl:call-template name="calc-scope-const"> 477 <xsl:with-param name="sId" select="substring-after($a_Element/@id, '-')"/> 478 </xsl:call-template> 479 </xsl:when> 480 481 <!-- Recursively try the parent element. --> 482 <xsl:when test="($a_cRecursions) > 10"> 483 <xsl:message terminal="yes">calc-scope recursion too deep.</xsl:message> 484 </xsl:when> 485 <xsl:otherwise> 486 <xsl:call-template name="calc-scope"> 487 <xsl:with-param name="a_Element" select="$a_Element/.."/> 488 <xsl:with-param name="a_cRecursions" select="$a_cRecursions + 1"/> 489 </xsl:call-template> 490 </xsl:otherwise> 491 </xsl:choose> 492 </xsl:template> 493 494 <!-- Calculates a scope constant from a ID like value. --> 495 <xsl:template name="calc-scope-const"> 486 <xsl:otherwise> 487 <xsl:message terminate="yes">expected remark child or id attribute.</xsl:message> 488 </xsl:otherwise> 489 </xsl:choose> 490 </xsl:template> 491 492 <!-- Turns a @id into a scope constant. 493 Some woodoo taking place here here that chops the everything up to and 494 including the first refentry/@id word from all IDs before turning them into 495 constants (word delimiter '-'). --> 496 <xsl:template name="calc-scope-const-from-id"> 496 497 <xsl:param name="sId" select="@id"/> 497 <xsl:if test="$sId = ''"><xsl:message terminate="yes">refentry: command Missing </xsl:message></xsl:if> 498 <xsl:variable name="sTmp1" select="translate($sId, '-', '_')"/> 499 <xsl:variable name="sTmp2"> 500 <xsl:call-template name="str:to-upper"> 501 <xsl:with-param name="text" select="$sTmp1"/> 498 <xsl:variable name="sPrefix" select="concat(substring-before(ancestor::refentry/@id, '-'), '-')"/> 499 <xsl:if test="not(contains($sId, sPrefix))"> 500 <xsl:message terminate="yes">Expected sId (<xsl:value-of select="$sId"/>) to contain <xsl:value-of select="$sPrefix"/></xsl:message> 501 </xsl:if> 502 <xsl:text>HELP_SCOPE_</xsl:text> 503 <xsl:call-template name="str:to-upper"> 504 <xsl:with-param name="text" select="translate(substring-after($sId, $sPrefix), '-', '_')"/> 505 </xsl:call-template> 506 </xsl:template> 507 508 <!-- Turns a remark into one or more scope constant. --> 509 <xsl:template name="calc-scope-consts-from-remark"> 510 <xsl:param name="sCondition" select="remark/@condition"/> 511 <xsl:variable name="sNormalized" select="normalize-space(translate($sCondition, ',;:', ' '))"/> 512 <xsl:if test="$sNormalized = ''"> 513 <xsl:message terminate="yes">Empty @condition for help-scope remark.</xsl:message> 514 </xsl:if> 515 <xsl:text>HELP_SCOPE_</xsl:text><xsl:value-of select="substring-before($sList, ' ')"/> 516 <xsl:call-template name="calc-scope-const-from-remark-worker"> 517 <xsl:with-param name="sList" select="substring-after($sNormalized, ' ')"/> 518 </xsl:call-template> 519 </xsl:template> 520 521 <xsl:template name="calc-scope-const-from-remark-worker"> 522 <xsl:param name="sList"/> 523 <xsl:if test="$List != ''"> 524 <xsl:text> | HELP_SCOPE_</xsl:text><xsl:value-of select="substring-before($sList, ' ')"/> 525 <xsl:call-template name="calc-scope-const-from-remark-worker"> 526 <xsl:with-param name="sList" select="substring-after($sList, ' ')"/> 502 527 </xsl:call-template> 503 </xsl:variable> 504 <xsl:text>HELP_SCOPE_</xsl:text> 505 <xsl:value-of select="$sTmp2"/> 506 </xsl:template> 507 508 <!-- Calculates and emits indentation. --> 528 </xsl:if> 529 </xsl:template> 530 531 532 <!-- 533 Calculates and emits indentation. 534 --> 509 535 <xsl:template name="emit-indentation"> 510 <xsl:if test="ancestor::refsect1 ">536 <xsl:if test="ancestor::refsect1|ancestor::refsynopsisdiv"> 511 537 <xsl:text> </xsl:text> 512 538 </xsl:if> … … 527 553 </xsl:template> 528 554 529 <!-- Captializes the given text. --> 555 <!-- 556 Captializes the given text. 557 --> 530 558 <xsl:template name="capitalize"> 531 559 <xsl:param name="text"/> -
trunk/doc/manual/docbook-refentry-to-H-help.xsl
r56336 r56344 1 1 <?xml version="1.0"?> 2 2 <!-- 3 docbook-refentry-to-manual-sect1.xsl: 4 XSLT stylesheet for nicking the refsynopsisdiv bit of a 5 refentry (manpage) for use in the command overview section 6 in the user manual. 3 docbook-refentry-to-H-help.xsl: 4 XSLT stylesheet for generating command and sub-command 5 constants header for the built-in help. 7 6 8 7 Copyright (C) 2006-2015 Oracle Corporation … … 28 27 <xsl:strip-space elements="*"/> 29 28 29 <xsl:param name="g_sMode" select="not-specified"/> 30 30 31 31 32 <!-- Default action, do nothing. --> 32 33 <xsl:template match="node()|@*"/> 33 34 34 35 35 <!-- 36 main() - because we need to order the output in a specific manner 37 that is contrary to the data flow in the refentry, this is 38 going to look a bit more like a C program than a stylesheet. 36 Generate SCOPE enum for a refentry. We convert the 37 cmdsynopsisdiv/cmdsynopsis IDs into constants. 39 38 --> 40 39 <xsl:template match="refentry"> 41 < !-- Assert refetry expectations. -->42 <xsl:if test="not(./refsynopsisdiv)"> <xsl:message terminate="yes">refentry must have a refsynopsisdiv</xsl:message></xsl:if>43 <xsl:if test="not(./refentryinfo/title)"> <xsl:message terminate="yes">refentry must have a refentryinfo with title</xsl:message></xsl:if>44 <xsl:if test="not(./refsect1/title)"> <xsl:message terminate="yes">refentry must have a refsect1 with title</xsl:message></xsl:if>45 < xsl:if test="not(@id) or @id = ''"> <xsl:message terminate="yes">refentry must have an id attribute</xsl:message></xsl:if>40 <xsl:variable name="sBaseNm"> 41 <xsl:call-template name="str:to-upper"> 42 <xsl:with-param name="text" select="translate(substring-after(@id, '-'), '-', '_')"/> 43 </xsl:call-template> 44 </xsl:variable> 46 45 47 <!-- variables --> 48 <xsl:variable name="sBaseId" select="@id"/> 49 <xsl:variable name="sDataBaseSym" select="concat('g_', translate(@id, '-', '_'))"/> 46 <xsl:choose> 47 <!-- Generate subcommand enums and defines --> 48 <xsl:when test="$g_sMode = 'subcmd'"> 49 <xsl:text> 50 enum 51 { 52 #define HELP_SCOPE_</xsl:text> 53 <xsl:value-of select="$sBaseNm"/> 54 <xsl:value-of select="substring(' ',1,56 - string-length($sBaseNm) - 11)"/> 55 <xsl:text> RT_BIT_32(HELP_SCOPE_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>_BIT) 56 HELP_SCOPE_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>_BIT = 0</xsl:text> 57 <xsl:for-each select="./refsynopsisdiv/cmdsynopsis"> 58 <xsl:variable name="sSubNm"> 59 <xsl:text>HELP_SCOPE_</xsl:text> 60 <xsl:call-template name="str:to-upper"> 61 <xsl:with-param name="text" select="translate(substring-after(substring-after(@id, '-'), '-'), '-', '_')"/> 62 </xsl:call-template> 63 </xsl:variable> 64 <xsl:text>, 65 #define </xsl:text> 66 <xsl:value-of select="$sSubNm"/> 67 <xsl:value-of select="substring(' ',1,56 - string-length($sSubNm))"/> 68 <xsl:text> RT_BIT_32(</xsl:text><xsl:value-of select="$sSubNm"/><xsl:text>_BIT) 69 </xsl:text><xsl:value-of select="$sSubNm"/><xsl:text>_BIT</xsl:text> 70 </xsl:for-each> 50 71 51 52 <!-- 53 Convert the refsynopsisdiv into REFENTRY::Synopsis data. 54 --> 55 <xsl:text> 56 57 static const REFENTRYSTR </xsl:text><xsl:value-of select="$sDataBaseSym"/><xsl:text>_synopsis[] = 58 {</xsl:text> 59 <xsl:for-each select="./refsynopsisdiv/cmdsynopsis"> 60 <!-- Assert synopsis expectations --> 61 <xsl:if test="not(@id) or substring-before(@id, '-') != 'synopsis'"> 62 <xsl:message terminate="yes">The refsynopsisdiv/cmdsynopsis elements must have an id starting with 'synopsis-'.</xsl:message> 63 </xsl:if> 64 <xsl:if test="not(../../refsect1/refsect2[@id=./@id])"> 65 <xsl:message terminate="yes">No refsect2 with id="<xsl:value-of select="@id"/>" found.</xsl:message> 66 </xsl:if> 67 68 <!-- Do the work. --> 69 <xsl:apply-templates select="."/> 70 71 </xsl:for-each> 72 <xsl:text> 73 };</xsl:text> 74 75 76 <!-- 77 Convert the whole manpage to help text. 78 --> 79 <xsl:text> 80 static const REFENTRYSTR </xsl:text><xsl:value-of select="$sDataBaseSym"/><xsl:text>_full_help[] = 81 {</xsl:text> 82 <!-- We start by combining the refentry title and the refpurpose into a short description. --> 83 <xsl:text> 84 { </xsl:text><xsl:call-template name="calc-scope"/><xsl:text>, 85 "</xsl:text> 86 <xsl:apply-templates select="./refentryinfo/title/node()"/> 87 <xsl:text> -- </xsl:text> 88 <xsl:call-template name="capitalize"> 89 <xsl:with-param name="text"> 90 <xsl:apply-templates select="./refnamediv/refpurpose/node()"/> 91 </xsl:with-param> 92 </xsl:call-template> 93 <xsl:text>." }, 94 { REFENTRYSTR_SCOPE_SAME, "" },</xsl:text> 95 96 <!-- The follows the usage (synopsis) section. --> 97 <xsl:text> 98 { REFENTRYSTR_SCOPE_GLOBAL, 99 "Usage:" },</xsl:text> 100 <xsl:apply-templates select="./refsynopsisdiv/node()"/> 101 102 <!-- Then comes the description and other refsect1 --> 103 <xsl:for-each select="./refsect1"> 104 <xsl:if test="name(*[1]) != 'title'"><xsl:message terminate="yes">Expected title as the first element in refsect1.</xsl:message></xsl:if> 105 <xsl:if test="text()"><xsl:message terminate="yes">No text supported in refsect1.</xsl:message></xsl:if> 106 <xsl:if test="not(./remark[@role='help-skip'])"> 107 <xsl:text> 108 { </xsl:text><xsl:call-template name="calc-scope-refsect1"/><xsl:text>, "" }, 109 { REFENTRYSTR_SCOPE_SAME, 110 "</xsl:text><xsl:apply-templates select="title/node()"/><xsl:text>:" },</xsl:text> 111 <xsl:apply-templates select="./*[position() > 1]"/> 112 </xsl:if> 113 </xsl:for-each> 114 115 <xsl:text> 116 };</xsl:text> 117 118 <!-- 119 Generate the refentry structure. 120 --> 121 <xsl:text> 122 static const REFENTRY </xsl:text><xsl:value-of select="$sDataBaseSym"/><xsl:text> = 123 { 124 /* .idinternal = */ HELP_CMD_</xsl:text> 125 <xsl:call-template name="str:to-upper"> 126 <xsl:with-param name="text" select="translate(substring-after(@id, '-'), '-', '_')"/> 127 </xsl:call-template> 128 <xsl:text>, 129 /* .Synopsis = */ { </xsl:text> 130 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_synopsis, RT_ELEMENTS(</xsl:text> 131 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_synopsis) }, 132 /* .Help = */ { </xsl:text> 133 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_full_help, RT_ELEMENTS(</xsl:text> 134 <xsl:value-of select="$sDataBaseSym"/><xsl:text>_full_help) }, 135 /* pszBrief = */ "</xsl:text> 136 <xsl:apply-templates select="./refnamediv/refpurpose/node()"/> 137 <xsl:text>" 72 <xsl:text>, 73 HELP_SCOPE_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>_END 138 74 }; 139 75 </xsl:text> 140 </xsl:template>141 142 143 <!--144 Convert command synopsis to text.145 -->146 <xsl:template match="cmdsynopsis">147 <xsl:if test="text()"><xsl:message terminate="yes">cmdsynopsis with text is not supported.</xsl:message></xsl:if>148 <xsl:text>149 { </xsl:text><xsl:call-template name="calc-scope-cmdsynopsis"/><xsl:text>,150 "</xsl:text><xsl:call-template name="emit-indentation"/><xsl:apply-templates select="*|@*"/><xsl:text>" },</xsl:text>151 </xsl:template>152 153 <xsl:template match="sbr">154 <xsl:text>" },155 { REFENTRYSTR_SCOPE_SAME,156 " </xsl:text><xsl:call-template name="emit-indentation"/>157 </xsl:template>158 159 <xsl:template match="command|option|computeroutput">160 <xsl:apply-templates select="node()|@*"/>161 </xsl:template>162 163 <xsl:template match="replaceable">164 <xsl:text><</xsl:text>165 <xsl:apply-templates select="node()|@*"/>166 <xsl:text>></xsl:text>167 </xsl:template>168 169 <xsl:template match="arg|group">170 <!-- separator char if we're not the first child -->171 <xsl:if test="position() > 1">172 <xsl:choose>173 <xsl:when test="ancestor-or-self::*/@sepchar"><xsl:value-of select="ancestor-or-self::*/@sepchar"/></xsl:when>174 <xsl:otherwise><xsl:text> </xsl:text></xsl:otherwise>175 </xsl:choose>176 </xsl:if>177 <!-- open wrapping -->178 <xsl:choose>179 <xsl:when test="@choice = 'opt' or not(@choice) or @choice = ''"> <xsl:text>[</xsl:text></xsl:when>180 <xsl:when test="@choice = 'req'"> <xsl:text></xsl:text></xsl:when>181 <xsl:when test="@choice = 'plain'"/>182 <xsl:otherwise><xsl:message terminate="yes">Invalid arg choice: "<xsl:value-of select="@choice"/>"</xsl:message></xsl:otherwise>183 </xsl:choose>184 <!-- render the arg (TODO: may need to do more work here) -->185 <xsl:apply-templates select="node()|@*"/>186 <!-- repeat wrapping -->187 <xsl:choose>188 <xsl:when test="@rep = 'norepeat' or not(@rep) or @rep = ''"/>189 <xsl:when test="@rep = 'repeat'"> <xsl:text>...</xsl:text></xsl:when>190 <xsl:otherwise><xsl:message terminate="yes">Invalid rep choice: "<xsl:value-of select="@rep"/>"</xsl:message></xsl:otherwise>191 </xsl:choose>192 <!-- close wrapping -->193 <xsl:choose>194 <xsl:when test="@choice = 'opt' or not(@choice) or @choice = ''"> <xsl:text>]</xsl:text></xsl:when>195 <xsl:when test="@choice = 'req'"> <xsl:text></xsl:text></xsl:when>196 </xsl:choose>197 </xsl:template>198 199 200 <!--201 refsect2202 -->203 <xsl:template match="refsect2">204 <!-- assertions -->205 <xsl:if test="text()"><xsl:message terminate="yes">refsect2 shouldn't contain text</xsl:message></xsl:if>206 <xsl:if test="count(./cmdsynopsis) > 1"><xsl:message terminate="yes">Only a single cmdsynopsis is currently supported in a refsect2.</xsl:message></xsl:if>207 <xsl:if test="count(./title) > 1"><xsl:message terminate="yes">Only a single title in refsect2</xsl:message></xsl:if>208 209 <!-- title / command synopsis - sets the scope. -->210 <xsl:text>211 { </xsl:text><xsl:call-template name="calc-scope-refsect2"/><xsl:text>,212 "</xsl:text><xsl:call-template name="emit-indentation"/>213 <xsl:choose>214 <xsl:when test="name(./*[1]) = 'cmdsynopsis'">215 <xsl:text> </xsl:text>216 <xsl:apply-templates select="./cmdsynopsis/node()|./cmdsynopsis/@*"/>217 </xsl:when>218 <xsl:when test="name(./*[1]) = 'title'">219 <xsl:apply-templates select="./title/text()"/>220 </xsl:when>221 <xsl:otherwise>222 <xsl:message terminate="yes">Expected either a title or cmdsynopsis as the first element in a refsect2.223 (Put scoping remarks after.)</xsl:message>224 </xsl:otherwise>225 </xsl:choose>226 <xsl:text>" },</xsl:text>227 228 <!-- Format the text in the section -->229 <xsl:apply-templates select="./*[position() > 1]"/>230 231 <!-- Add a blank line, unless we're the last element in this refsect1. -->232 <xsl:if test="position() != last()">233 <xsl:text>234 { REFENTRYSTR_SCOPE_SAME, "" },</xsl:text>235 </xsl:if>236 </xsl:template>237 238 239 <!--240 para241 -->242 <xsl:template match="para">243 <xsl:if test="position() != 1 or not(parent::listitem)">244 <xsl:text>245 { REFENTRYSTR_SCOPE_SAME, "" },</xsl:text>246 </xsl:if>247 <xsl:call-template name="process-mixed"/>248 </xsl:template>249 250 251 <!--252 variablelist253 -->254 <xsl:template match="variablelist">255 <xsl:if test="*[not(self::varlistentry)]|text()">256 <xsl:message terminate="yes">Only varlistentry elements are supported in variablelist</xsl:message>257 </xsl:if>258 <xsl:for-each select="./varlistentry">259 <xsl:if test="count(*) != 2 or not(term) or not(listitem)">260 <xsl:message terminate="yes">Expected exactly one term and one listentry member in varlistentry element.</xsl:message>261 </xsl:if>262 <xsl:apply-templates select="*"/>263 </xsl:for-each>264 </xsl:template>265 266 <xsl:template match="varlistentry/term">267 <xsl:call-template name="process-mixed"/>268 </xsl:template>269 270 <xsl:template match="varlistentry/listitem">271 <xsl:if test="text() or *[not(self::para)]">272 <xsl:message terminate="yes">Expected varlistentry/listitem to only contain para elements</xsl:message>273 </xsl:if>274 <xsl:apply-templates select="*"/>275 </xsl:template>276 277 278 <!--279 Text escaping for C.280 -->281 <xsl:template match="text()" name="escape_text">282 <xsl:choose>283 284 <xsl:when test="contains(., '\') or contains(., '"')">285 <xsl:variable name="sTmp">286 <xsl:call-template name="str:subst">287 <xsl:with-param name="text" select="normalize-space(.)"/>288 <xsl:with-param name="replace" select="'\'"/>289 <xsl:with-param name="with" select="'\\'"/>290 <xsl:with-param name="disable-output-escaping" select="yes"/>291 </xsl:call-template>292 </xsl:variable>293 <xsl:call-template name="str:subst">294 <xsl:with-param name="text" select="$sTmp"/>295 <xsl:with-param name="replace" select="'"'"/>296 <xsl:with-param name="with" select="'\"'"/>297 <xsl:with-param name="disable-output-escaping" select="yes"/>298 </xsl:call-template>299 76 </xsl:when> 300 77 78 <!-- Generate command enum value. --> 79 <xsl:when test="$g_sMode = 'cmd'"> 80 <xsl:text> HELP_CMD_</xsl:text><xsl:value-of select="$sBaseNm"/><xsl:text>, 81 </xsl:text> 82 </xsl:when> 83 84 <!-- Shouldn't happen. --> 301 85 <xsl:otherwise> 302 <xsl: value-of select="normalize-space(.)"/>86 <xsl:message terminate="yes">Bad or missing g_sMode string parameter value.</xsl:message> 303 87 </xsl:otherwise> 304 88 </xsl:choose> 305 89 </xsl:template> 306 90 307 <!-- Elements producing non-breaking strings (single line). -->308 <xsl:template match="command/text()|option/text()|computeroutput/text()" name="escape_fixed_text">309 <xsl:choose>310 311 <xsl:when test="contains(., '\') or contains(., '"')">312 <xsl:variable name="sTmp1">313 <xsl:call-template name="str:subst">314 <xsl:with-param name="text" select="."/>315 <xsl:with-param name="replace" select="'\'"/>316 <xsl:with-param name="with" select="'\\'"/>317 <xsl:with-param name="disable-output-escaping" select="yes"/>318 </xsl:call-template>319 </xsl:variable>320 <xsl:variable name="sTmp2">321 <xsl:call-template name="str:subst">322 <xsl:with-param name="text" select="$sTmp1"/>323 <xsl:with-param name="replace" select="'"'"/>324 <xsl:with-param name="with" select="'\"'"/>325 <xsl:with-param name="disable-output-escaping" select="yes"/>326 </xsl:call-template>327 </xsl:variable>328 <xsl:call-template name="str:subst">329 <xsl:with-param name="text" select="$sTmp2"/>330 <xsl:with-param name="replace" select="' '"/>331 <xsl:with-param name="with" select="'\b'"/>332 <xsl:with-param name="disable-output-escaping" select="yes"/>333 </xsl:call-template>334 </xsl:when>335 336 <xsl:when test="contains(., ' ')">337 <xsl:call-template name="str:subst">338 <xsl:with-param name="text" select="."/>339 <xsl:with-param name="replace" select="' '"/>340 <xsl:with-param name="with" select="'\b'"/>341 <xsl:with-param name="disable-output-escaping" select="yes"/>342 </xsl:call-template>343 </xsl:when>344 345 <xsl:otherwise>346 <xsl:value-of select="."/>347 </xsl:otherwise>348 </xsl:choose>349 </xsl:template>350 351 352 <!--353 Unsupported elements and elements handled directly.354 -->355 <xsl:template match="synopfragment|synopfragmentref|title|refsect1">356 <xsl:message terminate="yes">The <xsl:value-of select="name()"/> element is not supported</xsl:message>357 </xsl:template>358 359 <!--360 Fail on misplaced scoping remarks.361 -->362 <xsl:template match="remark[@role = 'help-scope']">363 <xsl:choose>364 <xsl:when test="parent::refsect1"/>365 <xsl:when test="parent::refsect2"/>366 <xsl:when test="parent::cmdsynopsis and ancestor::refsynopsisdiv"/>367 <xsl:otherwise>368 <xsl:message terminate="yes">Misplaced remark/@role=help-scope element.369 Only supported on: refsect1, refsect2, refsynopsisdiv/cmdsynopsis</xsl:message>370 </xsl:otherwise>371 </xsl:choose>372 </xsl:template>373 374 <!--375 Warn about unhandled elements376 -->377 <xsl:template match="*">378 <xsl:message terminate="no">Warning: Unhandled element: <xsl:value-of select="name(.)"/></xsl:message>379 </xsl:template>380 381 382 <!--383 Functions384 Functions385 Functions386 -->387 388 <!--389 Processes mixed children, i.e. both text and regular elements.390 Normalizes whitespace. -->391 <xsl:template name="process-mixed">392 <xsl:text>393 { REFENTRYSTR_SCOPE_SAME,394 "</xsl:text><xsl:call-template name="emit-indentation"/>395 396 <xsl:for-each select="node()[not(self::remark)]">397 <xsl:if test="position() != 1">398 <xsl:text> </xsl:text>399 </xsl:if>400 <xsl:choose>401 <xsl:when test="name() = ''">402 <xsl:call-template name="escape_text"/>403 </xsl:when>404 <xsl:otherwise>405 <xsl:apply-templates select="."/>406 </xsl:otherwise>407 </xsl:choose>408 </xsl:for-each>409 410 <xsl:text>" },</xsl:text>411 </xsl:template>412 413 414 <!-- TODO: scoping must be reworked! -->415 <!-- Figures out the scope of a refsect1 element. -->416 <xsl:template name="calc-scope-refsect1">417 <xsl:choose>418 <xsl:when test="title[text() = 'Description']">419 <xsl:text>REFENTRYSTR_SCOPE_GLOBAL</xsl:text>420 </xsl:when>421 <xsl:otherwise>422 <xsl:call-template name="calc-scope"/>423 </xsl:otherwise>424 </xsl:choose>425 </xsl:template>426 427 <!-- Figures out the scope of a refsect2 element. -->428 <xsl:template name="calc-scope-refsect2">429 <xsl:choose>430 <xsl:when test="0">431 <xsl:text>REFENTRYSTR_SCOPE_GLOBAL</xsl:text>432 </xsl:when>433 <xsl:otherwise>434 <xsl:call-template name="calc-scope"/>435 </xsl:otherwise>436 </xsl:choose>437 </xsl:template>438 439 <!-- Figures out the scope of a refsect1 element. -->440 <xsl:template name="calc-scope-cmdsynopsis">441 <xsl:choose>442 <xsl:when test="ancestor::refsynopsisdiv">443 <xsl:call-template name="calc-scope"/>444 </xsl:when>445 <xsl:otherwise>446 <xsl:text>REFENTRYSTR_SCOPE_SAME</xsl:text>447 </xsl:otherwise>448 </xsl:choose>449 </xsl:template>450 451 <!-- Figures out the scope of an element. -->452 <xsl:template name="calc-scope">453 <xsl:param name="a_Element" select="."/>454 <xsl:param name="a_cRecursions" select="'1'"/>455 <xsl:variable name="ScopeRemark" select="$a_Element/remark[@role='help-scope']"/>456 457 <xsl:choose>458 <!-- Check for an explicit scope remark: <remark role='scope' condition='uninstall'/> -->459 <xsl:when test="$ScopeRemark">460 <xsl:if test="not($ScopeRemark/@condition)">461 <xsl:message terminate="yes">remark[role=scope] element must have a condition attribute.</xsl:message>462 </xsl:if>463 464 <xsl:call-template name="calc-scope-const">465 <xsl:with-param name="sId" select="concat(concat(ancestor::refentry[1]/@id, '-'), $ScopeRemark/@condition)"/>466 </xsl:call-template>467 </xsl:when>468 469 <!-- Try derive it from the @id tag, if any. -->470 <xsl:when test="substring(@id, 1, 3) = 'vbox'">471 <xsl:call-template name="calc-scope-const">472 <xsl:with-param name="sId" select="$a_Element/@id"/>473 </xsl:call-template>474 </xsl:when>475 <xsl:when test="@id">476 <xsl:call-template name="calc-scope-const">477 <xsl:with-param name="sId" select="substring-after($a_Element/@id, '-')"/>478 </xsl:call-template>479 </xsl:when>480 481 <!-- Recursively try the parent element. -->482 <xsl:when test="($a_cRecursions) > 10">483 <xsl:message terminal="yes">calc-scope recursion too deep.</xsl:message>484 </xsl:when>485 <xsl:otherwise>486 <xsl:call-template name="calc-scope">487 <xsl:with-param name="a_Element" select="$a_Element/.."/>488 <xsl:with-param name="a_cRecursions" select="$a_cRecursions + 1"/>489 </xsl:call-template>490 </xsl:otherwise>491 </xsl:choose>492 </xsl:template>493 494 <!-- Calculates a scope constant from a ID like value. -->495 <xsl:template name="calc-scope-const">496 <xsl:param name="sId" select="@id"/>497 <xsl:if test="$sId = ''"><xsl:message terminate="yes">refentry: command Missing </xsl:message></xsl:if>498 <xsl:variable name="sTmp1" select="translate($sId, '-', '_')"/>499 <xsl:variable name="sTmp2">500 <xsl:call-template name="str:to-upper">501 <xsl:with-param name="text" select="$sTmp1"/>502 </xsl:call-template>503 </xsl:variable>504 <xsl:text>HELP_SCOPE_</xsl:text>505 <xsl:value-of select="$sTmp2"/>506 </xsl:template>507 508 <!-- Calculates and emits indentation. -->509 <xsl:template name="emit-indentation">510 <xsl:if test="ancestor::refsect1">511 <xsl:text> </xsl:text>512 </xsl:if>513 <xsl:if test="ancestor::refsect2">514 <xsl:text> </xsl:text>515 </xsl:if>516 <xsl:if test="ancestor::refsect3">517 <xsl:text> </xsl:text>518 </xsl:if>519 <xsl:if test="ancestor::varlistentry">520 <xsl:if test="ancestor-or-self::term">521 <xsl:text> </xsl:text>522 </xsl:if>523 <xsl:if test="ancestor-or-self::listitem">524 <xsl:text> </xsl:text>525 </xsl:if>526 </xsl:if>527 </xsl:template>528 529 <!-- Captializes the given text. -->530 <xsl:template name="capitalize">531 <xsl:param name="text"/>532 <xsl:call-template name="str:to-upper">533 <xsl:with-param name="text" select="substring($text,1,1)"/>534 </xsl:call-template>535 <xsl:value-of select="substring($text,2)"/>536 </xsl:template>537 538 91 </xsl:stylesheet> 539 92 -
trunk/doc/manual/en_US/man_VBoxManage_debugvm.xml
r56336 r56344 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <!-- 3 manpage, user manual, usage: VBoxManage extpack3 manpage, user manual, usage: VBoxManage debugvm 4 4 5 5 Copyright (C) 2006-2015 Oracle Corporation … … 14 14 --> 15 15 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"> 16 <refentry id="vboxmanage- extpack" lang="en">16 <refentry id="vboxmanage-debugvm" lang="en"> 17 17 18 18 <refentryinfo> 19 19 <pubdate>$Date$</pubdate> 20 <title>VBoxManage extpack</title>20 <title>VBoxManage debugvm</title> 21 21 </refentryinfo> 22 22 … … 26 26 27 27 <refnamediv> 28 <refname>VBoxManage- extpack</refname>28 <refname>VBoxManage-debugvm</refname> 29 29 <refpurpose>extension package management</refpurpose> 30 30 <refclass>Oracle VM VirtualBox</refclass> … … 32 32 33 33 <refsynopsisdiv> 34 <cmdsynopsis id="synopsis-vboxmanage- extpack-install"> <!-- The 'id' is mandatory and must start with 'synopsis-'. -->35 <command>VBoxManage extpackinstall</command>34 <cmdsynopsis id="synopsis-vboxmanage-debugvm-install"> <!-- The 'id' is mandatory and must start with 'synopsis-'. --> 35 <command>VBoxManage debugvm install</command> 36 36 <arg>--replace</arg> 37 37 <arg choice="req"><replaceable>tarball</replaceable></arg> 38 38 </cmdsynopsis> 39 <cmdsynopsis id="synopsis-vboxmanage- extpack-uninstall">40 <command>VBoxManage extpackuninstall</command>39 <cmdsynopsis id="synopsis-vboxmanage-debugvm-uninstall"> 40 <command>VBoxManage debugvm uninstall</command> 41 41 <arg>--force</arg> 42 42 <arg choice="req"><replaceable>name</replaceable></arg> 43 43 </cmdsynopsis> 44 <cmdsynopsis id="synopsis-vboxmanage- extpack-cleanup">45 <command>VBoxManage extpackcleanup</command>44 <cmdsynopsis id="synopsis-vboxmanage-debugvm-cleanup"> 45 <command>VBoxManage debugvm cleanup</command> 46 46 </cmdsynopsis> 47 47 </refsynopsisdiv> … … 50 50 <title>Description</title> 51 51 52 <refsect2 id="vboxmanage- extpack-install">52 <refsect2 id="vboxmanage-debugvm-install"> 53 53 <cmdsynopsis> 54 <command>VBoxManage extpackinstall</command>54 <command>VBoxManage debugvm install</command> 55 55 <arg>--replace</arg> 56 56 <arg choice="req"><replaceable>tarball</replaceable></arg> … … 75 75 </refsect2> 76 76 77 <refsect2 id="vboxmanage- extpack-uninstall">77 <refsect2 id="vboxmanage-debugvm-uninstall"> 78 78 <cmdsynopsis> 79 <command>VBoxManage extpackuninstall</command>79 <command>VBoxManage debugvm uninstall</command> 80 80 <arg>--force</arg> 81 81 <arg choice="req"><replaceable>name</replaceable></arg> … … 84 84 Uninstalls an extension pack from the system. The subcommand will also succeed 85 85 in the case where the specified extension pack is not present on the system. 86 You can use <computeroutput>VBoxManage list extpacks</computeroutput> to show86 You can use <computeroutput>VBoxManage list debugvms</computeroutput> to show 87 87 the names of the extension packs which are currently installed. 88 88 </para> … … 103 103 </refsect2> 104 104 105 <refsect2 id="vboxmanage- extpack-cleanup">105 <refsect2 id="vboxmanage-debugvm-cleanup"> 106 106 <cmdsynopsis> 107 <command>VBoxManage extpackcleanup</command>107 <command>VBoxManage debugvm cleanup</command> 108 108 </cmdsynopsis> 109 109 <para> … … 115 115 </refsect1> 116 116 117 <!-- TODO examples118 <para>The following commands show examples how to list extension packs and119 remove one:<screen>120 $ VBoxManage list extpacks121 Extension Packs: 1122 Pack no. 0: Oracle VM VirtualBox Extension Pack123 Version: 4.1.12124 Revision: 77218125 Edition:126 Description: USB 2.0 Host Controller, VirtualBox RDP, PXE ROM with E1000 support.127 VRDE Module: VBoxVRDP128 Usable: true129 Why unusable:130 $ VBoxManage extpack uninstall "Oracle VM VirtualBox Extension Pack"131 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%132 Successfully uninstalled "Oracle VM VirtualBox Extension Pack".</screen></para>133 -->134 135 117 </refentry> 136 118
Note:
See TracChangeset
for help on using the changeset viewer.