changeset 1272:ad4971693bc2 octave-forge

Make sure it builds and simple tk_matrix test runs; vtk test doesn't work
author pkienzle
date Fri, 06 Feb 2004 19:33:20 +0000
parents 9d54947663da
children 9c2f1e3afc2e
files extra/tk_octave/Makeconf.add extra/tk_octave/Makefile extra/tk_octave/README extra/tk_octave/configure.add extra/tk_octave/tk_interp.cc extra/tk_octave/tk_matrix extra/tk_octave/tk_matrix.tcl
diffstat 7 files changed, 31 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/extra/tk_octave/Makeconf.add	Fri Feb 06 17:05:11 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-@DEFHAVE_TCLTK@
-@DEFHAVE_BLT@
-@DEFHAVE_VTK@
--- a/extra/tk_octave/Makefile	Fri Feb 06 17:05:11 2004 +0000
+++ b/extra/tk_octave/Makefile	Fri Feb 06 19:33:20 2004 +0000
@@ -2,37 +2,29 @@
 
 ## Change this to the location of mkoctfile for your version of
 ## octave linked against pthreads (see README).
-MKOCTFILE ?= mkoctfile-pthreads
+MKOCTFILE ?= mkoctfile
 
-ifndef OCTAVE_FORGE
-	HAVE_TCLTK ?= 1
-	HAVE_BLT ?= 1
-	HAVE_VTK ?= 0
-endif
-
-VTK_OPTS = -DHAVE_VTK -lVTKCommon -lVTKGraphics -lVTKImaging -lGL
+## Compile and link opts --- set as appropriate for your system
+TCL_OPTS = -I/usr/include/tcl8.4 -ltcl8.4 -ltk8.4 -lpthread
+VTK_OPTS = -DHAVE_VTK -lvtkCommon -lvtkGraphics -lvtkImaging -lGL
 BLT_OPTS = -DHAVE_BLT -lBLT
 
-## Include either or both VTK_OPTS and BLT_OPTS if you have VTK/BLT installed
-ifdef HAVE_BLT
-OPTS += $(BLT_OPTS)
-endif
-ifdef HAVE_VTK
-OPTS += $(VTK_OPTS)
-endif
+## The remainder of this file should not need changing
+OPTS  = $(TCL_OPTS) $(BLT_OPTS) $(VTK_OPTS)
+LINKS = tk_loop.oct tk_end.oct tk_cmd.oct
 
-## The remainder of this file should not need changing
-LIBS = -ltcl -ltk -lpthread
-
-ifdef HAVE_TCLTK
-all: tk_interp.oct
+ifdef TCL_OPTS
+all: tk_interp.oct $(LINKS)
 else
-all:
-	@echo No Tcl/TK: tk_octave is not being built
+all: ; @echo No Tcl/TK: tk_octave is not being built
 endif
 
 tk_interp.oct: tk_interp.cc
-	$(MKOCTFILE) -v $^ -o $@ $(OPTS) $(LIBS)
+	$(MKOCTFILE) -v $^ -o $@ $(OPTS)
+
+$(LINKS):
+	-$(RM) $@
+	$(LN_S) tk_interp.oct $@
 
 clean: ; -$(RM) core octave-core *.o *.oct *~
 
--- a/extra/tk_octave/README	Fri Feb 06 17:05:11 2004 +0000
+++ b/extra/tk_octave/README	Fri Feb 06 19:33:20 2004 +0000
@@ -31,7 +31,7 @@
 Compiling Octave with tk_interp.cc
 ==================================
 
-In order to use tk_interp, we needed to relink the Octave binary with
+In order to use tk_interp, you may need to relink the Octave binary with
 pthreads.
 
 1) Untar/gz the octave source to /someplace/octave
@@ -62,8 +62,8 @@
 After relinking a custom version of Octave with pthreads, you'll need to 
 create tk_interp.oct.  Modify Makefile in the tk_octave directory to
 reference the appropriate mkoctfile for your custom version of Octave,
-and include either or both of $(BLT_OPTS) and $(VTK_OPTS) on the
-OPTS = ... line.  Type make and it should create tk_interp.oct for you.
+and comment out TCL_OPTS=, BLT_OPTS= or VTK_OPTS= as appropriate.
+Type make and it should create tk_interp.oct for you.
 
 Note that to use BLT and VTK, you will need to link with code distributed
 under four different licenses:
@@ -224,10 +224,3 @@
 all GUI interaction, so the issue will never come up, but you will have to
 think carefully about what you put in your tk_cmd and oct_cmd commands to
 be sure.  See SAFE_VAR in tk_interp.cc.
-
-Add an FSF approved "arm's length" separation between octave and tcl by
-sending matrices and commands through a pipe to a separate executable
-rather than copying them to a separate thread.  Alternatively, find a
-GPL compatible replacement for BLT and VTK.  You may still want to keep
-a separate thread in octave for the communication so that you can continue
-to access octave data asynchronously.
--- a/extra/tk_octave/configure.add	Fri Feb 06 17:05:11 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-
-if test -e extra/tk_octave/NOINSTALL ; then
-	dnl Not installing so don't test for it.
-	DEFHAVE_TCLTK=
-	DEFHAVE_BLT=
-	DEFHAVE_VTK=
-	dnl Given the experimental status of tk_octave, don't tempt the user
-	dnl into installing it by telling them it is not installed
-	dnl STATUS=noinstall
-else
-	dnl Do we have tcl/tk?
-	AC_SUBST(DEFHAVE_TCLTK)
-	HAVE_TCLTK=1
-	AC_CHECK_HEADERS(tcl.h tk.h,, HAVE_TCLTK=0)
-	AC_CHECK_LIB(tcl, Tcl_Init,, HAVE_TCLTK=0)
-	AC_CHECK_LIB(tk, Tk_Init,, HAVE_TCLTK=0)
-	if test $HAVE_TCLTK = 1 ; then
-		DEFHAVE_TCLTK="HAVE_TCLTK=1"
-		STATUS=yes
-	else
-		DEFHAVE_TCKTK=
-		STATUS="TCL/TK missing"
-	fi
-
-	dnl Do we have BLT?
-	AC_SUBST(DEFHAVE_BLT)
-	HAVE_BLT=1
-	AC_CHECK_HEADERS(blt.h,, HAVE_BLT=0)
-	AC_CHECK_LIB(BLT, Blt_Init,, HAVE_BLT=0,-ltcl -ltk)
-	if test $HAVE_BLT = 1 ; then
-		DEFHAVE_BLT="HAVE_BLT=1"
-		STATUS="$STATUS, with BLT"
-	else
-		DEFHAVE_BLT=
-		STATUS="$STATUS, BLT missing"
-	fi
-	
-	dnl Do we have VTK?
-	AC_SUBST(DEFHAVE_VTK)
-	HAVE_VTK=1
-	AC_CHECK_HEADERS(vtk/vtk.h,, HAVE_VTK=0)
-	if test $HAVE_VTK = 1 ; then
-		DEFHAVE_VTK="HAVE_VTK=1"
-		STATUS="$STATUS and with VTK"
-	else
-		DEFHAVE_VTK=
-		STATUS="$STATUS and without VTK (no 3-D support)"
-	fi
-
-	dnl Let the user know what we found
-	STATUS_MSG="$STATUS_MSG
-   tk_octave: $STATUS"
-
-fi
-
--- a/extra/tk_octave/tk_interp.cc	Fri Feb 06 17:05:11 2004 +0000
+++ b/extra/tk_octave/tk_interp.cc	Fri Feb 06 19:33:20 2004 +0000
@@ -49,7 +49,6 @@
 #endif
 
 #if HAVE_VTK
-#include <vtk/vtk.h>
 #include <vtk/vtkRenderer.h>
 #include <vtk/vtkRenderWindow.h>
 #include <vtk/vtkRenderWindowInteractor.h>
@@ -57,7 +56,6 @@
 #include <vtk/vtkTransform.h>
 #include <vtk/vtkTransformPolyDataFilter.h>
 #include <vtk/vtkPoints.h>
-#include <vtk/vtkScalars.h>
 #include <vtk/vtkWarpScalar.h>
 #include <vtk/vtkDataSetMapper.h>
 #include <vtk/vtkPolyData.h>
@@ -66,14 +64,8 @@
 #endif /* HAVE_VTK */
 
 #include <string>
-#include <strstream>
-
-#include <string.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
+#include <iostream>
 #include <pthread.h>
-#include <iostream.h>
 
 #define TRUE  1
 #define FALSE 0
@@ -444,7 +436,7 @@
          argv[1], "\" defined.", NULL);
       return TCL_ERROR;
    }
-   string s = def.string_value();
+   std::string s = def.string_value();
    Tcl_AppendResult(interp, s.c_str(), NULL);
    return TCL_OK;
 }
@@ -702,8 +694,9 @@
    int numPts = input->GetNumberOfPoints();
    vtkPoints *newPts = vtkPoints::New();
    newPts->SetNumberOfPoints(numPts);
-   vtkScalars *colors = vtkScalars::New();
-   colors->SetNumberOfScalars(numPts);
+   // XXX FIXME XXX color handling has changed
+   // vtkScalars *colors = vtkScalars::New();
+   // colors->SetNumberOfScalars(numPts);
 
    // Convert values from Octave matrix and store in VTK object
    float p[3];
@@ -714,19 +707,19 @@
       int col = int((p[1] + 0.5) * (float) (m.cols() - 1));
       p[2] = ((m.elem(row, col) - min) / (max - min)) - 0.5;
       newPts->SetPoint(k, p);
-      colors->SetScalar(k, p[2]);
+      // colors->SetScalar(k, p[2]);
    }   
 
    surface->CopyStructure(input);
    surface->SetPoints(newPts);
-   surface->GetPointData()->SetScalars(colors);
+   // surface->GetPointData()->SetScalars(colors);
 
    // Clean up VTK objects
    plane->Delete();
    transform->Delete();
    transF->Delete();
    newPts->Delete();
-   colors->Delete();
+   // colors->Delete();
 
    return TCL_OK;
 }
@@ -1024,8 +1017,8 @@
       pthread_mutex_unlock(&tk_mutex);
       while(command_to_do)
       {
-         cout << "Processing command: " << command_to_do << "\n";
-         const string octave_cmd = string(command_to_do);
+	 std::cout << "Processing command: " << command_to_do << "\n";
+         const std::string octave_cmd = std::string(command_to_do);
          int parse_status = 0;
 #if SAFE_VAR
 	 pthread_mutex_lock(&oct_mutex);
@@ -1034,7 +1027,7 @@
 #if SAFE_VAR
 	 pthread_mutex_unlock(&oct_mutex);
 #endif
-         cout << "Finished\n";
+	 std::cout << "Finished\n";
 
          pthread_mutex_lock(&tk_mutex);
          tk_fifo.pop();
--- a/extra/tk_octave/tk_matrix	Fri Feb 06 17:05:11 2004 +0000
+++ b/extra/tk_octave/tk_matrix	Fri Feb 06 19:33:20 2004 +0000
@@ -1,4 +1,4 @@
-#!/usr/local/bin/octave-pthreads
+#!/usr/lib/octave -q
 
 colorbar = [1:100]';
 load sample.dat
--- a/extra/tk_octave/tk_matrix.tcl	Fri Feb 06 17:05:11 2004 +0000
+++ b/extra/tk_octave/tk_matrix.tcl	Fri Feb 06 19:33:20 2004 +0000
@@ -6,7 +6,7 @@
 
 set HaveTable [expr [ catch { package require Tktable } ] == 0 ]
 set HaveVTK [expr [ string equal [ info commands oct_mtovtk ] {} ] && \
-	          [ catch {load ./vtktcl} ] == 0 ]
+	          [ catch { package require vtk } ] == 0 ]
 
 
 set Matrix {}