OSDN Git Service

2001-01-31 Fernando Nasser <fnasser@redhat.com>
authorFernando Nasser <fnasser@redhat.com>
Wed, 31 Jan 2001 23:37:20 +0000 (23:37 +0000)
committerFernando Nasser <fnasser@redhat.com>
Wed, 31 Jan 2001 23:37:20 +0000 (23:37 +0000)
* library/plugins/rhabout.tcl: Add load for optional sample C command
procedure.
* library/plugins/rhabout/rhabout.itcl (constructor): Try calling
optional sample C command procedure rhabout_extra_text.
* library/plugins/rhabout/rhabout.c: New file. Implement an example
plug-in shared library with a sample C command procedure.
* library/plugins/rhabout/Makefile: New file. Makefile for the sample
shared library above (Linux only).

gdb/gdbtk/ChangeLog
gdb/gdbtk/library/plugins/rhabout.tcl
gdb/gdbtk/library/plugins/rhabout/Makefile [new file with mode: 0644]
gdb/gdbtk/library/plugins/rhabout/rhabout.c [new file with mode: 0644]
gdb/gdbtk/library/plugins/rhabout/rhabout.itcl

index 0edd3d1..89f7d66 100644 (file)
@@ -1,3 +1,14 @@
+2001-01-31  Fernando Nasser  <fnasser@redhat.com>
+
+       * library/plugins/rhabout.tcl: Add load for optional sample C command 
+       procedure.
+       * library/plugins/rhabout/rhabout.itcl (constructor): Try calling
+       optional sample C command procedure rhabout_extra_text.
+       * library/plugins/rhabout/rhabout.c: New file. Implement an example
+       plug-in shared library with a sample C command procedure.
+       * library/plugins/rhabout/Makefile: New file. Makefile for the sample
+       shared library above (Linux only).
+
 2001-01-28  Fernando Nasser  <fnasser@redhat.com>
 
        * library/plugins: New directory.  Sample plug-in directory to help
index 4d73faa..cd59486 100644 (file)
@@ -1,3 +1,4 @@
 package provide RHABOUT 1.0
 set dirname [file dirname [info script]]
 lappend auto_path [file join $dirname rhabout]
+catch {load [file join $dirname rhabout rhabout.so]}
diff --git a/gdb/gdbtk/library/plugins/rhabout/Makefile b/gdb/gdbtk/library/plugins/rhabout/Makefile
new file mode 100644 (file)
index 0000000..4feced4
--- /dev/null
@@ -0,0 +1,9 @@
+TCL_CFLAGS = -I/home/fnasser/DEVO/insight-sourceware/src/tcl/generic
+TCL =  -L/home/fnasser/BUILD/insight-sourceware/native/tcl/unix -ltcl8.0
+
+PRE=
+POS= ".so"
+
+rhabout: rhabout.c
+       gcc -fPIC $(TCL_CFLAGS) -I. -o rhabout.o -c rhabout.c
+       gcc -shared -o rhabout$(POS) rhabout.o $(TCL)
diff --git a/gdb/gdbtk/library/plugins/rhabout/rhabout.c b/gdb/gdbtk/library/plugins/rhabout/rhabout.c
new file mode 100644 (file)
index 0000000..3f9030e
--- /dev/null
@@ -0,0 +1,34 @@
+/* Sample command procedure library for a plug-in. */
+
+/* You have to include the Tcl headers, of course. */
+#include <tcl.h>
+
+/* Define the functions that implement your commands as required by Tcl */
+
+int extra_text (ClientData clientData,
+                Tcl_Interp *interp,
+                int argc, char *argv[]);
+
+/* Here you actually do whatever you want, like calling your target 
+   libraries etc.  Here we just return a string. */
+
+int
+extra_text (ClientData clientData,
+                Tcl_Interp *interp,
+                int argc, char *argv[])
+{
+  interp->result = "\nThis is a sample plug-in\n";
+  return TCL_OK;
+}
+
+/* Initialization function required in Tcl libraries. */
+
+int
+Rhabout_Init (Tcl_Interp *interp)
+{
+  /* Register your command as a Tcl command with this interpreter. */
+  Tcl_CreateCommand (interp, "rhabout_extra_text", extra_text,
+                     (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
+
+  return TCL_OK;
+}
index fd22e51..96e9adc 100644 (file)
@@ -5,7 +5,14 @@ class RHAbout {
     set f [frame $itk_interior.f]
     label $f.image1 -bg white -image \
       [image create photo -file [file join $gdb_ImageDir insight.gif]]
-    message $f.m -bg white -fg black -text [gdb_cmd {show version}] -aspect 500 -relief flat
+
+    # Here we call an interface function provided by GDBTCL
+    set text [gdb_cmd {show version}]
+
+    # Here we call a command procedure that we created, if it exists
+    catch {append text [rhabout_extra_text]}
+
+    message $f.m -bg white -fg black -text $text -aspect 500 -relief flat
     pack $f.image1 $f.m $itk_interior.f -fill both -expand yes
     pack  $itk_interior
     bind $f.image1 <1> [code $this unpost]