Improved BRoster and BMessenger (nearly complete)

This commit is contained in:
ocoursiere
2003-05-19 23:19:26 +00:00
parent 1d36a2e4d9
commit da4722288e
6 changed files with 987 additions and 15 deletions

View File

@@ -53,6 +53,8 @@ BApplication_ReadyToRun_hook Application_ReadyToRun_hook;
//BApplication_QuitRequested_hook Application_QuitRequested_hook;
//BApplication_MessageReceived_hook Application_MessageReceived_hook;
BMessenger *be_app_messengerCPlus;
#if defined(__cplusplus)
}
#endif
@@ -61,7 +63,7 @@ BPApplication::BPApplication(TPasObject PasObject, const char *signature)
: BApplication(signature), BPHandler(PasObject), BPLooper(PasObject),
BPasObject(PasObject)
{
be_app_messengerCPlus = &be_app_messenger;
}
BPApplication::BPApplication(TPasObject PasObject, const char *signature,
@@ -70,6 +72,7 @@ BPApplication::BPApplication(TPasObject PasObject, const char *signature,
BPLooper(PasObject),
BPasObject(PasObject)
{
be_app_messengerCPlus = &be_app_messenger;
}
void BPApplication::AppActivated(bool active)

View File

@@ -9,6 +9,7 @@
***********************************************************************/
#include "Messenger.h"
#include "Application.h"
#include <beobj.h>
#if defined(__cplusplus)
@@ -271,6 +272,7 @@ BMessenger_Team(BMessenger *Messenger)
// Messenger->InitData(mime_sig, team, perr);
//}
#if defined(__cplusplus)
}
#endif

View File

@@ -45,11 +45,698 @@ void BRoster_Destroy(TPasObject PasObject)
delete PasObject;
}
status_t BRoster_Broadcast(TCPlusObject Roster, TCPlusObject *message)
//status_t BRoster_Broadcast(TCPlusObject Roster, TCPlusObject *message)
//{
// return reinterpret_cast<BRoster*>(Roster)->Broadcast(reinterpret_cast<BMessage*>(message));
//}
/***********************************************************************
* Method: BRoster::IsRunning
* Params: const char *mime_sig
* Returns: bool
* Effects:
***********************************************************************/
bool
BRoster_IsRunning(BRoster *Roster, const char *mime_sig)
{
return reinterpret_cast<BRoster*>(Roster)->Broadcast(reinterpret_cast<BMessage*>(message));
return Roster->IsRunning(mime_sig);
}
/***********************************************************************
* Method: BRoster::IsRunning
* Params: entry_ref *ref
* Returns: bool
* Effects:
***********************************************************************/
bool
BRoster_IsRunning_1
(BRoster *Roster, entry_ref *ref)
{
return Roster->IsRunning(ref);
}
/***********************************************************************
* Method: BRoster::TeamFor
* Params: const char *mime_sig
* Returns: team_id
* Effects:
***********************************************************************/
team_id
BRoster_TeamFor(BRoster *Roster, const char *mime_sig)
{
return Roster->TeamFor(mime_sig);
}
/***********************************************************************
* Method: BRoster::TeamFor
* Params: entry_ref *ref
* Returns: team_id
* Effects:
***********************************************************************/
team_id
BRoster_TeamFor_1
(BRoster *Roster, entry_ref *ref)
{
return Roster->TeamFor(ref);
}
/***********************************************************************
* Method: BRoster::GetAppList
* Params: BList *team_id_list
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_GetAppList(BRoster *Roster, BList *team_id_list)
{
Roster->GetAppList(team_id_list);
}
/***********************************************************************
* Method: BRoster::GetAppList
* Params: const char *sig, BList *team_id_list
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_GetAppList_1
(BRoster *Roster, const char *sig, BList *team_id_list)
{
Roster->GetAppList(sig, team_id_list);
}
/***********************************************************************
* Method: BRoster::GetAppInfo
* Params: const char *sig, app_info *info
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_GetAppInfo(BRoster *Roster, const char *sig, app_info *info)
{
return Roster->GetAppInfo(sig, info);
}
/***********************************************************************
* Method: BRoster::GetAppInfo
* Params: entry_ref *ref, app_info *info
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_GetAppInfo_1
(BRoster *Roster, entry_ref *ref, app_info *info)
{
return Roster->GetAppInfo(ref, info);
}
/***********************************************************************
* Method: BRoster::GetRunningAppInfo
* Params: team_id team, app_info *info
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_GetRunningAppInfo(BRoster *Roster, team_id team, app_info *info)
{
return Roster->GetRunningAppInfo(team, info);
}
/***********************************************************************
* Method: BRoster::GetActiveAppInfo
* Params: app_info *info
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_GetActiveAppInfo(BRoster *Roster, app_info *info)
{
return Roster->GetActiveAppInfo(info);
}
/***********************************************************************
* Method: BRoster::FindApp
* Params: const char *mime_type, entry_ref *app
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_FindApp(BRoster *Roster, const char *mime_type, entry_ref *app)
{
return Roster->FindApp(mime_type, app);
}
/***********************************************************************
* Method: BRoster::FindApp
* Params: entry_ref *ref, entry_ref *app
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_FindApp_1
(BRoster *Roster, entry_ref *ref, entry_ref *app)
{
return Roster->FindApp(ref, app);
}
/***********************************************************************
* Method: BRoster::Broadcast
* Params: BMessage *msg
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Broadcast(BRoster *Roster, BMessage *msg)
{
return Roster->Broadcast(msg);
}
/***********************************************************************
* Method: BRoster::Broadcast
* Params: BMessage *msg, BMessenger reply_to
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Broadcast_1
(BRoster *Roster, BMessage *msg, BMessenger reply_to)
{
return Roster->Broadcast(msg, reply_to);
}
/***********************************************************************
* Method: BRoster::StopWatching
* Params: BMessenger target
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_StopWatching(BRoster *Roster, BMessenger target)
{
return Roster->StopWatching(target);
}
/***********************************************************************
* Method: BRoster::ActivateApp
* Params: team_id team
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_ActivateApp(BRoster *Roster, team_id team)
{
return Roster->ActivateApp(team);
}
/***********************************************************************
* Method: BRoster::Launch
* Params: const char *mime_type, BMessage *initial_msgs, team_id *app_team
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Launch(BRoster *Roster, const char *mime_type, BMessage *initial_msgs, team_id *app_team)
{
return Roster->Launch(mime_type, initial_msgs, app_team);
}
/***********************************************************************
* Method: BRoster::Launch
* Params: const char *mime_type, BList *message_list, team_id *app_team
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Launch_1
(BRoster *Roster, const char *mime_type, BList *message_list, team_id *app_team)
{
return Roster->Launch(mime_type, message_list, app_team);
}
/***********************************************************************
* Method: BRoster::Launch
* Params: const char *mime_type, int argc, char **args, team_id *app_team
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Launch_2
(BRoster *Roster, const char *mime_type, int argc, char **args, team_id *app_team)
{
return Roster->Launch(mime_type, argc, args, app_team);
}
/***********************************************************************
* Method: BRoster::Launch
* Params: const entry_ref *ref, const BMessage *initial_message, team_id *app_team
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Launch_3
(BRoster *Roster, const entry_ref *ref, const BMessage *initial_message, team_id *app_team)
{
return Roster->Launch(ref, initial_message, app_team);
}
/***********************************************************************
* Method: BRoster::Launch
* Params: const entry_ref *ref, const BList *message_list, team_id *app_team
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Launch_4
(BRoster *Roster, const entry_ref *ref, const BList *message_list, team_id *app_team)
{
return Roster->Launch(ref, message_list, app_team);
}
/***********************************************************************
* Method: BRoster::Launch
* Params: const entry_ref *ref, int argc, const char *const *args, team_id *app_team
* Returns: status_t
* Effects:
***********************************************************************/
status_t
BRoster_Launch_5
(BRoster *Roster, const entry_ref *ref, int argc, const char *const *args, team_id *app_team)
{
return Roster->Launch(ref, argc, args, app_team);
}
/***********************************************************************
* Method: BRoster::GetRecentDocuments
* Params: BMessage *refList, int32 maxCount, const char *ofType, const char *openedByAppSig
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_GetRecentDocuments(BRoster *Roster, BMessage *refList, int32 maxCount, const char *ofType, const char *openedByAppSig)
{
Roster->GetRecentDocuments(refList, maxCount, ofType, openedByAppSig);
}
/***********************************************************************
* Method: BRoster::GetRecentDocuments
* Params: BMessage *refList, int32 maxCount, const char *ofTypeList[], int32 ofTypeListCount, const char *openedByAppSig
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_GetRecentDocuments_1
(BRoster *Roster, BMessage *refList, int32 maxCount, const char *ofTypeList[], int32 ofTypeListCount, const char *openedByAppSig)
{
// Roster->GetRecentDocuments(refList, maxCount, ofTypeList[], ofTypeListCount, openedByAppSig);
}
/***********************************************************************
* Method: BRoster::GetRecentFolders
* Params: BMessage *refList, int32 maxCount, const char *openedByAppSig
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_GetRecentFolders(BRoster *Roster, BMessage *refList, int32 maxCount, const char *openedByAppSig)
{
Roster->GetRecentFolders(refList, maxCount, openedByAppSig);
}
/***********************************************************************
* Method: BRoster::GetRecentApps
* Params: BMessage *refList, int32 maxCount
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_GetRecentApps(BRoster *Roster, BMessage *refList, int32 maxCount)
{
Roster->GetRecentApps(refList, maxCount);
}
/***********************************************************************
* Method: BRoster::AddToRecentDocuments
* Params: const entry_ref *doc, const char *appSig
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_AddToRecentDocuments(BRoster *Roster, const entry_ref *doc, const char *appSig)
{
Roster->AddToRecentDocuments(doc, appSig);
}
/***********************************************************************
* Method: BRoster::AddToRecentFolders
* Params: const entry_ref *folder, const char *appSig
* Returns: void
* Effects:
***********************************************************************/
void
BRoster_AddToRecentFolders(BRoster *Roster, const entry_ref *folder, const char *appSig)
{
Roster->AddToRecentFolders(folder, appSig);
}
/***********************************************************************
* Method: BRoster::_StartWatching
* Params: mtarget t, BMessenger *roster_mess, uint32 what, BMessenger notify, uint32 event_mask
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster__StartWatching(BRoster *Roster, mtarget t, BMessenger *roster_mess, uint32 what, BMessenger notify, uint32 event_mask) const
{
return Roster->_StartWatching(t, roster_mess, what, notify, event_mask);
}
*/
/***********************************************************************
* Method: BRoster::_StopWatching
* Params: mtarget t, BMessenger *roster_mess, uint32 what, BMessenger notify
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster__StopWatching(BRoster *Roster, mtarget t, BMessenger *roster_mess, uint32 what, BMessenger notify) const
{
return Roster->_StopWatching(t, roster_mess, what, notify);
}
*/
/***********************************************************************
* Method: BRoster::AddApplication
* Params: const char *mime_sig, entry_ref *ref, uint32 flags, team_id team, thread_id thread, port_id port, bool full_reg
* Returns: uint32
* Effects:
***********************************************************************/
/*uint32
BRoster_AddApplication(BRoster *Roster, const char *mime_sig, entry_ref *ref, uint32 flags, team_id team, thread_id thread, port_id port, bool full_reg) const
{
return Roster->AddApplication(mime_sig, ref, flags, team, thread, port, full_reg);
}
*/
/***********************************************************************
* Method: BRoster::SetSignature
* Params: team_id team, const char *mime_sig
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_SetSignature(BRoster *Roster, team_id team, const char *mime_sig) const
{
Roster->SetSignature(team, mime_sig);
}
*/
/***********************************************************************
* Method: BRoster::SetThread
* Params: team_id team, thread_id tid
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_SetThread(BRoster *Roster, team_id team, thread_id tid) const
{
Roster->SetThread(team, tid);
}
*/
/***********************************************************************
* Method: BRoster::SetThreadAndTeam
* Params: uint32 entry_token, thread_id tid, team_id team
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_SetThreadAndTeam_1
(BRoster *Roster, uint32 entry_token, thread_id tid, team_id team) const
{
Roster->SetThreadAndTeam(entry_token, tid, team);
}
*/
/***********************************************************************
* Method: BRoster::CompleteRegistration
* Params: team_id team, thread_id, port_id port
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_CompleteRegistration(BRoster *Roster, team_id team, thread_id, port_id port) const
{
Roster->CompleteRegistration(team, , port);
}
*/
/***********************************************************************
* Method: BRoster::IsAppPreRegistered
* Params: entry_ref *ref, team_id team, app_info *info
* Returns: bool
* Effects:
***********************************************************************/
/*bool
BRoster_IsAppPreRegistered(BRoster *Roster, entry_ref *ref, team_id team, app_info *info) const
{
return Roster->IsAppPreRegistered(ref, team, info);
}
*/
/***********************************************************************
* Method: BRoster::RemovePreRegApp
* Params: uint32 entry_token
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_RemovePreRegApp(BRoster *Roster, uint32 entry_token) const
{
Roster->RemovePreRegApp(entry_token);
}
*/
/***********************************************************************
* Method: BRoster::RemoveApp
* Params: team_id team
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_RemoveApp(BRoster *Roster, team_id team) const
{
Roster->RemoveApp(team);
}
*/
/***********************************************************************
* Method: BRoster::xLaunchAppPrivate
* Params: const char *mime_sig, const entry_ref *ref, BList *msg_list, int cargs, char **args, team_id *app_team
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_xLaunchAppPrivate(BRoster *Roster, const char *mime_sig, const entry_ref *ref, BList *msg_list, int cargs, char **args, team_id *app_team) const
{
return Roster->xLaunchAppPrivate(mime_sig, ref, msg_list, cargs, args, app_team);
}
*/
/***********************************************************************
* Method: BRoster::UpdateActiveApp
* Params: team_id team
* Returns: bool
* Effects:
***********************************************************************/
/*bool
BRoster_UpdateActiveApp(BRoster *Roster, team_id team) const
{
return Roster->UpdateActiveApp(team);
}
*/
/***********************************************************************
* Method: BRoster::SetAppFlags
* Params: team_id team, uint32 flags
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_SetAppFlags(BRoster *Roster, team_id team, uint32 flags) const
{
Roster->SetAppFlags(team, flags);
}
*/
/***********************************************************************
* Method: BRoster::DumpRoster
* Params:
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_DumpRoster(BRoster *Roster) const
{
Roster->DumpRoster();
}
*/
/***********************************************************************
* Method: BRoster::resolve_app
* Params: const char *in_type, const entry_ref *ref, entry_ref *app_ref, char *app_sig, uint32 *app_flags, bool *was_document
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_resolve_app(BRoster *Roster, const char *in_type, const entry_ref *ref, entry_ref *app_ref, char *app_sig, uint32 *app_flags, bool *was_document) const
{
return Roster->resolve_app(in_type, ref, app_ref, app_sig, app_flags, was_document);
}
*/
/***********************************************************************
* Method: BRoster::translate_ref
* Params: const entry_ref *ref, BMimeType *app_meta, entry_ref *app_ref, BFile *app_file, char *app_sig, bool *was_document
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_translate_ref(BRoster *Roster, const entry_ref *ref, BMimeType *app_meta, entry_ref *app_ref, BFile *app_file, char *app_sig, bool *was_document) const
{
return Roster->translate_ref(ref, app_meta, app_ref, app_file, app_sig, was_document);
}
*/
/***********************************************************************
* Method: BRoster::translate_type
* Params: const char *mime_type, BMimeType *meta, entry_ref *app_ref, BFile *app_file, char *app_sig
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_translate_type(BRoster *Roster, const char *mime_type, BMimeType *meta, entry_ref *app_ref, BFile *app_file, char *app_sig) const
{
return Roster->translate_type(mime_type, meta, app_ref, app_file, app_sig);
}
*/
/***********************************************************************
* Method: BRoster::sniff_file
* Params: const entry_ref *file, BNodeInfo *finfo, char *mime_type
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_sniff_file(BRoster *Roster, const entry_ref *file, BNodeInfo *finfo, char *mime_type) const
{
return Roster->sniff_file(file, finfo, mime_type);
}
*/
/***********************************************************************
* Method: BRoster::is_wildcard
* Params: const char *sig
* Returns: bool
* Effects:
***********************************************************************/
/*bool
BRoster_is_wildcard(BRoster *Roster, const char *sig) const
{
return Roster->is_wildcard(sig);
}
*/
/***********************************************************************
* Method: BRoster::get_unique_supporting_app
* Params: const BMessage *apps, char *out_sig
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_get_unique_supporting_app(BRoster *Roster, const BMessage *apps, char *out_sig) const
{
return Roster->get_unique_supporting_app(apps, out_sig);
}
*/
/***********************************************************************
* Method: BRoster::get_random_supporting_app
* Params: const BMessage *apps, char *out_sig
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_get_random_supporting_app(BRoster *Roster, const BMessage *apps, char *out_sig) const
{
return Roster->get_random_supporting_app(apps, out_sig);
}
*/
/***********************************************************************
* Method: BRoster::build_arg_vector
* Params: char **args, int *pargs, const entry_ref *app_ref, const entry_ref *doc_ref
* Returns: char **
* Effects:
***********************************************************************/
/*char **
BRoster_build_arg_vector(BRoster *Roster, char **args, int *pargs, const entry_ref *app_ref, const entry_ref *doc_ref) const
{
return Roster->build_arg_vector(args, pargs, app_ref, doc_ref);
}
*/
/***********************************************************************
* Method: BRoster::send_to_running
* Params: team_id tema, const entry_ref *app_ref, int cargs, char **args, const BList *msg_list, const entry_ref *ref
* Returns: status_t
* Effects:
***********************************************************************/
/*status_t
BRoster_send_to_running(BRoster *Roster, team_id tema, const entry_ref *app_ref, int cargs, char **args, const BList *msg_list, const entry_ref *ref) const
{
return Roster->send_to_running(tema, app_ref, cargs, args, msg_list, ref);
}
*/
/***********************************************************************
* Method: BRoster::InitMessengers
* Params:
* Returns: void
* Effects:
***********************************************************************/
/*void
BRoster_InitMessengers(BRoster *Roster)
{
Roster->InitMessengers();
}
*/
#if defined(__cplusplus)
}
#endif

View File

@@ -48,12 +48,16 @@ procedure BApplication_HideCursor(Application : TCPlusObject); cdecl; external B
procedure BApplication_ShowCursor(Application : TCPlusObject); cdecl; external BePascalLibName;
function BApplication_Run(Application : TCPlusObject) : TThread_id; cdecl; external BePascalLibName;
procedure BApplication_Quit(Application : TCPlusObject); cdecl; external BePascalLibName;
function get_be_app_messenger : TCPlusObject; cdecl; external BePascalLibName name 'get_be_app_messenger';
var
be_app : TApplication;
implementation
uses
Messenger;
var
Application_AppActivated_hook : Pointer; cvar; external;
Application_ReadyToRun_hook : Pointer; cvar; external;
@@ -64,6 +68,7 @@ begin
inherited;
CPlusObject := BApplication_Create(Self, PChar('application/x-vnd.BePascal'));
be_app := Self;
be_app_TMessenger := TMessenger.Wrap(be_app_messengerCPlus);
end;
constructor TApplication.Create(Signature : PChar);
@@ -71,6 +76,7 @@ begin
inherited Create;
CPlusObject := BApplication_Create(Self, Signature);
be_app := Self;
be_app_TMessenger := TMessenger.Wrap(be_app_messengerCPlus);
end;
constructor TApplication.Create(Signature : PChar; error : PStatus_t);
@@ -78,12 +84,15 @@ begin
inherited Create;
CPlusObject := BApplication_Create(Self, Signature, error);
be_app := Self;
be_app_TMessenger := TMessenger.Wrap(be_app_messengerCPlus);
end;
destructor TApplication.Destroy;
begin
if CPlusObject <> nil then
BApplication_Free(CPlusObject);
if Assigned(be_app_TMessenger) then
be_app_TMessenger.UnWrap;
inherited;
end;

View File

@@ -90,7 +90,8 @@ function BMessenger_Team(AObject : TCPlusObject) : TTeam_id; cdecl; external BeP
//procedure BMessenger_bool extra4(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMessenger_bool extra4';
var
be_app_messenger : TMessenger;
be_app_TMessenger : TMessenger;
be_app_messengerCPlus : TCPlusObject; cvar; external;
implementation
@@ -240,9 +241,9 @@ end;
//end;
initialization
be_app_messenger := nil;
be_app_TMessenger := nil;
finalization
be_app_messenger := nil;
be_app_TMessenger := nil;
end.

View File

@@ -21,22 +21,157 @@ unit Roster;
interface
uses
beobj, appdefs, supportdefs,
beobj, appdefs, supportdefs, OS, Entry, StorageDefs, List, Messenger,
message;
type
PTEntryRef = ^TEntryRef;
TAppInfoProc = procedure;
TAppInfo = record
thread : TThread_id;
team : TTeam_id;
port : TPort_id;
flags : Cardinal;
ref : TEntryRef;
signature : Array[0..B_MIME_TYPE_LENGTH] of Char;
end;
TRoster = class(TBeObject)
private
public
constructor Create; override;
destructor Destroy; override;
function Broadcast(aMessage : TMessage) : TStatus_t;
//*****************
function IsRunning(mime_sig : PChar) : boolean;
function IsRunning(var ref : TEntryRef) : boolean;
function TeamFor(mime_sig : PChar) : TTeam_id;
function TeamFor(var ref : TEntryRef) : TTeam_id;
procedure GetAppList(team_id_list : TList);
procedure GetAppList(sig : PChar; team_id_list : TList);
function GetAppInfo(sig : PChar; var info : TAppInfo) : TStatus_t;
function GetAppInfo(var ref : TEntryRef; var info : TAppInfo) : TStatus_t;
function GetRunningAppInfo(team : TTeam_id; var info : TAppInfo) : TStatus_t;
function GetActiveAppInfo(var info : TAppInfo) : TStatus_t;
function FindApp(mime_type : PChar; var app : TEntryRef) : TStatus_t;
function FindApp(var ref : TEntryRef; var app : TEntryRef) : TStatus_t;
function Broadcast(msg : TMessage) : TStatus_t;
function Broadcast(msg : TMessage; reply_to : TMessenger) : TStatus_t;
function StopWatching(target : TMessenger) : TStatus_t;
function ActivateApp(team : TTeam_id) : TStatus_t;
function Launch(mime_type : PChar; initial_msgs : TMessage; var app_team : TTeam_id) : TStatus_t;
function Launch(mime_type : PChar; message_list : TList; var app_team : TTeam_id) : TStatus_t;
function Launch(mime_type : PChar; argc : integer; args : PChar; var app_team : TTeam_id) : TStatus_t;
function Launch(var ref : TEntryRef; initial_message : TMessage; var app_team : TTeam_id) : TStatus_t;
function Launch(var ref : TEntryRef; message_list : TList; var app_team : TTeam_id) : TStatus_t;
function Launch(var ref : TEntryRef; argc : integer; args : PChar; var app_team : TTeam_id) : TStatus_t;
procedure GetRecentDocuments(refList : TMessage; maxCount : integer; ofType : PChar; openedByAppSig : PChar);
procedure GetRecentDocuments(refList : TMessage; maxCount : integer; ofTypeList : PChar; ofTypeListCount : integer; openedByAppSig : PChar);
procedure GetRecentFolders(refList : TMessage; maxCount : integer; openedByAppSig : PChar);
procedure GetRecentApps(refList : TMessage; maxCount : integer);
procedure AddToRecentDocuments(var doc : TEntryRef; appSig : PChar);
procedure AddToRecentFolders(var folder : TEntryRef; appSig : PChar);
// private
// procedure enum mtarget { MAIN_MESSENGER, MIME_MESSENGER, USE_GIVEN };
{ function _StartWatching(t : ; roster_mess : TMessenger; what : Cardinal; notify : TMessenger; event_mask : Cardinal) : TStatus_t;
function _StopWatching(t : ; roster_mess : TMessenger; what : Cardinal; notify : TMessenger) : TStatus_t;
function AddApplication(mime_sig : PChar; ref : ^TEntryRef; flags : Cardinal; team : TTeam_id; thread : TThread_id; port : TPort_id; full_reg : boolean) : Cardinal;
procedure SetSignature(team : TTeam_id; mime_sig : PChar);
procedure SetThread(team : TTeam_id; tid : TThread_id);
procedure SetThreadAndTeam(entry_token : Cardinal; tid : TThread_id; team : TTeam_id);
procedure CompleteRegistration(team : TTeam_id; : TThread_id; port : TPort_id);
function IsAppPreRegistered(ref : ^TEntryRef; team : TTeam_id; info : ^TAppInfo) : boolean;
procedure RemovePreRegApp(entry_token : Cardinal);
procedure RemoveApp(team : TTeam_id);
function xLaunchAppPrivate(mime_sig : PChar; ref : ^TEntryRef; msg_list : TList; cargs : integer; args : PChar; app_team : ^TTeam_id) : TStatus_t;
function UpdateActiveApp(team : TTeam_id) : boolean;
procedure SetAppFlags(team : TTeam_id; flags : Cardinal);
procedure DumpRoster;
function resolve_app(in_type : PChar; ref : ^TEntryRef; app_ref : ^TEntryRef; app_sig : PChar; app_flags : Cardinal; was_document : boolean) : TStatus_t;
function translate_ref(ref : ^TEntryRef; app_meta : TBMimeType; app_ref : ^TEntryRef; app_file : TBFile; app_sig : PChar; was_document : boolean) : TStatus_t;
function translate_type(mime_type : PChar; meta : TBMimeType; app_ref : ^TEntryRef; app_file : TBFile; app_sig : PChar) : TStatus_t;
function sniff_file(file : ^TEntryRef; finfo : TBNodeInfo; mime_type : PChar) : TStatus_t;
function is_wildcard(sig : PChar) : boolean;
function get_unique_supporting_app(apps : TMessage; out_sig : PChar) : TStatus_t;
function get_random_supporting_app(apps : TMessage; out_sig : PChar) : TStatus_t;
function build_arg_vector(args : PChar; pargs : integer; app_ref : ^TEntryRef; doc_ref : ^TEntryRef) : PChar;
function send_to_running(tema : TTeam_id; app_ref : ^TEntryRef; cargs : integer; args : PChar; msg_list : TList; ref : ^TEntryRef) : TStatus_t;
procedure InitMessengers;
procedure BMessenger fMess;
procedure BMessenger fMimeMess;
procedure uint32 _fReserved[3];
}
end;
function Get_be_roster : TCPlusObject; cdecl; external BePascalLibName;
function BRoster_Create(AObject : TObject) : TCPlusObject; cdecl; external BePascalLibName;
procedure BRoster_Destroy(CPlusObject : TCPlusObject); cdecl; external BePascalLibName;
function BRoster_Broadcast(aRoster : TCPlusObject; aMessage : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName;
//function app_info_Create(AObject : TBeObject); cdecl; external BePascalLibName name 'app_info_Create';
//procedure app_info_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'app_info_Free';
//procedure app_info_thread_id thread(AObject : TCPlusObject); cdecl; external BePascalLibName name 'app_info_thread_id thread';
//procedure app_info_team_id team(AObject : TCPlusObject); cdecl; external BePascalLibName name 'app_info_team_id team';
//procedure app_info_port_id port(AObject : TCPlusObject); cdecl; external BePascalLibName name 'app_info_port_id port';
//procedure app_info_uint32 flags(AObject : TCPlusObject); cdecl; external BePascalLibName name 'app_info_uint32 flags';
//procedure app_info_entry_ref ref(AObject : TCPlusObject); cdecl; external BePascalLibName name 'app_info_entry_ref ref';
//procedure app_info_char signature[B_MIME_TYPE_LENGTH](AObject : TCPlusObject); cdecl; external BePascalLibName name 'app_info_char signature[B_MIME_TYPE_LENGTH]';
//function BRoster_Create(AObject : TBeObject); cdecl; external BePascalLibName name 'BRoster_Create';
//procedure BRoster_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_Free';
function BRoster_IsRunning(AObject : TCPlusObject; mime_sig : PChar) : boolean; cdecl; external BePascalLibName name 'BRoster_IsRunning';
function BRoster_IsRunning(AObject : TCPlusObject; var ref : TEntryRef) : boolean; cdecl; external BePascalLibName name 'BRoster_IsRunning';
function BRoster_TeamFor(AObject : TCPlusObject; mime_sig : PChar) : TTeam_id; cdecl; external BePascalLibName name 'BRoster_TeamFor';
function BRoster_TeamFor(AObject : TCPlusObject; var ref : TEntryRef) : TTeam_id; cdecl; external BePascalLibName name 'BRoster_TeamFor';
procedure BRoster_GetAppList(AObject : TCPlusObject; team_id_list : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_GetAppList';
procedure BRoster_GetAppList(AObject : TCPlusObject; sig : PChar; team_id_list : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_GetAppList';
function BRoster_GetAppInfo(AObject : TCPlusObject; sig : PChar; var info : TAppInfo) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_GetAppInfo';
function BRoster_GetAppInfo(AObject : TCPlusObject; var ref : TEntryRef; var info : TAppInfo) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_GetAppInfo';
function BRoster_GetRunningAppInfo(AObject : TCPlusObject; team : TTeam_id; var info : TAppInfo) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_GetRunningAppInfo';
function BRoster_GetActiveAppInfo(AObject : TCPlusObject; var info : TAppInfo) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_GetActiveAppInfo';
function BRoster_FindApp(AObject : TCPlusObject; mime_type : PChar; var app : TEntryRef) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_FindApp';
function BRoster_FindApp_1(AObject : TCPlusObject; var ref : TEntryRef; var app : TEntryRef) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_FindApp';
function BRoster_Broadcast(aRoster : TCPlusObject; msg : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Broadcast';
function BRoster_Broadcast_1(AObject : TCPlusObject; msg : TCPlusObject; reply_to : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Broadcast';
function BRoster_StopWatching(AObject : TCPlusObject; target : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_StopWatching';
function BRoster_ActivateApp(AObject : TCPlusObject; team : TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_ActivateApp';
function BRoster_Launch(AObject : TCPlusObject; mime_type : PChar; initial_msgs : TCPlusObject; var app_team : TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Launch';
function BRoster_Launch_1(AObject : TCPlusObject; mime_type : PChar; message_list : TCPlusObject; var app_team : TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Launch';
function BRoster_Launch_2(AObject : TCPlusObject; mime_type : PChar; argc : integer; args : PChar; var app_team : TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Launch';
function BRoster_Launch_3(AObject : TCPlusObject; var ref : TEntryRef; initial_message : TMessage; var app_team : TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Launch';
function BRoster_Launch_4(AObject : TCPlusObject; var ref : TEntryRef; message_list : TList; var app_team : TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Launch';
function BRoster_Launch_5(AObject : TCPlusObject; var ref : TEntryRef; argc : integer; args : PChar; var app_team : TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_Launch';
procedure BRoster_GetRecentDocuments(AObject : TCPlusObject; refList : TCPlusObject; maxCount : integer; ofType : PChar; openedByAppSig : PChar); cdecl; external BePascalLibName name 'BRoster_GetRecentDocuments';
procedure BRoster_GetRecentDocuments(AObject : TCPlusObject; refList : TCPlusObject; maxCount : integer; ofTypeList : PChar; ofTypeListCount : integer; openedByAppSig : PChar); cdecl; external BePascalLibName name 'BRoster_GetRecentDocuments';
procedure BRoster_GetRecentFolders(AObject : TCPlusObject; refList : TCPlusObject; maxCount : integer; openedByAppSig : PChar); cdecl; external BePascalLibName name 'BRoster_GetRecentFolders';
procedure BRoster_GetRecentApps(AObject : TCPlusObject; refList : TCPlusObject; maxCount : integer); cdecl; external BePascalLibName name 'BRoster_GetRecentApps';
procedure BRoster_AddToRecentDocuments(AObject : TCPlusObject; var doc : TEntryRef; appSig : PChar); cdecl; external BePascalLibName name 'BRoster_AddToRecentDocuments';
procedure BRoster_AddToRecentFolders(AObject : TCPlusObject; var folder : TEntryRef; appSig : PChar); cdecl; external BePascalLibName name 'BRoster_AddToRecentFolders';
// procedure BRoster_enum mtarget { MAIN_MESSENGER, MIME_MESSENGER, USE_GIVEN }(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_enum mtarget { MAIN_MESSENGER, MIME_MESSENGER, USE_GIVEN }';
{function BRoster__StartWatching(AObject : TCPlusObject; t : ; roster_mess : TCPlusObject; what : Cardinal; notify : TCPlusObject; event_mask : Cardinal) : TStatus_t; cdecl; external BePascalLibName name 'BRoster__StartWatching';
function BRoster__StopWatching(AObject : TCPlusObject; t : ; roster_mess : TCPlusObject; what : Cardinal; notify : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'BRoster__StopWatching';
function BRoster_AddApplication(AObject : TCPlusObject; mime_sig : PChar; ref : ^TEntryRef; flags : Cardinal; team : TTeam_id; thread : TThread_id; port : TPort_id; full_reg : boolean) : Cardinal; cdecl; external BePascalLibName name 'BRoster_AddApplication';
procedure BRoster_SetSignature(AObject : TCPlusObject; team : TTeam_id; mime_sig : PChar); cdecl; external BePascalLibName name 'BRoster_SetSignature';
procedure BRoster_SetThread(AObject : TCPlusObject; team : TTeam_id; tid : TThread_id); cdecl; external BePascalLibName name 'BRoster_SetThread';
procedure BRoster_SetThreadAndTeam(AObject : TCPlusObject; entry_token : Cardinal; tid : TThread_id; team : TTeam_id); cdecl; external BePascalLibName name 'BRoster_SetThreadAndTeam';
procedure BRoster_CompleteRegistration(AObject : TCPlusObject; team : TTeam_id; : TThread_id; port : TPort_id); cdecl; external BePascalLibName name 'BRoster_CompleteRegistration';
function BRoster_IsAppPreRegistered(AObject : TCPlusObject; ref : ^TEntryRef; team : TTeam_id; info : ^TAppInfo) : boolean; cdecl; external BePascalLibName name 'BRoster_IsAppPreRegistered';
procedure BRoster_RemovePreRegApp(AObject : TCPlusObject; entry_token : Cardinal); cdecl; external BePascalLibName name 'BRoster_RemovePreRegApp';
procedure BRoster_RemoveApp(AObject : TCPlusObject; team : TTeam_id); cdecl; external BePascalLibName name 'BRoster_RemoveApp';
function BRoster_xLaunchAppPrivate(AObject : TCPlusObject; mime_sig : PChar; ref : ^TEntryRef; msg_list : TCPlusObject; cargs : integer; args : PChar; app_team : ^TTeam_id) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_xLaunchAppPrivate';
function BRoster_UpdateActiveApp(AObject : TCPlusObject; team : TTeam_id) : boolean; cdecl; external BePascalLibName name 'BRoster_UpdateActiveApp';
procedure BRoster_SetAppFlags(AObject : TCPlusObject; team : TTeam_id; flags : Cardinal); cdecl; external BePascalLibName name 'BRoster_SetAppFlags';
procedure BRoster_DumpRoster(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_DumpRoster';
function BRoster_resolve_app(AObject : TCPlusObject; in_type : PChar; ref : ^TEntryRef; app_ref : ^TEntryRef; app_sig : PChar; app_flags : Cardinal; was_document : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_resolve_app';
function BRoster_translate_ref(AObject : TCPlusObject; ref : ^TEntryRef; app_meta : TCPlusObject; app_ref : ^TEntryRef; app_file : TCPlusObject; app_sig : PChar; was_document : boolean) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_translate_ref';
function BRoster_translate_type(AObject : TCPlusObject; mime_type : PChar; meta : TCPlusObject; app_ref : ^TEntryRef; app_file : TCPlusObject; app_sig : PChar) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_translate_type';
function BRoster_sniff_file(AObject : TCPlusObject; file : ^TEntryRef; finfo : TCPlusObject; mime_type : PChar) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_sniff_file';
function BRoster_is_wildcard(AObject : TCPlusObject; sig : PChar) : boolean; cdecl; external BePascalLibName name 'BRoster_is_wildcard';
function BRoster_get_unique_supporting_app(AObject : TCPlusObject; apps : TMessage; out_sig : PChar) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_get_unique_supporting_app';
function BRoster_get_random_supporting_app(AObject : TCPlusObject; apps : TMessage; out_sig : PChar) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_get_random_supporting_app';
function BRoster_build_arg_vector(AObject : TCPlusObject; args : PChar; pargs : integer; app_ref : ^TEntryRef; doc_ref : ^TEntryRef) : PChar; cdecl; external BePascalLibName name 'BRoster_build_arg_vector';
function BRoster_send_to_running(AObject : TCPlusObject; tema : TTeam_id; app_ref : ^TEntryRef; cargs : integer; args : PChar; msg_list : TList; ref : ^TEntryRef) : TStatus_t; cdecl; external BePascalLibName name 'BRoster_send_to_running';
procedure BRoster_InitMessengers(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_InitMessengers';
procedure BRoster_BMessenger fMess(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_BMessenger fMess';
procedure BRoster_BMessenger fMimeMess(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_BMessenger fMimeMess';
procedure BRoster_uint32 _fReserved[3](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BRoster_uint32 _fReserved[3]';
}
var
be_roster : TRoster;
@@ -56,9 +191,144 @@ begin
inherited;
end;
function TRoster.Broadcast(aMessage : TMessage) : TStatus_t;
function TRoster.IsRunning(mime_sig : PChar) : boolean;
begin
result := BRoster_Broadcast(Self.CPlusObject, aMessage.CPlusObject);
Result := BRoster_IsRunning(CPlusObject, mime_sig);
end;
function TRoster.IsRunning(var ref : TEntryRef) : boolean;
begin
Result := BRoster_IsRunning(CPlusObject, ref);
end;
function TRoster.TeamFor(mime_sig : PChar) : TTeam_id;
begin
Result := BRoster_TeamFor(CPlusObject, mime_sig);
end;
function TRoster.TeamFor(var ref : TEntryRef) : TTeam_id;
begin
Result := BRoster_TeamFor(CPlusObject, ref);
end;
procedure TRoster.GetAppList(team_id_list : TList);
begin
BRoster_GetAppList(CPlusObject, team_id_list.CPlusObject);
end;
procedure TRoster.GetAppList(sig : PChar; team_id_list : TList);
begin
BRoster_GetAppList(CPlusObject, sig, team_id_list.CPlusObject);
end;
function TRoster.GetAppInfo(sig : PChar; var info : TAppInfo) : TStatus_t;
begin
Result := BRoster_GetAppInfo(CPlusObject, sig, info);
end;
function TRoster.GetAppInfo(var ref : TEntryRef; var info : TAppInfo) : TStatus_t;
begin
Result := BRoster_GetAppInfo(CPlusObject, ref, info);
end;
function TRoster.GetRunningAppInfo(team : TTeam_id; var info : TAppInfo) : TStatus_t;
begin
Result := BRoster_GetRunningAppInfo(CPlusObject, team, info);
end;
function TRoster.GetActiveAppInfo(var info : TAppInfo) : TStatus_t;
begin
Result := BRoster_GetActiveAppInfo(CPlusObject, info);
end;
function TRoster.FindApp(mime_type : PChar; var app : TEntryRef) : TStatus_t;
begin
Result := BRoster_FindApp(CPlusObject, mime_type, app);
end;
function TRoster.FindApp(var ref : TEntryRef; var app : TEntryRef) : TStatus_t;
begin
Result := BRoster_FindApp_1(CPlusObject, ref, app);
end;
function TRoster.Broadcast(msg : TMessage) : TStatus_t;
begin
Result := BRoster_Broadcast(CPlusObject, msg.CPlusObject);
end;
function TRoster.Broadcast(msg : TMessage; reply_to : TMessenger) : TStatus_t;
begin
Result := BRoster_Broadcast_1(CPlusObject, msg.CPlusObject, reply_to.CPlusObject);
end;
function TRoster.StopWatching(target : TMessenger) : TStatus_t;
begin
Result := BRoster_StopWatching(CPlusObject, target.CPlusObject);
end;
function TRoster.ActivateApp(team : TTeam_id) : TStatus_t;
begin
Result := BRoster_ActivateApp(CPlusObject, team);
end;
function TRoster.Launch(mime_type : PChar; initial_msgs : TMessage; var app_team : TTeam_id) : TStatus_t;
begin
Result := BRoster_Launch(CPlusObject, mime_type, initial_msgs.CPlusObject, app_team);
end;
function TRoster.Launch(mime_type : PChar; message_list : TList; var app_team : TTeam_id) : TStatus_t;
begin
Result := BRoster_Launch_1(CPlusObject, mime_type, message_list.CPlusObject, app_team);
end;
function TRoster.Launch(mime_type : PChar; argc : integer; args : PChar; var app_team : TTeam_id) : TStatus_t;
begin
Result := BRoster_Launch_2(CPlusObject, mime_type, argc, args, app_team);
end;
function TRoster.Launch(var ref : TEntryRef; initial_message : TMessage; var app_team : TTeam_id) : TStatus_t;
begin
Result := BRoster_Launch_3(CPlusObject, ref, initial_message, app_team);
end;
function TRoster.Launch(var ref : TEntryRef; message_list : TList; var app_team : TTeam_id) : TStatus_t;
begin
Result := BRoster_Launch_4(CPlusObject, ref, message_list, app_team);
end;
function TRoster.Launch(var ref : TEntryRef; argc : integer; args : PChar; var app_team : TTeam_id) : TStatus_t;
begin
Result := BRoster_Launch_5(CPlusObject, ref, argc, args, app_team);
end;
procedure TRoster.GetRecentDocuments(refList : TMessage; maxCount : integer; ofType : PChar; openedByAppSig : PChar);
begin
BRoster_GetRecentDocuments(CPlusObject, refList.CPlusObject, maxCount, ofType, openedByAppSig);
end;
procedure TRoster.GetRecentDocuments(refList : TMessage; maxCount : integer; ofTypeList : PChar; ofTypeListCount : integer; openedByAppSig : PChar);
begin
BRoster_GetRecentDocuments(CPlusObject, refList.CPlusObject, maxCount, ofTypeList, ofTypeListCount, openedByAppSig);
end;
procedure TRoster.GetRecentFolders(refList : TMessage; maxCount : integer; openedByAppSig : PChar);
begin
BRoster_GetRecentFolders(CPlusObject, refList.CPlusObject, maxCount, openedByAppSig);
end;
procedure TRoster.GetRecentApps(refList : TMessage; maxCount : integer);
begin
BRoster_GetRecentApps(CPlusObject, refList.CPlusObject, maxCount);
end;
procedure TRoster.AddToRecentDocuments(var doc : TEntryRef; appSig : PChar);
begin
BRoster_AddToRecentDocuments(CPlusObject, doc, appSig);
end;
procedure TRoster.AddToRecentFolders(var folder : TEntryRef; appSig : PChar);
begin
BRoster_AddToRecentFolders(CPlusObject, folder, appSig);
end;
initialization