[Top][All Lists]

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

gnuplot with X11 and octave cygwin32

From: John W. Eaton
Subject: gnuplot with X11 and octave cygwin32
Date: Tue, 19 May 1998 11:17:28 -0500 (CDT)

On 19-May-1998, Billinghurst, David <address@hidden> wrote:

| gnuplot-beta340 compiles out of the box using
| cygwin32/egcs-1.0.2/X11r6.3 and works on NT4 SP3
| This gnuplot works OK with octave-2.0.12

OK, but that requires an X server running on your Windows system,
doesn't it?

| Under Windows 95 gnuplot crashes nearly all the time (but I ran a couple
| of demos once ;-)

Do you mean the version of gnuplot compiled with the gnu tools?

In any case, I think we have a better solution now.  You can use a
simple wrapper program like the one below to send messages to the
Windows binary of gnuplot (I've used the binary version of 3.6beta340
that's available on on an NT system and it seems
to work fine).

To use the wrapper program, compile it and put it somewhere in your
path.  Rename the binary file something like pipe-gnuplot.exe.  Then

  gnuplot_binary = "pipe-gnuplot /gnuplot/wgnuplot"

replacing /gnuplot/wgnuplot with the actual name of your real gnuplot
binary (it must not contain spaces, though, or you may need to do some
quoting, or you can just modify the default location in the wrapper
program and recompile it).

I will make a binary and some more complete instructions available

If there are any Windows programmers out there who can improve this
bit of code, please let me know!



#include <stdio.h>
#include <windows.h>

main (int argc, char **argv)
  char *real_gnuplot = "C:\\gnuplot\\wgnuplot.exe";

  if (argc > 1)
    real_gnuplot = argv[1];

  /* load gnuplot (minimized in order to show only the graphic window) */

  if (WinExec (real_gnuplot, SW_MINIMIZE) <= 32)
    fprintf (stderr, "can't load gnuplot\n");
      HWND hwnd_parent;

      /* wait for the gnuplot window */

      hwnd_parent = FindWindow ((LPSTR) NULL, (LPCTSTR) "gnuplot");

      if (! hwnd_parent)
        fprintf (stderr, "can't find the gnuplot window");
          /* find the child text window */

          HWND hwnd_text = FindWindowEx (hwnd_parent, (HWND) NULL,
                                         (LPCTSTR) NULL);

          if (! hwnd_text)
            fprintf (stderr, "can't find wgnuplot_text");
              /* wait for commands on stdin, and send them to the
                 gnuplot text window */

              int c;

              while ((c = getchar ()) != EOF)
                PostMessage (hwnd_text, WM_CHAR, c, 1L);

              /* XXX FIXME XXX -- can't we send a string? */
              PostMessage (hwnd_text, WM_CHAR, 'q', 1L);
              PostMessage (hwnd_text, WM_CHAR, 'u', 1L);
              PostMessage (hwnd_text, WM_CHAR, 'i', 1L);
              PostMessage (hwnd_text, WM_CHAR, 't', 1L);
              PostMessage (hwnd_text, WM_CHAR, '\n', 1L);
              return 0;

  return 1;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]