Hey support

This commit is contained in:
ocoursiere
2003-05-22 18:24:55 +00:00
parent 60208db643
commit 03f210b689
3 changed files with 1431 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
#ifndef HEY_H
#define HEY_H
#include <SupportDefs.h>
__declspec(dllexport) int32 HeyInterpreterThreadHook(void* arg);
__declspec(dllexport) status_t Hey(BMessenger* target, const char* arg, BMessage* reply);
__declspec(dllexport) bool isSpace(char c);
__declspec(dllexport) status_t Hey(BMessenger* target, char* argv[], int32* argx, int32 argc, BMessage* reply);
__declspec(dllexport) status_t add_specifier(BMessage *to_message, char *argv[], int32 *argx, int32 argc);
__declspec(dllexport) status_t add_data(BMessage *to_message, char *argv[], int32 *argx);
__declspec(dllexport) status_t add_with(BMessage *to_message, char *argv[], int32 *argx, int32 argc);
__declspec(dllexport) void add_message_contents(BList *textlist, BMessage *msg, int32 level);
__declspec(dllexport) char *get_datatype_string(int32 type);
__declspec(dllexport) char *format_data(int32 type, char *ptr, long size);
__declspec(dllexport) void print_message(BMessage *message);
__declspec(dllexport) char *id_to_string(long ID, char *here);
__declspec(dllexport) bool is_valid_char(uint8 c);
#endif

View File

@@ -0,0 +1,70 @@
unit hey;
interface
uses
beobj, SysUtils, Messenger, Message, SupportDefs, Roster, OS, List, fdblib;
type
BHey = class
public
class function Hey(atarget : TMessenger; aarg : string; areply : TMessage) : TStatus_t;
class function Hey(AppName : string; aarg : string; areply : TMessage) : TStatus_t;
class function GetMessenger(AppName : string) : TMessenger;
end;
implementation
function InternalHey(target : TCPlusObject; arg : PChar; reply : TCPlusObject) : TStatus_t; cdecl; external BePascalLibName name 'Hey__FP10BMessengerPCcP8BMessage';//'Hey__FP10BMessengerPPcPllP8BMessage';
class function BHey.Hey(AppName : string; aArg : string; aReply : TMessage) : TStatus_t;
var
Messenger : TMessenger;
begin
Messenger := BHey.GetMessenger(AppName);
if Messenger <> nil then
Result := BHey.Hey(Messenger, aArg, aReply);
end;
class function BHey.Hey(atarget : TMessenger; aarg : string; areply : TMessage) : TStatus_t;
var
local : string;
begin
local := aarg + #0;
Result := InternalHey(atarget.CPlusObject, @local[1], areply.CPlusObject);
end;
class function BHey.GetMessenger(AppName : string) : TMessenger;
var
List : TList;
i : integer;
Team_id : TTeam_id;
AppInfo : TAppInfo;
Status_t : TStatus_t;
begin
Result := nil;
List := TList.Create;
try
be_roster.GetAppList(List);
for i := 0 to List.CountItems - 1 do
begin
Team_id := TTeam_id(List.ItemAt(i));
be_roster.GetRunningAppInfo(Team_id, AppInfo);
if AppName = PChar(AppInfo.Signature) then
begin
Result := TMessenger.Create(PChar(AppInfo.Signature), -1, Status_t);
Break;
end
else if PChar(AppInfo.ref.name) = AppName then
begin
Result := TMessenger.Create(0, Team_id, Status_t);
Break;
end;
end;
finally
List.Free;
end;
end;
end.