Added methods that return the entry_ref to the application and the port of its app looper.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@674 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2002-08-09 23:29:24 +00:00
parent 0f4210a2a3
commit a46169b509
2 changed files with 34 additions and 0 deletions
+30
View File
@@ -23,6 +23,7 @@ AppRunner::AppRunner(bool requestQuitOnDestruction)
fOutput(),
fReader(-1),
fTeam(-1),
fRef(),
fMessenger(),
fRequestQuitOnDestruction(requestQuitOnDestruction)
{
@@ -50,6 +51,7 @@ AppRunner::Run(const char *command, const char *args, bool findCommand)
find_test_app(command, &appPath);
command = appPath.String();
}
get_ref_for_path(command, &fRef);
// add args, i.e. compose the command line
BString cmdLine(command);
if (args) {
@@ -128,6 +130,34 @@ AppRunner::Team()
return fTeam;
}
// AppLooperPort
port_id
AppRunner::AppLooperPort()
{
struct messenger_hack {
port_id fPort;
int32 fHandlerToken;
team_id fTeam;
int32 extra0;
int32 extra1;
bool fPreferredTarget;
bool extra2;
bool extra3;
bool extra4;
};
return ((messenger_hack*)&fMessenger)->fPort;
}
// GetRef
status_t
AppRunner::GetRef(entry_ref *ref)
{
status_t error = (ref ? B_OK : B_ERROR);
if (error == B_OK)
*ref = fRef;
return error;
}
// RequestQuit
status_t
AppRunner::RequestQuit()
+4
View File
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <DataIO.h>
#include <Entry.h>
#include <Locker.h>
class AppRunner {
@@ -18,6 +19,8 @@ public:
bool HasQuitted();
void WaitFor(bool requestQuit = false);
team_id Team();
port_id AppLooperPort();
status_t GetRef(entry_ref *ref);
status_t RequestQuit();
status_t GetOutput(BString *buffer);
@@ -38,6 +41,7 @@ private:
BMallocIO fOutput;
thread_id fReader;
team_id fTeam;
entry_ref fRef;
BMessenger fMessenger;
bool fRequestQuitOnDestruction;