1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-10 19:35:10 -05:00

Small fix.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@186 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-11-03 20:54:35 +00:00
parent 61c802d7c0
commit 29d0b3f267
2 changed files with 280 additions and 311 deletions

View File

@ -1,194 +1,161 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="8">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="project1"/>
<CursorPos X="30" Y="18"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../../../../Documents/fpc/packages/fcl-process/src/process.pp"/>
<UnitName Value="process"/>
<CursorPos X="23" Y="94"/>
<TopLine Value="72"/>
<EditorIndex Value="4"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit1>
<Unit2>
<Filename Value="../../../../Documents/fpc/packages/fcl-process/src/unix/process.inc"/>
<CursorPos X="34" Y="138"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit2>
<Unit3>
<Filename Value="../../../../Documents/fpc/packages/ncurses/src/form.pp"/>
<UnitName Value="form"/>
<CursorPos X="42" Y="9"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit3>
<Unit4>
<Filename Value="../../../../Documents/fpc/packages/fv/src/time.pas"/>
<UnitName Value="Time"/>
<CursorPos X="44" Y="9"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit4>
<Unit5>
<Filename Value="../../../../Documents/fpc/rtl/linux/system.pp"/>
<UnitName Value="System"/>
<CursorPos X="40" Y="9"/>
<TopLine Value="350"/>
<EditorIndex Value="3"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit5>
<Unit6>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<UnitName Value="ExtCtrls"/>
<CursorPos X="22" Y="324"/>
<TopLine Value="316"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit6>
<Unit7>
<Filename Value="../../../../Documents/lazarus/lcl/customtimer.pas"/>
<UnitName Value="CustomTimer"/>
<CursorPos X="37" Y="39"/>
<TopLine Value="27"/>
<EditorIndex Value="2"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit7>
</Units>
<JumpHistory Count="16" HistoryIndex="15">
<Position1>
<Filename Value="../../../../Documents/fpc/packages/fcl-process/src/process.pp"/>
<Caret Line="158" Column="9" TopLine="132"/>
</Position1>
<Position2>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position2>
<Position3>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<Caret Line="324" Column="9" TopLine="316"/>
</Position3>
<Position4>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<Caret Line="329" Column="26" TopLine="316"/>
</Position4>
<Position5>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<Caret Line="389" Column="26" TopLine="374"/>
</Position5>
<Position6>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<Caret Line="1166" Column="19" TopLine="1151"/>
</Position6>
<Position7>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<Caret Line="1248" Column="44" TopLine="1233"/>
</Position7>
<Position8>
<Filename Value="../../../../Documents/lazarus/lcl/extctrls.pp"/>
<Caret Line="324" Column="22" TopLine="316"/>
</Position8>
<Position9>
<Filename Value="project1.lpr"/>
<Caret Line="53" Column="19" TopLine="26"/>
</Position9>
<Position10>
<Filename Value="project1.lpr"/>
<Caret Line="71" Column="15" TopLine="49"/>
</Position10>
<Position11>
<Filename Value="project1.lpr"/>
<Caret Line="9" Column="38" TopLine="1"/>
</Position11>
<Position12>
<Filename Value="project1.lpr"/>
<Caret Line="55" Column="37" TopLine="40"/>
</Position12>
<Position13>
<Filename Value="project1.lpr"/>
<Caret Line="57" Column="68" TopLine="40"/>
</Position13>
<Position14>
<Filename Value="project1.lpr"/>
<Caret Line="56" Column="23" TopLine="43"/>
</Position14>
<Position15>
<Filename Value="../../../../Documents/fpc/packages/fcl-process/src/process.pp"/>
<Caret Line="119" Column="71" TopLine="104"/>
</Position15>
<Position16>
<Filename Value="project1.lpr"/>
<Caret Line="75" Column="50" TopLine="88"/>
</Position16>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
</Flags>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="0"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
<Language Value=""/>
<CharSet Value=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<Units Count="9">
<Unit0>
<Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="project1"/>
<CursorPos X="40" Y="57"/>
<TopLine Value="46"/>
<EditorIndex Value="0"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
<Filename Value="../../../Documents/fpc/packages/fcl-process/src/process.pp"/>
<UnitName Value="process"/>
<CursorPos X="23" Y="94"/>
<TopLine Value="72"/>
<UsageCount Value="10"/>
</Unit1>
<Unit2>
<Filename Value="../../../Documents/fpc/packages/fcl-process/src/unix/process.inc"/>
<CursorPos X="34" Y="138"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit2>
<Unit3>
<Filename Value="../../../Documents/fpc/packages/ncurses/src/form.pp"/>
<UnitName Value="form"/>
<CursorPos X="42" Y="9"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit3>
<Unit4>
<Filename Value="../../../Documents/fpc/packages/fv/src/time.pas"/>
<UnitName Value="Time"/>
<CursorPos X="44" Y="9"/>
<TopLine Value="1"/>
<UsageCount Value="10"/>
</Unit4>
<Unit5>
<Filename Value="../../../Documents/fpc/rtl/linux/system.pp"/>
<UnitName Value="System"/>
<CursorPos X="40" Y="9"/>
<TopLine Value="350"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<Filename Value="../../../Documents/lazarus/lcl/extctrls.pp"/>
<UnitName Value="ExtCtrls"/>
<CursorPos X="22" Y="324"/>
<TopLine Value="316"/>
<UsageCount Value="10"/>
</Unit6>
<Unit7>
<Filename Value="../../../Documents/lazarus/lcl/customtimer.pas"/>
<UnitName Value="CustomTimer"/>
<CursorPos X="37" Y="39"/>
<TopLine Value="27"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="../../../fpcsrc/fpc/rtl/inc/except.inc"/>
<CursorPos X="3" Y="194"/>
<TopLine Value="178"/>
<EditorIndex Value="1"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit8>
</Units>
<JumpHistory Count="8" HistoryIndex="7">
<Position1>
<Filename Value="project1.lpr"/>
<Caret Line="53" Column="19" TopLine="26"/>
</Position1>
<Position2>
<Filename Value="project1.lpr"/>
<Caret Line="71" Column="15" TopLine="49"/>
</Position2>
<Position3>
<Filename Value="project1.lpr"/>
<Caret Line="9" Column="38" TopLine="1"/>
</Position3>
<Position4>
<Filename Value="project1.lpr"/>
<Caret Line="55" Column="37" TopLine="40"/>
</Position4>
<Position5>
<Filename Value="project1.lpr"/>
<Caret Line="57" Column="68" TopLine="40"/>
</Position5>
<Position6>
<Filename Value="project1.lpr"/>
<Caret Line="56" Column="23" TopLine="43"/>
</Position6>
<Position7>
<Filename Value="project1.lpr"/>
<Caret Line="18" Column="27" TopLine="1"/>
</Position7>
<Position8>
<Filename Value="project1.lpr"/>
<Caret Line="56" Column="34" TopLine="37"/>
</Position8>
</JumpHistory>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Target>
<Filename Value="project1"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)/"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -1,117 +1,119 @@
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils, CustApp, Process
{ you can add units after this };
type
{ TMyApplication }
TMyApplication = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
{ TMyApplication }
procedure TMyApplication.DoRun;
var
ErrorMsg: String;
Processes: array of TProcess;
i, c, a:integer;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h','help');
if ErrorMsg<>'' then begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
// parse parameters
if HasOption('h','help') then begin
WriteHelp;
Terminate;
Exit;
end;
a := 5;
SetLength(Processes, a);
for i := 0 to a - 1 do
begin
Processes[i] := TProcess.Create(Self);
Processes[i].CommandLine := 'echo "wat"';
Processes[i].ApplicationName := 'ForkingTest: ' + inttostr(i);
Processes[i].Execute;
Writeln('Process ' + inttostr(i) + ', has ID ' + inttostr(Processes[i].ProcessID));
end;
sleep(10000);
while true do
begin
c := 0;
for i := 0 to a - 1 do
begin
if not Processes[i].Running then
c := c + 1;
end;
if c = a then
break;
sleep(1000);
end;
for i := 0 to a - 1 do
begin
Processes[i].Free;
end;
{ add
end;
your program here }
// stop program loop
Terminate;
end;
constructor TMyApplication.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException:=True;
end;
destructor TMyApplication.Destroy;
begin
inherited Destroy;
end;
procedure TMyApplication.WriteHelp;
begin
{ add your help code here }
writeln('Usage: ',ExeName,' -h');
end;
var
Application: TMyApplication;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin
Application:=TMyApplication.Create(nil);
Application.Title:='My Application';
Application.Run;
Application.Free;
end.
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils, CustApp, Process
{ you can add units after this };
type
{ TMyApplication }
TMyApplication = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
{ TMyApplication }
procedure TMyApplication.DoRun;
var
ErrorMsg: String;
Processes: array of TProcess;
i, c, a:integer;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h','help');
if ErrorMsg<>'' then begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
// parse parameters
if HasOption('h','help') then begin
WriteHelp;
Terminate;
Exit;
end;
a := 5;
SetLength(Processes, a);
for i := 0 to a - 1 do
begin
Processes[i] := TProcess.Create(Self);
{$WARNING SET THIS PATH}
Processes[i].CommandLine := 'C:/mufasa/Projects/MufasaTests/project1.exe';
//Processes[i].ApplicationName := 'ForkingTest: ' + inttostr(i);
Processes[i].Execute;
Writeln('Process ' + inttostr(i) + ', has ID ' + inttostr(Processes[i].ProcessID));
end;
sleep(10000);
while true do
begin
c := 0;
for i := 0 to a - 1 do
begin
if not Processes[i].Running then
c := c + 1;
end;
if c = a then
break;
sleep(1000);
end;
for i := 0 to a - 1 do
begin
Processes[i].Free;
end;
{ add
end;
your program here }
// stop program loop
writeln('done');
Terminate;
end;
constructor TMyApplication.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException:=True;
end;
destructor TMyApplication.Destroy;
begin
inherited Destroy;
end;
procedure TMyApplication.WriteHelp;
begin
{ add your help code here }
writeln('Usage: ',ExeName,' -h');
end;
var
Application: TMyApplication;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin
Application:=TMyApplication.Create(nil);
Application.Title:='My Application';
Application.Run;
Application.Free;
end.