Changeset 32 for trunk/Target/UTargetInterpretter.pas
- Timestamp:
- Feb 18, 2012, 8:44:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Target/UTargetInterpretter.pas
r31 r32 6 6 7 7 uses 8 Classes, SysUtils, Dialogs, Forms, StrUtils, UTarget ;8 Classes, SysUtils, Dialogs, Forms, StrUtils, UTarget, Registry, URegistry; 9 9 10 10 type 11 11 TTargetInterpretter = class; 12 13 14 TRunState = (rsStopped, rsPaused, rsRunning);15 12 16 13 { TTargetInterpretterThread } … … 31 28 private 32 29 FCellSize: Integer; 33 FOnChangeState: TNotifyEvent;34 FState: TRunState;35 30 FThreadState: Boolean; 36 31 FThread: TTargetInterpretterThread; … … 39 34 function GetMemorySize: Integer; 40 35 procedure SetMemorySize(AValue: Integer); 41 procedure SetSource(AValue: string);42 36 procedure SetState(AValue: TRunState); 43 37 procedure SetThread(State: Boolean); … … 51 45 procedure CommandLoopStart; 52 46 procedure CommandLoopEnd; 47 protected 48 procedure SetSource(AValue: string); override; 53 49 public 54 50 FSource: array of TBrainFuckCommand; … … 67 63 procedure Pause; override; 68 64 procedure Stop; override; 69 constructor Create; 65 constructor Create; override; 70 66 destructor Destroy; override; 71 pro perty State: TRunState read FState;72 pro perty OnChangeState: TNotifyEvent read FOnChangeState write FOnChangeState;67 procedure LoadFromRegistry(Root: HKEY; Key: string); override; 68 procedure SaveToRegistry(Root: HKEY; Key: string); override; 73 69 property StepCount: Integer read FStepCount; 74 property Source: string write SetSource;75 70 property MemorySize: Integer read GetMemorySize write SetMemorySize; 76 71 property CellSize: Integer read FCellSize write FCellSize; … … 284 279 constructor TTargetInterpretter.Create; 285 280 begin 281 inherited; 286 282 Name := 'Interpretter'; 287 283 Capabilities := [tcRun, tcPause, tcStop]; … … 305 301 end; 306 302 303 procedure TTargetInterpretter.LoadFromRegistry(Root: HKEY; Key: string); 304 begin 305 inherited LoadFromRegistry(Root, Key); 306 with TRegistryEx.Create do 307 try 308 RootKey := Root; 309 OpenKey(Key, True); 310 CellSize := ReadIntegerWithDefault('CellSize', 256); 311 MemorySize := ReadIntegerWithDefault('MemorySize', 30000); 312 finally 313 Free; 314 end; 315 end; 316 317 procedure TTargetInterpretter.SaveToRegistry(Root: HKEY; Key: string); 318 begin 319 inherited SaveToRegistry(Root, Key); 320 with TRegistryEx.Create do 321 try 322 RootKey := Root; 323 OpenKey(Key, True); 324 WriteInteger('CellSize', CellSize); 325 WriteInteger('MemorySize', MemorySize); 326 finally 327 Free; 328 end; 329 end; 330 307 331 end. 308 332
Note:
See TracChangeset
for help on using the changeset viewer.