diff --git a/.gitattributes b/.gitattributes
index 1ed268b98d..de7de8652d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3086,6 +3086,7 @@ components/lazutils/test/TestLazStorageMem.lpi svneol=native#text/plain
components/lazutils/test/TestLazStorageMem.lpr svneol=native#text/plain
components/lazutils/test/testlazstoragememcase1.pas svneol=native#text/plain
components/lazutils/textstrings.pas svneol=native#text/pascal
+components/lazutils/translations.pas svneol=native#text/pascal
components/lazutils/ttcache.pas svneol=native#text/pascal
components/lazutils/ttcalc.pas svneol=native#text/pascal
components/lazutils/ttcalc1.inc svneol=native#text/pascal
@@ -7990,7 +7991,6 @@ lcl/tests/test6_1masks.lpr svneol=native#text/plain
lcl/themes.pas svneol=native#text/pascal
lcl/tmschema.pas svneol=native#text/pascal
lcl/toolwin.pp svneol=native#text/pascal
-lcl/translations.pas svneol=native#text/pascal
lcl/update_allunits.lpi svneol=native#text/plain
lcl/update_allunits.lpr svneol=native#text/plain
lcl/utrace.pp svneol=native#text/pascal
diff --git a/components/lazutils/lazlogger.pas b/components/lazutils/lazlogger.pas
index cb06dd3b83..d6eeb942ef 100644
--- a/components/lazutils/lazlogger.pas
+++ b/components/lazutils/lazlogger.pas
@@ -27,6 +27,7 @@ function DbgStr(const StringWithSpecialChars: string): string; overload;
function DbgStr(const StringWithSpecialChars: string; StartPos, Len: PtrInt): string; overload;
function DbgStr(const p: PChar; Len: PtrInt): string; overload;
function DbgWideStr(const StringWithSpecialChars: widestring): string; overload;
+procedure DumpExceptionBackTrace;
function ConvertLineEndings(const s: string): string;
procedure ReplaceSubstring(var s: string; StartPos, Count: SizeInt;
@@ -765,6 +766,30 @@ begin
end;
end;
+procedure DumpAddr(Addr: Pointer);
+begin
+ // preventing another exception, while dumping stack trace
+ try
+ DebugLn(BackTraceStrFunc(Addr));
+ except
+ DebugLn(SysBackTraceStr(Addr));
+ end;
+end;
+
+procedure DumpExceptionBackTrace;
+var
+ FrameCount: integer;
+ Frames: PPointer;
+ FrameNumber:Integer;
+begin
+ DebugLn(' Stack trace:');
+ DumpAddr(ExceptAddr);
+ FrameCount:=ExceptFrameCount;
+ Frames:=ExceptFrames;
+ for FrameNumber := 0 to FrameCount-1 do
+ DumpAddr(Frames[FrameNumber]);
+end;
+
function ConvertLineEndings(const s: string): string;
var
i: Integer;
diff --git a/components/lazutils/lazutils.lpk b/components/lazutils/lazutils.lpk
index 3a5fb4f912..7b5aba1989 100644
--- a/components/lazutils/lazutils.lpk
+++ b/components/lazutils/lazutils.lpk
@@ -16,7 +16,7 @@
-
+
@@ -262,117 +262,121 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
+
+
+
+
diff --git a/components/lazutils/lazutils.pas b/components/lazutils/lazutils.pas
index f0bc749fae..1df5e920e8 100644
--- a/components/lazutils/lazutils.pas
+++ b/components/lazutils/lazutils.pas
@@ -18,9 +18,9 @@ uses
LazLoggerProfiling, LazMethodList, LazUnicode, LazUTF16, LazUTF8,
LazUTF8Classes, LazUTF8SysUtils, LazUtilities, LazUtilsStrConsts,
LConvEncoding, lcsvutils, LookupStringList, Maps, Masks, PasWString,
- StringHashList, TextStrings, TTCache, TTCalc, TTCMap, TTDebug, TTError,
- TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile, TTRASTER,
- TTTables, TTTypes, UTF8Process, LazarusPackageIntf;
+ StringHashList, TextStrings, Translations, TTCache, TTCalc, TTCMap, TTDebug,
+ TTError, TTFile, TTGLoad, TTInterp, TTLoad, TTMemory, TTObjs, TTProfile,
+ TTRASTER, TTTables, TTTypes, UTF8Process, LazarusPackageIntf;
implementation
diff --git a/lcl/translations.pas b/components/lazutils/translations.pas
similarity index 99%
rename from lcl/translations.pas
rename to components/lazutils/translations.pas
index 8eb296ba04..a646474239 100644
--- a/lcl/translations.pas
+++ b/components/lazutils/translations.pas
@@ -81,17 +81,13 @@ unit Translations;
{$mode objfpc}{$H+}{$INLINE ON}
-{$include include/lcl_defines.inc}
-
interface
uses
Classes, SysUtils,
{$IF FPC_FULLVERSION>=30001}jsonscanner,{$ENDIF} jsonparser, fpjson,
- // LCL
- LCLProc,
// LazUtils
- FileUtil, LazFileUtils, LazUTF8, LazUTF8Classes, LConvEncoding,
+ FileUtil, LazFileUtils, LazUTF8, LazUTF8Classes, LConvEncoding, LazLogger,
AvgLvlTree, StringHashList;
type
@@ -613,7 +609,7 @@ begin
Result:=true;
except
on e: Exception do begin
- {$IFNDEF DisableChecks}
+ {$IFnDEF DisableChecks}
DebugLn('Exception while translating ', ResUnitName);
DebugLn(e.Message);
DumpExceptionBackTrace;
@@ -648,7 +644,7 @@ begin
Result:=true;
except
on e: Exception do begin
- {$IFNDEF DisableChecks}
+ {$IFnDEF DisableChecks}
DebugLn('Exception while translating:');
DebugLn(e.Message);
DumpExceptionBackTrace;
@@ -1168,7 +1164,8 @@ begin
{$ENDIF}
then begin
Result:=Item.Translation;
- if Result='' then RaiseGDBException('TPOFile.Translate Inconsistency');
+ if Result='' then
+ Raise Exception.Create('TPOFile.Translate Inconsistency');
end else
Result:=OriginalValue;
//Remove lineending at the end of the string if present.
@@ -1211,7 +1208,7 @@ begin
DebugLn('Entries:');
DebugLn('---------------------------------------------');
for i:=0 to FItems.Count-1 do begin
- DebugLn('#',dbgs(i),': ');
+ DebugLn(['#', i ,': ']);
Item := TPOFileItem(FItems[i]);
DebugLn('Comments=',Item.Comments);
DebugLn('Identifier=',Item.IdentifierLow);
@@ -1253,10 +1250,10 @@ begin
if (StopIndex > Count - 1) then StopIndex := Count - 1;
if (StartIndex < 0) then StartIndex := 0;
- DebugLn('Entries [',DbgS(StartIndex),'..',Dbgs(StopIndex),']:');
+ DebugLn(['Entries [', StartIndex, '..', StopIndex, ']:']);
DebugLn('---------------------------------------------');
for i := StartIndex to StopIndex do begin
- DebugLn('#',dbgs(i),': ');
+ DebugLn(['#', i, ': ']);
Item := TPOFileItem(FItems[i]);
DebugLn('Identifier=',Item.IdentifierLow);
DebugLn('msgid=',Item.Original);
@@ -1297,10 +1294,10 @@ begin
if (StopIndex > Count - 1) then StopIndex := Count - 1;
if (StartIndex < 0) then StartIndex := 0;
- Log.Add('Entries ['+DbgS(StartIndex)+'..'+Dbgs(StopIndex)+']:');
+ Log.Add(Format('Entries [%d..%d]:', [StartIndex, StopIndex]));
Log.Add('---------------------------------------------');
for i := StartIndex to StopIndex do begin
- Log.Add('#'+dbgs(i)+': ');
+ Log.Add(Format('#%d: ', [i]));
Item := TPOFileItem(FItems[i]);
Log.Add('Identifier='+Item.IdentifierLow);
Log.Add('msgid='+Item.Original);
@@ -1819,18 +1816,14 @@ var
begin
F := TStringList.Create;
try
-
F.CommaText := Flags;
i := F.IndexOf(AFlag);
-
if (i<0) and Check then
F.Add(AFlag)
else
if (i>=0) and (not Check) then
F.Delete(i);
-
Flags := F.CommaText;
-
finally
F.Free;
end;
diff --git a/lcl/alllclunits.pp b/lcl/alllclunits.pp
index 46cc7a86a3..6512575372 100644
--- a/lcl/alllclunits.pp
+++ b/lcl/alllclunits.pp
@@ -17,13 +17,13 @@ uses
LCLStrConsts, LCLType, Menus, LCLUnicodeData, LCLVersion, LMessages,
LResources, MaskEdit, PairSplitter, PopupNotifier, PostScriptCanvas,
PostScriptPrinter, PostScriptUnicode, Printers, PropertyStorage, RubberBand,
- ShellCtrls, Spin, StdActns, StdCtrls, Themes, TmSchema, Toolwin,
- Translations, UTrace, XMLPropStorage, TimePopup, Messages, WSButtons,
- WSCalendar, WSCheckLst, WSComCtrls, WSControls, WSDesigner, WSDialogs,
- WSExtCtrls, WSExtDlgs, WSFactory, WSForms, WSGrids, WSImgList, WSLCLClasses,
- WSMenus, WSPairSplitter, WSProc, WSReferences, WSSpin, WSStdCtrls,
- WSToolwin, ActnList, AsyncProcess, ButtonPanel, Buttons, Calendar,
- RegisterLCL, ValEdit, LazCanvas, LazDialogs, LazRegions, CustomDrawn_Common,
+ ShellCtrls, Spin, StdActns, StdCtrls, Themes, TmSchema, Toolwin, UTrace,
+ XMLPropStorage, TimePopup, Messages, WSButtons, WSCalendar, WSCheckLst,
+ WSComCtrls, WSControls, WSDesigner, WSDialogs, WSExtCtrls, WSExtDlgs,
+ WSFactory, WSForms, WSGrids, WSImgList, WSLCLClasses, WSMenus,
+ WSPairSplitter, WSProc, WSReferences, WSSpin, WSStdCtrls, WSToolwin,
+ ActnList, AsyncProcess, ButtonPanel, Buttons, Calendar, RegisterLCL,
+ ValEdit, LazCanvas, LazDialogs, LazRegions, CustomDrawn_Common,
CustomDrawnControls, CustomDrawnDrawers, LazDeviceApis, LDockTree,
LazFreeTypeIntfDrawer, CustomDrawn_WinXP, CustomDrawn_Android, Arrow,
EditBtn, ComboEx, DBExtCtrls, CustomDrawn_Mac, CalcForm, LCLTranslator,
diff --git a/lcl/lclbase.lpk b/lcl/lclbase.lpk
index 41991fd801..21aa003a1b 100644
--- a/lcl/lclbase.lpk
+++ b/lcl/lclbase.lpk
@@ -27,7 +27,7 @@
-
+
@@ -273,901 +273,897 @@
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+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