| 1 |
{ |
| 2 |
Copyright 2023-2023 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Command-line parameters processing of CGE tester. } |
| 17 |
unit CastleTesterParameters; |
| 18 |
|
| 19 |
interface |
| 20 |
|
| 21 |
var |
| 22 |
ParamNoWindowCreate: Boolean = false; |
| 23 |
ParamConsole: Boolean = false; |
| 24 |
ParamFilter: String = ''; |
| 25 |
|
| 26 |
procedure TesterParseParameters; |
| 27 |
|
| 28 |
implementation |
| 29 |
|
| 30 |
uses CastleUtils, CastleParameters; |
| 31 |
|
| 32 |
const |
| 33 |
Options: array [0..2] of TOption = ( |
| 34 |
(Short: 'f'; Long: 'filter'; Argument: oaRequired), |
| 35 |
(Short: #0; Long: 'console'; Argument: oaNone), |
| 36 |
(Short: #0; Long: 'no-window-create'; Argument: oaNone) |
| 37 |
); |
| 38 |
|
| 39 |
procedure OptionProc(OptionNum: Integer; HasArgument: boolean; |
| 40 |
const Argument: string; const SeparateArgs: TSeparateArgs; Data: Pointer); |
| 41 |
begin |
| 42 |
case OptionNum of |
| 43 |
0: ParamFilter := Argument; |
| 44 |
1: ParamConsole := true; |
| 45 |
2: ParamNoWindowCreate := true; |
| 46 |
else raise EInternalError.CreateFmt('OptionProc: OptionNum = %d', [OptionNum]); |
| 47 |
end; |
| 48 |
end; |
| 49 |
|
| 50 |
procedure TesterParseParameters; |
| 51 |
begin |
| 52 |
Parameters.Parse(Options, @OptionProc, nil, false); |
| 53 |
Parameters.CheckHigh(0); // check no excessive parameters |
| 54 |
end; |
| 55 |
|
| 56 |
end. |