Changeset 89642 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- Jun 13, 2021 1:38:33 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 145087
- Location:
- trunk/src/VBox/ValidationKit/utils/audio
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/utils/audio/vkat.cpp
r89641 r89642 734 734 735 735 736 const VKATCMD g_CmdTest = 737 { 738 "test", 739 audioTestMain, 740 "Runs audio tests and creates an audio test set.", 741 g_aCmdTestOptions, 742 RT_ELEMENTS(g_aCmdTestOptions), 743 audioTestCmdTestHelp 744 }; 745 746 736 747 /********************************************************************************************************************************* 737 748 * Command: verify * … … 895 906 896 907 908 const VKATCMD g_CmdVerify = 909 { 910 "verify", 911 audioVerifyMain, 912 "Verifies a formerly created audio test set.", 913 g_aCmdVerifyOptions, 914 RT_ELEMENTS(g_aCmdVerifyOptions), 915 NULL, 916 }; 917 918 897 919 /********************************************************************************************************************************* 898 920 * Main * … … 914 936 } 915 937 916 const VKATCMD g_aCommands[] = 917 { 918 { 919 "test", audioTestMain, 920 "Runs audio tests and creates an audio test set.", 921 g_aCmdTestOptions, RT_ELEMENTS(g_aCmdTestOptions), audioTestCmdTestHelp 922 }, 923 { 924 "verify", audioVerifyMain, 925 "Verifies a formerly created audio test set.", 926 g_aCmdVerifyOptions, RT_ELEMENTS(g_aCmdVerifyOptions), NULL, 927 }, 928 g_cmdEnum, 929 g_cmdPlay, 930 g_cmdRec, 931 g_cmdSelfTest 938 /** 939 * Commands. 940 */ 941 const VKATCMD *g_apCommands[] = 942 { 943 &g_CmdTest, 944 &g_CmdVerify, 945 &g_CmdEnum, 946 &g_CmdPlay, 947 &g_CmdRec, 948 &g_CmdSelfTest 932 949 }; 933 950 … … 956 973 ); 957 974 958 for (uintptr_t iCmd = 0; iCmd < RT_ELEMENTS(g_aCommands); iCmd++) 959 { 975 for (uintptr_t iCmd = 0; iCmd < RT_ELEMENTS(g_apCommands); iCmd++) 976 { 977 PCVKATCMD const pCmd = g_apCommands[iCmd]; 960 978 RTStrmPrintf(pStrm, 961 979 "\n" … … 963 981 " %s\n" 964 982 "Options for '%s':\n", 965 g_aCommands[iCmd].pszCommand, g_aCommands[iCmd].pszDesc, g_aCommands[iCmd].pszCommand);966 PCRTGETOPTDEF const paOptions = g_aCommands[iCmd].paOptions;967 for (unsigned i = 0; i < g_aCommands[iCmd].cOptions; i++)983 pCmd->pszCommand, pCmd->pszDesc, pCmd->pszCommand); 984 PCRTGETOPTDEF const paOptions = pCmd->paOptions; 985 for (unsigned i = 0; i < pCmd->cOptions; i++) 968 986 { 969 987 if (RT_C_IS_PRINT(paOptions[i].iShort)) … … 973 991 974 992 const char *pszHelp = NULL; 975 if ( g_aCommands[iCmd].pfnOptionHelp)976 pszHelp = g_aCommands[iCmd].pfnOptionHelp(&paOptions[i]);993 if (pCmd->pfnOptionHelp) 994 pszHelp = pCmd->pfnOptionHelp(&paOptions[i]); 977 995 if (pszHelp) 978 996 RTStrmPrintf(pStrm, " %s\n", pszHelp); … … 1075 1093 case VINF_GETOPT_NOT_OPTION: 1076 1094 { 1077 for (uintptr_t i = 0; i < RT_ELEMENTS(g_aCommands); i++) 1078 if (strcmp(ValueUnion.psz, g_aCommands[i].pszCommand) == 0) 1095 for (uintptr_t iCmd = 0; iCmd < RT_ELEMENTS(g_apCommands); iCmd++) 1096 { 1097 PCVKATCMD const pCmd = g_apCommands[iCmd]; 1098 if (strcmp(ValueUnion.psz, pCmd->pszCommand) == 0) 1079 1099 { 1080 size_t const cCombinedOptions = g_aCommands[i].cOptions + RT_ELEMENTS(g_aCmdCommonOptions);1100 size_t const cCombinedOptions = pCmd->cOptions + RT_ELEMENTS(g_aCmdCommonOptions); 1081 1101 PRTGETOPTDEF paCombinedOptions = (PRTGETOPTDEF)RTMemAlloc(cCombinedOptions * sizeof(RTGETOPTDEF)); 1082 1102 if (paCombinedOptions) … … 1084 1104 memcpy(paCombinedOptions, g_aCmdCommonOptions, sizeof(g_aCmdCommonOptions)); 1085 1105 memcpy(&paCombinedOptions[RT_ELEMENTS(g_aCmdCommonOptions)], 1086 g_aCommands[i].paOptions, g_aCommands[i].cOptions * sizeof(RTGETOPTDEF));1106 pCmd->paOptions, pCmd->cOptions * sizeof(RTGETOPTDEF)); 1087 1107 1088 1108 rc = RTGetOptInit(&GetState, argc, argv, paCombinedOptions, cCombinedOptions, … … 1091 1111 { 1092 1112 1093 rcExit = g_aCommands[i].pfnHandler(&GetState);1113 rcExit = pCmd->pfnHandler(&GetState); 1094 1114 RTMemFree(paCombinedOptions); 1095 1115 return rcExit; … … 1099 1119 return RTMsgErrorExitFailure("Out of memory!"); 1100 1120 } 1121 } 1101 1122 RTMsgError("Unknown command '%s'!\n", ValueUnion.psz); 1102 1123 audioTestUsage(g_pStdErr); -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdGeneric.cpp
r89641 r89642 149 149 * Command table entry for 'enum'. 150 150 */ 151 const VKATCMD g_ cmdEnum =151 const VKATCMD g_CmdEnum = 152 152 { 153 153 "enum", … … 478 478 * Command table entry for 'play'. 479 479 */ 480 const VKATCMD g_ cmdPlay =480 const VKATCMD g_CmdPlay = 481 481 { 482 482 "play", … … 858 858 * Command table entry for 'rec'. 859 859 */ 860 const VKATCMD g_ cmdRec =860 const VKATCMD g_CmdRec = 861 861 { 862 862 "rec", -
trunk/src/VBox/ValidationKit/utils/audio/vkatCmdSelfTest.cpp
r89617 r89642 329 329 } 330 330 331 const VKATCMD g_cmdSelfTest = 332 { 333 "selftest", audioTestCmdSelftestHandler, 331 /** 332 * Command table entry for 'selftest'. 333 */ 334 const VKATCMD g_CmdSelfTest = 335 { 336 "selftest", 337 audioTestCmdSelftestHandler, 334 338 "Performs self-tests.", 335 s_aCmdSelftestOptions, RT_ELEMENTS(s_aCmdSelftestOptions), audioTestCmdSelftestHelp, 339 s_aCmdSelftestOptions, 340 RT_ELEMENTS(s_aCmdSelftestOptions), 341 audioTestCmdSelftestHelp, 336 342 }; 337 343 -
trunk/src/VBox/ValidationKit/utils/audio/vkatInternal.h
r89641 r89642 363 363 DECLCALLBACKMEMBER(const char *, pfnOptionHelp,(PCRTGETOPTDEF pOpt)); 364 364 } VKATCMD; 365 /** Pointer to a single VKAT command. */366 typedef VKATCMD *PVKATCMD;367 368 extern const VKATCMD g_ cmdEnum;369 extern const VKATCMD g_ cmdPlay;370 extern const VKATCMD g_ cmdRec;371 extern const VKATCMD g_ cmdSelfTest;365 /** Pointer to a const VKAT command entry. */ 366 typedef VKATCMD const *PCVKATCMD; 367 368 extern const VKATCMD g_CmdEnum; 369 extern const VKATCMD g_CmdPlay; 370 extern const VKATCMD g_CmdRec; 371 extern const VKATCMD g_CmdSelfTest; 372 372 373 373 extern AUDIOTESTDESC g_aTests[];
Note:
See TracChangeset
for help on using the changeset viewer.