# revisions: 44496,44529,44632,44635,44643,44644,44664

git-svn-id: branches/fixes_3_2@44863 -
This commit is contained in:
marco 2020-04-19 18:06:48 +00:00
parent 89025f241c
commit 8250336193
8 changed files with 91 additions and 18 deletions

View File

@ -39,7 +39,9 @@ command:
msgfmt -o restest.<langcode>.mo restest.<langcode>.po
(msgfmt is part of the GNU gettext tools)
If you add a new language, please send the .po file to the Free Pascal
developers.
Michael. <Michael.VanCanneyt@Wisa.be>
Michael. <michael@freepascal.org>

View File

@ -23,7 +23,7 @@ interface
uses SysUtils, Classes;
const
MOFileHeaderMagic = $950412de;
MOFileHeaderMagic = $950412DE;
type
TMOFileHeader = packed record
@ -201,14 +201,14 @@ var
begin
for i := 0 to StringCount - 1 do
begin
Dispose(OrigStrings^[i]);
Dispose(TranslStrings^[i]);
FreeMem(OrigStrings^[i]);
FreeMem(TranslStrings^[i]);
end;
Dispose(OrigTable);
Dispose(TranslTable);
Dispose(OrigStrings);
Dispose(TranslStrings);
Dispose(HashTable);
FreeMem(OrigTable);
FreeMem(TranslTable);
FreeMem(OrigStrings);
FreeMem(TranslStrings);
FreeMem(HashTable);
inherited Destroy;
end;
@ -280,7 +280,7 @@ end;
procedure TranslateUnitResourceStrings(const AUnitName:string; AFile: TMOFile);
begin
// SetUnitResourceStrings(AUnitName,@Translate,AFile);
SetUnitResourceStrings(AUnitName,@Translate,AFile);
end;
@ -312,6 +312,7 @@ end;
procedure GetLanguageIDs(var Lang, FallbackLang: string);
begin
FallbackLang:='';
lang := GetEnvironmentVariable('LC_ALL');
if Length(lang) = 0 then
begin

View File

@ -27,7 +27,7 @@ Type
poNoConsole,poNewConsole,
poDefaultErrorMode,poNewProcessGroup,
poDebugProcess,poDebugOnlyThisProcess,
poPassInput);
poPassInput,poRunIdle);
TShowWindowOptions = (swoNone,swoHIDE,swoMaximize,swoMinimize,swoRestore,swoShow,
swoShowDefault,swoShowMaximized,swoShowMinimized,

View File

@ -562,7 +562,7 @@ begin
if assigned(stderr) then
gotoutputstderr:=ReadInputStream(StdErr,StdErrBytesRead,StdErrLength,StdErrString,1);
if not gotoutput and not gotoutputstderr and Assigned(FOnRunCommandEvent) Then
if (porunidle in options) and not gotoutput and not gotoutputstderr and Assigned(FOnRunCommandEvent) Then
FOnRunCommandEvent(self,Nil,RunCommandIdle,'');
end;
// Get left output after end of execution

View File

@ -14,9 +14,13 @@
**********************************************************************}
unit getopts;
Interface
{$modeswitch advancedrecords}
{$modeswitch defaultparameters}
{$h+}
Interface
Const
No_Argument = 0;
Required_Argument = 1;
@ -51,11 +55,6 @@ Function GetLongOpts (ShortOpts : String;LongOpts : POption;var Longind : Longin
Implementation
Procedure TOption.SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PChar=nil;AValue:Char=#0);
begin
Name:=aName; Has_Arg:=AHas_Arg; Flag:=AFlag; Value:=Avalue;
end;
{$IFNDEF FPC}
{***************************************************************************
@ -147,6 +146,20 @@ end;
{$ENDIF}
function strpas(p : pchar) : ansistring;
begin
if p=nil then
strpas:=''
else
strpas:=p;
end;
Procedure TOption.SetOption(const aName:String;AHas_Arg:integer=0;AFlag:PChar=nil;AValue:Char=#0);
begin
Name:=aName; Has_Arg:=AHas_Arg; Flag:=AFlag; Value:=Avalue;
end;
{***************************************************************************
Real Getopts
***************************************************************************}

View File

@ -693,6 +693,10 @@ type
public
constructor Create;
destructor Destroy; override;
function ToObjectArray(aStart,aEnd : Integer) : TObjectDynArray; overload;
function ToObjectArray: TObjectDynArray; overload;
function ToStringArray(aStart,aEnd : Integer) : TStringDynArray; overload;
function ToStringArray: TStringDynArray; overload;
function Add(const S: string): Integer; virtual; overload;
function AddObject(const S: string; AObject: TObject): Integer; virtual; overload;
function Add(const Fmt : string; const Args : Array of const): Integer; overload;
@ -703,6 +707,8 @@ type
procedure AddStrings(TheStrings: TStrings; ClearFirst : Boolean); overload;
procedure AddStrings(const TheStrings: array of string); overload; virtual;
procedure AddStrings(const TheStrings: array of string; ClearFirst : Boolean); overload;
procedure SetStrings(TheStrings: TStrings); overload; virtual;
procedure SetStrings(TheStrings: array of string); overload; virtual;
Procedure AddText(Const S : String); virtual;
procedure AddCommaText(const S: String);
procedure AddDelimitedText(const S: String; ADelimiter: char; AStrictDelimiter: Boolean); overload;

View File

@ -689,6 +689,7 @@ begin
Exclude(FOptions,soUseLocale);
end;
procedure TStrings.SetWriteBOM(AValue: Boolean);
begin
if AValue then
@ -1018,6 +1019,43 @@ begin
inherited destroy;
end;
function TStrings.ToObjectArray: TObjectDynArray;
begin
Result:=ToObjectArray(0,Count-1);
end;
function TStrings.ToObjectArray(aStart,aEnd : Integer): TObjectDynArray;
Var
I : Integer;
begin
Result:=Nil;
if aStart>aEnd then exit;
SetLength(Result,aEnd-aStart+1);
For I:=aStart to aEnd do
Result[i-aStart]:=Objects[i];
end;
function TStrings.ToStringArray: TStringDynArray;
begin
Result:=ToStringArray(0,Count-1);
end;
function TStrings.ToStringArray(aStart,aEnd : Integer): TStringDynArray;
Var
I : Integer;
begin
Result:=Nil;
if aStart>aEnd then exit;
SetLength(Result,aEnd-aStart+1);
For I:=aStart to aEnd do
Result[i-aStart]:=Strings[i];
end;
constructor TStrings.Create;
begin
@ -1120,6 +1158,18 @@ begin
end;
end;
procedure TStrings.SetStrings(TheStrings: TStrings);
begin
AddStrings(TheStrings,True);
end;
procedure TStrings.SetStrings(TheStrings: array of string);
begin
AddStrings(TheStrings,True);
end;
Procedure TStrings.Assign(Source: TPersistent);
Var

View File

@ -64,6 +64,7 @@ type
TShortIntDynArray = array of ShortInt;
TSmallIntDynArray = array of SmallInt;
TStringDynArray = array of AnsiString;
TObjectDynArray = array of TObject;
TWideStringDynArray = array of WideString;
TWordDynArray = array of Word;
TCurrencyArray = Array of currency;