GDB (API)
|
00001 /* Sample command procedure library for a plug-in. */ 00002 00003 /* You have to include the Tcl headers, of course. */ 00004 #include <tcl.h> 00005 00006 /* Define the functions that implement your commands as required by Tcl */ 00007 #ifdef __CYGWIN__ 00008 # define EXPORT __declspec(dllexport) 00009 #else 00010 # define EXPORT /* nothing */ 00011 #endif 00012 00013 int extra_text (ClientData clientData, 00014 Tcl_Interp *interp, 00015 int objc, Tcl_Obj *CONST objv[]); 00016 00017 /* Here you actually do whatever you want, like calling your target 00018 libraries etc. Here we just return a string. */ 00019 00020 int 00021 extra_text (ClientData clientData, 00022 Tcl_Interp *interp, 00023 int objc, Tcl_Obj *CONST objv[]) 00024 { 00025 Tcl_SetObjResult (interp, 00026 Tcl_NewStringObj ("\nThis is a sample plug-in\n", -1)); 00027 return TCL_OK; 00028 } 00029 00030 /* Initialization function required in Tcl libraries. */ 00031 00032 int EXPORT 00033 Rhabout_Init (Tcl_Interp *interp) 00034 { 00035 /* Register your command as a Tcl command with this interpreter. */ 00036 Tcl_CreateObjCommand (interp, "rhabout_extra_text", extra_text, 00037 (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); 00038 00039 /* Register this package */ 00040 Tcl_PkgProvide (interp, "RHABOUT", "1.0"); 00041 return TCL_OK; 00042 } 00043 00044 /* This is REQUIRED for cygwin */ 00045 #ifdef __CYGWIN__ 00046 #include <windows.h> 00047 #include <tclInt.h> 00048 00049 struct _reent *_impure_ptr; 00050 extern struct _reent *_imp__reent_data; 00051 00052 BOOL APIENTRY 00053 DllMain (HINSTANCE hInstance, DWORD reason, LPVOID reserved) 00054 { 00055 _impure_ptr = _imp__reent_data; 00056 return TRUE; 00057 } 00058 #endif