hedgewars/ArgParsers.pas
branchqmlfrontend
changeset 11699 83c40c1eb0e7
parent 11544 b69f5f22a3ba
parent 11680 5ce2cf06b531
child 11828 a69124eb7ce7
equal deleted inserted replaced
11634:0af93f018701 11699:83c40c1eb0e7
    20 
    20 
    21 unit ArgParsers;
    21 unit ArgParsers;
    22 interface
    22 interface
    23 
    23 
    24 procedure GetParams;
    24 procedure GetParams;
    25 {$IFDEF HWLIBRARY}
       
    26 {$IFNDEF BSD}
    25 {$IFNDEF BSD}
    27 var operatingsystem_parameter_argc: NativeInt; external;
    26 var operatingsystem_parameter_argc: NativeInt; external;
    28     operatingsystem_parameter_argv: pointer; external;
    27     operatingsystem_parameter_argv: pointer; external;
    29     operatingsystem_parameter_envp: pointer; external;
    28     operatingsystem_parameter_envp: pointer; external;
    30 {$ELSE}
    29 {$ELSE}
    31 var operatingsystem_parameter_argc: LongInt; export;
    30 var operatingsystem_parameter_argc: LongInt; export;
    32     operatingsystem_parameter_argv: pointer; export;
    31     operatingsystem_parameter_argv: pointer; export;
    33     operatingsystem_parameter_envp: pointer; export;
    32     operatingsystem_parameter_envp: pointer; export;
    34 {$ENDIF}
    33 {$ENDIF}
       
    34 
    35 function ParamCount: LongInt;
    35 function ParamCount: LongInt;
    36 function ParamStr(i: LongInt): shortstring;
    36 function ParamStr(i: LongInt): shortstring;
    37 {$ENDIF}
       
    38 
    37 
    39 implementation
    38 implementation
    40 uses uVariables, uTypes, uUtils, uSound, uConsts;
    39 uses uVariables, uTypes, uUtils, uSound, uConsts;
    41 var isInternal: Boolean;
    40 var isInternal: Boolean;
    42 
    41 
    43 {$IFDEF HWLIBRARY}
       
    44 
       
    45 type PCharArray = array[0..255] of PChar;
    42 type PCharArray = array[0..255] of PChar;
    46      PPCharArray = ^PCharArray;
    43      PPCharArray = ^PCharArray;
    47 
    44 
    48 function ParamCount: LongInt;
    45 function ParamCount: LongInt;
    49 begin
    46 begin
    52 
    49 
    53 function ParamStr(i: LongInt): shortstring;
    50 function ParamStr(i: LongInt): shortstring;
    54 begin
    51 begin
    55     ParamStr:= StrPas(PPCharArray(operatingsystem_parameter_argv)^[i])
    52     ParamStr:= StrPas(PPCharArray(operatingsystem_parameter_argv)^[i])
    56 end;
    53 end;
    57 
       
    58 {$ENDIF}
       
    59 
    54 
    60 procedure GciEasterEgg;
    55 procedure GciEasterEgg;
    61 begin
    56 begin
    62     WriteLn(stdout, '                                                                ');
    57     WriteLn(stdout, '                                                                ');
    63     WriteLn(stdout, '      /\\\\\\\\\\\\        /\\\\\\\\\  /\\\\\\\\\\\             ');
    58     WriteLn(stdout, '      /\\\\\\\\\\\\        /\\\\\\\\\  /\\\\\\\\\\\             ');