Changeset 68 for trunk/IDE/UCore.pas
- Timestamp:
- Jul 30, 2012, 3:52:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IDE/UCore.pas
r66 r68 7 7 uses 8 8 Classes, SysUtils, FileUtil, ULastOpenedList, UProject, UApplicationInfo, 9 UCompiler, UGeneralRegistry, UDebugLog, UCoolTranslator, UTarget; 9 UCompiler, URegistry, Registry, UDebugLog, UCoolTranslator, UTarget, 10 USourceCode, UModule; 10 11 11 12 type … … 13 14 14 15 TCustomCompiler = class(TCompiler) 16 private 17 procedure InitSystemModule; 18 public 15 19 StartTime: TDateTime; 16 20 SourceFiles: TSourceFileManager; … … 18 22 procedure Init; override; 19 23 function ElapsedTime: TDateTime; 20 procedure LoadFromRegistry(Root: Integer; const Key: string);21 procedure SaveToRegistry(Root: Integer; const Key: string);24 procedure LoadFromRegistry(Root: HKEY; const Key: string); 25 procedure SaveToRegistry(Root: HKEY; const Key: string); 22 26 constructor Create; override; 23 27 destructor Destroy; override; … … 45 49 TargetProject: TProject; 46 50 Compiler: TCustomCompiler; 51 ModuleManager: TModuleManager; 47 52 procedure ProjectTemplatesInit; 48 53 procedure ProjectOpen(FileName: string); 49 54 procedure ProjectNew; 50 55 procedure CompilerDebugLog(Text: string); 51 procedure LoadFromRegistry(Root: Integer; const Key: string);52 procedure SaveToRegistry(Root: Integer; const Key: string);56 procedure LoadFromRegistry(Root: HKEY; const Key: string); 57 procedure SaveToRegistry(Root: HKEY; const Key: string); 53 58 end; 54 59 … … 100 105 ReopenLastOpenedFile := True; 101 106 LogParsing := False; 107 108 ModuleManager := TModuleManager.Create; 102 109 end; 103 110 104 111 procedure TCore.DataModuleDestroy(Sender: TObject); 105 112 begin 113 ModuleManager.Free; 106 114 ProjectTemplates.Free; 107 115 LastOpenedFiles.Free; … … 142 150 end; 143 151 144 procedure TCore.LoadFromRegistry(Root: Integer; const Key: string);145 begin 146 with T GeneralRegistry.Create(nil)do152 procedure TCore.LoadFromRegistry(Root: HKEY; const Key: string); 153 begin 154 with TRegistryEx.Create do 147 155 try 148 CurrentRoot:= Root;156 RootKey := Root; 149 157 OpenKey(Key, True); 150 158 if ValueExists('ReopenLastOpenedFile') then … … 163 171 Free; 164 172 end; 165 LastOpenedFiles.LoadFromRegistry(Root, Key + '\LastOpenedFiles'); 173 LastOpenedFiles.LoadFromRegistry(Root, Key + '\LastOpenedFiles'); //Root, Key + '\LastOpenedFiles'); 166 174 Compiler.LoadFromRegistry(Root, Key + '\Compiler'); 167 175 FormMain.LoadFromRegistry(Root, Key); 168 176 end; 169 177 170 procedure TCore.SaveToRegistry(Root: Integer; const Key: string);171 begin 172 with T GeneralRegistry.Create(nil)do178 procedure TCore.SaveToRegistry(Root: HKEY; const Key: string); 179 begin 180 with TRegistryEx.Create do 173 181 try 174 CurrentRoot:= Root;182 RootKey := Root; 175 183 OpenKey(Key, True); 176 184 WriteBool('ReopenLastOpenedFile', ReopenLastOpenedFile); … … 192 200 { TCustomCompiler } 193 201 202 procedure TCustomCompiler.InitSystemModule; 203 var 204 SystemModule: TSourceModule; 205 begin 206 SystemModule := TSourceModule.Create; 207 with SystemModule do begin 208 Name := 'System'; 209 Internal := True; 210 with TType(Body.Types.AddNew(TType.Create)) do begin 211 Name := 'Byte'; 212 Size := 1; 213 Internal := True; 214 end; 215 with TType(Body.Types.AddNew(TType.Create)) do begin 216 Name := 'ShortInt'; 217 Size := 1; 218 Internal := True; 219 end; 220 with TType(Body.Types.AddNew(TType.Create)) do begin 221 Name := 'Word'; 222 Size := 2; 223 Internal := True; 224 end; 225 with TType(Body.Types.AddNew(TType.Create)) do begin 226 Name := 'SmallInt'; 227 Size := 2; 228 Internal := True; 229 end; 230 with TType(Body.Types.AddNew(TType.Create)) do begin 231 Name := 'Cardinal'; 232 Size := 4; 233 Internal := True; 234 end; 235 with TType(Body.Types.AddNew(TType.Create)) do begin 236 Name := 'Integer'; 237 Size := 4; 238 Internal := True; 239 end; 240 with TType(Body.Types.AddNew(TType.Create)) do begin 241 Name := 'UInt64'; 242 Size := 8; 243 Internal := True; 244 end; 245 with TType(Body.Types.AddNew(TType.Create)) do begin 246 Name := 'Int64'; 247 Size := 8; 248 Internal := True; 249 end; 250 with TFunction(Body.Functions.AddNew(TFunction.Create)) do begin 251 Name := 'WriteLn'; 252 Internal := True; 253 end; 254 ParentProgram := AbstractCode; 255 end; 256 AbstractCode.Modules.Add(SystemModule); 257 end; 258 194 259 procedure TCustomCompiler.Init; 195 260 begin 196 261 inherited; 197 262 StartTime := Now; 263 InitSystemModule; 198 264 end; 199 265 … … 203 269 end; 204 270 205 procedure TCustomCompiler.LoadFromRegistry(Root: Integer; const Key: string);271 procedure TCustomCompiler.LoadFromRegistry(Root: HKEY; const Key: string); 206 272 var 207 273 I: Integer; 208 274 begin 209 with T GeneralRegistry.Create(nil)do275 with TRegistryEx.Create do 210 276 try 211 CurrentRoot:= Root;277 RootKey := Root; 212 278 for I := 0 to Targets.Count - 1 do 213 279 with TTarget(Targets[I]) do begin … … 225 291 end; 226 292 227 procedure TCustomCompiler.SaveToRegistry(Root: Integer; const Key: string);293 procedure TCustomCompiler.SaveToRegistry(Root: HKEY; const Key: string); 228 294 var 229 295 I: Integer; 230 296 begin 231 with T GeneralRegistry.Create(nil)do297 with TRegistryEx.Create do 232 298 try 233 CurrentRoot:= Root;299 RootKey := Root; 234 300 for I := 0 to Targets.Count - 1 do 235 301 with TTarget(Targets[I]) do begin
Note:
See TracChangeset
for help on using the changeset viewer.