00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef __TCLXPCOM_H__
00036 #define __TCLXPCOM_H__
00037
00038 #include "tcl.h"
00039 #include "nsISupports.h"
00040 #include "nsIInterfaceInfo.h"
00041
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046
00047
00048
00049
00050 #ifdef BUILD_TCLXPCOM
00051 # undef TCL_STORAGE_CLASS
00052 # define TCL_STORAGE_CLASS DLLEXPORT
00053 #endif
00054
00055 #define TCLXPCOM_MOZHOMEVARNAME "::xpcom::mozilla_home"
00056 #define TCLXPCOM_LASTRESULTVARNAME "::xpcom::lastResult"
00057 #define TCLXPCOM_ERRORMSGPROC "::xpcom::errormsg"
00058 #define TCLXPCOM_BGERRORPROC "::xpcom::bgerror"
00059
00060 EXTERN int Tclxpcom_Init _ANSI_ARGS_((Tcl_Interp *interp));
00061 EXTERN int Tclxpcom_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
00062
00063
00064
00065 #define TCLXPCOM_ISUPPORTSTYPENAME "TclXPCOM_Interface_Reference"
00066 #define TCLXPCOM_NSIDTYPENAME "TclXPCOM_Unique_ID"
00067 #define TCLXPCOM_POINTERTYPENAME "TclXPCOM_Void_Pointer"
00068 #define TCLXPCOM_IDENTIFIERTYPENAME "TclXPCOM_Identifier"
00069
00070 EXTERN Tcl_Obj *TclXPCOM_NewISupportsObj (nsISupports *isupports, nsIInterfaceInfo *interfaceinfo);
00071 EXTERN Tcl_Obj *TclXPCOM_NewNsIDObj (nsID *id);
00072 EXTERN Tcl_Obj *TclXPCOM_NewPointerObj (void *ptr);
00073 EXTERN Tcl_Obj *TclXPCOM_NewIdentifierObj (nsIInterfaceInfo *interfaceinfo, char *identifier);
00074
00075 EXTERN int TclXPCOM_GetISupportsFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, nsISupports **ref, nsIInterfaceInfo **info);
00076 EXTERN int TclXPCOM_QueryISupportsObj (Tcl_Interp *interp, Tcl_Obj *objPtr, nsIInterfaceInfo *info, nsISupports **ref);
00077 EXTERN int TclXPCOM_GetNsIDFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, nsID **id);
00078 EXTERN int TclXPCOM_GetPointerFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, void **ptr);
00079 EXTERN int TclXPCOM_GetIdentifierFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, nsIInterfaceInfo **interfaceinfo, char **identifier);
00080
00081 EXTERN int TclXPCOM_IsNULL (Tcl_Obj *objPtr);
00082
00083
00084
00085 #define FORCE_HIDDEN 0x01
00086 #define FORCE_NOTXPCOM 0x02
00087 #define FORCE_NOTSCRIPTABLE 0x04
00088
00089
00090 EXTERN void TclXPCOM_RegisterCommands (Tcl_Interp *interp);
00091
00092 EXTERN Tcl_ObjCmdProc TclXPCOM_InvokeObjCmd;
00093 EXTERN Tcl_ObjCmdProc TclXPCOM_WrapObjCmd;
00094 EXTERN Tcl_ObjCmdProc TclXPCOM_ThisObjCmd;
00095 EXTERN Tcl_ObjCmdProc TclXPCOM_ConstantObjCmd;
00096 EXTERN Tcl_ObjCmdProc TclXPCOM_InfoObjCmd;
00097 EXTERN Tcl_ObjCmdProc TclXPCOM_NullObjCmd;
00098 EXTERN Tcl_ObjCmdProc TclXPCOM_IsNullObjCmd;
00099 EXTERN Tcl_ObjCmdProc TclXPCOM_PointerObjCmd;
00100 EXTERN Tcl_ObjCmdProc TclXPCOM_AddressObjCmd;
00101 EXTERN Tcl_ObjCmdProc TclXPCOM_FromStringObjCmd;
00102 EXTERN Tcl_ObjCmdProc TclXPCOM_SetReturnCodeObjCmd;
00103 EXTERN Tcl_ObjCmdProc TclXPCOM_IdObjCmd;
00104
00105
00106 EXTERN int TclXPCOM_Invoke (Tcl_Interp *interp, Tcl_Obj *CONST objv[], nsISupports *isupports, nsIInterfaceInfo *interfaceinfo, PRUint16 methodindex);
00107
00108
00109
00110 EXTERN void TclXPCOM_GetCurrentComponentContext (nsIInterfaceInfo **interfaceinfo, nsISupports **isupports);
00111 EXTERN int TclXPCOM_SetReturnCode (nsresult res);
00112
00113 EXTERN int TclXPCOM_CheckInterfaceIsReflectable (Tcl_Interp *interp, nsIInterfaceInfo *interfaceinfo, int flags);
00114 EXTERN int TclXPCOM_CheckMethodIsReflectable (Tcl_Interp *interp, nsIInterfaceInfo *interfaceinfo, PRUint16 methodindex, int flags);
00115
00116
00117 typedef struct IdentifierInfo_ IdentifierInfo;
00118 typedef struct ClassInfo_ ClassInfo;
00119
00120
00121 #define INTERFACEINFO_METHOD 0x01
00122 #define INTERFACEINFO_GETTER 0x02
00123 #define INTERFACEINFO_SETTER 0x04
00124
00125 EXTERN int TclXPCOM_GetIdentifierInfoFromInterface (Tcl_Interp *interp, nsIInterfaceInfo *info, Tcl_Obj *identifier, int type, IdentifierInfo **idinfo);
00126 EXTERN int TclXPCOM_GetIdentifierInfoFromClass (Tcl_Interp *interp, ClassInfo *cinfo, Tcl_Obj *identifier, int type, nsIInterfaceInfo **info, IdentifierInfo **idinfo);
00127 EXTERN int TclXPCOM_GetMethodIndex (Tcl_Interp *interp, IdentifierInfo *idinfo, int type, PRUint16 *methodindex);
00128 EXTERN int TclXPCOM_GetConstant (Tcl_Interp *interp, nsIInterfaceInfo *interfaceinfo, Tcl_Obj *constantname, Tcl_Obj **result);
00129 EXTERN ClassInfo *TclXPCOM_GetClassInfo (int iidcount, nsIID **iids);
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 EXTERN void TclXPCOM_SetErrorCode (Tcl_Interp *interp, nsresult res);
00146
00147 EXTERN int TclXPCOM_GetErrorCode (Tcl_Interp *interp, nsresult *res);
00148 EXTERN void TclXPCOM_BackgroundError (Tcl_Interp *interp);
00149
00150 EXTERN void TclXPCOM_SetErrorMessage (Tcl_Interp *interp, nsresult res);
00151 EXTERN void TclXPCOM_SetError (Tcl_Interp *interp, nsresult res);
00152
00153
00154
00155 EXTERN Tcl_Obj *TclXPCOM_ListInterfaceMethods (nsIInterfaceInfo *interfaceinfo);
00156 EXTERN Tcl_Obj *TclXPCOM_ListInterfaceAttributes (nsIInterfaceInfo *interfaceinfo);
00157 EXTERN Tcl_Obj *TclXPCOM_ListInterfaceConstants (nsIInterfaceInfo *interfaceinfo);
00158 EXTERN Tcl_Obj *TclXPCOM_ListClassMethods (ClassInfo *cinfo);
00159 EXTERN Tcl_Obj *TclXPCOM_ListClassAttributes (ClassInfo *cinfo);
00160
00161 EXTERN Tcl_Obj *TclXPCOM_ListMethodArguments (nsIInterfaceInfo *interfaceinfo, PRUint16 methodindex);
00162 EXTERN Tcl_Obj *TclXPCOM_GetAttributeType (nsIInterfaceInfo *interfaceinfo, IdentifierInfo *idinfo);
00163 EXTERN Tcl_Obj *TclXPCOM_GetReturnValueType (nsIInterfaceInfo *interfaceinfo, IdentifierInfo *idinfo);
00164
00165
00166 # undef TCL_STORAGE_CLASS
00167 # define TCL_STORAGE_CLASS DLLIMPORT
00168
00169 #ifdef __cplusplus
00170 }
00171 #endif
00172
00173 #endif