You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
(20) |
May
(48) |
Jun
(8) |
Jul
(23) |
Aug
(41) |
Sep
(42) |
Oct
(22) |
Nov
(17) |
Dec
(36) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(43) |
Feb
(42) |
Mar
(17) |
Apr
(39) |
May
(16) |
Jun
(35) |
Jul
(37) |
Aug
(47) |
Sep
(49) |
Oct
(9) |
Nov
(52) |
Dec
(37) |
2008 |
Jan
(48) |
Feb
(21) |
Mar
(7) |
Apr
(2) |
May
(5) |
Jun
(17) |
Jul
(17) |
Aug
(40) |
Sep
(58) |
Oct
(38) |
Nov
(19) |
Dec
(32) |
2009 |
Jan
(67) |
Feb
(46) |
Mar
(54) |
Apr
(34) |
May
(37) |
Jun
(52) |
Jul
(67) |
Aug
(72) |
Sep
(48) |
Oct
(35) |
Nov
(27) |
Dec
(12) |
2010 |
Jan
(56) |
Feb
(46) |
Mar
(19) |
Apr
(14) |
May
(21) |
Jun
(3) |
Jul
(13) |
Aug
(48) |
Sep
(34) |
Oct
(51) |
Nov
(16) |
Dec
(32) |
2011 |
Jan
(36) |
Feb
(14) |
Mar
(12) |
Apr
(3) |
May
(5) |
Jun
(24) |
Jul
(15) |
Aug
(30) |
Sep
(21) |
Oct
(4) |
Nov
(25) |
Dec
(23) |
2012 |
Jan
(45) |
Feb
(42) |
Mar
(19) |
Apr
(14) |
May
(13) |
Jun
(7) |
Jul
(3) |
Aug
(46) |
Sep
(21) |
Oct
(10) |
Nov
(2) |
Dec
|
2013 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <cyc...@us...> - 2008-10-11 19:16:49
|
Revision: 2541 http://jcl.svn.sourceforge.net/jcl/?rev=2541&view=rev Author: cycocrew Date: 2008-10-11 19:16:39 +0000 (Sat, 11 Oct 2008) Log Message: ----------- Added GetWindowsProductString function + Updated SysInfo.dtx help file. Modified Paths: -------------- trunk/help/SysInfo.dtx trunk/jcl/source/common/JclSysInfo.pas Modified: trunk/help/SysInfo.dtx =================================================================== --- trunk/help/SysInfo.dtx 2008-10-11 12:51:07 UTC (rev 2540) +++ trunk/help/SysInfo.dtx 2008-10-11 19:16:39 UTC (rev 2541) @@ -329,7 +329,7 @@ all users. A typical path is C:\Documents and Settings\All Users\Application Data. Result: The current directory for the calling process or an empty string on failure. -Note: +Notes: Requires shell v5.00 and upwards. See also: GetCommonFilesFolder @@ -505,7 +505,7 @@ @@TWindowsVersion.wvUnknown Anonymous Windows version. This can happen when a new Windows version is released after JCL or if you are running a Windows version with a different build number - then expected. For example a beta version. + than expected. For example a beta version. @@TWindowsVersion.wvWin95 Windows 95 @@TWindowsVersion.wvWin95OSR2 @@ -535,6 +535,52 @@ @@TWindowsVersion.wvWinServer2008 Windows Server 2008 -------------------------------------------------------------------------------- +@@TWindowsEdition +<GROUP SystemInformationRoutines.VersionInformation> +Summary: + Enumeration of Windows editions. Used as function result by GetWindowsEdition +Description: + Enumeration of Windows editions. Used as function result by GetWindowsEdition +See also: + GetWindowsEdition +Donator: + Jean-Fabien Connault +@@TWindowsEdition.weUnknown + Anonymous Windows ediion. This can happen when a new Windows edition is released + after JCL or if you are running a Windows edition. +@@TWindowsEdition.weWinXPHome + Windows XP Home +@@TWindowsEdition.weWinXPPro + Windows XP Professional +@@TWindowsEdition.weWinXPN + Windows XP N +@@TWindowsEdition.weWinXPK + Windows XP K +@@TWindowsEdition.weWinXPKN + Windows XP KN +@@TWindowsEdition.weWinXPStarter + Windows XP Starter +@@TWindowsEdition.weWinXPMediaCenter + Windows XP Media Center +@@TWindowsEdition.weWinXPTablet + Windows XP Tablet +@@TWindowsEdition.weWinVistaStarter + Windows Vista Starter +@@TWindowsEdition.weWinVistaHomeBasic + Windows Vista Home Basic +@@TWindowsEdition.weWinVistaHomeBasicN + Windows Vista Home Basic N +@@TWindowsEdition.weWinVistaHomePremium + Windows Vista Home Premium +@@TWindowsEdition.weWinVistaBusiness + Windows Vista Business +@@TWindowsEdition.weWinVistaBusinessN + Windows Vista Business N +@@TWindowsEdition.weWinVistaEnterprise + Windows Vista Enterprise +@@TWindowsEdition.weWinVistaUltimate + Windows Vista Ultimate +-------------------------------------------------------------------------------- @@GetWindowsVersion <GROUP SystemInformationRoutines.VersionInformation> Summary: @@ -563,6 +609,17 @@ Donator: Marcel van Brakel -------------------------------------------------------------------------------- +@@GetWindowsEdition +<GROUP SystemInformationRoutines.VersionInformation> +Summary: + Returns the Windows edition. +Description: + GetWindowsEdition returns the Windows edition as an enumerated type. +Result: + The Windows edition, see TWindowsEdition for the possible values. +Donator: + Jean-Fabien Connault +-------------------------------------------------------------------------------- @@GetOSVersionString <GROUP SystemInformationRoutines.VersionInformation> Summary: @@ -584,14 +641,60 @@ Summary: Returns the Windows version as a string. Description: - GetWindowsVersionString returns the Windows version as a string. For example, 'Windows 2000'. + GetWindowsVersionString returns the Windows version as a string. For example, 'Windows Vista'. +Notes: + The result does not contain the Windows edition string. For example, 'Ultimate'. + The Windows edition string is retrieved using the GetWindowsEditionString function. + To obtain the Windows product string (For Example 'Windows Vista Ultimate'), the + GetWindowsProductString function should be used. Result: The Windows version as a string or an empty string if the OS is not recognized. See also: GetWindowsVersion + GetWindowsEditionString + GetWindowsProductString Donator: Jean-Fabien Connault -------------------------------------------------------------------------------- +@@GetWindowsEditionString +<GROUP SystemInformationRoutines.VersionInformation> +Summary: + Returns the Windows edition as a string. +Description: + GetWindowsEditionString returns the Windows edition as a string. For example, 'Ultimate'. +Notes: + The result does not contain the Windows version string. For example, 'Windows Vista'. + The Windows version string is retrieved using the GetWindowsVersionString function. + To obtain the Windows product string (For Example 'Windows Vista Ultimate'), the + GetWindowsProductString function should be used. +Result: + The Windows edition as a string or an empty string if the edition is not recognized. +See also: + GetWindowsEdition + GetWindowsVersionString + GetWindowsProductString +Donator: + Jean-Fabien Connault +-------------------------------------------------------------------------------- +@@GetWindowsProductString +<GROUP SystemInformationRoutines.VersionInformation> +Summary: + Returns the Windows product as a string. +Description: + GetWindowsProductString returns the Windows product as a string. For example, 'Windows Vista Ultimate'. + The Windows product string is equivalent to the concatenation of the Windows version string + and the Windows edition string. +Notes: + The Windows version string alone is retrieved using the GetWindowsVersionString function. For example, 'Windows Vista'. + The Windows edition string alone is retrieved using the GetWindowsEditionString function. For example, 'Ultimate'. +Result: + The Windows product as a string or an empty string if the product is not recognized. +See also: + GetWindowsEditionString + GetWindowsVersionString +Donator: + Jean-Fabien Connault +-------------------------------------------------------------------------------- @@GetWindowsServicePackVersion <GROUP SystemInformationRoutines.VersionInformation> Summary: @@ -1051,7 +1154,7 @@ Result: The BIOS release date, if successful. The system base date (12/30/1899), if there has been a problem. -Note: This information is accurate only if you have not updated or +Notes: This information is accurate only if you have not updated or changed the BIOS since you last ran Windows Setup. See also: GetBIOSName Modified: trunk/jcl/source/common/JclSysInfo.pas =================================================================== --- trunk/jcl/source/common/JclSysInfo.pas 2008-10-11 12:51:07 UTC (rev 2540) +++ trunk/jcl/source/common/JclSysInfo.pas 2008-10-11 19:16:39 UTC (rev 2541) @@ -325,6 +325,7 @@ function NtProductType: TNtProductType; function GetWindowsVersionString: string; function GetWindowsEditionString: string; +function GetWindowsProductString: string; function NtProductTypeString: string; function GetWindowsServicePackVersion: Integer; function GetWindowsServicePackVersionString: string; @@ -3546,6 +3547,13 @@ end; end; +function GetWindowsProductString: string; +begin + Result := GetWindowsVersionString; + if (GetWindowsEditionString <> '') then + Result := Result + ' ' + GetWindowsEditionString; +end; + function NtProductTypeString: string; begin case NtProductType of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cyc...@us...> - 2008-10-11 12:51:18
|
Revision: 2540 http://jcl.svn.sourceforge.net/jcl/?rev=2540&view=rev Author: cycocrew Date: 2008-10-11 12:51:07 +0000 (Sat, 11 Oct 2008) Log Message: ----------- Added GetWindowsEdition and GetWindowsEditionString functions in JcSysInfo Modified Paths: -------------- trunk/jcl/source/common/JclResources.pas trunk/jcl/source/common/JclSysInfo.pas Modified: trunk/jcl/source/common/JclResources.pas =================================================================== --- trunk/jcl/source/common/JclResources.pas 2008-10-10 13:36:26 UTC (rev 2539) +++ trunk/jcl/source/common/JclResources.pas 2008-10-11 12:51:07 UTC (rev 2540) @@ -1880,21 +1880,38 @@ RsUnknownAMDModel = 'Unknown AMD (Model %d)'; - RsOSVersionWin95 = 'Windows 95'; - RsOSVersionWin95OSR2 = 'Windows 95 OSR2'; - RsOSVersionWin98 = 'Windows 98'; - RsOSVersionWin98SE = 'Windows 98 SE'; - RsOSVersionWinME = 'Windows ME'; - RsOSVersionWinNT3 = 'Windows NT 3.%u'; - RsOSVersionWinNT4 = 'Windows NT 4.%u'; - RsOSVersionWin2000 = 'Windows 2000'; - RsOSVersionWinXP = 'Windows XP'; - RsOSVersionWin2003 = 'Windows Server 2003'; - RsOSVersionWin2003R2 = 'Windows Server 2003 "R2"'; - RsOSVersionWinXP64 = 'Windows XP x64'; - RsOSVersionWinVista = 'Windows Vista'; + RsOSVersionWin95 = 'Windows 95'; + RsOSVersionWin95OSR2 = 'Windows 95 OSR2'; + RsOSVersionWin98 = 'Windows 98'; + RsOSVersionWin98SE = 'Windows 98 SE'; + RsOSVersionWinME = 'Windows ME'; + RsOSVersionWinNT3 = 'Windows NT 3.%u'; + RsOSVersionWinNT4 = 'Windows NT 4.%u'; + RsOSVersionWin2000 = 'Windows 2000'; + RsOSVersionWinXP = 'Windows XP'; + RsOSVersionWin2003 = 'Windows Server 2003'; + RsOSVersionWin2003R2 = 'Windows Server 2003 "R2"'; + RsOSVersionWinXP64 = 'Windows XP x64'; + RsOSVersionWinVista = 'Windows Vista'; RsOSVersionWinServer2008 = 'Windows Server 2008'; + RsEditionWinXPHome = 'Home'; + RsEditionWinXPPro = 'Professional'; + RsEditionWinXPN = 'N'; + RsEditionWinXPK = 'K'; + RsEditionWinXPKN = 'KN'; + RsEditionWinXPStarter = 'Starter'; + RsEditionWinXPMediaCenter = 'Media Center'; + RsEditionWinXPTablet = 'Tablet'; + RsEditionWinVistaStarter = 'Starter'; + RsEditionWinVistaHomeBasic = 'Home Basic'; + RsEditionWinVistaHomeBasicN = 'Home Basic N'; + RsEditionWinVistaHomePremium = 'Home Premium'; + RsEditionWinVistaBusiness = 'Business'; + RsEditionWinVistaBusinessN = 'Business N'; + RsEditionWinVistaEnterprise = 'Enterprise'; + RsEditionWinVistaUltimate = 'Ultimate'; + RsProductTypeWorkStation = 'Workstation'; RsProductTypeServer = 'Server'; RsProductTypeAdvancedServer = 'Advanced Server'; Modified: trunk/jcl/source/common/JclSysInfo.pas =================================================================== --- trunk/jcl/source/common/JclSysInfo.pas 2008-10-10 13:36:26 UTC (rev 2539) +++ trunk/jcl/source/common/JclSysInfo.pas 2008-10-11 12:51:07 UTC (rev 2540) @@ -274,6 +274,12 @@ (wvUnknown, wvWin95, wvWin95OSR2, wvWin98, wvWin98SE, wvWinME, wvWinNT31, wvWinNT35, wvWinNT351, wvWinNT4, wvWin2000, wvWinXP, wvWin2003, wvWinXP64, wvWin2003R2, wvWinVista, wvWinServer2008); + TWindowsEdition = + (weUnknown, weWinXPHome, weWinXPPro, weWinXPN, weWinXPK, weWinXPKN, + weWinXPStarter, weWinXPMediaCenter, weWinXPTablet, + weWinVistaStarter, weWinVistaHomeBasic, weWinVistaHomeBasicN, + weWinVistaHomePremium, weWinVistaBusiness, weWinVistaBusinessN, + weWinVistaEnterprise, weWinVistaUltimate); TNtProductType = (ptUnknown, ptWorkStation, ptServer, ptAdvancedServer, ptPersonal, ptProfessional, ptDatacenterServer, ptEnterprise, ptWebEdition); @@ -315,8 +321,10 @@ {$EXTERNALSYM PROCESSOR_ARCHITECTURE_IA64} function GetWindowsVersion: TWindowsVersion; +function GetWindowsEdition: TWindowsEdition; function NtProductType: TNtProductType; function GetWindowsVersionString: string; +function GetWindowsEditionString: string; function NtProductTypeString: string; function GetWindowsServicePackVersion: Integer; function GetWindowsServicePackVersionString: string; @@ -3295,6 +3303,71 @@ end; end; +function GetWindowsEdition: TWindowsEdition; +const + ProductName = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion'; +var + Edition: string; +begin + Result := weUnknown; + Edition := RegReadStringDef(HKEY_LOCAL_MACHINE, ProductName, 'ProductName', ''); + if (pos('Windows XP', Edition) = 1) then + begin + // Windows XP Editions + if (pos('Home', Edition) > 0) then + Result := weWinXPHome + else + if (pos('Pro', Edition) > 0) then + Result := weWinXPPro + else + if (pos('N', Edition) > 0) then + Result := weWinXPN + else + if (pos('K', Edition) > 0) then + Result := weWinXPK + else + if (pos('KN', Edition) > 0) then + Result := weWinXPKN + else + if (pos('Starter', Edition) > 0) then + Result := weWinXPStarter + else + if (pos('Media Center', Edition) > 0) then + Result := weWinXPMediaCenter + else + if (pos('Tablet', Edition) > 0) then + Result := weWinXPTablet; + end + else + if (pos('Windows Vista', Edition) = 1) then + begin + // Windows Vista Editions + if (pos('Starter', Edition) > 0) then + Result := weWinVistaStarter + else + if (pos('Home Basic', Edition) > 0) then + Result := weWinVistaHomeBasic + else + if (pos('Home Basic N', Edition) > 0) then + Result := weWinVistaHomeBasicN + else + if (pos('Home Premium', Edition) > 0) then + Result := weWinVistaHomePremium + else + if (pos('Business', Edition) > 0) then + Result := weWinVistaBusiness + else + if (pos('Business N', Edition) > 0) then + Result := weWinVistaBusinessN + else + if (pos('Enterprise', Edition) > 0) then + Result := weWinVistaEnterprise + else + if (pos('Ultimate', Edition) > 0) then + Result := weWinVistaUltimate; + end; +end; + function NtProductType: TNtProductType; const ProductType = 'SYSTEM\CurrentControlSet\Control\ProductOptions'; @@ -3433,6 +3506,46 @@ end; end; +function GetWindowsEditionString: string; +begin + case GetWindowsEdition of + weWinXPHome: + Result := RsEditionWinXPHome; + weWinXPPro: + Result := RsEditionWinXPPro; + weWinXPN: + Result := RsEditionWinXPN; + weWinXPK: + Result := RsEditionWinXPK; + weWinXPKN: + Result := RsEditionWinXPKN; + weWinXPStarter: + Result := RsEditionWinXPStarter; + weWinXPMediaCenter: + Result := RsEditionWinXPMediaCenter; + weWinXPTablet: + Result := RsEditionWinXPTablet; + weWinVistaStarter: + Result := RsEditionWinVistaStarter; + weWinVistaHomeBasic: + Result := RsEditionWinVistaHomeBasic; + weWinVistaHomeBasicN: + Result := RsEditionWinVistaHomeBasicN; + weWinVistaHomePremium: + Result := RsEditionWinVistaHomePremium; + weWinVistaBusiness: + Result := RsEditionWinVistaBusiness; + weWinVistaBusinessN: + Result := RsEditionWinVistaBusinessN; + weWinVistaEnterprise: + Result := RsEditionWinVistaEnterprise; + weWinVistaUltimate: + Result := RsEditionWinVistaUltimate; + else + Result := ''; + end; +end; + function NtProductTypeString: string; begin case NtProductType of This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-10 13:36:32
|
Revision: 2539 http://jcl.svn.sourceforge.net/jcl/?rev=2539&view=rev Author: outchy Date: 2008-10-10 13:36:26 +0000 (Fri, 10 Oct 2008) Log Message: ----------- Mantis 4496: IDE Expert JCL Exception Dialog for Delphi did not work in Delphi 2009. Templates have to be loaded as Ansi streams. Modified Paths: -------------- trunk/jcl/experts/repository/JclOtaRepositoryReg.pas Modified: trunk/jcl/experts/repository/JclOtaRepositoryReg.pas =================================================================== --- trunk/jcl/experts/repository/JclOtaRepositoryReg.pas 2008-10-09 11:21:19 UTC (rev 2538) +++ trunk/jcl/experts/repository/JclOtaRepositoryReg.pas 2008-10-10 13:36:26 UTC (rev 2539) @@ -191,19 +191,21 @@ var AFileStream: TFileStream; StreamLength: Int64; + AnsiResult: AnsiString; begin - Result := ''; + AnsiResult := ''; if FileName <> '' then begin AFileStream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); try StreamLength := AFileStream.Size; - SetLength(Result, StreamLength); - AFileStream.ReadBuffer(Result[1], StreamLength); + SetLength(AnsiResult, StreamLength); + AFileStream.ReadBuffer(AnsiResult[1], StreamLength); finally AFileStream.Free; end; end; + Result := string(AnsiResult); end; const TemplateSubDir = 'experts\debug\dialog\'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-09 11:21:24
|
Revision: 2538 http://jcl.svn.sourceforge.net/jcl/?rev=2538&view=rev Author: outchy Date: 2008-10-09 11:21:19 +0000 (Thu, 09 Oct 2008) Log Message: ----------- Sync with ExceptDlg.Delphi32.pas revision 2496 Revision Links: -------------- http://jcl.svn.sourceforge.net/jcl/?rev=2496&view=rev Modified Paths: -------------- trunk/jcl/experts/debug/dialog/ExceptDlg.pas trunk/jcl/experts/debug/dialog/ExceptDlgMail.pas Modified: trunk/jcl/experts/debug/dialog/ExceptDlg.pas =================================================================== --- trunk/jcl/experts/debug/dialog/ExceptDlg.pas 2008-10-08 15:02:43 UTC (rev 2537) +++ trunk/jcl/experts/debug/dialog/ExceptDlg.pas 2008-10-09 11:21:19 UTC (rev 2538) @@ -30,7 +30,7 @@ uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts, - JclSysUtils, JclDebug; + JclSysUtils, JclUnitVersioning, JclUnitVersioningProviders, JclDebug; const UM_CREATEDETAILS = WM_USER + $100; @@ -109,7 +109,7 @@ RsScreenRes = 'Display : %dx%d pixels, %d bpp'; RsActiveControl = 'Active Controls hierarchy:'; RsThread = 'Thread: %s'; - RsMissingVersionInfo = '(no version info)'; + RsMissingVersionInfo = '(no module version info)'; RsErrorMessage = 'There was an error during the execution of this program.' + NativeLineBreak + 'The application might become unstable and even useless.' + NativeLineBreak + @@ -118,6 +118,7 @@ 'You may send it to the application vendor, helping him to understand what had happened.' + NativeLineBreak + ' Application title: %s' + NativeLineBreak + ' Application file: %s'; + RsUnitVersioningIntro = 'Unit versioning information:'; var ExceptionDialog: TExceptionDialog; @@ -288,6 +289,10 @@ StackList: TJclStackInfoList; PETarget: TJclPeTarget; + UnitVersioning: TUnitVersioning; + UnitVersioningModule: TUnitVersioningModule; + UnitVersion: TUnitVersion; + ModuleIndex, UnitIndex: Integer; begin SL := TStringList.Create; try @@ -346,6 +351,8 @@ // Modules list if LoadedModulesList(SL, GetCurrentProcessId) then begin + UnitVersioning := GetUnitVersioning; + UnitVersioning.RegisterProvider(TJclDefaultUnitVersioningProvider); DetailsMemo.Lines.Add(RsModulesList); SL.CustomSort(SortModulesListByAddressCompare); for I := 0 to SL.Count - 1 do @@ -379,6 +386,20 @@ end else DetailsMemo.Lines.Add(ImageBaseStr + RsMissingVersionInfo); + for ModuleIndex := 0 to UnitVersioning.ModuleCount - 1 do + begin + UnitVersioningModule := UnitVersioning.Modules[ModuleIndex]; + if UnitVersioningModule.Instance = ModuleBase then + begin + if UnitVersioningModule.Count > 0 then + DetailsMemo.Lines.Add(StrRepeat(' ', 11) + RsUnitVersioningIntro); + for UnitIndex := 0 to UnitVersioningModule.Count - 1 do + begin + UnitVersion := UnitVersioningModule.Items[UnitIndex]; + DetailsMemo.Lines.Add(Format('%s%s %s %s %s', [StrRepeat(' ', 13), UnitVersion.LogPath, UnitVersion.RCSfile, UnitVersion.Revision, UnitVersion.Date])); + end; + end; + end; end; NextDetailBlock; end; Modified: trunk/jcl/experts/debug/dialog/ExceptDlgMail.pas =================================================================== --- trunk/jcl/experts/debug/dialog/ExceptDlgMail.pas 2008-10-08 15:02:43 UTC (rev 2537) +++ trunk/jcl/experts/debug/dialog/ExceptDlgMail.pas 2008-10-09 11:21:19 UTC (rev 2538) @@ -30,7 +30,7 @@ uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts, - JclSysUtils, JclMapi, JclDebug; + JclSysUtils, JclMapi, JclUnitVersioning, JclUnitVersioningProviders, JclDebug; const UM_CREATEDETAILS = WM_USER + $100; @@ -109,7 +109,7 @@ RsScreenRes = 'Display : %dx%d pixels, %d bpp'; RsActiveControl = 'Active Controls hierarchy:'; RsThread = 'Thread: %s'; - RsMissingVersionInfo = '(no version info)'; + RsMissingVersionInfo = '(no module version info)'; RsErrorMessage = 'There was an error during the execution of this program.' + NativeLineBreak + 'The application might become unstable and even useless.' + NativeLineBreak + @@ -118,6 +118,7 @@ 'You may send it to the application vendor, helping him to understand what had happened.' + NativeLineBreak + ' Application title: %s' + NativeLineBreak + ' Application file: %s'; + RsUnitVersioningIntro = 'Unit versioning information:'; var ExceptionDialogMail: TExceptionDialogMail; @@ -308,6 +309,10 @@ StackList: TJclStackInfoList; PETarget: TJclPeTarget; + UnitVersioning: TUnitVersioning; + UnitVersioningModule: TUnitVersioningModule; + UnitVersion: TUnitVersion; + ModuleIndex, UnitIndex: Integer; begin SL := TStringList.Create; try @@ -366,6 +371,8 @@ // Modules list if LoadedModulesList(SL, GetCurrentProcessId) then begin + UnitVersioning := GetUnitVersioning; + UnitVersioning.RegisterProvider(TJclDefaultUnitVersioningProvider); DetailsMemo.Lines.Add(RsModulesList); SL.CustomSort(SortModulesListByAddressCompare); for I := 0 to SL.Count - 1 do @@ -399,6 +406,20 @@ end else DetailsMemo.Lines.Add(ImageBaseStr + RsMissingVersionInfo); + for ModuleIndex := 0 to UnitVersioning.ModuleCount - 1 do + begin + UnitVersioningModule := UnitVersioning.Modules[ModuleIndex]; + if UnitVersioningModule.Instance = ModuleBase then + begin + if UnitVersioningModule.Count > 0 then + DetailsMemo.Lines.Add(StrRepeat(' ', 11) + RsUnitVersioningIntro); + for UnitIndex := 0 to UnitVersioningModule.Count - 1 do + begin + UnitVersion := UnitVersioningModule.Items[UnitIndex]; + DetailsMemo.Lines.Add(Format('%s%s %s %s %s', [StrRepeat(' ', 13), UnitVersion.LogPath, UnitVersion.RCSfile, UnitVersion.Revision, UnitVersion.Date])); + end; + end; + end; end; NextDetailBlock; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-08 15:02:50
|
Revision: 2537 http://jcl.svn.sourceforge.net/jcl/?rev=2537&view=rev Author: outchy Date: 2008-10-08 15:02:43 +0000 (Wed, 08 Oct 2008) Log Message: ----------- Mantis 3277: donation of standalone ZIP compression and decompression classes Added Paths: ----------- trunk/donations/standalonezip.zip Property changes on: trunk/donations/standalonezip.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-08 06:18:47
|
Revision: 2536 http://jcl.svn.sourceforge.net/jcl/?rev=2536&view=rev Author: outchy Date: 2008-10-08 06:18:44 +0000 (Wed, 08 Oct 2008) Log Message: ----------- >From Caleb Hattingh: the state of the warning-report setting should be restored at the end of the unit: Contrary to the delphi documentation, the {$WARNINGS} declaration is not confined only to a single unit, and the setting remains in effect for subsequent units, until the setting is altered once more. Modified Paths: -------------- trunk/jcl/source/prototypes/JclWin32.pas trunk/jcl/source/windows/JclWin32.pas Modified: trunk/jcl/source/prototypes/JclWin32.pas =================================================================== --- trunk/jcl/source/prototypes/JclWin32.pas 2008-10-08 06:11:07 UTC (rev 2535) +++ trunk/jcl/source/prototypes/JclWin32.pas 2008-10-08 06:18:44 UTC (rev 2536) @@ -276,6 +276,8 @@ UnregisterUnitVersion(HInstance); {$ENDIF UNITVERSIONING} +{$WARNINGS ON} + end. Modified: trunk/jcl/source/windows/JclWin32.pas =================================================================== --- trunk/jcl/source/windows/JclWin32.pas 2008-10-08 06:11:07 UTC (rev 2535) +++ trunk/jcl/source/windows/JclWin32.pas 2008-10-08 06:18:44 UTC (rev 2536) @@ -8516,6 +8516,8 @@ UnregisterUnitVersion(HInstance); {$ENDIF UNITVERSIONING} +{$WARNINGS ON} + end. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-08 06:11:18
|
Revision: 2535 http://jcl.svn.sourceforge.net/jcl/?rev=2535&view=rev Author: outchy Date: 2008-10-08 06:11:07 +0000 (Wed, 08 Oct 2008) Log Message: ----------- >From Patrick van Logchem: detection of compiler features and codenames for Delphi/C++Builder version under development. Modified Paths: -------------- trunk/jcl/source/include/jedi.inc Modified: trunk/jcl/source/include/jedi.inc =================================================================== --- trunk/jcl/source/include/jedi.inc 2008-10-07 20:21:53 UTC (rev 2534) +++ trunk/jcl/source/include/jedi.inc 2008-10-08 06:11:07 UTC (rev 2535) @@ -121,21 +121,21 @@ Directive Description ------------------------------------------------------------------------------ - DELPHI1 Defined when compiling with Delphi 1 - DELPHI2 Defined when compiling with Delphi 2 - DELPHI3 Defined when compiling with Delphi 3 - DELPHI4 Defined when compiling with Delphi 4 - DELPHI5 Defined when compiling with Delphi 5 - DELPHI6 Defined when compiling with Delphi 6 - DELPHI7 Defined when compiling with Delphi 7 - DELPHI8 Defined when compiling with Delphi 8 - DELPHI2005 Defined when compiling with Delphi 2005 + DELPHI1 Defined when compiling with Delphi 1 (Codename WASABI/MANGO) + DELPHI2 Defined when compiling with Delphi 2 (Codename POLARIS) + DELPHI3 Defined when compiling with Delphi 3 (Codename IVORY) + DELPHI4 Defined when compiling with Delphi 4 (Codename ALLEGRO) + DELPHI5 Defined when compiling with Delphi 5 (Codename ARGUS) + DELPHI6 Defined when compiling with Delphi 6 (Codename ILLIAD) + DELPHI7 Defined when compiling with Delphi 7 (Codename AURORA) + DELPHI8 Defined when compiling with Delphi 8 (Codename OCTANE) + DELPHI2005 Defined when compiling with Delphi 2005 (Codename DIAMONDBACK) DELPHI9 Alias for DELPHI2005 - DELPHI10 Defined when compiling with Delphi 2006 + DELPHI10 Defined when compiling with Delphi 2006 (Codename DEXTER) DELPHI2006 Alias for DELPHI10 - DELPHI11 Defined when compiling with Delphi 2007 for Win32 + DELPHI11 Defined when compiling with Delphi 2007 for Win32 (Codename SPACELY) DELPHI2007 Alias for DELPHI11 - DELPHI12 Defined when compiling with Delphi 2009 for Win32 + DELPHI12 Defined when compiling with Delphi 2009 for Win32 (Codename TIBURON) DELPHI2009 Alias for DELPHI12 DELPHI1_UP Defined when compiling with Delphi 1 or higher DELPHI2_UP Defined when compiling with Delphi 2 or higher @@ -165,7 +165,7 @@ ------------------------------------------------------------------------------ KYLIX1 Defined when compiling with Kylix 1 KYLIX2 Defined when compiling with Kylix 2 - KYLIX3 Defined when compiling with Kylix 3 + KYLIX3 Defined when compiling with Kylix 3 (Codename CORTEZ) KYLIX1_UP Defined when compiling with Kylix 1 or higher KYLIX2_UP Defined when compiling with Kylix 2 or higher KYLIX3_UP Defined when compiling with Kylix 3 or higher @@ -212,11 +212,11 @@ BCB1 Defined when compiling with C++Builder 1 BCB3 Defined when compiling with C++Builder 3 BCB4 Defined when compiling with C++Builder 4 - BCB5 Defined when compiling with C++Builder 5 - BCB6 Defined when compiling with C++Builder 6 - BCB10 Defined when compiling with C++Builder Personality of BDS 4.0 (also known as C++Builder 2006) - BCB11 Defined when compiling with C++Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) - BCB12 Defined when compiling with C++Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) + BCB5 Defined when compiling with C++Builder 5 (Codename RAMPAGE) + BCB6 Defined when compiling with C++Builder 6 (Codename RIPTIDE) + BCB10 Defined when compiling with C++Builder Personality of BDS 4.0 (also known as C++Builder 2006) (Codename DEXTER) + BCB11 Defined when compiling with C++Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) (Codename COGSWELL) + BCB12 Defined when compiling with C++Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) (Codename TIBURON) BCB1_UP Defined when compiling with C++Builder 1 or higher BCB3_UP Defined when compiling with C++Builder 3 or higher BCB4_UP Defined when compiling with C++Builder 4 or higher @@ -238,12 +238,12 @@ Directive Description ------------------------------------------------------------------------------ - BDS Defined when compiling with BDS version of dcc32.exe - BDS2 Defined when compiling with BDS 2.0 (Delphi 8) - BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) - BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) - BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) - BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) + BDS Defined when compiling with BDS version of dcc32.exe (Codename SIDEWINDER) + BDS2 Defined when compiling with BDS 2.0 (Delphi 8) (Codename OCTANE) + BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) (Codename DIAMONDBACK) + BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) (Codename DEXTER) + BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) (Codename HIGHLANDER) + BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) (Codename TIBURON) BDS2_UP Defined when compiling with BDS 2.0 or higher BDS3_UP Defined when compiling with BDS 3.0 or higher BDS4_UP Defined when compiling with BDS 4.0 or higher @@ -340,68 +340,73 @@ Directive Description ------------------------------------------------------------------------------ - SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+) - SUPPORTS_SINGLE Compiler supports the Single type (D1+) - SUPPORTS_DOUBLE Compiler supports the Double type (D1+) - SUPPORTS_EXTENDED Compiler supports the Extended type (D1+) - SUPPORTS_CURRENCY Compiler supports the Currency type (D2+) - SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+) - SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+) - SUPPORTS_VARIANT Compiler supports variant (D2+) - SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+) - SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+) - SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+) - SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+) - SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC) - SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+) - SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+) - SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+) - SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+) - SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+) - SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+) - SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+) - SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+) - SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+) - SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+) - SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC) - SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+) - SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC) - SUPPORTS_FOR_IN Compiler supports for in loops (D9+) - SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+) - SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+) - SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+) - SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+) - SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+) - SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+) - SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+) - SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+) - SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+) - SUPPORTS_GENERICS Compiler supports generic implementations (D11.net, D12+) - ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC) - ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC) - ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+) - SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+) - SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+) - SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+) - SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+) - SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+) - SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+) - SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7) - SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive - SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive - SUPPORTS_PACKAGES Compiler supports Packages - HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86) - HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC) - HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC) - HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC) - HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC) - HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC) - HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC) - HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+) - HAS_UNIT_PNGIMAGE Unit PngImage exists (D12+) - XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC) - SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.net, D12+) - SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+) + SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+) + SUPPORTS_SINGLE Compiler supports the Single type (D1+) + SUPPORTS_DOUBLE Compiler supports the Double type (D1+) + SUPPORTS_EXTENDED Compiler supports the Extended type (D1+) + SUPPORTS_CURRENCY Compiler supports the Currency type (D2+) + SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+) + SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+) + SUPPORTS_VARIANT Compiler supports variant (D2+) + SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+) + SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+) + SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+) + SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+) + SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC) + SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+) + SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+) + SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+) + SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+) + SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+) + SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+) + SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+) + SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+) + SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+) + SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+) + SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC) + SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+) + SUPPORTS_SETPEFLAGS Compiler supports the SetPEFlags directive (D6+/BCB6+) + SUPPORTS_EXPERIMENTAL_WARNINGS Compiler supports the WARN SYMBOL_EXPERIMENTAL and WARN UNIT_EXPERIMENTAL directives (D6+/BCB6+) + SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC) + SUPPORTS_FOR_IN Compiler supports for in loops (D9+) + SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+) + SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+) + SUPPORTS_REGION Compiler supports the REGION and ENDREGION directives (D9+) + SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+) + SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+) + SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+) + SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+) + SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+) + SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+) + SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+) + SUPPORTS_METHODINFO Compiler supports the METHODINFO directives (D10+) + SUPPORTS_GENERICS Compiler supports generic implementations (D11.net, D12+) + ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC) + ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC) + ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+) + SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+) + SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+) + SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+) + SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+) + SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+) + SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+) + SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7) + SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive + SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive + SUPPORTS_PACKAGES Compiler supports Packages + HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86) + HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC) + HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC) + HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC) + HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC) + HAS_UNIT_HTTPPROD Unit HTTPProd exists (D9+) + HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+) + HAS_UNIT_PNGIMAGE Unit PngImage exists (D12+) + XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC) + SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.net, D12+) + SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+) - Compiler Settings @@ -1040,6 +1045,8 @@ {$DEFINE SUPPORTS_LIBRARY} {$DEFINE SUPPORTS_PLATFORM} {$DEFINE SUPPORTS_LOCAL} + {$DEFINE SUPPORTS_SETPEFLAGS} + {$DEFINE SUPPORTS_EXPERIMENTAL_WARNINGS} {$DEFINE ACCEPT_DEPRECATED} {$DEFINE ACCEPT_PLATFORM} {$DEFINE ACCEPT_LIBRARY} @@ -1061,6 +1068,7 @@ {$DEFINE SUPPORTS_INLINE} {$DEFINE SUPPORTS_NESTED_CONSTANTS} {$DEFINE SUPPORTS_NESTED_TYPES} + {$DEFINE SUPPORTS_REGION} {$IFDEF CLR} {$DEFINE SUPPORTS_ENHANCED_RECORDS} {$DEFINE SUPPORTS_CLASS_FIELDS} @@ -1080,6 +1088,7 @@ {$DEFINE SUPPORTS_STRICT} {$DEFINE SUPPORTS_STATIC} {$DEFINE SUPPORTS_FINAL} + {$DEFINE SUPPORTS_METHODINFO} {$ENDIF COMPILER10_UP} {$IFDEF COMPILER11_UP} @@ -1096,6 +1105,10 @@ {$ENDIF CLR} {$ENDIF COMPILER12_UP} +{$IFDEF RTL130_UP} + {$DEFINE HAS_UNIT_CONTNRS} +{$ENDIF RTL130_UP} + {$IFDEF RTL140_UP} {$IFDEF LINUX} {$DEFINE HAS_UNIT_LIBC} @@ -1108,9 +1121,9 @@ {$DEFINE XPLATFORM_RTL} {$ENDIF RTL140_UP} -{$IFDEF RTL130_UP} - {$DEFINE HAS_UNIT_CONTNRS} -{$ENDIF RTL130_UP} +{$IFDEF RTL170_UP} + {$DEFINE HAS_UNIT_HTTPPROD} +{$ENDIF RTL170_UP} {$IFDEF RTL200_UP} {$DEFINE HAS_UNIT_ANSISTRINGS} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-07 20:22:01
|
Revision: 2534 http://jcl.svn.sourceforge.net/jcl/?rev=2534&view=rev Author: outchy Date: 2008-10-07 20:21:53 +0000 (Tue, 07 Oct 2008) Log Message: ----------- compatibility of revision 2519. JclUnicode is now Delphi.net compatible. Revision Links: -------------- http://jcl.svn.sourceforge.net/jcl/?rev=2519&view=rev Modified Paths: -------------- trunk/jcl/lib/d10.net/common.exc trunk/jcl/lib/d11.net/common.exc trunk/jcl/lib/d9.net/common.exc trunk/jcl/packages/d10.net/Jedi.Jcl.bdsproj trunk/jcl/packages/d10.net/Jedi.Jcl.dpk trunk/jcl/packages/d11.net/Jedi.Jcl.dpk trunk/jcl/packages/d11.net/Jedi.Jcl.dproj trunk/jcl/packages/d9.net/Jedi.Jcl.bdsproj trunk/jcl/packages/d9.net/Jedi.Jcl.dpk trunk/jcl/packages/xml/Jcl-R.xml trunk/jcl/source/common/JclAbstractContainers.pas trunk/jcl/source/common/JclUnicode.pas Modified: trunk/jcl/lib/d10.net/common.exc =================================================================== --- trunk/jcl/lib/d10.net/common.exc 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/lib/d10.net/common.exc 2008-10-07 20:21:53 UTC (rev 2534) @@ -16,7 +16,6 @@ JclSchedule.pas JclStrHashMap.pas JclStringLists.pas -JclUnicode.pas JclUnitVersioning.pas JclUnitVersioningProviders.pas JclWideStrings.pas Modified: trunk/jcl/lib/d11.net/common.exc =================================================================== --- trunk/jcl/lib/d11.net/common.exc 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/lib/d11.net/common.exc 2008-10-07 20:21:53 UTC (rev 2534) @@ -16,7 +16,6 @@ JclSchedule.pas JclStrHashMap.pas JclStringLists.pas -JclUnicode.pas JclUnitVersioning.pas JclUnitVersioningProviders.pas JclWideStrings.pas Modified: trunk/jcl/lib/d9.net/common.exc =================================================================== --- trunk/jcl/lib/d9.net/common.exc 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/lib/d9.net/common.exc 2008-10-07 20:21:53 UTC (rev 2534) @@ -16,7 +16,6 @@ JclSchedule.pas JclStrHashMap.pas JclStringLists.pas -JclUnicode.pas JclUnitVersioning.pas JclUnitVersioningProviders.pas JclWideStrings.pas Modified: trunk/jcl/packages/d10.net/Jedi.Jcl.bdsproj =================================================================== --- trunk/jcl/packages/d10.net/Jedi.Jcl.bdsproj 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/packages/d10.net/Jedi.Jcl.bdsproj 2008-10-07 20:21:53 UTC (rev 2534) @@ -199,6 +199,7 @@ <File FileName="..\..\source\Common\JclSynch.pas" ContainerId="" ModuleName="JclSynch"/> <File FileName="..\..\source\common\JclSysInfo.pas" ContainerId="" ModuleName="JclSysInfo"/> <File FileName="..\..\source\common\JclSysUtils.pas" ContainerId="" ModuleName="JclSysUtils"/> + <File FileName="..\..\source\Common\JclUnicode.pas" ContainerId="" ModuleName="JclUnicode"/> <File FileName="..\..\source\common\JclUnitConv.pas" ContainerId="" ModuleName="JclUnitConv"/> <File FileName="..\..\source\common\JclValidation.pas" ContainerId="" ModuleName="JclValidation"/> </FileList> Modified: trunk/jcl/packages/d10.net/Jedi.Jcl.dpk =================================================================== --- trunk/jcl/packages/d10.net/Jedi.Jcl.dpk 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/packages/d10.net/Jedi.Jcl.dpk 2008-10-07 20:21:53 UTC (rev 2534) @@ -4,7 +4,7 @@ DO NOT EDIT THIS FILE, IT IS GENERATED BY THE PACKAGE GENERATOR ALWAYS EDIT THE RELATED XML FILE (Jcl-R.xml) - Last generated: 09-09-2008 17:41:48 UTC + Last generated: 07-10-2008 19:03:45 UTC ----------------------------------------------------------------------------- } @@ -60,6 +60,7 @@ JclSynch in '..\..\source\Common\JclSynch.pas' , JclSysInfo in '..\..\source\common\JclSysInfo.pas' , JclSysUtils in '..\..\source\common\JclSysUtils.pas' , + JclUnicode in '..\..\source\Common\JclUnicode.pas' , JclUnitConv in '..\..\source\common\JclUnitConv.pas' , JclValidation in '..\..\source\common\JclValidation.pas' ; Modified: trunk/jcl/packages/d11.net/Jedi.Jcl.dpk =================================================================== --- trunk/jcl/packages/d11.net/Jedi.Jcl.dpk 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/packages/d11.net/Jedi.Jcl.dpk 2008-10-07 20:21:53 UTC (rev 2534) @@ -4,7 +4,7 @@ DO NOT EDIT THIS FILE, IT IS GENERATED BY THE PACKAGE GENERATOR ALWAYS EDIT THE RELATED XML FILE (Jcl-R.xml) - Last generated: 09-09-2008 17:41:50 UTC + Last generated: 07-10-2008 19:03:46 UTC ----------------------------------------------------------------------------- } @@ -59,6 +59,7 @@ JclSynch in '..\..\source\Common\JclSynch.pas' , JclSysInfo in '..\..\source\common\JclSysInfo.pas' , JclSysUtils in '..\..\source\common\JclSysUtils.pas' , + JclUnicode in '..\..\source\Common\JclUnicode.pas' , JclUnitConv in '..\..\source\common\JclUnitConv.pas' , JclValidation in '..\..\source\common\JclValidation.pas' ; Modified: trunk/jcl/packages/d11.net/Jedi.Jcl.dproj =================================================================== --- trunk/jcl/packages/d11.net/Jedi.Jcl.dproj 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/packages/d11.net/Jedi.Jcl.dproj 2008-10-07 20:21:53 UTC (rev 2534) @@ -132,6 +132,7 @@ <DCCReference Include="..\..\source\Common\JclSynch.pas"/> <DCCReference Include="..\..\source\common\JclSysInfo.pas"/> <DCCReference Include="..\..\source\common\JclSysUtils.pas"/> + <DCCReference Include="..\..\source\Common\JclUnicode.pas"/> <DCCReference Include="..\..\source\common\JclUnitConv.pas"/> <DCCReference Include="..\..\source\common\JclValidation.pas"/> </ItemGroup> Modified: trunk/jcl/packages/d9.net/Jedi.Jcl.bdsproj =================================================================== --- trunk/jcl/packages/d9.net/Jedi.Jcl.bdsproj 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/packages/d9.net/Jedi.Jcl.bdsproj 2008-10-07 20:21:53 UTC (rev 2534) @@ -199,6 +199,7 @@ <File FileName="..\..\source\Common\JclSynch.pas" ContainerId="" ModuleName="JclSynch"/> <File FileName="..\..\source\common\JclSysInfo.pas" ContainerId="" ModuleName="JclSysInfo"/> <File FileName="..\..\source\common\JclSysUtils.pas" ContainerId="" ModuleName="JclSysUtils"/> + <File FileName="..\..\source\Common\JclUnicode.pas" ContainerId="" ModuleName="JclUnicode"/> <File FileName="..\..\source\common\JclUnitConv.pas" ContainerId="" ModuleName="JclUnitConv"/> <File FileName="..\..\source\common\JclValidation.pas" ContainerId="" ModuleName="JclValidation"/> </FileList> Modified: trunk/jcl/packages/d9.net/Jedi.Jcl.dpk =================================================================== --- trunk/jcl/packages/d9.net/Jedi.Jcl.dpk 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/packages/d9.net/Jedi.Jcl.dpk 2008-10-07 20:21:53 UTC (rev 2534) @@ -4,7 +4,7 @@ DO NOT EDIT THIS FILE, IT IS GENERATED BY THE PACKAGE GENERATOR ALWAYS EDIT THE RELATED XML FILE (Jcl-R.xml) - Last generated: 09-09-2008 17:41:48 UTC + Last generated: 07-10-2008 19:03:45 UTC ----------------------------------------------------------------------------- } @@ -60,6 +60,7 @@ JclSynch in '..\..\source\Common\JclSynch.pas' , JclSysInfo in '..\..\source\common\JclSysInfo.pas' , JclSysUtils in '..\..\source\common\JclSysUtils.pas' , + JclUnicode in '..\..\source\Common\JclUnicode.pas' , JclUnitConv in '..\..\source\common\JclUnitConv.pas' , JclValidation in '..\..\source\common\JclValidation.pas' ; Modified: trunk/jcl/packages/xml/Jcl-R.xml =================================================================== --- trunk/jcl/packages/xml/Jcl-R.xml 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/packages/xml/Jcl-R.xml 2008-10-07 20:21:53 UTC (rev 2534) @@ -56,7 +56,7 @@ <File Name="..\..\source\Common\JclSynch.pas" Targets="JclDev,JclDotNet" Formname="" Condition=""/> <File Name="..\..\source\common\JclSysInfo.pas" Targets="JclDev,JclDotNet" Formname="" Condition=""/> <File Name="..\..\source\common\JclSysUtils.pas" Targets="JclDev,JclDotNet" Formname="" Condition=""/> - <File Name="..\..\source\Common\JclUnicode.pas" Targets="JclDev" Formname="" Condition=""/> + <File Name="..\..\source\Common\JclUnicode.pas" Targets="JclDev,JclDotNet" Formname="" Condition=""/> <File Name="..\..\source\common\JclUnitConv.pas" Targets="JclDev,JclDotNet" Formname="" Condition=""/> <File Name="..\..\source\common\JclUnitVersioning.pas" Targets="JclDev" Formname="" Condition=""/> <File Name="..\..\source\common\JclUnitVersioningProviders.pas" Targets="JclDev" Formname="" Condition=""/> Modified: trunk/jcl/source/common/JclAbstractContainers.pas =================================================================== --- trunk/jcl/source/common/JclAbstractContainers.pas 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/source/common/JclAbstractContainers.pas 2008-10-07 20:21:53 UTC (rev 2534) @@ -687,7 +687,9 @@ {$IFDEF HAS_UNIT_ANSISTRINGS} AnsiStrings, {$ENDIF HAS_UNIT_ANSISTRINGS} + {$IFNDEF CLR} JclWideStrings, + {$ENDIF ~CLR} JclStringConversions, JclUnicode, SysUtils; @@ -1524,9 +1526,9 @@ case FEncoding of seUTF16: if FCaseSensitive then - Result := JclWideStrings.WideCompareStr(A, B) + Result := {$IFNDEF CLR}JclWideStrings.{$ENDIF ~CLR}WideCompareStr(A, B) else - Result := JclWideStrings.WideCompareText(A, B); + Result := {$IFNDEF CLR}JclWideStrings.{$ENDIF ~CLR}WideCompareText(A, B); else raise EJclOperationNotSupportedError.Create; end; @@ -1545,9 +1547,9 @@ case FEncoding of seUTF16: if FCaseSensitive then - Result := JclWideStrings.WideCompareStr(A, B) = 0 + Result := {$IFNDEF CLR}JclWideStrings.{$ENDIF ~CLR}WideCompareStr(A, B) = 0 else - Result := JclWideStrings.WideCompareText(A, B) = 0; + Result := {$IFNDEF CLR}JclWideStrings.{$ENDIF ~CLR}WideCompareText(A, B) = 0; else raise EJclOperationNotSupportedError.Create; end; Modified: trunk/jcl/source/common/JclUnicode.pas =================================================================== --- trunk/jcl/source/common/JclUnicode.pas 2008-10-07 19:25:34 UTC (rev 2533) +++ trunk/jcl/source/common/JclUnicode.pas 2008-10-07 20:21:53 UTC (rev 2534) @@ -626,6 +626,7 @@ (Range:(RangeStart: $F0000; RangeEnd: $FFFFF); Name: 'Supplementary Private Use Area-A'), (Range:(RangeStart: $100000; RangeEnd: $10FFFF); Name: 'Supplementary Private Use Area-B')); +{$IFNDEF CLR} type TWideStrings = class; @@ -1090,12 +1091,6 @@ property OnChanging: TNotifyEvent read FOnChanging write FOnChanging; end; - // result type for number retrieval functions - TUcNumber = record - Numerator, - Denominator: Integer; - end; - // functions involving null-terminated strings // NOTE: PWideChars as well as WideStrings are NOT managed by reference counting under Win32. // In Kylix this is different. WideStrings are reference counted there, just like ANSI strings. @@ -1137,6 +1132,7 @@ function WideExtractQuotedStr(var Src: PWideChar; Quote: WideChar): WideString; function WideQuotedStr(const S: WideString; Quote: WideChar): WideString; function WideStringOfChar(C: WideChar; Count: Cardinal): WideString; +{$ENDIF ~CLR} // case conversion function type @@ -1148,16 +1144,26 @@ function WideCaseFolding(const S: WideString): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} function WideLowerCase(C: WideChar): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} function WideLowerCase(const S: WideString): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} +function WideTitleCase(C: WideChar): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} +function WideTitleCase(const S: WideString): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} +function WideUpperCase(C: WideChar): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} +function WideUpperCase(const S: WideString): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} + +{$IFNDEF CLR} function WideNormalize(const S: WideString; Form: TNormalizationForm): WideString; function WideSameText(const Str1, Str2: WideString): Boolean; -function WideTitleCase(C: WideChar): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} -function WideTitleCase(const S: WideString): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} function WideTrim(const S: WideString): WideString; function WideTrimLeft(const S: WideString): WideString; function WideTrimRight(const S: WideString): WideString; -function WideUpperCase(C: WideChar): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} -function WideUpperCase(const S: WideString): WideString; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF SUPPORTS_INLINE} +{$ENDIF ~CLR} +type + // result type for number retrieval functions + TUcNumber = record + Numerator, + Denominator: Integer; + end; + // Low level character routines function UnicodeNumberLookup(Code: UCS4; var Number: TUcNumber): Boolean; function UnicodeCompose(const Codes: array of UCS4; var Composite: UCS4): Integer; @@ -1229,6 +1235,7 @@ function UnicodeIsHangul(C: UCS4): Boolean; // Utility functions +{$IFNDEF CLR} function CharSetFromLocale(Language: LCID): Byte; function GetCharSetFromLocale(Language: LCID; out FontCharSet: Byte): Boolean; function CodePageFromLocale(Language: LCID): Integer; @@ -1240,6 +1247,7 @@ function StringToWideStringEx(const S: AnsiString; CodePage: Word): WideString; function TranslateString(const S: AnsiString; CP1, CP2: Word): AnsiString; function WideStringToStringEx(const WS: WideString; CodePage: Word): AnsiString; +{$ENDIF ~CLR} type TCompareFunc = function (const W1, W2: WideString; Locale: LCID): Integer; @@ -1301,10 +1309,13 @@ {$IFDEF UNICODE_ZLIB_DATA} ZLibh, {$ENDIF UNICODE_ZLIB_DATA} + JclStreams, {$IFNDEF UNICODE_RAW_DATA} - JclStreams, JclCompression, {$ENDIF ~UNICODE_RAW_DATA} + {$IFDEF CLR} + Borland.Vcl.WinUtils, + {$ENDIF CLR} JclResources, JclSynch, JclSysUtils, JclSysInfo, JclStringConversions; const @@ -1331,25 +1342,27 @@ // while the data is loaded. LoadInProgress: TJclCriticalSection; -function OpenResourceStream(const ResName: string): TStream; +function OpenResourceStream(const ResName: string): TJclEasyStream; var ResourceStream: TStream; {$IFNDEF UNICODE_RAW_DATA} DecompressionStream: TStream; + RawStream: TMemoryStream; {$ENDIF ~UNICODE_RAW_DATA} begin ResourceStream := TResourceStream.Create(HInstance, ResName, 'UNICODEDATA'); {$IFDEF UNICODE_RAW_DATA} - Result := ResourceStream; + Result := TJclEasyStream.Create(ResourceStream, True); {$ENDIF UNICODE_RAW_DATA} {$IFDEF UNICODE_BZIP2_DATA} try LoadBZip2; DecompressionStream := TJclBZIP2DecompressionStream.Create(ResourceStream); try - Result := TMemoryStream.Create; - StreamCopy(DecompressionStream, Result); - StreamSeek(Result, 0, soBeginning); + RawStream := TMemoryStream.Create; + StreamCopy(DecompressionStream, RawStream); + StreamSeek(RawStream, 0, soBeginning); + Result := TJclEasyStream.Create(RawStream, True); finally DecompressionStream.Free; end; @@ -1362,9 +1375,10 @@ LoadZLib; DecompressionStream := TJclZLibDecompressStream.Create(ResourceStream); try - Result := TMemoryStream.Create; - StreamCopy(DecompressionStream, Result); - StreamSeek(Result, 0, soBeginning); + RawStream := TMemoryStream.Create; + StreamCopy(DecompressionStream, RawStream); + StreamSeek(RawStream, 0, soBeginning); + Result := TJclEasyStream.Create(RawStream, True); finally DecompressionStream.Free; end; @@ -1405,7 +1419,7 @@ // the comments about JclUnicode.res above). var Size: Integer; - Stream: TStream; + Stream: TJclEasyStream; Category: TCharacterCategory; Buffer: TRangeArray; First, Second, Third: Byte; @@ -1423,19 +1437,25 @@ while Stream.Position < Stream.Size do begin // a) read which category is current in the stream - Stream.ReadBuffer(Category, 1); + Category := TCharacterCategory(Stream.ReadByte); // b) read the size of the ranges and the ranges themself - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; if Size > 0 then begin SetLength(Buffer, Size); - Stream.ReadBuffer(Buffer[0], Size * SizeOf(TRange)); + for J := 0 to Size - 1 do + begin + Buffer[J].Start := Stream.ReadInteger; + Buffer[J].Stop := Stream.ReadInteger; + end; // c) go through every range and add the current category to each code point for J := 0 to Size - 1 do for K := Buffer[J].Start to Buffer[J].Stop do begin + {$IFNDEF CLR} Assert(K < $1000000, LoadResString(@RsCategoryUnicodeChar)); + {$ENDIF ~CLR} First := (K shr 16) and $FF; Second := (K shr 8) and $FF; @@ -1463,7 +1483,9 @@ var First, Second, Third: Byte; begin + {$IFNDEF CLR} Assert(Code < $1000000, LoadResString(@RsCategoryUnicodeChar)); + {$ENDIF ~CLR} // load property data if not already done if not CategoriesLoaded then @@ -1493,9 +1515,8 @@ procedure LoadCaseMappingData; var - Stream: TStream; - I, Code, - Size: Cardinal; + Stream: TJclEasyStream; + I, J, Code, Size: Integer; First, Second, Third: Byte; begin if not CaseDataLoaded then @@ -1508,15 +1529,16 @@ Stream := OpenResourceStream('CASE'); try // the first entry in the stream is the number of entries in the case mapping table - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; for I := 0 to Size - 1 do begin // a) read actual code point - Stream.ReadBuffer(Code, 4); + Code := Stream.ReadInteger; + {$IFNDEF CLR} + Assert(Code < $1000000, LoadResString(@RsCasedUnicodeChar)); + {$ENDIF ~CLR} - Assert(Code < $1000000, LoadResString(@RsCasedUnicodeChar)); // if there is no high byte entry in the first stage table then create one - First := (Code shr 16) and $FF; Second := (Code shr 8) and $FF; Third := Code and $FF; @@ -1526,32 +1548,36 @@ SetLength(CaseMapping[First, Second], 256); // b) read fold case array - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; if Size > 0 then begin SetLength(CaseMapping[First, Second, Third, ctFold], Size); - Stream.ReadBuffer(CaseMapping[First, Second, Third, ctFold, 0], Size * SizeOf(UCS4)); + for J := 0 to Size - 1 do + CaseMapping[First, Second, Third, ctFold, J] := Stream.ReadInteger; end; // c) read lower case array - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; if Size > 0 then begin SetLength(CaseMapping[First, Second, Third, ctLower], Size); - Stream.ReadBuffer(CaseMapping[First, Second, Third, ctLower, 0], Size * SizeOf(UCS4)); + for J := 0 to Size - 1 do + CaseMapping[First, Second, Third, ctLower, J] := Stream.ReadInteger; end; // d) read title case array - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; if Size > 0 then begin SetLength(CaseMapping[First, Second, Third, ctTitle], Size); - Stream.ReadBuffer(CaseMapping[First, Second, Third, ctTitle, 0], Size * SizeOf(UCS4)); + for J := 0 to Size - 1 do + CaseMapping[First, Second, Third, ctTitle, J] := Stream.ReadInteger; end; // e) read upper case array - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; if Size > 0 then begin SetLength(CaseMapping[First, Second, Third, ctUpper], Size); - Stream.ReadBuffer(CaseMapping[First, Second, Third, ctUpper, 0], Size * SizeOf(UCS4)); + for J := 0 to Size - 1 do + CaseMapping[First, Second, Third, ctUpper, J] := Stream.ReadInteger; end; end; @@ -1571,7 +1597,9 @@ var First, Second, Third: Byte; begin + {$IFNDEF CLR} Assert(Code < $1000000, LoadResString(@RsCasedUnicodeChar)); + {$ENDIF ~CLR} // load case mapping data if not already done if not CaseDataLoaded then @@ -1664,9 +1692,8 @@ procedure LoadDecompositionData; var - Stream: TStream; - I, Code, - Size: Cardinal; + Stream: TJclEasyStream; + I, J, Code, Size: Integer; First, Second, Third: Byte; begin if not DecompositionsLoaded then @@ -1679,12 +1706,14 @@ Stream := OpenResourceStream('DECOMPOSITION'); try // determine how many decomposition entries we have - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; for I := 0 to Size - 1 do begin - Stream.ReadBuffer(Code, 4); + Code := Stream.ReadInteger; + {$IFNDEF CLR} Assert((Code and not $40000000) < $1000000, LoadResString(@RsDecomposedUnicodeChar)); + {$ENDIF ~CLR} // if there is no high byte entry in the first stage table then create one First := (Code shr 16) and $FF; @@ -1700,11 +1729,12 @@ if CompatibleDecompositions[First, Second] = nil then SetLength(CompatibleDecompositions[First, Second], 256); - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; if Size > 0 then begin SetLength(CompatibleDecompositions[First, Second, Third], Size); - Stream.ReadBuffer(CompatibleDecompositions[First, Second, Third, 0], Size * SizeOf(UCS4)); + for J := 0 to Size - 1 do + CompatibleDecompositions[First, Second, Third, J] := Stream.ReadInteger; end; end else @@ -1714,11 +1744,12 @@ if CanonicalDecompositions[First, Second] = nil then SetLength(CanonicalDecompositions[First, Second], 256); - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; if Size > 0 then begin SetLength(CanonicalDecompositions[First, Second, Third], Size); - Stream.ReadBuffer(CanonicalDecompositions[First, Second, Third, 0], Size * SizeOf(UCS4)); + for J := 0 to Size - 1 do + CanonicalDecompositions[First, Second, Third, J] := Stream.ReadInteger; end; end; end; @@ -1752,7 +1783,9 @@ var First, Second, Third: Byte; begin + {$IFNDEF CLR} Assert((Code and not $40000000) < $1000000, LoadResString(@RsDecomposedUnicodeChar)); + {$ENDIF ~CLR} // load decomposition data if not already done if not DecompositionsLoaded then @@ -1808,9 +1841,8 @@ procedure LoadCombiningClassData; var - Stream: TStream; - I, J, K, - Size: Cardinal; + Stream: TJclEasyStream; + I, J, K, Size: Integer; Buffer: TRangeArray; First, Second, Third: Byte; begin @@ -1826,21 +1858,27 @@ while Stream.Position < Stream.Size do begin // a) determine which class is stored here - Stream.ReadBuffer(I, 4); + I := Stream.ReadInteger; // b) determine how many ranges are assigned to this class - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; // c) read start and stop code of each range if Size > 0 then begin SetLength(Buffer, Size); - Stream.ReadBuffer(Buffer[0], Size * SizeOf(TRange)); + for J := 0 to Size - 1 do + begin + Buffer[J].Start := Stream.ReadInteger; + Buffer[J].Stop := Stream.ReadInteger; + end; // d) put this class in every of the code points just loaded for J := 0 to Size - 1 do for K := Buffer[J].Start to Buffer[J].Stop do begin // (outchy) TODO: handle in a cleaner way + {$IFNDEF CLR} Assert(K < $1000000, LoadResString(@RsCombiningClassUnicodeChar)); + {$ENDIF ~CLR} First := (K shr 16) and $FF; Second := (K shr 8) and $FF; Third := K and $FF; @@ -1866,7 +1904,9 @@ var First, Second, Third: Byte; begin + {$IFNDEF CLR} Assert(Code < $1000000, LoadResString(@RsCombiningClassUnicodeChar)); + {$ENDIF ~CLR} // load combining class data if not already done if not CCCsLoaded then @@ -1898,8 +1938,8 @@ procedure LoadNumberData; var - Stream: TStream; - Size: Cardinal; + Stream: TJclEasyStream; + Size, I: Integer; begin // make sure no other code is currently modifying the global data area LoadInProgress.Enter; @@ -1908,21 +1948,32 @@ if NumberCodes = nil then begin Stream := OpenResourceStream('NUMBERS'); - // Numbers are special (compared to other Unicode data) as they utilize two - // arrays, one containing all used numbers (in nominator-denominator format) and - // another one which maps a code point to one of the numbers in the first array. + try + // Numbers are special (compared to other Unicode data) as they utilize two + // arrays, one containing all used numbers (in nominator-denominator format) and + // another one which maps a code point to one of the numbers in the first array. - // a) determine size of numbers array - Stream.ReadBuffer(Size, 4); - SetLength(Numbers, Size); - // b) read numbers data - Stream.ReadBuffer(Numbers[0], Size * SizeOf(TUcNumber)); - // c) determine size of index array - Stream.ReadBuffer(Size, 4); - SetLength(NumberCodes, Size); - // d) read index data - Stream.ReadBuffer(NumberCodes[0], Size * SizeOf(TCodeIndex)); - Stream.Free; + // a) determine size of numbers array + Size := Stream.ReadInteger; + SetLength(Numbers, Size); + // b) read numbers data + for I := 0 to Size - 1 do + begin + Numbers[I].Numerator := Stream.ReadInteger; + Numbers[I].Denominator := Stream.ReadInteger; + end; + // c) determine size of index array + Size := Stream.ReadInteger; + SetLength(NumberCodes, Size); + // d) read index data + for I := 0 to Size - 1 do + begin + NumberCodes[I].Code := Stream.ReadInteger; + NumberCodes[I].Index := Stream.ReadInteger; + end; + finally + Stream.Free; + end; end; finally LoadInProgress.Leave; @@ -1980,8 +2031,8 @@ procedure LoadCompositionData; var - Stream: TStream; - I, Size: Integer; + Stream: TJclEasyStream; + I, J, Size: Integer; begin // make sure no other code is currently modifying the global data area LoadInProgress.Enter; @@ -1992,18 +2043,19 @@ Stream := OpenResourceStream('COMPOSITION'); try // a) determine size of compositions array - Stream.ReadBuffer(Size, 4); + Size := Stream.ReadInteger; SetLength(Compositions, Size); // b) read data for I := 0 to Size - 1 do begin - Stream.ReadBuffer(Compositions[I].Code, 4); - Stream.ReadBuffer(Size, 4); + Compositions[I].Code := Stream.ReadInteger; + Size := Stream.ReadInteger; if Size > MaxCompositionSize then MaxCompositionSize := Size; SetLength(Compositions[I].Next, Size - 1); - Stream.ReadBuffer(Compositions[I].First, 4); - Stream.ReadBuffer(Compositions[I].Next[0], 4 * (Size - 1)); + Compositions[I].First := Stream.ReadInteger; + for J := 0 to Size - 2 do + Compositions[I].Next[J] := Stream.ReadInteger; end; finally Stream.Free; @@ -2084,6 +2136,8 @@ //=== { TSearchEngine } ====================================================== +{$IFNDEF CLR} + constructor TSearchEngine.Create(AOwner: TWideStrings); begin FOwner := AOwner; @@ -6809,6 +6863,35 @@ FixCanonical(Result); end; +function WideNormalize(const S: WideString; Form: TNormalizationForm): WideString; +var + Temp: WideString; + Compatible: Boolean; +begin + Result := S; + + if Form = nfNone then + Exit; // No normalization needed. + + Compatible := Form in [nfKC, nfKD]; + if Form in [nfD, nfKD] then + Result := WideDecompose(S, Compatible) + else + begin + Temp := WideDecompose(S, Compatible); + Result := WideCompose(Temp); + end; +end; + +function WideSameText(const Str1, Str2: WideString): Boolean; +// Compares both strings case-insensitively and returns True if both are equal, otherwise False is returned. +begin + Result := Length(Str1) = Length(Str2); + if Result then + Result := StrICompW(PWideChar(Str1), PWideChar(Str2)) = 0; +end; +{$ENDIF ~CLR} + //----------------- general purpose case mapping --------------------------------------------------- function WideCaseConvert(C: WideChar; CaseType: TCaseType): WideString; @@ -6909,34 +6992,6 @@ Result:= WideCaseConvert(S, ctLower); end; -function WideNormalize(const S: WideString; Form: TNormalizationForm): WideString; -var - Temp: WideString; - Compatible: Boolean; -begin - Result := S; - - if Form = nfNone then - Exit; // No normalization needed. - - Compatible := Form in [nfKC, nfKD]; - if Form in [nfD, nfKD] then - Result := WideDecompose(S, Compatible) - else - begin - Temp := WideDecompose(S, Compatible); - Result := WideCompose(Temp); - end; -end; - -function WideSameText(const Str1, Str2: WideString): Boolean; -// Compares both strings case-insensitively and returns True if both are equal, otherwise False is returned. -begin - Result := Length(Str1) = Length(Str2); - if Result then - Result := StrICompW(PWideChar(Str1), PWideChar(Str2)) = 0; -end; - function WideTitleCase(C: WideChar): WideString; begin Result:= WideCaseConvert(C, ctTitle); @@ -7295,6 +7350,7 @@ Result := (C >= $AC00) and (C <= $D7FF); end; +{$IFNDEF CLR} // I need to fix a problem (introduced by MS) here. The first parameter can be a pointer // (and is so defined) or can be a normal DWORD, depending on the dwFlags parameter. // As usual, lpSrc has been translated to a var parameter. But this does not work in @@ -7455,15 +7511,19 @@ Result:= WideStringToStringEx(StringToWideStringEx(S, CP1), CP2); end; +{$ENDIF ~CLR} + procedure PrepareUnicodeData; // Prepares structures which are globally needed. begin LoadInProgress := TJclCriticalSection.Create; + {$IFNDEF CLR} if (Win32Platform and VER_PLATFORM_WIN32_NT) <> 0 then @WideCompareText := @CompareTextWinNT else @WideCompareText := @CompareTextWin95; + {$ENDIF ~CLR} end; procedure FreeUnicodeData; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-07 19:25:38
|
Revision: 2533 http://jcl.svn.sourceforge.net/jcl/?rev=2533&view=rev Author: outchy Date: 2008-10-07 19:25:34 +0000 (Tue, 07 Oct 2008) Log Message: ----------- Added Byte-related stuff into TJclEasyStream. Modified Paths: -------------- trunk/jcl/source/common/JclStreams.pas Modified: trunk/jcl/source/common/JclStreams.pas =================================================================== --- trunk/jcl/source/common/JclStreams.pas 2008-10-07 19:16:48 UTC (rev 2532) +++ trunk/jcl/source/common/JclStreams.pas 2008-10-07 19:25:34 UTC (rev 2533) @@ -304,6 +304,7 @@ function ReadAnsiChar: AnsiChar; function ReadWideChar: WideChar; {$IFNDEF CLR} + function ReadByte: Byte; function ReadCurrency: Currency; function ReadDateTime: TDateTime; function ReadExtended: Extended; @@ -323,6 +324,7 @@ procedure WriteChar(Value: Char); procedure WriteAnsiChar(Value: AnsiChar); procedure WriteWideChar(Value: WideChar); + procedure WriteByte(Value: Byte); {$IFNDEF CLR} procedure WriteCurrency(const Value: Currency); procedure WriteDateTime(const Value: TDateTime); @@ -1688,6 +1690,11 @@ end; {$IFNDEF CLR} +function TJclEasyStream.ReadByte: Byte; +begin + ReadBuffer(Result, SizeOf(Result)); +end; + function TJclEasyStream.ReadCurrency: Currency; begin ReadBuffer(Result, SizeOf(Result)); @@ -1922,6 +1929,15 @@ {$ENDIF ~CLR} end; +procedure TJclEasyStream.WriteByte(Value: Byte); +begin + {$IFDEF CLR} + WriteBuffer(Value); + {$ELSE ~CLR} + WriteBuffer(Value, SizeOf(Value)); + {$ENDIF ~CLR} +end; + {$IFNDEF CLR} procedure TJclEasyStream.WriteCurrency(const Value: Currency); begin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-07 19:16:58
|
Revision: 2532 http://jcl.svn.sourceforge.net/jcl/?rev=2532&view=rev Author: outchy Date: 2008-10-07 19:16:48 +0000 (Tue, 07 Oct 2008) Log Message: ----------- synchronized prototype file (jcl/source/prototypes/JclContainerIntf.pas) with previous changes directly made in target file (jcl/source/common/JclContainerIntf.pas). Modified Paths: -------------- trunk/jcl/source/prototypes/JclContainerIntf.pas Modified: trunk/jcl/source/prototypes/JclContainerIntf.pas =================================================================== --- trunk/jcl/source/prototypes/JclContainerIntf.pas 2008-10-07 19:15:23 UTC (rev 2531) +++ trunk/jcl/source/prototypes/JclContainerIntf.pas 2008-10-07 19:16:48 UTC (rev 2532) @@ -266,7 +266,7 @@ property CaseSensitive: Boolean read GetCaseSensitive write SetCaseSensitive; end; - TJclAnsiStrEncoding = (seISO {, seUTF8}); // TODO: make JclUnicode compatible with Linux and .NET + TJclAnsiStrEncoding = (seISO, seUTF8); IJclAnsiStrContainer = interface(IJclStrContainer) ['{F8239357-B96F-46F1-A48E-B5DF25B5F1FA}'] @@ -287,7 +287,7 @@ procedure LoadDelimited(const AString: AnsiString; const Separator: AnsiString = AnsiLineBreak); end; - TJclWideStrEncoding = (weUCS2 {, wsUTF16}); // TODO: make JclUnicode compatible with Linux and .NET + TJclWideStrEncoding = (seUTF16); IJclWideStrContainer = interface(IJclStrContainer) ['{875E1AC4-CA22-46BC-8999-048E5B9BF11D}'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2008-10-07 19:15:27
|
Revision: 2531 http://jcl.svn.sourceforge.net/jcl/?rev=2531&view=rev Author: obones Date: 2008-10-07 19:15:23 +0000 (Tue, 07 Oct 2008) Log Message: ----------- Removed warning in D2009 Modified Paths: -------------- trunk/jcl/source/vcl/JclVersionCtrlSVNImpl.pas Modified: trunk/jcl/source/vcl/JclVersionCtrlSVNImpl.pas =================================================================== --- trunk/jcl/source/vcl/JclVersionCtrlSVNImpl.pas 2008-10-07 19:14:20 UTC (rev 2530) +++ trunk/jcl/source/vcl/JclVersionCtrlSVNImpl.pas 2008-10-07 19:15:23 UTC (rev 2531) @@ -256,7 +256,7 @@ // new SVN entries file (flat-style) if EntryLine = NativeFormFeed then begin - EntryLine := Entries.ReadLn; + EntryLine := string(Entries.ReadLn); if StrSame(UpperCaseFileName, StrUpper(EntryLine)) then begin // TODO: check modifications This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2008-10-07 19:14:22
|
Revision: 2530 http://jcl.svn.sourceforge.net/jcl/?rev=2530&view=rev Author: obones Date: 2008-10-07 19:14:20 +0000 (Tue, 07 Oct 2008) Log Message: ----------- Modified Paths: -------------- trunk/jcl/source/common/JclFileUtils.pas Modified: trunk/jcl/source/common/JclFileUtils.pas =================================================================== --- trunk/jcl/source/common/JclFileUtils.pas 2008-10-07 19:10:17 UTC (rev 2529) +++ trunk/jcl/source/common/JclFileUtils.pas 2008-10-07 19:14:20 UTC (rev 2530) @@ -644,7 +644,7 @@ TJclFileVersionInfo = class(TObject) private - FBuffer: string; + FBuffer: AnsiString; FFixedInfo: PVSFixedFileInfo; FFileFlags: TFileFlags; FItemList: TStringList; @@ -5336,7 +5336,8 @@ constructor TJclFileVersionInfo.Attach(VersionInfoData: Pointer; Size: Integer); begin - SetString(FBuffer, PChar(VersionInfoData), Size); + SetLength(FBuffer, Size); + CopyMemory(PAnsiChar(FBuffer), VersionInfoData, Size); ExtractData; end; @@ -5349,7 +5350,7 @@ if Size = 0 then raise EJclFileVersionInfoError.CreateRes(@RsFileUtilsNoVersionInfo); SetLength(FBuffer, Size); - Win32Check(GetFileVersionInfo(PChar(FileName), Handle, Size, PChar(FBuffer))); + Win32Check(GetFileVersionInfo(PChar(FileName), Handle, Size, PAnsiChar(FBuffer))); ExtractData; end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-07 19:10:26
|
Revision: 2529 http://jcl.svn.sourceforge.net/jcl/?rev=2529&view=rev Author: outchy Date: 2008-10-07 19:10:17 +0000 (Tue, 07 Oct 2008) Log Message: ----------- Disabling Extended-related stuff for Delphi.net. The behavior is not reliable across various platforms. Modified Paths: -------------- trunk/jcl/source/common/JclStreams.pas Modified: trunk/jcl/source/common/JclStreams.pas =================================================================== --- trunk/jcl/source/common/JclStreams.pas 2008-10-07 18:24:09 UTC (rev 2528) +++ trunk/jcl/source/common/JclStreams.pas 2008-10-07 19:10:17 UTC (rev 2529) @@ -306,9 +306,9 @@ {$IFNDEF CLR} function ReadCurrency: Currency; function ReadDateTime: TDateTime; + function ReadExtended: Extended; {$ENDIF ~CLR} function ReadDouble: Double; - function ReadExtended: Extended; function ReadInt64: Int64; function ReadInteger: Integer; function ReadCString: string; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} @@ -326,9 +326,9 @@ {$IFNDEF CLR} procedure WriteCurrency(const Value: Currency); procedure WriteDateTime(const Value: TDateTime); + procedure WriteExtended(const Value: Extended); {$ENDIF ~CLR} procedure WriteDouble(const Value: Double); - procedure WriteExtended(const Value: Extended); procedure WriteInt64(Value: Int64); overload; procedure WriteInteger(Value: Integer); overload; procedure WriteCString(const Value: string); {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} @@ -1708,14 +1708,12 @@ {$ENDIF ~CLR} end; +{$IFNDEF CLR} function TJclEasyStream.ReadExtended: Extended; begin - {$IFDEF CLR} - ReadBuffer(Result); - {$ELSE ~CLR} ReadBuffer(Result, SizeOf(Result)); - {$ENDIF ~CLR} end; +{$ENDIF ~CLR} function TJclEasyStream.ReadInt64: Int64; begin @@ -1945,14 +1943,12 @@ {$ENDIF ~CLR} end; +{$IFNDEF CLR} procedure TJclEasyStream.WriteExtended(const Value: Extended); begin - {$IFDEF CLR} - WriteBuffer(Value); - {$ELSE ~CLR} WriteBuffer(Value, SizeOf(Value)); - {$ENDIF ~CLR} end; +{$ENDIF ~CLR} procedure TJclEasyStream.WriteInt64(Value: Int64); begin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-07 18:24:20
|
Revision: 2528 http://jcl.svn.sourceforge.net/jcl/?rev=2528&view=rev Author: outchy Date: 2008-10-07 18:24:09 +0000 (Tue, 07 Oct 2008) Log Message: ----------- force ZLib to be loaded when linked from DLL. Modified Paths: -------------- trunk/jcl/source/common/JclUnicode.pas Modified: trunk/jcl/source/common/JclUnicode.pas =================================================================== --- trunk/jcl/source/common/JclUnicode.pas 2008-10-07 16:12:37 UTC (rev 2527) +++ trunk/jcl/source/common/JclUnicode.pas 2008-10-07 18:24:09 UTC (rev 2528) @@ -1298,6 +1298,9 @@ {$IFDEF UNICODE_BZIP2_DATA} BZip2, {$ENDIF UNICODE_BZIP2_DATA} + {$IFDEF UNICODE_ZLIB_DATA} + ZLibh, + {$ENDIF UNICODE_ZLIB_DATA} {$IFNDEF UNICODE_RAW_DATA} JclStreams, JclCompression, @@ -1356,6 +1359,7 @@ {$ENDIF UNICODE_BZIP2_DATA} {$IFDEF UNICODE_ZLIB_DATA} try + LoadZLib; DecompressionStream := TJclZLibDecompressStream.Create(ResourceStream); try Result := TMemoryStream.Create; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2008-10-07 16:12:38
|
Revision: 2527 http://jcl.svn.sourceforge.net/jcl/?rev=2527&view=rev Author: obones Date: 2008-10-07 16:12:37 +0000 (Tue, 07 Oct 2008) Log Message: ----------- Removed warning Modified Paths: -------------- trunk/jcl/source/common/JclSysInfo.pas Modified: trunk/jcl/source/common/JclSysInfo.pas =================================================================== --- trunk/jcl/source/common/JclSysInfo.pas 2008-10-07 15:36:51 UTC (rev 2526) +++ trunk/jcl/source/common/JclSysInfo.pas 2008-10-07 16:12:37 UTC (rev 2527) @@ -2197,14 +2197,12 @@ begin SetLength(Host, MAX_PATH); GetHostName(PAnsiChar(Host), MAX_PATH); - HostEnt := GetHostByName(PAnsiChar(Host)); - if HostEnt = nil then - Host := ''; end else Host := HostName; - - if Host <> '' then + + HostEnt := GetHostByName(PAnsiChar(Host)); + if HostEnt <> nil then begin pPtr := PaPInAddr(HostEnt^.h_addr_list); i := 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ob...@us...> - 2008-10-07 15:36:52
|
Revision: 2526 http://jcl.svn.sourceforge.net/jcl/?rev=2526&view=rev Author: obones Date: 2008-10-07 15:36:51 +0000 (Tue, 07 Oct 2008) Log Message: ----------- When using a unicode capable compiler, we must call the W version of the API Modified Paths: -------------- trunk/jcl/source/common/JclFileUtils.pas Modified: trunk/jcl/source/common/JclFileUtils.pas =================================================================== --- trunk/jcl/source/common/JclFileUtils.pas 2008-10-05 19:31:10 UTC (rev 2525) +++ trunk/jcl/source/common/JclFileUtils.pas 2008-10-07 15:36:51 UTC (rev 2526) @@ -2587,7 +2587,7 @@ begin Result := Path; if not Assigned(_GetLongPathName) then - _GetLongPathName := GetModuleSymbol(Kernel32Handle, 'GetLongPathNameA'); + _GetLongPathName := GetModuleSymbol(Kernel32Handle, {$IFDEF UNICODE}'GetLongPathNameW'{$ELSE}'GetLongPathNameA'{$ENDIF UNICODE}); if not Assigned(_GetLongPathName) then Result := ShellGetLongPathName(Path) else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cyc...@us...> - 2008-10-05 19:31:14
|
Revision: 2525 http://jcl.svn.sourceforge.net/jcl/?rev=2525&view=rev Author: cycocrew Date: 2008-10-05 19:31:10 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Fixed TJclUnicodeStrAbstractContainer.Hash in JclAbstractContainers.pas Modified Paths: -------------- trunk/jcl/source/common/JclAbstractContainers.pas Modified: trunk/jcl/source/common/JclAbstractContainers.pas =================================================================== --- trunk/jcl/source/common/JclAbstractContainers.pas 2008-10-05 14:26:49 UTC (rev 2524) +++ trunk/jcl/source/common/JclAbstractContainers.pas 2008-10-05 19:31:10 UTC (rev 2525) @@ -1635,52 +1635,46 @@ IntegerHash.H2 := 1; IntegerHash.H3 := 2; IntegerHash.H4 := 3; - case FEncoding of - seUTF16: + SetLength(CA, 0); + if FCaseSensitive then + begin + I := 1; + while I < Length(AString) do + begin + C2.C := UTF16GetNextChar(AString, I); + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; + end; + end + else + begin + // case insensitive + I := 1; + while I < Length(AString) do + begin + C2.C := UTF16GetNextChar(AString, I); + CA := UnicodeCaseFold(C2.C); + for J := Low(CA) to High(CA) do begin - SetLength(CA, 0); - if FCaseSensitive then - begin - I := 1; - while I < Length(AString) do - begin - C2.C := UTF16GetNextChar(AString, I); - if I = -1 then - raise EJclUnexpectedEOSequenceError.Create; - IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; - IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; - IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; - IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; - end; - end - else - begin - // case insensitive - I := 1; - while I < Length(AString) do - begin - C2.C := UTF16GetNextChar(AString, I); - CA := UnicodeCaseFold(C2.C); - for J := Low(CA) to High(CA) do - begin - C2.C := CA[J]; - if I = -1 then - raise EJclUnexpectedEOSequenceError.Create; - IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; - IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; - IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; - IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; - end; - end; - end; + C2.C := CA[J]; + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; end; - else - raise EJclOperationNotSupportedError.Create; + end; end; Result := IntegerHash.H; end; end; + function TJclUnicodeStrAbstractContainer.ItemsCompare(const A, B: UnicodeString): Integer; begin if Assigned(FCompare) then This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 15:29:07
|
Revision: 2523 http://jcl.svn.sourceforge.net/jcl/?rev=2523&view=rev Author: outchy Date: 2008-10-05 14:21:29 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Mantis 2099: TJclAppInstances: Sending only to one specific window , which doesn't need to be application.handle Modified Paths: -------------- trunk/jcl/source/common/JclSysInfo.pas trunk/jcl/source/windows/JclAppInst.pas Modified: trunk/jcl/source/common/JclSysInfo.pas =================================================================== --- trunk/jcl/source/common/JclSysInfo.pas 2008-10-05 13:49:10 UTC (rev 2522) +++ trunk/jcl/source/common/JclSysInfo.pas 2008-10-05 14:21:29 UTC (rev 2523) @@ -260,6 +260,7 @@ function GetProcessNameFromWnd(Wnd: THandle): string; function GetProcessNameFromPid(PID: DWORD): string; function GetMainAppWndFromPid(PID: DWORD): THandle; +function GetWndFromPid(PID: DWORD; const WindowClassName: string): HWND; {.$ENDIF ~FPC} function GetShellProcessName: string; @@ -3131,6 +3132,49 @@ Result := SearchRec.Wnd; end; +function GetWndFromPid(PID: DWORD; const WindowClassName: string): HWND; +type + PEnumWndStruct = ^TEnumWndStruct; + TEnumWndStruct = record + PID: DWORD; + WndClassName: string; + ResultWnd: HWND; + end; + + function EnumWinProc(Wnd: HWND; Enum: PEnumWndStruct): BOOL; stdcall; + var + PID: DWORD; + C: PChar; + CLen: Integer; + begin + Result := True; + GetWindowThreadProcessId(Wnd, @PID); + if (PID = Enum.PID) then + begin + CLen := Length(Enum.WndClassName)+1; + C := StrAlloc(CLen); + + if (GetClassName(Wnd, C, CLen) > 0) then + if (C = Enum.WndClassName) then + begin + Result := False; + Enum.ResultWnd := Wnd; + end; + + StrDispose(C); + end; + end; + +var + EnumWndStruct: TEnumWndStruct; +begin + EnumWndStruct.PID := PID; + EnumWndStruct.WndClassName := WindowClassName; + EnumWndStruct.ResultWnd := 0; + EnumWindows(@EnumWinProc, LPARAM(@EnumWndStruct)); + Result := EnumWndStruct.ResultWnd; +end; + function GetShellProcessName: string; const cShellKey = 'SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon'; Modified: trunk/jcl/source/windows/JclAppInst.pas =================================================================== --- trunk/jcl/source/windows/JclAppInst.pas 2008-10-05 13:49:10 UTC (rev 2522) +++ trunk/jcl/source/windows/JclAppInst.pas 2008-10-05 14:21:29 UTC (rev 2523) @@ -114,6 +114,14 @@ procedure ReadMessageString(const Message: TMessage; var S: string); procedure ReadMessageStrings(const Message: TMessage; const Strings: TStrings); +function SendData(const Wnd, OriginatorWnd: HWND; + const DataKind: TJclAppInstDataKind; const Data: Pointer; const Size: Integer): Boolean; +function SendStrings(const Wnd, OriginatorWnd: HWND; + const DataKind: TJclAppInstDataKind; const Strings: TStrings): Boolean; +function SendCmdLineParams(const Wnd, OriginatorWnd: HWND): Boolean; +function SendString(const Wnd, OriginatorWnd: HWND; + const DataKind: TJclAppInstDataKind; const S: string): Boolean; + {$IFDEF UNITVERSIONING} const UnitVersioning: TUnitVersionInfo = ( @@ -582,6 +590,47 @@ end; end; +function SendData(const Wnd, OriginatorWnd: HWND; + const DataKind: TJclAppInstDataKind; const Data: Pointer; const Size: Integer): Boolean; +var + CopyData: TCopyDataStruct; +begin + CopyData.dwData := DataKind; + CopyData.cbData := Size; + CopyData.lpData := Data; + Result := Boolean(SendMessage(Wnd, WM_COPYDATA, OriginatorWnd, LPARAM(@CopyData))); +end; + +function SendStrings(const Wnd, OriginatorWnd: HWND; + const DataKind: TJclAppInstDataKind; const Strings: TStrings): Boolean; +var + S: string; +begin + S := Strings.Text; + Result := SendData(Wnd, OriginatorWnd, DataKind, Pointer(S), Length(S)); +end; + +function SendCmdLineParams(const Wnd, OriginatorWnd: HWND): Boolean; +var + TempList: TStringList; + I: Integer; +begin + TempList := TStringList.Create; + try + for I := 1 to ParamCount do + TempList.Add(ParamStr(I)); + Result := SendStrings(Wnd, OriginatorWnd, AppInstCmdLineDataKind, TempList); + finally + TempList.Free; + end; +end; + +function SendString(const Wnd, OriginatorWnd: HWND; + const DataKind: TJclAppInstDataKind; const S: string): Boolean; +begin + Result := SendData(Wnd, OriginatorWnd, DataKind, PChar(S), Length(S)); +end; + initialization {$IFDEF UNITVERSIONING} RegisterUnitVersion(HInstance, UnitVersioning); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 14:29:31
|
Revision: 2524 http://jcl.svn.sourceforge.net/jcl/?rev=2524&view=rev Author: outchy Date: 2008-10-05 14:26:49 +0000 (Sun, 05 Oct 2008) Log Message: ----------- >From Jean-Fabien Connault: missing overload directive when compiling revision 2518. Revision Links: -------------- http://jcl.svn.sourceforge.net/jcl/?rev=2518&view=rev Modified Paths: -------------- trunk/jcl/source/common/JclStringConversions.pas Modified: trunk/jcl/source/common/JclStringConversions.pas =================================================================== --- trunk/jcl/source/common/JclStringConversions.pas 2008-10-05 14:21:29 UTC (rev 2523) +++ trunk/jcl/source/common/JclStringConversions.pas 2008-10-05 14:26:49 UTC (rev 2524) @@ -104,9 +104,9 @@ // if UNICODE_SILENT_FAILURE is defined, invalid sequences will be replaced by ReplacementCharacter // otherwise StrPos is set to -1 on return to flag an error (invalid UTF16 sequence) // StrPos will be incremented by the number of chars that were read -function UTF16GetNextChar(const S: TUTF16String; var StrPos: Integer): UCS4; +function UTF16GetNextChar(const S: TUTF16String; var StrPos: Integer): UCS4; overload; {$IFDEF SUPPORTS_UNICODE_STRING} -function UTF16GetNextChar(const S: UnicodeString; var StrPos: Integer): UCS4; +function UTF16GetNextChar(const S: UnicodeString; var StrPos: Integer): UCS4; overload; {$ENDIF SUPPORTS_UNICODE_STRING} function UTF16GetNextCharFromStream(S: TStream; var Ch: UCS4): Boolean; @@ -114,9 +114,9 @@ // if UNICODE_SILENT_FAILURE is defined, invalid sequences will be replaced by ReplacementCharacter // otherwise StrPos is set to -1 on return to flag an error (invalid UTF16 sequence) // StrPos will be decremented by the number of chars that were read -function UTF16GetPreviousChar(const S: TUTF16String; var StrPos: Integer): UCS4; +function UTF16GetPreviousChar(const S: TUTF16String; var StrPos: Integer): UCS4; overload; {$IFDEF SUPPORTS_UNICODE_STRING} -function UTF16GetPreviousChar(const S: UnicodeString; var StrPos: Integer): UCS4; +function UTF16GetPreviousChar(const S: UnicodeString; var StrPos: Integer): UCS4; overload; {$ENDIF SUPPORTS_UNICODE_STRING} // UTF16SkipChars = skip NbSeq UTF16 sequences starting from StrPos @@ -124,9 +124,9 @@ // if UNICODE_SILENT_FAILURE is not defined StrPos is set to -1 on error (invalid UTF16 sequence) // StrPos will be incremented by the number of chars that were skipped // On return, NbChar contains the number of UTF16 sequences that were skipped -function UTF16SkipChars(const S: TUTF16String; var StrPos: Integer; var NbSeq: Integer): Boolean; +function UTF16SkipChars(const S: TUTF16String; var StrPos: Integer; var NbSeq: Integer): Boolean; overload; {$IFDEF SUPPORTS_UNICODE_STRING} -function UTF16SkipChars(const S: UnicodeString; var StrPos: Integer; var NbSeq: Integer): Boolean; +function UTF16SkipChars(const S: UnicodeString; var StrPos: Integer; var NbSeq: Integer): Boolean; overload; {$ENDIF SUPPORTS_UNICODE_STRING} function UTF16SkipCharsFromStream(S: TStream; var NbSeq: Integer): Boolean; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 14:23:04
|
Revision: 2518 http://jcl.svn.sourceforge.net/jcl/?rev=2518&view=rev Author: outchy Date: 2008-10-05 13:08:35 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Added overloaded version of UTF16-related functions to reduce number of implicit conversions when using Delphi 2009. Modified Paths: -------------- trunk/jcl/source/common/JclStringConversions.pas Modified: trunk/jcl/source/common/JclStringConversions.pas =================================================================== --- trunk/jcl/source/common/JclStringConversions.pas 2008-10-05 13:00:19 UTC (rev 2517) +++ trunk/jcl/source/common/JclStringConversions.pas 2008-10-05 13:08:35 UTC (rev 2518) @@ -105,6 +105,9 @@ // otherwise StrPos is set to -1 on return to flag an error (invalid UTF16 sequence) // StrPos will be incremented by the number of chars that were read function UTF16GetNextChar(const S: TUTF16String; var StrPos: Integer): UCS4; +{$IFDEF SUPPORTS_UNICODE_STRING} +function UTF16GetNextChar(const S: UnicodeString; var StrPos: Integer): UCS4; +{$ENDIF SUPPORTS_UNICODE_STRING} function UTF16GetNextCharFromStream(S: TStream; var Ch: UCS4): Boolean; // UTF16GetPreviousChar = read previous UTF16 sequence starting at StrPos-1 @@ -112,6 +115,9 @@ // otherwise StrPos is set to -1 on return to flag an error (invalid UTF16 sequence) // StrPos will be decremented by the number of chars that were read function UTF16GetPreviousChar(const S: TUTF16String; var StrPos: Integer): UCS4; +{$IFDEF SUPPORTS_UNICODE_STRING} +function UTF16GetPreviousChar(const S: UnicodeString; var StrPos: Integer): UCS4; +{$ENDIF SUPPORTS_UNICODE_STRING} // UTF16SkipChars = skip NbSeq UTF16 sequences starting from StrPos // returns False if String is too small @@ -119,6 +125,9 @@ // StrPos will be incremented by the number of chars that were skipped // On return, NbChar contains the number of UTF16 sequences that were skipped function UTF16SkipChars(const S: TUTF16String; var StrPos: Integer; var NbSeq: Integer): Boolean; +{$IFDEF SUPPORTS_UNICODE_STRING} +function UTF16SkipChars(const S: UnicodeString; var StrPos: Integer; var NbSeq: Integer): Boolean; +{$ENDIF SUPPORTS_UNICODE_STRING} function UTF16SkipCharsFromStream(S: TStream; var NbSeq: Integer): Boolean; // UTF16SetNextChar = append an UTF16 sequence at StrPos @@ -1158,6 +1167,55 @@ end; end; +// if UNICODE_SILENT_FAILURE is defined, invalid sequences will be replaced by ReplacementCharacter +// otherwise StrPos is set to -1 on return to flag an error (invalid UTF16 sequence) +// StrPos will be incremented by the number of chars that were read +{$IFDEF SUPPORTS_UNICODE_STRING} +function UTF16GetNextChar(const S: UnicodeString; var StrPos: Integer): UCS4; +var + StrLength: Integer; + ChNext: UCS4; +begin + StrLength := Length(S); + + if (StrPos <= StrLength) and (StrPos > 0) then + begin + Result := UCS4(S[StrPos]); + + case Result of + SurrogateHighStart..SurrogateHighEnd: + begin + // 2 bytes to read + if StrPos >= StrLength then + begin + FlagInvalidSequence(StrPos, 1, Result); + Exit; + end; + ChNext := UCS4(S[StrPos + 1]); + if (ChNext < SurrogateLowStart) or (ChNext > SurrogateLowEnd) then + begin + FlagInvalidSequence(StrPos, 1, Result); + Exit; + end; + Result := ((Result - SurrogateHighStart) shl HalfShift) + (ChNext - SurrogateLowStart) + HalfBase; + Inc(StrPos, 2); + end; + SurrogateLowStart..SurrogateLowEnd: + FlagInvalidSequence(StrPos, 1, Result); + else + // 1 byte to read + Inc(StrPos); + end; + end + else + begin + // StrPos > StrLength + Result := 0; + FlagInvalidSequence(StrPos, 0, Result); + end; +end; +{$ENDIF SUPPORTS_UNICODE_STRING} + function UTF16GetNextCharFromStream(S: TStream; var Ch: UCS4): Boolean; var W: Word; @@ -1236,6 +1294,55 @@ end; end; +// if UNICODE_SILENT_FAILURE is defined, invalid sequences will be replaced by ReplacementCharacter +// otherwise StrPos is set to -1 on return to flag an error (invalid UTF16 sequence) +// StrPos will be decremented by the number of chars that were read +{$IFDEF SUPPORTS_UNICODE_STRING} +function UTF16GetPreviousChar(const S: UnicodeString; var StrPos: Integer): UCS4; +var + StrLength: Integer; + ChPrev: UCS4; +begin + StrLength := Length(S); + + if (StrPos <= (StrLength + 1)) and (StrPos > 1) then + begin + Result := UCS4(S[StrPos - 1]); + + case Result of + SurrogateHighStart..SurrogateHighEnd: + FlagInvalidSequence(StrPos, -1, Result); + SurrogateLowStart..SurrogateLowEnd: + begin + // 2 bytes to read + if StrPos <= 2 then + begin + FlagInvalidSequence(StrPos, -1, Result); + Exit; + end; + ChPrev := UCS4(S[StrPos - 2]); + if (ChPrev < SurrogateHighStart) or (ChPrev > SurrogateHighEnd) then + begin + FlagInvalidSequence(StrPos, -1, Result); + Exit; + end; + Result := ((ChPrev - SurrogateHighStart) shl HalfShift) + (Result - SurrogateLowStart) + HalfBase; + Dec(StrPos, 2); + end; + else + // 1 byte to read + Dec(StrPos); + end; + end + else + begin + // StrPos > StrLength + Result := 0; + FlagInvalidSequence(StrPos, 0, Result); + end; +end; +{$ENDIF SUPPORTS_UNICODE_STRING} + // returns False if String is too small // if UNICODE_SILENT_FAILURE is not defined StrPos is set to -1 on error (invalid UTF16 sequence) // StrPos will be incremented by the number of chars that were skipped @@ -1322,6 +1429,94 @@ NbSeq := Index; end; +// returns False if String is too small +// if UNICODE_SILENT_FAILURE is not defined StrPos is set to -1 on error (invalid UTF16 sequence) +// StrPos will be incremented by the number of chars that were skipped +// On return, NbSeq contains the number of UTF16 sequences that were skipped +{$IFDEF SUPPORTS_UNICODE_STRING} +function UTF16SkipChars(const S: UnicodeString; var StrPos: Integer; var NbSeq: Integer): Boolean; +var + StrLength, Index: Integer; + Ch, ChNext: UCS4; +begin + Result := True; + StrLength := Length(S); + + Index := 0; + if NbSeq >= 0 then + while (Index < NbSeq) and (StrPos > 0) do + begin + Ch := UCS4(S[StrPos]); + + case Ch of + SurrogateHighStart..SurrogateHighEnd: + // 2 bytes to skip + if StrPos >= StrLength then + FlagInvalidSequence(StrPos, 1) + else + begin + ChNext := UCS4(S[StrPos + 1]); + if (ChNext < SurrogateLowStart) or (ChNext > SurrogateLowEnd) then + FlagInvalidSequence(StrPos, 1) + else + Inc(StrPos, 2); + end; + SurrogateLowStart..SurrogateLowEnd: + // error + FlagInvalidSequence(StrPos, 1); + else + // 1 byte to skip + Inc(StrPos); + end; + + if StrPos <> -1 then + Inc(Index); + + if (StrPos > StrLength) and (Index < NbSeq) then + begin + Result := False; + Break; + end; + end + else + while (Index > NbSeq) and (StrPos > 1) do + begin + Ch := UCS4(S[StrPos - 1]); + + case Ch of + SurrogateHighStart..SurrogateHighEnd: + // error + FlagInvalidSequence(StrPos, -1); + SurrogateLowStart..SurrogateLowEnd: + // 2 bytes to skip + if StrPos <= 2 then + FlagInvalidSequence(StrPos, -1) + else + begin + ChNext := UCS4(S[StrPos - 2]); + if (ChNext < SurrogateHighStart) or (ChNext > SurrogateHighEnd) then + FlagInvalidSequence(StrPos, -1) + else + Dec(StrPos, 2); + end; + else + // 1 byte to skip + Dec(StrPos); + end; + + if StrPos <> -1 then + Dec(Index); + + if (StrPos = 1) and (Index > NbSeq) then + begin + Result := False; + Break; + end; + end; + NbSeq := Index; +end; +{$ENDIF SUPPORTS_UNICODE_STRING} + function UTF16SkipCharsFromStream(S: TStream; var NbSeq: Integer): Boolean; var Index: Integer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 13:52:39
|
Revision: 2521 http://jcl.svn.sourceforge.net/jcl/?rev=2521&view=rev Author: outchy Date: 2008-10-05 13:48:16 +0000 (Sun, 05 Oct 2008) Log Message: ----------- fixed wrong conditional defines. Modified Paths: -------------- trunk/jcl/source/common/zlibh.pas Modified: trunk/jcl/source/common/zlibh.pas =================================================================== --- trunk/jcl/source/common/zlibh.pas 2008-10-05 13:23:36 UTC (rev 2520) +++ trunk/jcl/source/common/zlibh.pas 2008-10-05 13:48:16 UTC (rev 2521) @@ -2298,7 +2298,7 @@ procedure UnloadZLib; begin - {$IFDEF BZIP2_LINKONREQUEST} + {$IFDEF ZLIB_LINKONREQUEST} if ZLibModuleHandle <> INVALID_MODULEHANDLE_VALUE then {$IFDEF MSWINDOWS} FreeLibrary(ZLibModuleHandle); @@ -2307,7 +2307,7 @@ dlclose(Pointer(ZLibModuleHandle)); {$ENDIF UNIX} ZLibModuleHandle := INVALID_MODULEHANDLE_VALUE; - {$ENDIF BZIP2_LINKONREQUEST} + {$ENDIF ZLIB_LINKONREQUEST} end; {$IFDEF ZLIB_LINKDLL} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 13:51:52
|
Revision: 2522 http://jcl.svn.sourceforge.net/jcl/?rev=2522&view=rev Author: outchy Date: 2008-10-05 13:49:10 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Mantis 4493: StrBefore is not working correct with Delphi 2009 The error was in StrFind. Modified Paths: -------------- trunk/jcl/source/common/JclStrings.pas Modified: trunk/jcl/source/common/JclStrings.pas =================================================================== --- trunk/jcl/source/common/JclStrings.pas 2008-10-05 13:48:16 UTC (rev 2521) +++ trunk/jcl/source/common/JclStrings.pas 2008-10-05 13:49:10 UTC (rev 2522) @@ -2966,13 +2966,13 @@ {$ELSE} function StrFind(const Substr, S: string; const Index: Integer): Integer; var - pos: PChar; + Pos: PChar; begin - pos := StrPos(PChar(@S[Index]),PChar(@SubStr[1])); + Pos := StrPos(PChar(@S[Index]),PChar(@SubStr[1])); if Pos = nil then Result := 0 else - Result := Cardinal(Pos) - Cardinal(@S[1]) + 1; + Result := (Cardinal(Pos) - Cardinal(@S[1])) div SizeOf(Char) + 1; end; {$ENDIF CLR} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 13:26:17
|
Revision: 2520 http://jcl.svn.sourceforge.net/jcl/?rev=2520&view=rev Author: outchy Date: 2008-10-05 13:23:36 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Marked TJclEasyStream.WriteStringDelimitedByNull as deprecated inside KEEP_DEPRECATED conditional block. Modified Paths: -------------- trunk/jcl/source/common/JclStreams.pas Modified: trunk/jcl/source/common/JclStreams.pas =================================================================== --- trunk/jcl/source/common/JclStreams.pas 2008-10-05 13:16:43 UTC (rev 2519) +++ trunk/jcl/source/common/JclStreams.pas 2008-10-05 13:23:36 UTC (rev 2520) @@ -334,7 +334,9 @@ procedure WriteCString(const Value: string); {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} procedure WriteCAnsiString(const Value: AnsiString); procedure WriteCWideString(const Value: WideString); - procedure WriteStringDelimitedByNull(const Value: string); {$IFDEF ACCEPT_DEPRECATED}deprecated;{$ENDIF ACCEPT_DEPRECATED} + {$IFDEF KEEP_DEPRECATED} + procedure WriteStringDelimitedByNull(const Value: string); + {$ENDIF KEEP_DEPRECATED} procedure WriteShortString(const Value: ShortString); procedure WriteSingle(const Value: Single); procedure WriteSizedString(const Value: string); {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} @@ -2013,10 +2015,12 @@ {$ENDIF ~CLR} end; +{$IFDEF KEEP_DEPRECATED} procedure TJclEasyStream.WriteStringDelimitedByNull(const Value: string); begin WriteCString(Value); end; +{$ENDIF KEEP_DEPRECATED} procedure TJclEasyStream.WriteShortString(const Value: ShortString); {$IFDEF CLR} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 13:21:04
|
Revision: 2519 http://jcl.svn.sourceforge.net/jcl/?rev=2519&view=rev Author: outchy Date: 2008-10-05 13:16:43 +0000 (Sun, 05 Oct 2008) Log Message: ----------- reworking hashing of strings according to "Fast Hashing of Variable-Length Text Strings" by Peter K. Pearson. Modified Paths: -------------- trunk/jcl/source/common/JclAbstractContainers.pas trunk/jcl/source/common/JclContainerIntf.pas Modified: trunk/jcl/source/common/JclAbstractContainers.pas =================================================================== --- trunk/jcl/source/common/JclAbstractContainers.pas 2008-10-05 13:08:35 UTC (rev 2518) +++ trunk/jcl/source/common/JclAbstractContainers.pas 2008-10-05 13:16:43 UTC (rev 2519) @@ -651,6 +651,26 @@ end; {$ENDIF SUPPORTS_UNICODE_STRING} +const + // table of byte permutations without inner loop + BytePermTable: array [Byte] of Byte = + ( 22, 133, 0, 244, 194, 193, 4, 164, 69, 211, 166, 235, 75, 110, 9, 140, + 125, 84, 64, 209, 57, 47, 197, 76, 237, 48, 189, 87, 221, 254, 20, 132, + 25, 162, 203, 225, 186, 165, 72, 228, 61, 208, 158, 185, 114, 173, 1, 66, + 202, 46, 198, 214, 27, 161, 178, 238, 8, 68, 97, 17, 199, 210, 96, 196, + 85, 240, 233, 71, 232, 142, 148, 70, 184, 152, 90, 206, 139, 182, 34, 101, + 104, 12, 143, 227, 24, 247, 175, 150, 39, 31, 36, 123, 62, 119, 236, 28, + 117, 100, 230, 223, 30, 154, 18, 153, 127, 192, 176, 19, 174, 134, 2, 216, + 218, 91, 45, 7, 128, 138, 126, 40, 16, 54, 207, 181, 11, 137, 60, 191, + 51, 231, 121, 213, 86, 111, 141, 172, 98, 226, 179, 249, 136, 58, 88, 93, + 201, 195, 118, 144, 146, 113, 212, 32, 21, 131, 177, 33, 151, 130, 205, 171, + 92, 251, 168, 29, 156, 124, 224, 200, 3, 187, 105, 52, 239, 147, 82, 94, + 26, 102, 243, 242, 145, 163, 49, 135, 43, 78, 112, 83, 63, 35, 170, 167, + 250, 159, 73, 37, 6, 79, 106, 215, 129, 74, 109, 42, 41, 120, 23, 160, + 107, 180, 103, 77, 53, 169, 89, 149, 44, 38, 81, 246, 188, 67, 15, 80, + 155, 99, 95, 5, 229, 108, 13, 255, 59, 241, 252, 245, 222, 248, 115, 55, + 217, 56, 65, 219, 204, 190, 10, 50, 253, 183, 234, 116, 122, 220, 14, 157); + {$IFDEF UNITVERSIONING} const UnitVersioning: TUnitVersionInfo = ( @@ -667,9 +687,8 @@ {$IFDEF HAS_UNIT_ANSISTRINGS} AnsiStrings, {$ENDIF HAS_UNIT_ANSISTRINGS} - {$IFNDEF RTL140_UP} JclWideStrings, - {$ENDIF ~RTL140_UP} + JclStringConversions, JclUnicode, SysUtils; //=== { TJclAbstractLockable } =============================================== @@ -1228,26 +1247,98 @@ end; function TJclAnsiStrAbstractContainer.Hash(const AString: AnsiString): Integer; +// from "Fast Hashing of Variable-Length Text Strings", Peter K. Pearson, 1990 +// http://portal.acm.org/citation.cfm?id=78978 +type + TIntegerHash = packed record + case Byte of + 0: (H1, H2, H3, H4: Byte); + 1: (H: Integer); + 2: (C: UCS4); + end; var - I: Integer; + I, J: Integer; + C1: Byte; + C2, IntegerHash: TIntegerHash; + CA: TUCS4Array; begin if Assigned(FHashConvert) then Result := FHashConvert(AString) else begin - Result := 0; + IntegerHash.H1 := 0; + IntegerHash.H2 := 1; + IntegerHash.H3 := 2; + IntegerHash.H4 := 3; case FEncoding of seISO: - if FCaseSensitive then - for I := 1 to Length(AString) do - Inc(Result, Ord(AString[I]) * (I - 1) * 256) - else - for I := 1 to Length(AString) do - Inc(Result, Ord(UpCase(AString[I])) * (I - 1) * 256); - //seUTF8: + begin + if FCaseSensitive then + begin + for I := 1 to Length(AString) do + begin + C1 := Ord(AString[I]); + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C1]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C1]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C1]; + end; + end + else + begin + // case insensitive + for I := 1 to Length(AString) - 1 do + begin + C1 := Ord(JclAnsiStrings.CharUpper(AString[I])); + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C1]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C1]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C1]; + end; + end; + end; + seUTF8: + begin + if FCaseSensitive then + begin + I := 1; + while I < Length(AString) do + begin + C2.C := UTF8GetNextChar(AString, I); + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; + end; + end + else + begin + // case insensitive + I := 1; + SetLength(CA, 0); + while I < Length(AString) do + begin + C2.C := UTF8GetNextChar(AString, I); + CA := UnicodeCaseFold(C2.C); + for J := Low(CA) to High(CA) do + begin + C2.C := CA[J]; + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; + end; + end; + end; + end; else raise EJclOperationNotSupportedError.Create; end; + Result := IntegerHash.H; end; end; @@ -1356,26 +1447,71 @@ end; function TJclWideStrAbstractContainer.Hash(const AString: WideString): Integer; +// from "Fast Hashing of Variable-Length Text Strings", Peter K. Pearson, 1990 +// http://portal.acm.org/citation.cfm?id=78978 +type + TIntegerHash = packed record + case Byte of + 0: (H1, H2, H3, H4: Byte); + 1: (H: Integer); + 2: (C: UCS4); + end; var - I: Integer; + I, J: Integer; + C2, IntegerHash: TIntegerHash; + CA: TUCS4Array; begin if Assigned(FHashConvert) then Result := FHashConvert(AString) else begin - Result := 0; + IntegerHash.H1 := 0; + IntegerHash.H2 := 1; + IntegerHash.H3 := 2; + IntegerHash.H4 := 3; case FEncoding of - weUCS2: - //if FCaseSensitive then - for I := 1 to Length(AString) do - Inc(Result, Ord(AString[I]) * (I - 1) * 65536) - //else - // for I := 1 to Length(AString) do - // Inc(Result, Ord(AString[I]) * (I - 1) * 65536); // TODO: case folding - //weUTF16: + seUTF16: + begin + SetLength(CA, 0); + if FCaseSensitive then + begin + I := 1; + while I < Length(AString) do + begin + C2.C := UTF16GetNextChar(AString, I); + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; + end; + end + else + begin + // case insensitive + I := 1; + while I < Length(AString) do + begin + C2.C := UTF16GetNextChar(AString, I); + CA := UnicodeCaseFold(C2.C); + for J := Low(CA) to High(CA) do + begin + C2.C := CA[J]; + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; + end; + end; + end; + end; else raise EJclOperationNotSupportedError.Create; end; + Result := IntegerHash.H; end; end; @@ -1386,12 +1522,11 @@ else begin case FEncoding of - weUCS2: + seUTF16: if FCaseSensitive then - Result := WideCompareStr(A, B) + Result := JclWideStrings.WideCompareStr(A, B) else - Result := WideCompareText(A, B); - //weUTF16: + Result := JclWideStrings.WideCompareText(A, B); else raise EJclOperationNotSupportedError.Create; end; @@ -1408,12 +1543,11 @@ else begin case FEncoding of - weUCS2: + seUTF16: if FCaseSensitive then - Result := WideCompareStr(A, B) = 0 + Result := JclWideStrings.WideCompareStr(A, B) = 0 else - Result := WideCompareText(A, B) = 0; - //weUTF16: + Result := JclWideStrings.WideCompareText(A, B) = 0; else raise EJclOperationNotSupportedError.Create; end; @@ -1479,20 +1613,71 @@ end; function TJclUnicodeStrAbstractContainer.Hash(const AString: UnicodeString): Integer; +// from "Fast Hashing of Variable-Length Text Strings", Peter K. Pearson, 1990 +// http://portal.acm.org/citation.cfm?id=78978 +type + TIntegerHash = packed record + case Byte of + 0: (H1, H2, H3, H4: Byte); + 1: (H: Integer); + 2: (C: UCS4); + end; var - I: Integer; + I, J: Integer; + C2, IntegerHash: TIntegerHash; + CA: TUCS4Array; begin if Assigned(FHashConvert) then Result := FHashConvert(AString) else begin - Result := 0; - //if FCaseSensitive then - for I := 1 to Length(AString) do - Inc(Result, Ord(AString[I]) * (I - 1) * 65536) - //else - // for I := 1 to Length(AString) do - // Inc(Result, Ord(AString[I]) * (I - 1) * 65536); // TODO: case folding + IntegerHash.H1 := 0; + IntegerHash.H2 := 1; + IntegerHash.H3 := 2; + IntegerHash.H4 := 3; + case FEncoding of + seUTF16: + begin + SetLength(CA, 0); + if FCaseSensitive then + begin + I := 1; + while I < Length(AString) do + begin + C2.C := UTF16GetNextChar(AString, I); + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; + end; + end + else + begin + // case insensitive + I := 1; + while I < Length(AString) do + begin + C2.C := UTF16GetNextChar(AString, I); + CA := UnicodeCaseFold(C2.C); + for J := Low(CA) to High(CA) do + begin + C2.C := CA[J]; + if I = -1 then + raise EJclUnexpectedEOSequenceError.Create; + IntegerHash.H1 := BytePermTable[IntegerHash.H1 xor C2.H1]; + IntegerHash.H2 := BytePermTable[IntegerHash.H2 xor C2.H2]; + IntegerHash.H3 := BytePermTable[IntegerHash.H3 xor C2.H3]; + IntegerHash.H4 := BytePermTable[IntegerHash.H4 xor C2.H4]; + end; + end; + end; + end; + else + raise EJclOperationNotSupportedError.Create; + end; + Result := IntegerHash.H; end; end; Modified: trunk/jcl/source/common/JclContainerIntf.pas =================================================================== --- trunk/jcl/source/common/JclContainerIntf.pas 2008-10-05 13:08:35 UTC (rev 2518) +++ trunk/jcl/source/common/JclContainerIntf.pas 2008-10-05 13:16:43 UTC (rev 2519) @@ -270,7 +270,7 @@ property CaseSensitive: Boolean read GetCaseSensitive write SetCaseSensitive; end; - TJclAnsiStrEncoding = (seISO {, seUTF8}); // TODO: make JclUnicode compatible with Linux and .NET + TJclAnsiStrEncoding = (seISO, seUTF8); IJclAnsiStrContainer = interface(IJclStrContainer) ['{F8239357-B96F-46F1-A48E-B5DF25B5F1FA}'] @@ -291,7 +291,7 @@ procedure LoadDelimited(const AString: AnsiString; const Separator: AnsiString = AnsiLineBreak); end; - TJclWideStrEncoding = (weUCS2 {, wsUTF16}); // TODO: make JclUnicode compatible with Linux and .NET + TJclWideStrEncoding = (seUTF16); IJclWideStrContainer = interface(IJclStrContainer) ['{875E1AC4-CA22-46BC-8999-048E5B9BF11D}'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ou...@us...> - 2008-10-05 13:04:40
|
Revision: 2517 http://jcl.svn.sourceforge.net/jcl/?rev=2517&view=rev Author: outchy Date: 2008-10-05 13:00:19 +0000 (Sun, 05 Oct 2008) Log Message: ----------- Reduced Delphi 5 specificities. Modified Paths: -------------- trunk/jcl/source/common/JclWideStrings.pas Modified: trunk/jcl/source/common/JclWideStrings.pas =================================================================== --- trunk/jcl/source/common/JclWideStrings.pas 2008-10-05 12:56:31 UTC (rev 2516) +++ trunk/jcl/source/common/JclWideStrings.pas 2008-10-05 13:00:19 UTC (rev 2517) @@ -291,12 +291,10 @@ function WidePos(const SubStr, S: WideString): Integer; function WideQuotedStr(const S: WideString; Quote: WideChar): WideString; function WideExtractQuotedStr(var Src: PWideChar; Quote: WideChar): WideString; -{$IFNDEF RTL140_UP} function WideCompareText(const S1, S2: WideString): Integer; function WideCompareStr(const S1, S2: WideString): Integer; function WideUpperCase(const S: WideString): WideString; function WideLowerCase(const S: WideString): WideString; -{$ENDIF ~RTL140_UP} function TrimW(const S: WideString): WideString; function TrimLeftW(const S: WideString): WideString; function TrimRightW(const S: WideString): WideString; @@ -1001,9 +999,6 @@ end; end; -// functions missing in Delphi 5 / FPC -{$IFNDEF RTL140_UP} - function WideCompareText(const S1, S2: WideString): Integer; begin {$IFDEF MSWINDOWS} @@ -1060,8 +1055,6 @@ {$ENDIF ~MSWINDOWS} end; -{$ENDIF ~RTL140_UP} - function TrimLeftLengthW(const S: WideString): Integer; var Len: Integer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |