Bladeren bron

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

git-svn-id: branches/fixes_3_2@44863 -
marco 5 jaren geleden
bovenliggende
commit
8250336193

+ 3 - 1
packages/fcl-base/examples/intl/README.txt

@@ -39,7 +39,9 @@ command:
 
 
 msgfmt -o restest.<langcode>.mo restest.<langcode>.po
 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
 If you add a new language, please send the .po file to the Free Pascal
 developers.
 developers.
 
 
-Michael. <[email protected]>
+Michael. <[email protected]>

+ 10 - 9
packages/fcl-base/src/gettext.pp

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

+ 1 - 1
packages/fcl-process/src/process.pp

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

+ 1 - 1
packages/fcl-process/src/processbody.inc

@@ -562,7 +562,7 @@ begin
         if assigned(stderr) then
         if assigned(stderr) then
             gotoutputstderr:=ReadInputStream(StdErr,StdErrBytesRead,StdErrLength,StdErrString,1);
             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,'');
           FOnRunCommandEvent(self,Nil,RunCommandIdle,'');
       end;
       end;
     // Get left output after end of execution
     // Get left output after end of execution

+ 19 - 6
rtl/inc/getopts.pp

@@ -14,9 +14,13 @@
 
 
  **********************************************************************}
  **********************************************************************}
 unit getopts;
 unit getopts;
-Interface
+
 {$modeswitch advancedrecords}
 {$modeswitch advancedrecords}
 {$modeswitch defaultparameters}
 {$modeswitch defaultparameters}
+{$h+}
+
+Interface
+
 Const
 Const
   No_Argument       = 0;
   No_Argument       = 0;
   Required_Argument = 1;
   Required_Argument = 1;
@@ -51,11 +55,6 @@ Function GetLongOpts (ShortOpts : String;LongOpts : POption;var Longind : Longin
 Implementation
 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}
 {$IFNDEF FPC}
 {***************************************************************************
 {***************************************************************************
@@ -147,6 +146,20 @@ end;
 
 
 {$ENDIF}
 {$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
                                Real Getopts
 ***************************************************************************}
 ***************************************************************************}

+ 6 - 0
rtl/objpas/classes/classesh.inc

@@ -693,6 +693,10 @@ type
   public
   public
     constructor Create;
     constructor Create;
     destructor Destroy; override;
     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 Add(const S: string): Integer; virtual; overload;
     function AddObject(const S: string; AObject: TObject): 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;
     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(TheStrings: TStrings; ClearFirst : Boolean); overload;
     procedure AddStrings(const TheStrings: array of string); overload; virtual;
     procedure AddStrings(const TheStrings: array of string); overload; virtual;
     procedure AddStrings(const TheStrings: array of string; ClearFirst : Boolean); overload;
     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 AddText(Const S : String); virtual;
     procedure AddCommaText(const S: String);
     procedure AddCommaText(const S: String);
     procedure AddDelimitedText(const S: String; ADelimiter: char; AStrictDelimiter: Boolean); overload;
     procedure AddDelimitedText(const S: String; ADelimiter: char; AStrictDelimiter: Boolean); overload;

+ 50 - 0
rtl/objpas/classes/stringl.inc

@@ -689,6 +689,7 @@ begin
     Exclude(FOptions,soUseLocale);
     Exclude(FOptions,soUseLocale);
 end;
 end;
 
 
+
 procedure TStrings.SetWriteBOM(AValue: Boolean);
 procedure TStrings.SetWriteBOM(AValue: Boolean);
 begin
 begin
   if AValue then
   if AValue then
@@ -1018,6 +1019,43 @@ begin
   inherited destroy;
   inherited destroy;
 end;
 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;
 constructor TStrings.Create;
 begin
 begin
@@ -1120,6 +1158,18 @@ begin
   end;
   end;
 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);
 Procedure TStrings.Assign(Source: TPersistent);
 
 
 Var
 Var

+ 1 - 0
rtl/objpas/types.pp

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