Ilya Zakharevich on Sat, 27 May 2006 01:17:25 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Restore support for lowlevel-Gnuplot plotting terminals


This patch restores (in very simplified form, and with much better
docs) support for plotting via Gnuplot engines.  This is the necessary
change for the base files.  Right now one needs to use an appropriate
--graphic option to Configure; all the remaining features are made
self-documenting.

  [Eventually, one should better restore the old behaviour of makeing
   runtime-dynamic-link the default; this does not need any
   "additional" software at build time.]

Enjoy,
Ilya

--- ./README.os2-ini	Tue Feb  4 13:54:58 2003
+++ ./README.os2	Wed Mar 15 01:21:34 2006
@@ -27,14 +27,13 @@ a convenience, but also statically linke
 sigh...
 
 To use the gnuplot-engine DLL gnpltdrw.DLL, one can give Configure the option
---graphic=gnuplot-dynamic,gnpltdrw (requires linking with -Zcrtdll for graphics
-to work).  Add -DOLD_SET_FEEDBACK_RECTANGLE gcc option if gnpltdrw.DLL supports
+--graphic=gnuplot.dynamic,gnpltdrw (requires linking with -Zcrtdll for graphics
+to work).  Add -DUSE_SET_FEEDBACK_RECTANGLE gcc option if gnpltdrw.DLL supports
 mousing, but is an old build, so it won't report this capability.
 
 Thus the build process may look like this:
 
-  sh Configure --graphic=gnuplot-dynamic,gnpltdrw
-  make gp
+  sh Configure --graphic=gnuplot.dynamic,gnpltdrw
   cd Oos2-ix86
   make _O=.obj _A=.lib CC_FLAVOR="-Zomf -Zcrtdll -Zstack 8192 -DOLD_SET_FEEDBACK_RECTANGLE" RLLIBS=-lreadline_import DLLD_IGNORE= AR=emxomfar bench
   cd ..
--- ./config/get_fltk-ini	Mon Jul  4 01:05:56 2005
+++ ./config/get_fltk	Tue Mar 14 21:06:24 2006
@@ -2,7 +2,7 @@ if test -z "$with_fltk"; then
   case "$which_graphic_lib" in
     fltk) with_fltk=yes;;
   esac
-  if test -z "$X11"; then with_fltk=yes; fi
+  if test -z "$X11" -a "X$which_graphic_lib" = "Xnone"; then with_fltk=yes; fi
 fi
 if test -n "$with_fltk"; then
   which_graphic_lib=fltk
--- ./config/get_graphic_lib-ini	Thu Oct 20 08:50:30 2005
+++ ./config/get_graphic_lib	Tue Mar 14 21:51:24 2006
@@ -2,13 +2,18 @@ case $which_graphic_lib in
   auto) which_graphic_lib=none;;
 esac
 if test "$fastread" != yes; then
+  case "X$X11" in
+  X)   ;;
+  *)   add_graph="   builtin.X11+gnuplot.dynamic" ;;
+  esac
   cat << EOT
 ==========================================================================
 GP contains high resolution plotting functions. Choose among
-       none       X11       fltk      Qt
+  none   X11   fltk   Qt   gnuplot.dynamic$add_graph
+The '*-dynamic' version may be trailed by ',dll_base_name'.
 EOT
   echo $n ..."Use which graphic library (\"none\" means no hi-res plot) ? $c"
-  rep="none X11 fltk Qt";
+  rep="none X11 fltk Qt$add_graph gnuplot.dynamic";
   dflt=$which_graphic_lib; . ./myread
   which_graphic_lib=$ans
 
--- ./config/Makefile.SH-ini	Mon Jan 16 07:53:50 2006
+++ ./config/Makefile.SH	Wed Mar 15 17:40:50 2006
@@ -60,12 +60,26 @@ fltk)
   PLOTLIBS="-L\$(FLTKDIR)/lib -lfltk $FLTK_LIBS"
   postconfig='-fltk-config --post '
   graph=plotfltk;;
+*gnuplot.dynamic*)
+  graphic_lib_dll=NULL
+  case "$which_graphic_lib" in
+  *,*)
+      graphic_lib_dll='\"'`echo "$which_graphic_lib" | sed -e 's/[-a-z.+]*,//'`'\"'
+      which_graphic_lib=`echo "$which_graphic_lib" | sed -e 's/,.*//'` ;;
+  esac
+  CFLAGS="$CFLAGS -DPLOT_IS_TUNABLE"	# For plotport.c
+  PLOTCFLAGS="-DDYNAMIC_PLOTTING -DDYNAMIC_PLOTTING_RUNTIME_LINK=$graphic_lib_dll"
+  PLOTLIBS="-L\$(QTDIR)/lib $QTLIB"
+  graph=plotgnuplot;;
 esac
 graph="plotport $graph"
 
 plotrunpath=
 case "$which_graphic_lib" in
   *X11*)
+    case "$which_graphic_lib" in
+      *gnuplot*) PLOTCFLAGS="$PLOTCFLAGS -DBOTH_GNUPLOT_AND_X11" ;;
+    esac
     PLOTCFLAGS="$PLOTCFLAGS $X11_INC"
     PLOTLIBS="$PLOTLIBS $X11_LIBS"
     plotrunpath=$X11
--- ./src/graph/plotport.c-ini	Wed Jan 11 03:35:06 2006
+++ ./src/graph/plotport.c	Sat Mar 18 20:22:28 2006
@@ -29,7 +29,7 @@ static void PARI_get_psplot(void);
 
 static long current_color[NUMRECT];
 PariRect **rectgraph = NULL;
-PARI_plot pari_plot, pari_psplot;
+PARI_plot pari_plot, pari_psplot, X11_pari_plot;
 PARI_plot *pari_plot_engine = &pari_plot;
 long  rectpoint_itype = 0;
 long  rectline_itype  = 0;
@@ -769,7 +769,7 @@ void
 rectpointsize(long ne, GEN size) /* code = ROt_PTS */
 {
  if (ne == -1) {
-     /*do nothing*/
+     set_pointsize(gtodouble(size));	/* Immediate set */
  } else {
      PariRect *e = check_rect_init(ne);
      RectObj *z = (RectObj*) gpmalloc(sizeof(RectObjPS));
@@ -2133,3 +2133,18 @@ gen_rectdraw0(struct plot_eng *eng, void
     }
   }
 }
+
+#ifndef PLOT_IS_TUNABLE
+long
+term_set(char *s) {
+  if (s && 0 == strcmp(s,"?"))
+    pariputs("plotterm(), plotfile(), or plotpointsize() unsupported by this driver.\n");
+  return 1; 
+}
+
+long
+plot_outfile_set(char *s) { (void)s; return 1; }
+
+void
+set_pointsize(double d) { (void)d; }
+#endif
--- ./src/graph/plotX.c-ini	Fri Dec  9 11:34:24 2005
+++ ./src/graph/plotX.c	Wed Mar 15 18:22:16 2006
@@ -19,6 +19,11 @@ Foundation, Inc., 59 Temple Place - Suit
 /*                                                                 */
 /*******************************************************************/
 
+#ifdef BOTH_GNUPLOT_AND_X11		/* The switch support in plotgnuplot */
+#  define rectdraw0		X11_rectdraw0
+#  define PARI_get_plot		X11_PARI_get_plot
+#endif
+
 #include "pari.h"
 #include "rect.h"
 #include "../language/anal.h"
--- ./src/graph/rect.h-ini	Sat Nov 26 08:07:50 2005
+++ ./src/graph/rect.h	Tue Mar 14 22:19:10 2006
@@ -312,4 +312,8 @@ void gen_rectdraw0(struct plot_eng *eng,
 void  PARI_get_plot(long fatal);
 void  rectdraw0(long *w, long *x, long *y, long lw);
 
+long  plot_outfile_set(char *s);
+void  set_pointsize(double d);
+long  term_set(char *s);
+
 ENDEXTERN