Changeset 5 for os/trunk/System
- Timestamp:
- Jun 2, 2013, 2:34:55 PM (11 years ago)
- Location:
- os/trunk
- Files:
-
- 1 added
- 2 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
os/trunk
- Property svn:ignore
-
old new 1 1 Win32 2 2 *.~dsk 3 __history
-
- Property svn:ignore
-
os/trunk/System
-
Property svn:ignore
set to
__history
-
Property svn:ignore
set to
-
os/trunk/System/LDOS.Kernel.pas
r3 r5 1 unit Xvcl.Kernel;1 unit LDOS.Kernel; 2 2 3 3 interface … … 17 17 Priority: Integer; 18 18 State: TProcessState; 19 TimerExpire: TDateTime; 20 Application: TApplication; 19 21 procedure Execute; virtual; 22 procedure Terminate; virtual; 23 end; 24 25 TTimer = class 26 end; 27 28 TScheduler = class 29 Kernel: TKernel; 30 procedure Reschedule; 31 constructor Create; 32 destructor Destroy; override; 20 33 end; 21 34 … … 33 46 34 47 TScreen = class(TComponent) 48 private 49 public 50 Kernel: TKernel; 35 51 Canvas: TScreenCanvas; 36 52 Size: TPoint; 37 53 Forms: TList<TForm>; 38 54 VideoDevice: TVideoDevice; 55 procedure HandleResize; 39 56 procedure Paint; 40 57 procedure FocusForm(Form: TForm); … … 57 74 end; 58 75 59 TScheduler = class60 Kernel: TKernel;61 procedure Reschedule;62 end;63 64 76 TKernel = class 65 77 private 66 78 FOnAfterDriverInit: TNotifyEvent; 67 79 FOnTick: TNotifyEvent; 80 procedure HandleTaskList; 68 81 public 82 Timers: TList<TTimer>; 69 83 Processes: TList<TProcess>; 70 84 Drivers: TList<TDriver>; … … 78 92 procedure PowerOff; 79 93 procedure Reboot; 94 function GetProcessId: Integer; 95 procedure RunApplication(App: TApplication); 80 96 constructor Create; 81 97 destructor Destroy; override; … … 99 115 100 116 for App in StartOnBoot do 101 App.Run;117 RunApplication(App); 102 118 103 119 repeat … … 113 129 begin 114 130 Processes := TList<TProcess>.Create; 131 Timers := TList<TTimer>.Create; 115 132 Drivers := TList<TDriver>.Create; 116 133 Screen := TScreen.Create; 134 Screen.Kernel := Self; 117 135 StartOnBoot := TList<TApplication>.Create; 118 136 Scheduler := TScheduler.Create; 137 Scheduler.Kernel := Self; 119 138 Keyboard := TKeyboard.Create; 120 139 Keyboard.Kernel := Self; … … 132 151 Drivers.Destroy; 133 152 Processes.Destroy; 134 inherited; 135 end; 136 153 Timers.Destroy; 154 inherited; 155 end; 156 157 158 function TKernel.GetProcessId: Integer; 159 var 160 I: Integer; 161 begin 162 Result := 1; 163 for I := 0 to Processes.Count - 1 do 164 if Processes[I].Id > Result then Result := Processes[I].Id + 1; 165 end; 137 166 138 167 procedure TKernel.PowerOff; … … 144 173 begin 145 174 175 end; 176 177 procedure TKernel.RunApplication(App: TApplication); 178 var 179 NewProcess: TProcess; 180 I: Integer; 181 begin 182 NewProcess := TProcess.Create; 183 NewProcess.Application := App; 184 NewProcess.Id := GetProcessId; 185 Processes.Add(NewProcess); 186 App.Run; 187 NewProcess.Name := App.Caption; 188 HandleTaskList; 189 end; 190 191 procedure TKernel.HandleTaskList; 192 var 193 Form: TForm; 194 NewMessage: TMessageTaskList; 195 Process: TProcess; 196 begin 197 NewMessage := TMessageTaskList.Create; 198 try 199 for Form in Screen.Forms do 200 Form.HandleMessage(NewMessage); 201 for Process in Processes do 202 Process.Application.HandleMessage(NewMessage); 203 finally 204 NewMessage.Destroy; 205 end; 146 206 end; 147 207 … … 176 236 end; 177 237 238 procedure TScreen.HandleResize; 239 var 240 Form: TForm; 241 NewMessage: TMessageResize; 242 Process: TProcess; 243 begin 244 NewMessage := TMessageResize.Create; 245 try 246 for Form in Kernel.Screen.Forms do 247 Form.HandleMessage(NewMessage); 248 for Process in Kernel.Processes do 249 Process.Application.HandleMessage(NewMessage); 250 finally 251 NewMessage.Destroy; 252 end; 253 end; 254 178 255 procedure TScreen.Paint; 179 256 var … … 199 276 { TScheduler } 200 277 278 constructor TScheduler.Create; 279 begin 280 inherited; 281 end; 282 283 destructor TScheduler.Destroy; 284 begin 285 286 inherited; 287 end; 288 201 289 procedure TScheduler.Reschedule; 202 290 begin … … 218 306 219 307 procedure TProcess.Execute; 308 begin 309 310 end; 311 312 procedure TProcess.Terminate; 220 313 begin 221 314
Note:
See TracChangeset
for help on using the changeset viewer.