Gnuplot terminal detection on linux without X11 patch

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

Gnuplot terminal detection on linux without X11 patch

by Bugzilla from stefan@stefant.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

To: bug@...
Cc: stefan@...
Subject: Gnuplot terminal detection on linux without X11 patch

Bug report for Octave 3.0.1 configured for i486-pc-linux-gnu

Description:
-----------

If 'plot' is used on a linux server without X (p.e. using ssh),
octave sets terminal 'aqua' to gnuplot, which is not available
(in octave 3.0), and not all diehard console users know/care about
setting GNUTERM (like me :) ).

Similary, in Octave 3.2 in gnuplot_drawnow.m the Gnuplot terminal
should only be set to X11 if DISPLAY is set (else, set to 'unknown'
again or something).

It would be nice to have an option/command/.. to prevent plot,etc..
from displaying the plot, but only store it to a file using 'print'.
(I don't know if there is already such an option, but I could not find one).

Repeat-By:
---------

Run Octave 3.0/3.2 on a linux terminal, unset DISPLAY and GNUTERM
environment variables, execute the following code:

plot( [1 2 3 2 3] );
print('test.eps','-deps');


Fix:
---

Here is a patch for drawnow.m for octave 3.0 which checks for OS X
first, which works for me:

diff -ru m.orig/plot/drawnow.m m/plot/drawnow.m
--- m.orig/plot/drawnow.m       2009-10-30 20:00:21.000000000 +0100
+++ m/plot/drawnow.m    2009-10-30 19:59:45.000000000 +0100
@@ -160,13 +160,10 @@
        term = "x11";
       elseif (! isunix ())
        term = "windows";
-      else
-       ## This should really be checking for os x before setting
-       ## the terminal type to aqua, but nobody will notice because
-       ## every other unix will be using x11 and windows will be
-       ## using windows.  Those diehards still running octave from
-       ## a linux console know how to set the GNUTERM variable.
+      elseif ( ismac () )
        term = "aqua";
+      else
+       term = "unknown";
       endif
     endif

@@ -195,10 +192,9 @@

     elseif (enhanced)
       fprintf (plot_stream, "set terminal %s %s\n", term, enh_str);
+    elseif ( isempty (getenv ("GNUTERM")) )
+      fprintf (plot_stream, "set terminal %s\n", term);
     endif
-    ## gnuplot will pick up the GNUTERM environment variable itself
-    ## so no need to set the terminal type if not also setting the
-    ## figure title or enhanced mode.

   endif


For Octave 3.2 the following patch could work, but I have *not* tested it:

diff -ru scripts.orig/plot/gnuplot_drawnow.m scripts/plot/gnuplot_drawnow.m
--- scripts.orig/plot/gnuplot_drawnow.m 2009-10-30 20:41:19.000000000 +0100
+++ scripts/plot/gnuplot_drawnow.m      2009-10-30 20:20:52.000000000 +0100
@@ -326,8 +326,10 @@
       term = "aqua";
     elseif (! isunix ())
       term = "windows";
-    else
+    elseif (! isempty( getenv ("DISPLAY")) )
       term = "x11";
+    else
+      term = "unknown";
     endif
   endif
 endfunction


Configuration (please do not edit this section):
-----------------------------------------------

uname output:     Linux data 2.6.26-2-vserver-686 #1 SMP Sun Jun 21 07:50:38 UTC 2009 i686 GNU/Linux
configure opts:   '--host=i486-linux-gnu' '--build=i486-linux-gnu' '--prefix=/usr' '--datadir=/usr/share'
'--libdir=/usr/lib' '--libexecdir=/usr/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man'
'--with-blas=-lblas-3gf' '--with-lapack=-llapackgf-3' '--with-hdf5' '--with-fftw' '--enable-shared' '--enable-rpath'
'--disable-static' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CC=gcc' 'CFLAGS=-g -O2' 'LDFLAGS='
'CPPFLAGS=' 'CXX=g++' 'CXXFLAGS=-g -O2' 'F77=gfortran' 'FFLAGS=-g -O2'
Fortran compiler: gfortran
FFLAGS:           -O2 -g
F2C:              @F2C@
F2CFLAGS:         @F2CFLAGS@
FLIBS:            -L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib -L/lib/../lib
-L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../.. -lhdf5 -lz -lgfortranbegin -lgfortran -lm
CPPFLAGS:
INCFLAGS:         -I. -I. -I./liboctave -I./src -I./libcruft/misc
C compiler:       gcc, version 4.3.2 (Debian 4.3.2-1.1)
CFLAGS:           -O2 -g
CPICFLAG:         -fPIC
C++ compiler:     g++, version 4.3.2
CXXFLAGS:         -O2 -g
CXXPICFLAG:       -fPIC
LD_CXX:           g++
LDFLAGS:
LIBFLAGS:         -L.
RLD_FLAG:         -Wl,-rpath -Wl,/usr/lib/octave-3.0.1
BLAS_LIBS:        -llapackgf-3 -lblas-3gf
FFTW_LIBS:        -lfftw3
LIBS:             -lreadline  -lncurses -ldl -lhdf5 -lz -lm
LEXLIB:
LIBGLOB:
SED:              /bin/sed
DEFS:

  -DPACKAGE_NAME="" -DPACKAGE_TARNAME="" -DPACKAGE_VERSION=""
  -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT="" -DOCTAVE_SOURCE=1
  -D_GNU_SOURCE=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1
  -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
  -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSEPCHAR=':'
  -DSEPCHAR_STR=":" -D__NO_MATH_INLINES=1 -DCXX_NEW_FRIEND_TEMPLATE_DECL=1
  -DCXX_ISO_COMPLIANT_LIBRARY=1 -DCXX_ABI=unknown -DHAVE_LIBM=1
  -DHAVE_QHULL=1 -DHAVE_PCRE=1 -DHAVE_REGEXEC=1 -DHAVE_REGEX=1
  -DHAVE_ZLIB_H=1 -DHAVE_ZLIB=1 -DHAVE_HDF5_H=1 -DHAVE_HDF5=1
  -DHAVE_H5GGET_NUM_OBJS=1 -DHAVE_FFTW3=1 -DHAVE_GLPK_H=1 -DHAVE_GLPK=1
  -DHAVE_CURL_CURL_H=1 -DHAVE_CURL=1 -DHAVE_IEEE754_DATA_FORMAT=1
  -DF77_FUNC(name,NAME)=name ## _ -DF77_FUNC_(name,NAME)=name ## _
  -DHAVE_BLAS=1 -DHAVE_SUITESPARSE_UMFPACK_H=1 -DHAVE_U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YPE_IS_VOID=1 -DHAVE_GETRUSAGE=1
  -DHAVE_TIMES=1 -DYYTEXT_POINTER=1 -DGNUPLOT_BINARY="gnuplot"

User-preferences (please do not edit this section):
--------------------------------------------------

  EDITOR = vim
  EXEC_PATH =
/usr/lib/octave/3.0.1/site/exec/i486-pc-linux-gnu:/usr/lib/octave/api-v32/site/exec/i486-pc-linux-gnu:/usr/lib/octave/site/exec/i486-pc-linux-gnu:/usr/lib/octave/3.0.1/exec/i486-pc-linux-gnu:/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/opt/dmd/dmd/bin:/opt/llvm/llvm/bin:/opt/llvm/ldc/bin
  IMAGE_PATH = .:/usr/share/octave/3.0.1/imagelib
  PAGER = pager
  PS1 = \s:\#>
  PS2 = >
  PS4 = +
  beep_on_error = 0
  completion_append_char =
  crash_dumps_octave_core = 1
  echo_executing_commands = 0
  fixed_point_format = 0
  gnuplot_binary = gnuplot
  gnuplot_command_end =

  gnuplot_command_plot = pl
  gnuplot_command_replot = rep
  gnuplot_command_splot = sp
  gnuplot_command_title = t
  gnuplot_command_using = u
  gnuplot_command_with = w
  history_file = /home/stefan/.octave_hist
  history_size = 1024
  ignore_function_time_stamp = system
  info_file = /usr/share/info/octave3.0.info
  info_program = info
  makeinfo_program = makeinfo
  max_recursion_depth = 256
  output_max_field_width = 5
  output_precision = 5
  page_output_immediately = 0
  page_screen_output = 1
  print_answer_id_name = 1
  print_empty_dimensions = 1
  save_precision = 16
  saving_history = 1
  sighup_dumps_octave_core = 1
  sigterm_dumps_octave_core = 1
  silent_functions = 0
  split_long_rows = 1
  string_fill_char =
  struct_levels_to_print = 2
  suppress_verbose_help_message = 0
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Gnuplot terminal detection on linux without X11 patch

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 30-Oct-2009, Stefan Hepp wrote:

| Bug report for Octave 3.0.1 configured for i486-pc-linux-gnu
|
| Description:
| -----------
|
| If 'plot' is used on a linux server without X (p.e. using ssh),
| octave sets terminal 'aqua' to gnuplot, which is not available
| (in octave 3.0), and not all diehard console users know/care about
| setting GNUTERM (like me :) ).
|
| Similary, in Octave 3.2 in gnuplot_drawnow.m the Gnuplot terminal
| should only be set to X11 if DISPLAY is set (else, set to 'unknown'
| again or something).
|
| It would be nice to have an option/command/.. to prevent plot,etc..
| from displaying the plot, but only store it to a file using 'print'.
| (I don't know if there is already such an option, but I could not find one).
|
| Repeat-By:
| ---------
|
| Run Octave 3.0/3.2 on a linux terminal, unset DISPLAY and GNUTERM
| environment variables, execute the following code:
|
| plot( [1 2 3 2 3] );
| print('test.eps','-deps');
|
|
| Fix:
| ---
|
| Here is a patch for drawnow.m for octave 3.0 which checks for OS X
| first, which works for me:
|
| diff -ru m.orig/plot/drawnow.m m/plot/drawnow.m
| --- m.orig/plot/drawnow.m       2009-10-30 20:00:21.000000000 +0100
| +++ m/plot/drawnow.m    2009-10-30 19:59:45.000000000 +0100
| @@ -160,13 +160,10 @@
|         term = "x11";
|        elseif (! isunix ())
|         term = "windows";
| -      else
| -       ## This should really be checking for os x before setting
| -       ## the terminal type to aqua, but nobody will notice because
| -       ## every other unix will be using x11 and windows will be
| -       ## using windows.  Those diehards still running octave from
| -       ## a linux console know how to set the GNUTERM variable.
| +      elseif ( ismac () )
|         term = "aqua";
| +      else
| +       term = "unknown";
|        endif
|      endif
|
| @@ -195,10 +192,9 @@
|
|      elseif (enhanced)
|        fprintf (plot_stream, "set terminal %s %s\n", term, enh_str);
| +    elseif ( isempty (getenv ("GNUTERM")) )
| +      fprintf (plot_stream, "set terminal %s\n", term);
|      endif
| -    ## gnuplot will pick up the GNUTERM environment variable itself
| -    ## so no need to set the terminal type if not also setting the
| -    ## figure title or enhanced mode.
|
|    endif
|
|
| For Octave 3.2 the following patch could work, but I have *not* tested it:
|
| diff -ru scripts.orig/plot/gnuplot_drawnow.m scripts/plot/gnuplot_drawnow.m
| --- scripts.orig/plot/gnuplot_drawnow.m 2009-10-30 20:41:19.000000000 +0100
| +++ scripts/plot/gnuplot_drawnow.m      2009-10-30 20:20:52.000000000 +0100
| @@ -326,8 +326,10 @@
|        term = "aqua";
|      elseif (! isunix ())
|        term = "windows";
| -    else
| +    elseif (! isempty( getenv ("DISPLAY")) )
|        term = "x11";
| +    else
| +      term = "unknown";
|      endif
|    endif
|  endfunction

3.0.x is no longer maintained.  I checked in your patch for 3.2 to the
main development branch:

  http://hg.savannah.gnu.org/hgweb/octave/rev/4634a0e9ea1b

Jaroslav, I don't think this is a regression or a particularly serious
bug, but it should be safe to apply the patch to the 3.2.x release
branch.

Thanks,

jwe
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> | +      else
> | +       term = "unknown";

It may be convenient to use the "dumb" terminal instead. However,

        $ GNUTERM=dumb octave
        octave> plot(1:100);

does not draw anything in Octave 3.2.x while it works correctly in 3.0.x.
Isn't the stdout of gnuplot redirected to /dev/null?

---
PM
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  3-Nov-2009, Petr Mikulik wrote:

| > | +      else
| > | +       term = "unknown";
|
| It may be convenient to use the "dumb" terminal instead. However,
|
| $ GNUTERM=dumb octave
| octave> plot(1:100);
|
| does not draw anything in Octave 3.2.x while it works correctly in 3.0.x.

Here is what I see with 3.2.3:

  $ GNUTERM=dumb octave3.2
  GNU Octave, version 3.2.3
  Copyright (C) 2009 John W. Eaton and others.
  This is free software; see the source code for copying conditions.
  There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

  Octave was configured for "x86_64-pc-linux-gnu".

  Additional information about Octave is available at http://www.octave.org.

  Please contribute if you find this software useful.
  For more information, visit http://www.octave.org/help-wanted.html

  Report bugs to <bug@...> (but first, please read
  http://www.octave.org/bugs.html to learn how to write a helpful report).

  For information about changes from previous versions, type `news'.

  octave3.2:1> line
  Error: terminal "dumb" does not support continuous colors.
  octave3.2:2>

No plot appears.

| Isn't the stdout of gnuplot redirected to /dev/null?

I don't see any code in Octave for doing that.

jwe
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

For octave 3.2.3 and gnuplot 4.5 CVS on mingw, I did not see what John has shown but saw that octave
only represented the next prompt.  Perhaps what I saw is the same as what Petr saw.
Perhaps the response octave depends on gnuplot version.

> | Isn't the stdout of gnuplot redirected to /dev/null?

I do not know for octave 3.0.x. At least, octave 3.2.x or later uses bidirectional pipes to
communicate with gnuplot.

In the 'gnuplot_drawnow.m', (octave 3.0.x does not have it), 'dumb' terminal is not treated.
Therefore it is quite natural octave 3.2 does not respond to 'dumb' terminal.

If you would like you use dumb terminal octave 3.2 or later, you should modify gnuplot_drawnow.m.

Regards

Tatsuro

--- "John W. Eaton"  wrote:

> On  3-Nov-2009, Petr Mikulik wrote:
>
> | > | +      else
> | > | +       term = "unknown";
> |
> | It may be convenient to use the "dumb" terminal instead. However,
> |
> | $ GNUTERM=dumb octave
> | octave> plot(1:100);
> |
> | does not draw anything in Octave 3.2.x while it works correctly in 3.0.x.
>
> Here is what I see with 3.2.3:
>
>   $ GNUTERM=dumb octave3.2
>   GNU Octave, version 3.2.3
>   Copyright (C) 2009 John W. Eaton and others.
>   This is free software; see the source code for copying conditions.
>   There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
>   FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.
>
>   Octave was configured for "x86_64-pc-linux-gnu".
>
>   Additional information about Octave is available at http://www.octave.org.
>
>   Please contribute if you find this software useful.
>   For more information, visit http://www.octave.org/help-wanted.html
>
>   Report bugs to <bug@...> (but first, please read
>   http://www.octave.org/bugs.html to learn how to write a helpful report).
>
>   For information about changes from previous versions, type `news'.
>
>   octave3.2:1> line
>   Error: terminal "dumb" does not support continuous colors.
>   octave3.2:2>
>
> No plot appears.
>
> | Isn't the stdout of gnuplot redirected to /dev/null?
>
> I don't see any code in Octave for doing that.
>
> jwe
> _______________________________________________
> Bug-octave mailing list
> Bug-octave@...
> https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave
>


--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > | Isn't the stdout of gnuplot redirected to /dev/null?
>
> I do not know for octave 3.0.x. At least, octave 3.2.x or later uses bidirectional pipes to
> communicate with gnuplot.
>
> If you would like you use dumb terminal octave 3.2 or later, you should modify gnuplot_drawnow.m.

Thanks for the hint. It was necesary to "set output '/dev/stderr'". Now the
dumb plot works, see the enclosed patch.

Does it work also on Windows?

>   Error: terminal "dumb" does not support continuous colors.

It's just a warning, it has been removed recently.

---
PM
[dumb01.diff]

--- orig/gnuplot_drawnow.m 2009-09-21 15:24:16.000000000 +0200
+++ gnuplot_drawnow.m 2009-11-04 16:28:40.000000000 +0100
@@ -143,8 +143,8 @@
 
     if (! isempty (h) && isfigure (h))
 
-      ## Generate gnuoplot title string for backend plot windows.
-      if (output_to_screen (term))
+      ## Generate gnuplot title string for backend plot windows.
+      if (output_to_screen (term) && ~strcmp(term, "dumb"))
         fig.numbertitle = get (h, "numbertitle");
         fig.name = get (h, "name");
         if (strcmpi (get (h, "numbertitle"), "on"))
@@ -239,6 +239,12 @@
           elseif (strncmpi (term, "aqua", 3))
             ## Aqua has size, but the format is different.
             size_str = sprintf ("size %d %d", gnuplot_size);
+          elseif (strncmpi (term, "dumb", 3))
+            ## Dumb uses full text screen size
+    if ~isempty(getenv("COLUMNS")) && ~isempty(getenv("LINES"))
+ new_stream = 1;
+       size_str = ["size ", getenv("COLUMNS"), " ", getenv("LINES")];
+    end
           elseif (strncmpi (term, "fig", 3))
             ## Fig also has size, but the format is different.
             size_str = sprintf ("size %.15g %.15g", gnuplot_size);
@@ -286,6 +292,9 @@
       ## the canvas size for terminals cdr/corel.
       term_str = sprintf ("%s %s", term_str, size_str);
     endif
+    if strcmp(term, "dumb")
+ fprintf (plot_stream, "set output '/dev/stderr';\n");
+    end
     ## Work around the gnuplot feature of growing the x11 window and
     ## flickering window (x11, windows, & wxt) when the mouse and
     ## multiplot are set in gnuplot.
@@ -315,7 +324,6 @@
     ## figure title, enhanced mode, or position.
   endif
 
-
 endfunction
 
 function term = gnuplot_default_term ()
@@ -361,7 +369,7 @@
 endfunction
 
 function ret = output_to_screen (term)
-  ret = any (strcmpi ({"aqua", "wxt", "x11", "windows", "pm"}, term));
+  ret = any (strcmpi ({"aqua", "dumb", "wxt", "x11", "windows", "pm"}, term));
 endfunction
 
 function ret = term_units_are_pixels (term)


_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

--- Petr Mikulik  wrote:

> Does it work also on Windows?

Worked on only Cygwin. For octave mingw, it did not work simply because native windows no '/dev/stdrr'
file device.

Regards

Tatsuro

--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > Does it work also on Windows?
>
> Worked on only Cygwin.

You mean gnuplot with x11 on cygwin?

> For octave mingw, it did not work simply because native windows no
> '/dev/stde rr' file device.

Do you mean wgnuplot.exe or the new gnuplot.exe?

Does Octave use communication via stdin also in Windows, e.g. "set print"?
Should Octave do "unset print" before printing the dumb plot?

In DOS times, it was possible to use device named "con:" for console output.
Isn't there something similar for /dev/stderr?

Is it Octave which eats the dumb output? Shouldn't it thus reprint the dumb
output to screen instead of parsing this as gnuplot messages?

---
PM
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

--- Petr Mikulik wrote:

> > > Does it work also on Windows?
> >
> > Worked on only Cygwin.
>
> You mean gnuplot with x11 on cygwin?
Yes. However, why it would get successful result on Cygwin because Cygwin has '/dev/stderr'.
 
> > For octave mingw, it did not work simply because native windows no
> > '/dev/stde rr' file device.
>
> Do you mean wgnuplot.exe or the new gnuplot.exe?

Of cource gnuplot.exe on cvs trees. Old type pgnuplot is no longer used from octave 2.9.1?
or later.

> Does Octave use communication via stdin also in Windows, e.g. "set print"?
> Should Octave do "unset print" before printing the dumb plot?
>
> In DOS times, it was possible to use device named "con:" for console output.
> Isn't there something similar for /dev/stderr?
To my knowledge, it does not exist.  But someone might know
 
> Is it Octave which eats the dumb output? Shouldn't it thus reprint the dumb
> output to screen instead of parsing this as gnuplot messages?
Octave uses bidirectional pipes so that it may be possible to get information from gnuplot output.
But I do not know how it will be realized.

Regards

Tatsuro

--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > In DOS times, it was possible to use device named "con:" for console output.
> > Isn't there something similar for /dev/stderr?
> To my knowledge, it does not exist.  But someone might know

Hm, it seems that in Mingw's C, there is FILE *stderr, but you cannot do
fopen("/dev/stderr") (unless run inside cygwin's bash?).

> > Is it Octave which eats the dumb output? Shouldn't it thus reprint the dumb
> > output to screen instead of parsing this as gnuplot messages?
> Octave uses bidirectional pipes so that it may be possible to get
> information from gnuplot output.

Who knows how to do it?

---
PM
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Parent Message unknown Re: Gnuplot terminal detection on linux without X11 patch

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday, November 05, 2009, at 11:13AM, "Petr Mikulik" <mikulik@...> wrote:

>> > In DOS times, it was possible to use device named "con:" for console output.
>> > Isn't there something similar for /dev/stderr?
>> To my knowledge, it does not exist.  But someone might know
>
>Hm, it seems that in Mingw's C, there is FILE *stderr, but you cannot do
>fopen("/dev/stderr") (unless run inside cygwin's bash?).
>
>> > Is it Octave which eats the dumb output? Shouldn't it thus reprint the dumb
>> > output to screen instead of parsing this as gnuplot messages?
>> Octave uses bidirectional pipes so that it may be possible to get
>> information from gnuplot output.
>
>Who knows how to do it?

Take a look at __gnuplot_get_var__.m

http://hg.savannah.gnu.org/hgweb/octave/file/2941c1daf509/scripts/plot/__gnuplot_get_var__.m

Perhaps "replot" can be sent to gnuplot, the resulting output obtained using the same approach as in __gnuplot_get_var__?

Ben
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Petr Mikulik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> >Hm, it seems that in Mingw's C, there is FILE *stderr, but you cannot do
> >fopen("/dev/stderr") (unless run inside cygwin's bash?).
> >
> >> > Is it Octave which eats the dumb output?
> >> > output to screen instead of parsing this as gnuplot messages?
> >> Octave uses bidirectional pipes so that it may be possible to get
> >> information from gnuplot output.
>
> Take a look at __gnuplot_get_var__.m

So it's popen2("gnuplot") which eats the stdout. The approach of
__gnuplot_get_var__.m is too complicated and it uses mkfifo which may not
work everywhere. Using temporary file is much more easy and transparent.

Enclosed is a patch of gnuplot_drawnow.m for which
        GNUTERM=dumb octave
should work everywhere. Please test it and commit if OK.

---
Petr Mikulik
[dumb02.diff]

# Support for the "dumb" terminal of gnuplot.
# Petr Mikulik, 6.11.2009

--- gnuplot_drawnow.m 2009-11-06 10:06:11.000000000 +0100
+++ orig/gnuplot_drawnow.m 2009-09-21 15:24:00.000000000 +0200
@@ -87,22 +87,9 @@
     else
       new_stream = false;
     endif
-    term = gnuplot_default_term ();
-    if strcmp(term, "dumb") ## popen2 eats stdout of gnuplot, use temporary file instead
-      dumb_tmp_file = tmpnam;
-      fprintf (plot_stream(1), "set output '%s';\n", dumb_tmp_file);
-    end
     enhanced = gnuplot_set_term (plot_stream (1), new_stream, h);
     __go_draw_figure__ (h, plot_stream (1), enhanced, mono, 0);
     fflush (plot_stream (1));
-    if (strcmp (term, "dumb"))
-      pause(0.1);
-      f = fopen(dumb_tmp_file, 'r');
-      [a, count] = fscanf (f, '%c', Inf); ## reprint the plot on screen
-      puts (a);
-      fclose (f);
-      unlink (dumb_tmp_file);
-    endif
   else
     print_usage ();
   endif
@@ -156,8 +143,8 @@
 
     if (! isempty (h) && isfigure (h))
 
-      ## Generate gnuplot title string for backend plot windows.
-      if (output_to_screen (term) && ~strcmp (term, "dumb"))
+      ## Generate gnuoplot title string for backend plot windows.
+      if (output_to_screen (term))
         fig.numbertitle = get (h, "numbertitle");
         fig.name = get (h, "name");
         if (strcmpi (get (h, "numbertitle"), "on"))
@@ -252,12 +239,6 @@
           elseif (strncmpi (term, "aqua", 3))
             ## Aqua has size, but the format is different.
             size_str = sprintf ("size %d %d", gnuplot_size);
-          elseif (strncmpi (term, "dumb", 3))
-            ## Let dumb use full text screen size
-    if ~isempty(getenv("COLUMNS")) && ~isempty(getenv("LINES"))
- new_stream = 1;
-       size_str = ["size ", getenv("COLUMNS"), " ", getenv("LINES")];
-    end
           elseif (strncmpi (term, "fig", 3))
             ## Fig also has size, but the format is different.
             size_str = sprintf ("size %.15g %.15g", gnuplot_size);
@@ -309,7 +290,7 @@
     ## flickering window (x11, windows, & wxt) when the mouse and
     ## multiplot are set in gnuplot.
     fputs (plot_stream, "unset multiplot;\n");
-    flickering_terms = {"x11", "windows", "wxt", "dumb"};
+    flickering_terms = {"x11", "windows", "wxt"};
     if (! any (strcmp (term, flickering_terms))
         || numel (findall (h, "type", "axes")) > 1
         || numel (findall (h, "type", "image")) > 0)
@@ -334,6 +315,7 @@
     ## figure title, enhanced mode, or position.
   endif
 
+
 endfunction
 
 function term = gnuplot_default_term ()
@@ -379,7 +361,7 @@
 endfunction
 
 function ret = output_to_screen (term)
-  ret = any (strcmpi ({"aqua", "dumb", "wxt", "x11", "windows", "pm"}, term));
+  ret = any (strcmpi ({"aqua", "wxt", "x11", "windows", "pm"}, term));
 endfunction
 
 function ret = term_units_are_pixels (term)


_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 6, 2009, at 4:11 AM, Petr Mikulik wrote:

>>> Hm, it seems that in Mingw's C, there is FILE *stderr, but you  
>>> cannot do
>>> fopen("/dev/stderr") (unless run inside cygwin's bash?).
>>>
>>>>> Is it Octave which eats the dumb output?
>>>>> output to screen instead of parsing this as gnuplot messages?
>>>> Octave uses bidirectional pipes so that it may be possible to get
>>>> information from gnuplot output.
>>
>> Take a look at __gnuplot_get_var__.m
>
> So it's popen2("gnuplot") which eats the stdout. The approach of
> __gnuplot_get_var__.m is too complicated and it uses mkfifo which  
> may not
> work everywhere. Using temporary file is much more easy and  
> transparent.
>
> Enclosed is a patch of gnuplot_drawnow.m for which
> GNUTERM=dumb octave
> should work everywhere. Please test it and commit if OK.
>
> ---
> Petr Mikulik<dumb02.diff>
I've converted Petr's diff to a mercurial changeset.

I assume the "pause(0.1)" command is intended to give gnuplot time to  
produce the plot and write the file, and have modified the patch as  
indicated below.

-      pause(0.1);
-      f = fopen(dumb_tmp_file, 'r');

+      fid = -1;
+      while (fid < 0)
+        pause(0.1);
+        fid = fopen(dumb_tmp_file, 'r');
+      endwhile

Is there a better way to ensure that the temp file is ready to be read?

I also made some formatting changes for consistency with Octave's  
sources.

Ben



_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

changeset.patch (3K) Download Attachment

Re: Gnuplot terminal detection on linux without X11 patch

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--- Ben Abbott  wrote:

> > Petr Mikulik<dumb02.diff>
>
> I've converted Petr's diff to a mercurial changeset.

Thank you for your kindness.  To which branch ? 3.2.x or development branch  or to both

Anyway I will see the both code and try the patch.

Regards

Tatsuro

--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--- Ben Abbott  wrote:

> > Petr Mikulik<dumb02.diff>
>
> I've converted Petr's diff to a mercurial changeset.

Thank you for your kindness.  To which branch ? 3.2.x or development branch  or to both

Anyway I will see the both code and try the patch.

Regards

Tatsuro

--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Nov 6, 2009, at 8:11 PM, Tatsuro MATSUOKA wrote:

> --- Ben Abbott  wrote:
>
>>> Petr Mikulik<dumb02.diff>
>>
>> I've converted Petr's diff to a mercurial changeset.
>
> Thank you for your kindness.  To which branch ? 3.2.x or development  
> branch  or to both
>
> Anyway I will see the both code and try the patch.
>
> Regards
>
> Tatsuro

The changeset should apply to the developers branch.

It may also apply to 3.2.x, but I haven't tried.

Ben

_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Ben

--- Ben Abbott wrote:

> The changeset should apply to the developers branch.
>
> It may also apply to 3.2.x, but I haven't tried.
>
> Ben
*********
Thanks!

I have built octave of both branch with your changeset.patch.

However both branch, I have met the same error
*********************
octave:1> putenv('GNUTERM','dumb')
octave:2> plot(1:10)
error: `size_str' undefined near line 310 column 20
error: evaluating argument list element number 1
error: called from:
error:  
c:\usr\Tatsu\mingwhome\octaves\OctBuild\octave-develop\..\..\hg\octave-work\scripts\plot\gnuplot_drawnow.m
at line 310, column 5
error:  
c:\usr\Tatsu\mingwhome\octaves\OctBuild\octave-develop\..\..\hg\octave-work\scripts\plot\gnuplot_drawnow.m
at line 96, column 14
*********************
308:    if (! isempty (size_str) && new_stream)
309:      ## size_str comes after other options to permit specification of
310:      ## the canvas size for terminals cdr/corel.
311:      term_str = sprintf ("%s %s", term_str, size_str);
312:    endif

Hmmm ???

Regards

Tatsuro



--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 7, 2009, at 1:00 PM, Tatsuro MATSUOKA wrote:

Hello Ben

--- Ben Abbott wrote:

The changeset should apply to the developers branch.

It may also apply to 3.2.x, but I haven't tried.

Ben
*********
Thanks!

I have built octave of both branch with your changeset.patch.

However both branch, I have met the same error
*********************
octave:1> putenv('GNUTERM','dumb')
octave:2> plot(1:10)
error: `size_str' undefined near line 310 column 20
error: evaluating argument list element number 1
error: called from:
error:  
c:\usr\Tatsu\mingwhome\octaves\OctBuild\octave-develop\..\..\hg\octave-work\scripts\plot\gnuplot_drawnow.m
at line 310, column 5
error:  
c:\usr\Tatsu\mingwhome\octaves\OctBuild\octave-develop\..\..\hg\octave-work\scripts\plot\gnuplot_drawnow.m
at line 96, column 14
*********************
308:    if (! isempty (size_str) && new_stream)
309:      ## size_str comes after other options to permit specification of
310:      ## the canvas size for terminals cdr/corel.
311:      term_str = sprintf ("%s %s", term_str, size_str);
312:    endif

Hmmm ???

Regards

Tatsuro

I'll look into the problem. What I get is below. 

octave:1> setenv ("GNUTERM", "dumb")
octave:2> plot(1:10)
Error: terminal "dumb" does not support continuous colors.
^L


        10 ++-----------+------------+------------+------------+-----------++
           +            +            +            +            +        --- +
           |                                                         -+-    |
           |                                                       --       |
           |                                                     --         |
         8 ++                                                 -+-          ++
           |                                               ---              |
           |                                            -+-                 |
           |                                        ----                    |
         6 ++                                    -+-                       ++
           |                                  ---                           |
           |                               -+-                              |
           |                             --                                 |
           |                           --                                   |
         4 ++                       -+-                                    ++
           |                     ---                                        |
           |                  -+-                                           |
           |              ----                                              |
         2 ++          -+-                                                 ++
           |         --                                                     |
           |       --                                                       |
           |      +                                                         |
           +            +            +            +            +            +
         0 ++-----------+------------+------------+------------+-----------++
           0            2            4            6            8           10

octave:3> 


Ben


_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: Gnuplot terminal detection on linux without X11 patch

by Ben Abbott :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Nov 7, 2009, at 2:22 PM, Ben Abbott wrote:

>
> On Nov 7, 2009, at 1:00 PM, Tatsuro MATSUOKA wrote:
>
>> Hello Ben
>>
>> --- Ben Abbott wrote:
>>
>>> The changeset should apply to the developers branch.
>>>
>>> It may also apply to 3.2.x, but I haven't tried.
>>>
>>> Ben
>> *********
>> Thanks!
>>
>> I have built octave of both branch with your changeset.patch.
>>
>> However both branch, I have met the same error
>> *********************
>> octave:1> putenv('GNUTERM','dumb')
>> octave:2> plot(1:10)
>> error: `size_str' undefined near line 310 column 20
>> error: evaluating argument list element number 1
>> error: called from:
>> error:
>> c:\usr\Tatsu\mingwhome\octaves\OctBuild\octave-develop\..\..\hg
>> \octave-work\scripts\plot\gnuplot_drawnow.m
>> at line 310, column 5
>> error:
>> c:\usr\Tatsu\mingwhome\octaves\OctBuild\octave-develop\..\..\hg
>> \octave-work\scripts\plot\gnuplot_drawnow.m
>> at line 96, column 14
>> *********************
>> 308:    if (! isempty (size_str) && new_stream)
>> 309:      ## size_str comes after other options to permit  
>> specification of
>> 310:      ## the canvas size for terminals cdr/corel.
>> 311:      term_str = sprintf ("%s %s", term_str, size_str);
>> 312:    endif
>>
>> Hmmm ???
>>
>> Regards
>>
>> Tatsuro
>
> I'll look into the problem. What I get is below.
>
> octave:1> setenv ("GNUTERM", "dumb")
> octave:2> plot(1:10)
> Error: terminal "dumb" does not support continuous colors.
> ^L
>
>
>         10 ++-----------+------------+------------+------------
> +-----------++
>            +            +            +            +            
> +        --- +
>            |                                                          
> -+-    |
>            |                                                        
> --       |
>            |                                                      
> --         |
>          8 ++                                                 -
> +-          ++
>            |                                                
> ---              |
>            |                                            -
> +-                 |
>            |                                        
> ----                    |
>          6 ++                                    -
> +-                       ++
>            |                                  
> ---                           |
>            |                               -
> +-                              |
>            |                              
> --                                 |
>            |                            
> --                                   |
>          4 ++                       -
> +-                                    ++
>            |                      
> ---                                        |
>            |                  -
> +-                                           |
>            |              
> ----                                              |
>          2 ++          -
> +-                                                 ++
>            |          
> --                                                     |
>            |        
> --                                                       |
>            |      
> +                                                         |
>            +            +            +            +            
> +            +
>          0 ++-----------+------------+------------+------------
> +-----------++
>            0            2            4            6            
> 8           10
>
> octave:3>
>
> Ben
Ok, I see the problem.

"size_str" should contain the width and height of the "dumb" terminal  
in characters. In my case, I see

        size_str = size 91 36

Which is the width and height of my terminal (i.e. xterm) in characters.

For systems where the environment includes the variables "COLUMNS" and  
"LINES", those will be used to set the plot size. Otherwise I've added  
default values of 80x34 characters.

Is there a better way?

For the windows COMMAND window are there environment variables that  
represent the width and height?

Ben








_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

changeset.patch (3K) Download Attachment

Re: Gnuplot terminal detection on linux without X11 patch

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

--- Ben Abbott wrote:

> Ok, I see the problem.
>
> "size_str" should contain the width and height of the "dumb" terminal  
> in characters. In my case, I see
>
> size_str = size 91 36
>
> Which is the width and height of my terminal (i.e. xterm) in characters.
>
> For systems where the environment includes the variables "COLUMNS" and  
> "LINES", those will be used to set the plot size. Otherwise I've added  
> default values of 80x34 characters.
>
> Is there a better way?
>
> For the windows COMMAND window are there environment variables that  
> represent the width and height?

Oh! COLUMNS and LINES are environmental variables!
I have overlooked.
            if ~isempty (getenv ("COLUMNS")) && ~isempty (getenv ("LINES"))
                new_stream = 1;
              size_str = ["size ", getenv("COLUMNS"), " ", getenv("LINES")];
            end

OK! Worked if I set COLUMNS and LINES environmental variables,
octave:1> putenv('COLUMNS','79')
octave:2> putenv('LINES','24')
octave:3> putenv('GNUTERM','dumb')
octave:4> fplot ("[cos(x), sin(x)]", [0, 2*pi])
^L

        1 ++-------+-------+--------+-------+--------+-------+-------++
          +  +++   +++    +++       +    [cos(x), sin(x)](:,1) +----+ +
          |    ++++          ++          [cos(x), sin(x)](:,2) +----+ |
          |     ++            ++                         +            |
          |    ++ ++           ++                      ++             |
      0.5 ++  +    ++            +                    ++             ++
          |  +      ++            +                  ++               |
          | +        ++            +                ++                |
          |+          ++           ++              ++                 |
        0 ++           +            ++             +                 ++
          |             +            +            +            ++     |
          |             ++            +          +            ++      |
          |              ++            +        +            ++       |
          |               ++            +      ++           ++        |
     -0.5 ++               ++            +    ++            +        ++
          |                 ++            ++ ++           ++          |
          |                   +            ++            ++           |
          |                    ++         ++++          ++            |
          +        +       +    +++ +   +++ + +++    +++     +        +
       -1 ++-------+-------+--------+-------+--------+-------+-------++
          0        1       2        3       4        5       6        7

 
I have not seen the new patch. I will report later.
Anyway the changeset made by Ben and Petr works also on windows if size is set properly.

BTW, according to help of gnuplot for windows

************************
where <xsize>and <ysize>set the size of the dumb terminals. Default is 79 by 24.The last newline is
printed only if feedis enabled.

Examples:
set term dumb nofeed
set term dumb 79 49 #VGA screen---why would anyone do that?
*************************

Regards

Tatsuro

--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave
< Prev | 1 - 2 | Next >