- Timestamp:
- Jul 17, 2012, 10:25:56 PM (12 years ago)
- Location:
- Common
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Common.lpk
r384 r387 22 22 <License Value="GNU/GPL"/> 23 23 <Version Minor="7"/> 24 <Files Count="1 5">24 <Files Count="14"> 25 25 <Item1> 26 26 <Filename Value="StopWatch.pas"/> … … 70 70 </Item11> 71 71 <Item12> 72 <Filename Value="URegistry.pas"/>73 <UnitName Value="URegistry"/>74 </Item12>75 <Item13>76 72 <Filename Value="UJobProgressView.pas"/> 77 73 <HasRegisterProc Value="True"/> 78 74 <UnitName Value="UJobProgressView"/> 75 </Item12> 76 <Item13> 77 <Filename Value="UXMLUtils.pas"/> 78 <UnitName Value="UXMLUtils"/> 79 79 </Item13> 80 80 <Item14> 81 <Filename Value="UXMLUtils.pas"/>82 <UnitName Value="UXMLUtils"/>83 </Item14>84 <Item15>85 81 <Filename Value="UApplicationInfo.pas"/> 86 82 <HasRegisterProc Value="True"/> 87 83 <UnitName Value="UApplicationInfo"/> 88 </Item1 5>84 </Item14> 89 85 </Files> 90 86 <i18n> … … 93 89 </i18n> 94 90 <Type Value="RunAndDesignTime"/> 95 <RequiredPkgs Count=" 2">91 <RequiredPkgs Count="3"> 96 92 <Item1> 97 <PackageName Value=" TemplateGenerics"/>93 <PackageName Value="RegistryPkg"/> 98 94 </Item1> 99 95 <Item2> 96 <PackageName Value="TemplateGenerics"/> 97 </Item2> 98 <Item3> 100 99 <PackageName Value="FCL"/> 101 100 <MinVersion Major="1" Valid="True"/> 102 </Item 2>101 </Item3> 103 102 </RequiredPkgs> 104 103 <UsageOptions> -
Common/Common.pas
r384 r387 9 9 uses 10 10 StopWatch, UCommon, UDebugLog, UDelay, UPrefixMultiplier, UURI, UThreading, 11 UMemory, UResetableThread, UPool, ULastOpenedList, U Registry,12 U JobProgressView, UXMLUtils, UApplicationInfo, LazarusPackageIntf;11 UMemory, UResetableThread, UPool, ULastOpenedList, UJobProgressView, 12 UXMLUtils, UApplicationInfo, LazarusPackageIntf; 13 13 14 14 implementation -
Common/UApplicationInfo.pas
r385 r387 6 6 7 7 uses 8 SysUtils, Registry , Classes, Forms, URegistry;8 SysUtils, Registry2, Classes, Forms, URegistry; 9 9 10 10 type -
Common/ULastOpenedList.pas
r380 r387 6 6 7 7 uses 8 Classes, SysUtils, Registry , URegistry, Menus;8 Classes, SysUtils, Registry2, URegistry, Menus; 9 9 10 10 type -
Common/UMemory.pas
r290 r387 9 9 10 10 type 11 12 11 { TMemory } 13 12 … … 15 14 private 16 15 FData: PByte; 17 FSize: Integer;18 16 function GetItem(Index: Integer): Byte; 19 17 procedure SetItem(Index: Integer; AValue: Byte); 18 function GetSize: Integer; virtual; 20 19 procedure SetSize(AValue: Integer); virtual; 21 20 public 22 procedure Clear(Value: Byte = 0);21 procedure Fill(Value: Byte = 0); 23 22 procedure Assign(Source: TMemory); 24 23 constructor Create; 25 24 destructor Destroy; override; 26 25 property Data: PByte read FData; 27 property Size: Integer read FSize write SetSize;26 property Size: Integer read GetSize write SetSize; 28 27 property Items[Index: Integer]: Byte read GetItem write SetItem; default; 29 28 end; … … 42 41 end; 43 42 43 { TMemoryRec } 44 45 TMemoryRec = record 46 private 47 FData: PByte; 48 function GetItem(Index: Integer): Byte; inline; 49 procedure SetItem(Index: Integer; AValue: Byte); inline; 50 function GetSize: Integer; inline; 51 procedure SetSize(AValue: Integer); inline; 52 public 53 procedure Fill(Value: Byte = 0); inline; 54 procedure Assign(Source: TMemoryRec); inline; 55 property Data: PByte read FData; 56 property Size: Integer read GetSize write SetSize; 57 property Items[Index: Integer]: Byte read GetItem write SetItem; default; 58 end; 59 60 { TBitMemoryRec } 61 62 TBitMemoryRec = record 63 private 64 FMemory: TMemoryRec; 65 FSize: Cardinal; 66 function GetItem(Index: Cardinal): Boolean; inline; 67 function GetSize: Cardinal; inline; 68 procedure SetItem(Index: Cardinal; AValue: Boolean); inline; 69 procedure SetSize(AValue: Cardinal); inline; 70 public 71 procedure WriteItems(Addr: Cardinal; Items: TBitMemoryRec); 72 procedure Fill(Value: Boolean = False); 73 procedure Assign(Source: TBitMemoryRec); inline; 74 property Memory: TMemoryRec read FMemory; 75 property Size: Cardinal read GetSize write SetSize; 76 property Items[Index: Cardinal]: Boolean read GetItem write SetItem; default; 77 end; 78 79 44 80 implementation 45 81 82 { TBitMemoryRec } 83 84 function TBitMemoryRec.GetItem(Index: Cardinal): Boolean; 85 begin 86 Result := Boolean((FMemory[Index shr 3] shr (Index and 7)) and 1); 87 end; 88 89 function TBitMemoryRec.GetSize: Cardinal; 90 begin 91 Result := FSize; 92 end; 93 94 procedure TBitMemoryRec.SetItem(Index: Cardinal; AValue: Boolean); 95 begin 96 FMemory[Index shr 3] := (FMemory[Index shr 3] and ($ff xor (1 shl (Index and 7)))) or 97 (Byte(AValue) shl (Index and 7)); 98 end; 99 100 procedure TBitMemoryRec.SetSize(AValue: Cardinal); 101 begin 102 FSize := AValue; 103 FMemory.Size := (AValue - 1) shr 3 + 1; 104 end; 105 106 procedure TBitMemoryRec.WriteItems(Addr: Cardinal; Items: TBitMemoryRec); 107 begin 108 109 end; 110 111 procedure TBitMemoryRec.Fill(Value: Boolean); 112 begin 113 FMemory.Fill($ff * Byte(Value)); 114 end; 115 116 procedure TBitMemoryRec.Assign(Source: TBitMemoryRec); 117 begin 118 Size := Source.Size; 119 FMemory.Assign(Source.Memory); 120 end; 121 122 { TMemoryRec } 123 124 function TMemoryRec.GetItem(Index: Integer): Byte; 125 begin 126 Result := PByte(FData + Index)^; 127 end; 128 129 procedure TMemoryRec.SetItem(Index: Integer; AValue: Byte); 130 begin 131 PByte(FData + Index)^ := AValue; 132 end; 133 134 function TMemoryRec.GetSize: Integer; 135 begin 136 Result := MemSize(FData); 137 end; 138 139 procedure TMemoryRec.SetSize(AValue: Integer); 140 begin 141 FData := ReAllocMem(FData, AValue); 142 end; 143 144 procedure TMemoryRec.Fill(Value: Byte); 145 begin 146 FillChar(FData^, Size, Value); 147 end; 148 149 procedure TMemoryRec.Assign(Source: TMemoryRec); 150 begin 151 Size := Source.Size; 152 Move(Source.Data^, FData^, Size); 153 end; 154 46 155 { TPositionMemory } 47 156 … … 49 158 begin 50 159 inherited SetSize(AValue); 51 if FPosition > FSize then FPosition := FSize;160 if FPosition > Size then FPosition := Size; 52 161 end; 53 162 … … 70 179 procedure TMemory.SetSize(AValue: Integer); 71 180 begin 72 if FSize = AValue then Exit; 73 FSize := AValue; 74 FData := ReAllocMem(FData, FSize); 181 FData := ReAllocMem(FData, AValue); 75 182 end; 76 183 … … 85 192 end; 86 193 87 procedure TMemory.Clear(Value: Byte); 194 function TMemory.GetSize: Integer; 195 begin 196 Result := MemSize(FData); 197 end; 198 199 procedure TMemory.Fill(Value: Byte); 88 200 begin 89 201 FillChar(FData^, Size, Value); … … 99 211 begin 100 212 FData := nil; 101 FSize := 0;213 Size := 0; 102 214 end; 103 215
Note:
See TracChangeset
for help on using the changeset viewer.