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

View File

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