);
if CompareResult <> 0 then
Break;
Dec(abidx);
Inc(a);
Inc(b);
end;
if CompareResult = 0 then
CompareResult := msgidsize - Size;
if CompareResult = 0 then
begin // msgid=s
// Found the msgid
Pos := T + 8 * (i - 1);
Offset := CardinalInMem(Pos + 4);
Size := CardinalInMem(Pos);
{$ifdef CLR}
SetLength(Result, Size);
for j := 0 to Size - 1 do
Result[j + 1] := AnsiChar(moMemory[Offset + j]);
{$else}
SetString(Result, PAnsiChar(@moMemory[0]) + Offset, Size);
{$endif}
Found := True;
Break;
end;
if Step = 0 then
begin
// Not found
Result := msgid;
Break;
end;
if CompareResult < 0 then
begin // msgid<s
if i < 1 + Step then
i := 1
else
i := i - Step;
Step := Step shr 1;
end
else
begin // msgid>s
i := i + Step;
if i > N then
i := N;
Step := Step shr 1;
end;
end;
end;
{$ifdef DXGETTEXTDEBUG}
const
DebuggingText = 'gnugettext.pas debugging is enabled. Turn it off before ' +
'releasing this piece of software.';
{$endif}
initialization
{$ifdef DXGETTEXTDEBUG}
{$ifdef CLR}
MessageBox.show(DebuggingText);
{$else}
{$ifdef MSWINDOWS}
MessageBox(0, PChar(DebuggingText), 'Information', MB_OK);
{$endif}
{$ifdef LINUX}
WriteLn(stderr, DebuggingText);
{$endif}
{$endif}
{$endif}
if IsLibrary then
begin
// Get DLL/shared object Filename
SetLength(ExecutableFilename, 300);
{$ifdef MSWINDOWS}
SetLength(ExecutableFilename, GetModuleFileName(HInstance,
PChar(ExecutableFilename), Length(ExecutableFilename)));
{$endif}
{$ifdef LINUX}
// This line has not been tested on Linux, yet, but should work.
SetLength(ExecutableFilename, GetModuleFileName(0, PChar(ExecutableFilename),
Length(ExecutableFilename)));
{$endif}
{$ifdef CLR}
ExecutableFilename := System.Diagnostics.Process.GetCurrentProcess.MainModule.FileName;
{$endif}
end
else
ExecutableFilename := ParamStr(0);
FileLocator := TFileLocator.Create;
FileLocator.Analyze;
ResourceStringDomainList := TStringList.Create;
ResourceStringDomainList.Add(DefaultTextDomain);
ResourceStringDomainListCS := TMultiReadExclusiveWriteSynchronizer.Create;
DefaultInstance := TGnuGettextInstance.Create;
{$ifdef MSWINDOWS}
Win32PlatformIsUnicode := (Win32Platform = VER_PLATFORM_WIN32_NT);
{$endif}
{$ifndef CLR}
// replace Borlands LoadResString with gettext enabled version:
{$IFDEF DELPHI2009OROLDER}
HookLoadResString := THook.Create(@System.LoadResString, @LoadResStringU);
{$ELSE}
HookLoadResString := THook.Create(@System.LoadResString, @LoadResStringA);
{$ENDIF DELPHI2009OROLDER}
HookLoadStr := THook.Create(@SysUtils.LoadStr, @SysUtilsLoadStr);
HookFmtLoadStr := THook.Create(@SysUtils.FmtLoadStr, @SysUtilsFmtLoadStr);
HookIntoResourceStrings(AutoCreateHooks, False);
{$endif}
finalization
FreeAndNil(DefaultInstance);
FreeAndNil(ResourceStringDomainListCS);
FreeAndNil(ResourceStringDomainList);
{$ifndef CLR}
FreeAndNil(HookFmtLoadStr);
FreeAndNil(HookLoadStr);
FreeAndNil(HookLoadResString);
{$endif}
FreeAndNil(FileLocator);
end.
Author:
wuliaowang Time: 2008-9-17 00:30
{$IFDEF GB2312}
SCnPackMemMgr = '内存管理监视器';
SMemLeakDlgReport = '出现 %d 处内存漏洞[替换内存管理器之前已分配 %d 处]。';
SMemMgrODSReport = '获取 = %d,释放 = %d,重分配 = %d';
SMemMgrOverflow = '内存管理监视器指针列表溢出,请增大列表项数!';
SMemMgrRunTime = '%d 小时 %d 分 %d 秒。';
SOldAllocMemCount = '替换内存管理器前已分配 %d 处内存。';
SAppRunTime = '程序运行时间: ';
SMemSpaceCanUse = '可用地址空间: %d 千字节';
SUncommittedSpace = '未提交部分: %d 千字节';
SCommittedSpace = '已提交部分: %d 千字节';
SFreeSpace = '空闲部分: %d 千字节';
SAllocatedSpace = '已分配部分: %d 千字节';
SAllocatedSpacePercent = '地址空间载入: %d%%';
SFreeSmallSpace = '全部小空闲内存块: %d 千字节';
SFreeBigSpace = '全部大空闲内存块: %d 千字节';
SUnusedSpace = '其它未用内存块: %d 千字节';
SOverheadSpace = '内存管理器消耗: %d 千字节';
SObjectCountInMemory = '内存对象数目: ';
SNoMemLeak = '没有内存泄漏。';
SNoName = '(未命名)';
SNotAnObject = '不是对象';
SByte = '字节';
SCommaString = ',';
SPeriodString = '。';
{$ELSE}
SCnPackMemMgr = 'CnMemProf';
SMemLeakDlgReport = 'Found %d memory leaks. [There are %d allocated before replace memory manager.]';
SMemMgrODSReport = 'Get = %d Free = %d Realloc = %d';
SMemMgrOverflow = 'Memory Manager''s list capability overflow, Please enlarge it!';
SMemMgrRunTime = '%d hour(s) %d minute(s) %d second(s)。';
SOldAllocMemCount = 'There are %d allocated before replace memory manager.';
SAppRunTime = 'Application total run time: ';
SMemSpaceCanUse = 'HeapStatus.TotalAddrSpace: %d KB';
SUncommittedSpace = 'HeapStatus.TotalUncommitted: %d KB';
SCommittedSpace = 'HeapStatus.TotalCommitted: %d KB';
SFreeSpace = 'HeapStatus.TotalFree: %d KB';
SAllocatedSpace = 'HeapStatus.TotalAllocated: %d KB';
SAllocatedSpacePercent = 'TotalAllocated div TotalAddrSpace: %d%%';
SFreeSmallSpace = 'HeapStatus.FreeSmall: %d KB';
SFreeBigSpace = 'HeapStatus.FreeBig: %d KB';
SUnusedSpace = 'HeapStatus.Unused: %d KB';
SOverheadSpace = 'HeapStatus.Overhead: %d KB';
SObjectCountInMemory = 'Objects count in memory: ';
SNoMemLeak = ' No memory leak.';
SNoName = '(no name)';
SNotAnObject = ' Not an object';
SByte = 'Byte';
SCommaString = ',';
SPeriodString = '.';
{$ENDIF GB2312}
对照翻译.
CnMemProf在2009上有bug.MemProf也是同样的问题.
等cnpack达人们,升级吧
Author:
hubdog Time: 2008-9-17 00:35
OmniXml也需要更新到CVS的最新版,否则unicodeString类型的数据不能被加载。(我昨天报告,今天作者改好了)
Welcome to CnPack Forum (http://bbs.cnpack.org/) |
Powered by Discuz! 5.0.0 |