Term-Gnuplot

 view release on metacpan or  search on metacpan

patches/diff_ipc-pm-with-hack  view on Meta::CPAN

+PM_waitforinput()			/* Identical to X11 one */
+{
+    PM_serveinput(1);
+# if 0
+/* HBB 20010620: switching back and forth between X11 and a non-GUI
+ * terminal, while stdin is redirected, causes gnuplot to terminate
+ * right after it re-enters the X11 terminal --- read() returns a '\0'
+ * character once, and then EOF. Switching to <stdio.h>'s getc() fixed
+ * that, for me. */
+    if (read(0, &c, 1) != 1)
+	return EOF;
+    else
+	return c;
+# else
+    return getc(stdin);
+# endif	/* 0/1 */
+}
+#else
+#  define PM_serveinput(fl) 	/* Do nothing */
+#endif /* PIPE_IPC */
+
+
 static void
 PM_make_servername(char *str)
 {
@@ -385,6 +468,8 @@ PM_query()
 {
     int rc;
     ULONG cbR;
+
+    PM_serveinput(0);
     putc(GR_QUERY, PM_pipe);
     fflush(PM_pipe);
     rc = DosRead(fileno(PM_pipe), &term->h_char, sizeof(int), &cbR);
@@ -629,6 +714,7 @@ PM_pause(char *str)
 
     if (PM_pipe == NULL)
 	return 2;
+    PM_serveinput(0);
     bp = buf;
     putc(GR_PAUSE, PM_pipe);
     len = strlen(str) + 1;
@@ -676,6 +762,8 @@ TERM_PUBLIC int PM_make_palette (t_sm_pa
     int i;
     int rc;
     ULONG cbR, r, g, b, rgbTable[256];
+
+    PM_serveinput(0);
     putc(GR_MAKE_PALETTE, PM_pipe);
     if (palette == NULL) {
 	/* return maximal number of colours in palette */
@@ -808,7 +896,11 @@ TERM_TABLE_START(PM_driver)
     0 /*pointsize */ , TERM_CAN_MULTIPLOT, PM_suspend, PM_resume,
     PM_fillbox, PM_linewidth
 #ifdef USE_MOUSE
+#ifdef PIPE_IPC
+    , PM_waitforinput,
+#else
     , 0 /* PM_waitforinput */, 
+#endif
     PM_put_tmptext, PM_set_ruler, PM_set_cursor, PM_set_clipboard
 #endif
 #ifdef PM3D



( run in 1.247 second using v1.01-cache-2.11-cpan-2398b32b56e )