home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnuplapi.zip / gnuplot-api-os2 / build / diff_gnuplot-3.7.0.9.my-pm3d-1 < prev    next >
Encoding:
Text File  |  2001-03-02  |  25.4 KB  |  647 lines

  1. diff -pru gnuplot-3.7.0.9-pm3d-patch/config/makefile.os2 gnuplot-3.7.0.9.my/config/makefile.os2
  2. --- gnuplot-3.7.0.9-pm3d-patch/config/makefile.os2    Fri Mar  2 18:52:52 2001
  3. +++ gnuplot-3.7.0.9.my/config/makefile.os2    Fri Oct  8 01:03:42 1999
  4. @@ -115,7 +115,7 @@ O2 = obj
  5.  O3 = o
  6.  
  7.  # Flags for compiler and linker under OS/2
  8. -OS2FLAGS = -DOS2 -DHELPFILE=\"$(HELPFILE)\"
  9. +OS2FLAGS = -DOS2 -DHELPFILE=\"$(HELPFILE)\" -DPM3D=1
  10.  
  11.  # Flags for compiling with EMX/GCC
  12.  # Special note: -ffloat-store is necessary to avoid some
  13. @@ -206,6 +206,7 @@ endif
  14.  #
  15.  # Include dependencies valid for all platforms from makefile.all
  16.  #
  17. +###include makefile.all
  18.  include makefile.all
  19.  
  20.  #
  21. diff -pru gnuplot-3.7.0.9-pm3d-patch/config/makefile.os2.orig gnuplot-3.7.0.9.my/config/makefile.os2.orig
  22. --- gnuplot-3.7.0.9-pm3d-patch/config/makefile.os2.orig    Sun Jun  6 13:31:12 1999
  23. +++ gnuplot-3.7.0.9.my/config/makefile.os2.orig    Thu Oct  7 02:47:26 1999
  24. @@ -196,6 +196,7 @@ endif
  25.  #
  26.  # Include dependencies valid for all platforms from makefile.all
  27.  #
  28. +###include makefile.all
  29.  include makefile.all
  30.  
  31.  #
  32. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/command.c gnuplot-3.7.0.9.my/src/command.c
  33. --- gnuplot-3.7.0.9-pm3d-patch/src/command.c    Mon Jul  5 08:12:50 1999
  34. +++ gnuplot-3.7.0.9.my/src/command.c    Thu Oct  7 02:48:38 1999
  35. @@ -76,7 +76,7 @@ extern int PM_pause(char *);            
  36.  extern int ExecuteMacro(char *, int);   /* plot.c */
  37.  extern TBOOLEAN CallFromRexx;           /* plot.c */
  38.  # ifdef USE_MOUSE
  39. -PVOID input_from_PM_Terminal = NULL;
  40. +void* input_from_PM_Terminal = NULL;
  41.  char mouseShareMemName[40] = "";
  42.  #  define INCL_DOSMEMMGR
  43.  #  include <os2.h>
  44. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/gnuplot.opt gnuplot-3.7.0.9.my/src/gnuplot.opt
  45. --- gnuplot-3.7.0.9-pm3d-patch/src/gnuplot.opt    Fri Mar  2 18:52:52 2001
  46. +++ gnuplot-3.7.0.9.my/src/gnuplot.opt    Fri Oct  8 00:36:40 1999
  47. @@ -30,3 +30,5 @@ util.obj
  48.  util3d.obj
  49.  variable.obj
  50.  version.obj
  51. +color.obj
  52. +pm3d.obj
  53. \ No newline at end of file
  54. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/help.c gnuplot-3.7.0.9.my/src/help.c
  55. --- gnuplot-3.7.0.9-pm3d-patch/src/help.c    Tue Jun 22 07:00:48 1999
  56. +++ gnuplot-3.7.0.9.my/src/help.c    Fri Oct  8 01:12:02 1999
  57. @@ -549,6 +549,10 @@ TBOOLEAN *subtopics;        /* (out) are there
  58.          }
  59.          starts[stopics++] = start;
  60.          prev = start;
  61. +        if (stopics >= MAXSTARTS) {
  62. +          printf("Panic: Too many subtopics!\n");
  63. +          return;
  64. +        }
  65.          }
  66.      } else {
  67.          /* new topic */
  68. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/makefile.all gnuplot-3.7.0.9.my/src/makefile.all
  69. --- gnuplot-3.7.0.9-pm3d-patch/src/makefile.all    Fri Mar  2 18:53:02 2001
  70. +++ gnuplot-3.7.0.9.my/src/makefile.all    Fri Oct  8 00:54:02 1999
  71. @@ -8,6 +8,8 @@ plot.$(O) plot2d.$(O) plot3d.$(O) pm3d.$
  72.  show.$(O) specfun.$(O) standard.$(O) stdfn.$(O) term.$(O) time.$(O) \
  73.  util.$(O) util3d.$(O) variable.$(O)
  74.  
  75. +# pm3d.$(O) color.$(O)
  76. +
  77.  # List of terminal driver sources
  78.  CORETERM = $(T)aed.trm $(T)ai.trm $(T)amiga.trm $(T)apollo.trm \
  79.  $(T)atariaes.trm $(T)atarivdi.trm $(T)be.trm $(T)cgi.trm $(T)cgm.trm \
  80. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/Makefile.in gnuplot-3.7.0.9.my/src/Makefile.in
  81. --- gnuplot-3.7.0.9-pm3d-patch/src/Makefile.in    Fri Mar  2 18:53:02 2001
  82. +++ gnuplot-3.7.0.9.my/src/Makefile.in    Fri Oct  8 00:42:12 1999
  83. @@ -104,7 +104,7 @@ fit.h graph3d.c graphics.c graphics.h he
  84.  interpol.c matrix.c matrix.h misc.c national.h parse.c plot.c plot.h \
  85.  plot2d.c plot3d.c protos.h readline.c scanner.c set.c setshow.h show.c \
  86.  specfun.c standard.c stdfn.c stdfn.h syscfg.h term.c term.h time.c util.c \
  87. -util.h util3d.c util3d.h variable.c variable.h version.c
  88. +util.h util3d.c util3d.h variable.c variable.h version.c pm3d.c color.c
  89.  
  90.  
  91.  EXTRA_gnuplot_SOURCES = @NEXTOBJS@
  92. @@ -137,7 +137,7 @@ datafile.$(O) eval.$(O) fit.$(O) graph3d
  93.  hidden3d.$(O) internal.$(O) interpol.$(O) matrix.$(O) misc.$(O) parse.$(O) \
  94.  plot.$(O) plot2d.$(O) plot3d.$(O) readline.$(O) scanner.$(O) set.$(O) \
  95.  show.$(O) specfun.$(O) standard.$(O) stdfn.$(O) term.$(O) time.$(O) \
  96. -util.$(O) util3d.$(O) variable.$(O)
  97. +util.$(O) util3d.$(O) variable.$(O) pm3d.$(O) color.$(O)
  98.  
  99.  
  100.  # List of terminal driver sources
  101. @@ -183,7 +183,7 @@ contour$U.o datafile$U.o eval$U.o fit$U.
  102.  help$U.o hidden3d$U.o internal$U.o interpol$U.o matrix$U.o misc$U.o \
  103.  parse$U.o plot$U.o plot2d$U.o plot3d$U.o readline$U.o scanner$U.o \
  104.  set$U.o show$U.o specfun$U.o standard$U.o stdfn$U.o term$U.o time$U.o \
  105. -util$U.o util3d$U.o variable$U.o version$U.o
  106. +util$U.o util3d$U.o variable$U.o version$U.o pm3d.o color.o
  107.  gnuplot_OBJECTS =  $(am_gnuplot_OBJECTS)
  108.  gnuplot_DEPENDENCIES = 
  109.  gnuplot_LDFLAGS = 
  110. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/os2/gclient.c gnuplot-3.7.0.9.my/src/os2/gclient.c
  111. --- gnuplot-3.7.0.9-pm3d-patch/src/os2/gclient.c    Fri Mar  2 18:53:02 2001
  112. +++ gnuplot-3.7.0.9.my/src/os2/gclient.c    Sat Oct  9 18:44:00 1999
  113. @@ -131,8 +131,11 @@ static long lCols[16] =     { CLR_BLACK,
  114.                                CLR_BROWN,
  115.                                CLR_PALEGRAY,
  116.                                CLR_WHITE } ;
  117. +static long lCols_init = 0;
  118. +static long lCols_num = 16;
  119. +static long bkColor = -1;
  120.  
  121. -static LONG alColourTable[ 16 ] ;
  122. +static LONG alColourTable[ 18 ] ;
  123.  
  124.  #define   GNUBUF    1024        /* buffer for gnuplot commands */
  125.  #define   PIPEBUF   4096        /* size of pipe buffers */
  126. @@ -373,10 +376,20 @@ MRESULT EXPENTRY DisplayClientWndProc(HW
  127.          //PM: show the Mouse menu if connected to mouseable PM terminal
  128.         if (1 || mouseTerminal) //PM workaround for a bug---SEE "BUGS 2" IN README!!!
  129.  //       if (mouseTerminal)
  130. +       {
  131.           WinEnableMenuItem(
  132.             WinWindowFromID( WinQueryWindow( hApp, QW_PARENT ), FID_MENU ),
  133.             IDM_MOUSE, TRUE ) ;
  134.                  // get details of command-line window
  135. +        if (!input_from_PM_Terminal) {
  136. +          WinEnableMenuItem( // Useless: no feedback channel
  137. +            WinWindowFromID( WinQueryWindow( hApp, QW_PARENT ), FID_MENU ),
  138. +            IDM_MOUSE_GRID, FALSE ) ;
  139. +          WinEnableMenuItem( // Useless: no feedback channel
  140. +            WinWindowFromID( WinQueryWindow( hApp, QW_PARENT ), FID_MENU ),
  141. +            IDM_MOUSE_LINLOGY, FALSE ) ;
  142. +        }
  143. +        }
  144.              hSwitch = WinQuerySwitchHandle( 0, ppidGnu ) ;
  145.              WinQuerySwitchEntry( hSwitch, &swGnu ) ;
  146.              if( firstcall ) {
  147. @@ -566,7 +579,31 @@ case WM_MOUSEMOVE:
  148.  
  149.    MousePosToGraphPos( &x, &y, hWnd, mx, my, mouse_mode ); // transform mouse->real graph coords
  150.  
  151. -  sprintf(s,"[%g,%g]",x,y);
  152. +  s[0] = 0;
  153. +  if (ruler.on) { // append this info coming from the ruler position
  154. +    if (mouse_mode!=MOUSE_COORDINATES_REAL) 
  155. +    sprintf(s,"ruler[%g,%g], point: ",ruler.x,ruler.y); // distance makes no sense
  156. +      else {
  157. +    double dx, dy;
  158. +    if (gp4mouse.is_log_x) // ratio for log, distance for linear
  159. +        dx = (ruler.x==0) ? 99999 : x / ruler.x;
  160. +      else dx = x - ruler.x;
  161. +    if (gp4mouse.is_log_y) dy = (ruler.y==0) ? 99999 : y / ruler.y;
  162. +      else dy = y - ruler.y;
  163. +    sprintf(s,"ruler[%g,%g], distance(%g;%g)",ruler.x,ruler.y,dx,dy);
  164. +    // polar coords of distance (axes cannot be logarithmic)
  165. +    if (bMousePolarDistance && !gp4mouse.is_log_x && !gp4mouse.is_log_y) {
  166. +      double rho = sqrt((x-ruler.x)*(x-ruler.x)+(y-ruler.y)*(y-ruler.y));
  167. +      double phi = (180/M_PI)*atan2(y-ruler.y,x-ruler.x);
  168. +
  169. +      sprintf(s + strlen(s)," (%g;%.4g°), ",rho,phi);
  170. +      }
  171. +    else
  172. +      sprintf(s + strlen(s), ", ");
  173. +    }
  174. +    }
  175. +
  176. +  sprintf(s + strlen(s),"[%g,%g]",x,y);
  177.  
  178.    /* For negative table position, shift it to the top of the window.
  179.    This could be done like that: */
  180. @@ -594,30 +631,6 @@ case WM_MOUSEMOVE:
  181.    pt.x = xMouseTableOrig+2;
  182.    pt.y = yMouseTableOrig+2;
  183.  
  184. -  if (ruler.on) { // append this info coming from the ruler position
  185. -    char p[255];
  186. -    if (mouse_mode!=MOUSE_COORDINATES_REAL) 
  187. -    sprintf(p,"  ruler: [%g,%g]",ruler.x,ruler.y); // distance makes no sense
  188. -      else {
  189. -    double dx, dy;
  190. -    if (gp4mouse.is_log_x) // ratio for log, distance for linear
  191. -        dx = (ruler.x==0) ? 99999 : x / ruler.x;
  192. -      else dx = x - ruler.x;
  193. -    if (gp4mouse.is_log_y) dy = (ruler.y==0) ? 99999 : y / ruler.y;
  194. -      else dy = y - ruler.y;
  195. -    if (mouse_mode==MOUSE_COORDINATES_REAL)
  196. -    sprintf(p,"  ruler: [%g,%g]  distance: %g;%g",ruler.x,ruler.y,dx,dy);
  197. -    // polar coords of distance (axes cannot be logarithmic)
  198. -    if (bMousePolarDistance && !gp4mouse.is_log_x && !gp4mouse.is_log_y) {
  199. -      double rho = sqrt((x-ruler.x)*(x-ruler.x)+(y-ruler.y)*(y-ruler.y));
  200. -      double phi = (180/M_PI)*atan2(y-ruler.y,x-ruler.x);
  201. -      strcat(s,p);
  202. -      sprintf(p," (%g;%.4g°)",rho,phi);
  203. -      }
  204. -    }
  205. -    strcat(s,p);
  206. -    }
  207. -
  208.    GpiCharStringAt(hps,&pt,(long)strlen(s),s);
  209.    WinReleasePS(hps);
  210.  
  211. @@ -652,7 +665,9 @@ case WM_BUTTON1DBLCLK:
  212.  
  213.  
  214.  case WM_BUTTON2CLICK: // WM_BUTTON2UP:
  215. +case WM_BUTTON1DOWN:
  216.    if (IGNORE_MOUSE) return 0L;
  217. +  if (!input_from_PM_Terminal) return 0L;
  218.    // make zoom
  219.    {
  220.  
  221. @@ -671,14 +686,14 @@ case WM_BUTTON2CLICK: // WM_BUTTON2UP:
  222.    WinQueryWindowRect(hWnd,&ti.rclBoundary);
  223.  
  224.    // set minimum/maximum size for window = size of the present window
  225. -  ti.ptlMinTrackSize.x = ti.rclBoundary.xLeft;
  226. -  ti.ptlMinTrackSize.y = ti.rclBoundary.yBottom;
  227. -  ti.ptlMaxTrackSize.x = ti.rclBoundary.xRight;
  228. -  ti.ptlMaxTrackSize.y = ti.rclBoundary.yTop;
  229. +  ti.ptlMinTrackSize.x = ti.rclBoundary.xLeft - MOUSEMSG(&message)->x;
  230. +  ti.ptlMinTrackSize.y = ti.rclBoundary.yBottom - MOUSEMSG(&message)->y;
  231. +  ti.ptlMaxTrackSize.x = ti.rclBoundary.xRight - MOUSEMSG(&message)->x;
  232. +  ti.ptlMaxTrackSize.y = ti.rclBoundary.yTop - MOUSEMSG(&message)->x;
  233.  
  234.    // set initial initial tracking (zoomed) window
  235. -  ti.rclTrack.xRight = 50 + (ti.rclTrack.xLeft=MOUSEMSG(&message)->x);
  236. -  ti.rclTrack.yTop = 50 + (ti.rclTrack.yBottom=MOUSEMSG(&message)->y);
  237. +  ti.rclTrack.xRight = 1 + (ti.rclTrack.xLeft=MOUSEMSG(&message)->x);
  238. +  ti.rclTrack.yTop = 1 + (ti.rclTrack.yBottom=MOUSEMSG(&message)->y);
  239.  
  240.    // track the zooming rectangle, return when mouse is lifted
  241.    ti.fs = TF_TOP | TF_RIGHT | TF_SETPOINTERPOS;
  242. @@ -720,7 +735,7 @@ case WM_BUTTON3UP: // WM_BUTTON3DBLCLK:
  243.    SHORT mx=MOUSEMSG(&message)->x; // mouse position
  244.    SHORT my=MOUSEMSG(&message)->y;
  245.    char s[256];
  246. -  POINTL pt;
  247. +  POINTL pt, pt1;
  248.    double x,y;
  249.    HPS hps = WinGetPS(hWnd);
  250.  
  251. @@ -731,6 +746,13 @@ case WM_BUTTON3UP: // WM_BUTTON3DBLCLK:
  252.    GpiSetCharMode(hps,CM_MODE1);
  253.    pt.x = mx; pt.y = my;
  254.    GpiCharStringAt(hps,&pt,(long)strlen(s),s);
  255. +  // Mark point to which the annotation relates
  256. +  GpiMove(hps,&pt);
  257. +  pt1.x = mx-5; pt1.y = my-3;
  258. +  GpiLine(hps,&pt1);
  259. +  GpiMove(hps,&pt);
  260. +  pt1.x = mx-3; pt1.y = my-5;
  261. +  GpiLine(hps,&pt1);
  262.    WinReleasePS(hps);
  263.    }
  264.    return 0L; // end of case WM_BUTTON3...
  265. @@ -982,7 +1004,8 @@ MRESULT WmClientCmdProc(HWND hWnd, ULONG
  266.          sprintf(s,"set xr[%g:%g];set yr[%g:%g];rep",unzoom_xmin,unzoom_xmax,unzoom_ymin,unzoom_ymax);
  267.            // make the command as short as possible so that it prints on one line
  268.          TextToClipboard ( s );
  269. -        sprintf(input_from_PM_Terminal,"%s",s); //fraba: send the command to gnuplot
  270. +        if (input_from_PM_Terminal)
  271. +        sprintf(input_from_PM_Terminal,"%s",s); //fraba: send the command to gnuplot
  272.          }
  273.          return 0L;
  274.  
  275. @@ -1013,13 +1036,16 @@ MRESULT WmClientCmdProc(HWND hWnd, ULONG
  276.      case IDM_MOUSE_GRID:
  277.              if (bhave_grid) { //fraba
  278.          bhave_grid = FALSE;
  279. -        sprintf(input_from_PM_Terminal,"set nogrid; replot");
  280. +        if (input_from_PM_Terminal)
  281. +            sprintf(input_from_PM_Terminal,"set nogrid; replot");
  282.              } else {
  283.          bhave_grid = TRUE;
  284.          #if 0 /* 0 ... main grid, 1 ... fine grid */
  285. -        sprintf(input_from_PM_Terminal,"set grid; replot");
  286. +        if (input_from_PM_Terminal)
  287. +            sprintf(input_from_PM_Terminal,"set grid; replot");
  288.          #else
  289. -        sprintf(input_from_PM_Terminal,"set mxtics 2; set mytics 2; set grid x y mx my; replot");
  290. +        if (input_from_PM_Terminal)
  291. +            sprintf(input_from_PM_Terminal,"set mxtics 2; set mytics 2; set grid x y mx my; replot");
  292.          #endif
  293.              }
  294.          return 0L;
  295. @@ -1028,8 +1054,9 @@ MRESULT WmClientCmdProc(HWND hWnd, ULONG
  296.          // NOTE: if log, then take care of positive y min!
  297.          if (bhave_log) { //fraba
  298.             bhave_log = FALSE;
  299. -           sprintf(input_from_PM_Terminal, "set nolog y; replot" );
  300. -        } else {
  301. +           if (input_from_PM_Terminal)
  302. +             sprintf(input_from_PM_Terminal, "set nolog y; replot" );
  303. +        } else if (input_from_PM_Terminal) {
  304.             if (gp4mouse.ymin <= 0 || gp4mouse.ymax <= 0) {
  305.           sprintf(input_from_PM_Terminal, "# Hey! y range must be greater than 0 for log scale.");
  306.           DosBeep(300,10);
  307. @@ -1422,6 +1449,23 @@ HPS InitScreenPS()
  308.                              LCOL_RESET,
  309.                              LCOLF_CONSECRGB,
  310.                              0, nColour, alColourTable ) ;
  311. +    if (!lCols_init) {
  312. +    int i = -1;
  313. +
  314. +    lCols_init = 1;
  315. +    GpiQueryLogColorTable( hpsScreen, 0, 0, 16, alColourTable + 2 ) ;
  316. +    alColourTable[2+CLR_WHITE] = 0xffffff;        // -2 
  317. +    alColourTable[2+CLR_BLACK] = 0;            // -1
  318. +    bkColor = alColourTable[2+CLR_BACKGROUND];
  319. +    while (i++ < 16) {
  320. +        if (alColourTable[2+lCols[i]] == bkColor) {
  321. +        while (i++ < 16)
  322. +            lCols[i - 1] = lCols[i];
  323. +        lCols_num--;
  324. +        break;
  325. +        }
  326. +    }
  327. +    }
  328.      return hpsScreen ;
  329.      }
  330.  
  331. @@ -1710,8 +1754,10 @@ server:
  332.      sprintf( mouseShareMemName, "\\SHAREMEM\\GP%i_Mouse_Input", (int)ppidGnu ); //PM 11.5.1999
  333.      if (DosGetNamedSharedMem(&input_from_PM_Terminal, //fraba
  334.          mouseShareMemName,
  335. -        PAG_WRITE))
  336. -       DosBeep(1440L,1000L); /* indicates error */
  337. +        PAG_WRITE)) {
  338. +       /* DosBeep(1440L,1000L); */ /* error indicated by graying menus */
  339. +       input_from_PM_Terminal = 0;
  340. +    }
  341.  
  342.  //        DosPostEventSem( semStartSeq ) ;         /* once we've got pidGnu */
  343.          WinPostMsg( hApp, WM_GPSTART, 0, 0 ) ;
  344. @@ -1906,7 +1952,7 @@ server:
  345.                      DosExitCritSec() ;
  346.                      BufRead(hRead, str, len*sizeof(int), &cbR) ;
  347.                      lCurCol = GpiQueryColor( hps ) ;
  348. -                    GpiSetColor( hps, CLR_BLACK ) ;
  349. +                    GpiSetColor( hps, CLR_NEUTRAL ) ;
  350.                      sw = QueryTextBox( hps, strlen(str), str ) ; 
  351.                      switch(jmode) {
  352.                      case LEFT:   sw = 0;     break;
  353. @@ -1978,7 +2024,7 @@ server:
  354.                      else GpiSetLineWidthGeom( hps, linewidth ) ;
  355.                      if( lt < 0 ) lt = 0 ;
  356.                  lt = (lt%8);
  357. -                col = (col+2)%16 ;
  358. +                col = (col+2) % lCols_num;
  359.                      GpiLabel( hps, lLineTypes[lt] ) ;
  360.  lOldLine=lt ;
  361.                      LType( (bLineTypes||bBW)?lt:0 ) ;
  362. @@ -1986,7 +2032,7 @@ lOldLine=lt ;
  363.                      if( !bBW ) { /* maintain some flexibility here in case we don't want
  364.                             the model T option */ 
  365.                          if( bColours ) GpiSetColor( hps, lCols[col] ) ;
  366. -                        else GpiSetColor( hps, CLR_BLACK ) ;
  367. +                        else GpiSetColor( hps, CLR_NEUTRAL ) ;
  368.                          }
  369.                      }
  370.                      break ;
  371. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/os2/gclient.c.orig gnuplot-3.7.0.9.my/src/os2/gclient.c.orig
  372. --- gnuplot-3.7.0.9-pm3d-patch/src/os2/gclient.c.orig    Tue Jun 22 06:55:52 1999
  373. +++ gnuplot-3.7.0.9.my/src/os2/gclient.c.orig    Thu Oct  7 23:54:04 1999
  374. @@ -131,8 +131,11 @@ static long lCols[16] =     { CLR_BLACK,
  375.                                CLR_BROWN,
  376.                                CLR_PALEGRAY,
  377.                                CLR_WHITE } ;
  378. +static long lCols_init = 0;
  379. +static long lCols_num = 16;
  380. +static long bkColor = -1;
  381.  
  382. -static LONG alColourTable[ 16 ] ;
  383. +static LONG alColourTable[ 18 ] ;
  384.  
  385.  #define   GNUBUF    1024        /* buffer for gnuplot commands */
  386.  #define   PIPEBUF   4096        /* size of pipe buffers */
  387. @@ -373,10 +376,20 @@ MRESULT EXPENTRY DisplayClientWndProc(HW
  388.          //PM: show the Mouse menu if connected to mouseable PM terminal
  389.         if (1 || mouseTerminal) //PM workaround for a bug---SEE "BUGS 2" IN README!!!
  390.  //       if (mouseTerminal)
  391. +       {
  392.           WinEnableMenuItem(
  393.             WinWindowFromID( WinQueryWindow( hApp, QW_PARENT ), FID_MENU ),
  394.             IDM_MOUSE, TRUE ) ;
  395.                  // get details of command-line window
  396. +        if (!input_from_PM_Terminal) {
  397. +          WinEnableMenuItem( // Useless: no feedback channel
  398. +            WinWindowFromID( WinQueryWindow( hApp, QW_PARENT ), FID_MENU ),
  399. +            IDM_MOUSE_GRID, FALSE ) ;
  400. +          WinEnableMenuItem( // Useless: no feedback channel
  401. +            WinWindowFromID( WinQueryWindow( hApp, QW_PARENT ), FID_MENU ),
  402. +            IDM_MOUSE_LINLOGY, FALSE ) ;
  403. +        }
  404. +        }
  405.              hSwitch = WinQuerySwitchHandle( 0, ppidGnu ) ;
  406.              WinQuerySwitchEntry( hSwitch, &swGnu ) ;
  407.              if( firstcall ) {
  408. @@ -566,7 +579,31 @@ case WM_MOUSEMOVE:
  409.  
  410.    MousePosToGraphPos( &x, &y, hWnd, mx, my, mouse_mode ); // transform mouse->real graph coords
  411.  
  412. -  sprintf(s,"[%g,%g]",x,y);
  413. +  s[0] = 0;
  414. +  if (ruler.on) { // append this info coming from the ruler position
  415. +    if (mouse_mode!=MOUSE_COORDINATES_REAL) 
  416. +    sprintf(s,"ruler[%g,%g], point: ",ruler.x,ruler.y); // distance makes no sense
  417. +      else {
  418. +    double dx, dy;
  419. +    if (gp4mouse.is_log_x) // ratio for log, distance for linear
  420. +        dx = (ruler.x==0) ? 99999 : x / ruler.x;
  421. +      else dx = x - ruler.x;
  422. +    if (gp4mouse.is_log_y) dy = (ruler.y==0) ? 99999 : y / ruler.y;
  423. +      else dy = y - ruler.y;
  424. +    sprintf(s,"ruler[%g,%g], distance(%g;%g)",ruler.x,ruler.y,dx,dy);
  425. +    // polar coords of distance (axes cannot be logarithmic)
  426. +    if (bMousePolarDistance && !gp4mouse.is_log_x && !gp4mouse.is_log_y) {
  427. +      double rho = sqrt((x-ruler.x)*(x-ruler.x)+(y-ruler.y)*(y-ruler.y));
  428. +      double phi = (180/M_PI)*atan2(y-ruler.y,x-ruler.x);
  429. +
  430. +      sprintf(s + strlen(s)," (%g;%.4g°), ",rho,phi);
  431. +      }
  432. +    else
  433. +      sprintf(s + strlen(s), ", ");
  434. +    }
  435. +    }
  436. +
  437. +  sprintf(s + strlen(s),"[%g,%g]",x,y);
  438.  
  439.    /* For negative table position, shift it to the top of the window.
  440.    This could be done like that: */
  441. @@ -594,30 +631,6 @@ case WM_MOUSEMOVE:
  442.    pt.x = xMouseTableOrig+2;
  443.    pt.y = yMouseTableOrig+2;
  444.  
  445. -  if (ruler.on) { // append this info coming from the ruler position
  446. -    char p[255];
  447. -    if (mouse_mode!=MOUSE_COORDINATES_REAL) 
  448. -    sprintf(p,"  ruler: [%g,%g]",ruler.x,ruler.y); // distance makes no sense
  449. -      else {
  450. -    double dx, dy;
  451. -    if (gp4mouse.is_log_x) // ratio for log, distance for linear
  452. -        dx = (ruler.x==0) ? 99999 : x / ruler.x;
  453. -      else dx = x - ruler.x;
  454. -    if (gp4mouse.is_log_y) dy = (ruler.y==0) ? 99999 : y / ruler.y;
  455. -      else dy = y - ruler.y;
  456. -    if (mouse_mode==MOUSE_COORDINATES_REAL)
  457. -    sprintf(p,"  ruler: [%g,%g]  distance: %g;%g",ruler.x,ruler.y,dx,dy);
  458. -    // polar coords of distance (axes cannot be logarithmic)
  459. -    if (bMousePolarDistance && !gp4mouse.is_log_x && !gp4mouse.is_log_y) {
  460. -      double rho = sqrt((x-ruler.x)*(x-ruler.x)+(y-ruler.y)*(y-ruler.y));
  461. -      double phi = (180/M_PI)*atan2(y-ruler.y,x-ruler.x);
  462. -      strcat(s,p);
  463. -      sprintf(p," (%g;%.4g°)",rho,phi);
  464. -      }
  465. -    }
  466. -    strcat(s,p);
  467. -    }
  468. -
  469.    GpiCharStringAt(hps,&pt,(long)strlen(s),s);
  470.    WinReleasePS(hps);
  471.  
  472. @@ -653,6 +666,7 @@ case WM_BUTTON1DBLCLK:
  473.  
  474.  case WM_BUTTON2CLICK: // WM_BUTTON2UP:
  475.    if (IGNORE_MOUSE) return 0L;
  476. +  if (!input_from_PM_Terminal) return 0L;
  477.    // make zoom
  478.    {
  479.  
  480. @@ -720,7 +734,7 @@ case WM_BUTTON3UP: // WM_BUTTON3DBLCLK:
  481.    SHORT mx=MOUSEMSG(&message)->x; // mouse position
  482.    SHORT my=MOUSEMSG(&message)->y;
  483.    char s[256];
  484. -  POINTL pt;
  485. +  POINTL pt, pt1;
  486.    double x,y;
  487.    HPS hps = WinGetPS(hWnd);
  488.  
  489. @@ -731,6 +745,13 @@ case WM_BUTTON3UP: // WM_BUTTON3DBLCLK:
  490.    GpiSetCharMode(hps,CM_MODE1);
  491.    pt.x = mx; pt.y = my;
  492.    GpiCharStringAt(hps,&pt,(long)strlen(s),s);
  493. +  // Mark point to which the annotation relates
  494. +  GpiMove(hps,&pt);
  495. +  pt1.x = mx-5; pt1.y = my-3;
  496. +  GpiLine(hps,&pt1);
  497. +  GpiMove(hps,&pt);
  498. +  pt1.x = mx-3; pt1.y = my-5;
  499. +  GpiLine(hps,&pt1);
  500.    WinReleasePS(hps);
  501.    }
  502.    return 0L; // end of case WM_BUTTON3...
  503. @@ -982,7 +1003,8 @@ MRESULT WmClientCmdProc(HWND hWnd, ULONG
  504.          sprintf(s,"set xr[%g:%g];set yr[%g:%g];rep",unzoom_xmin,unzoom_xmax,unzoom_ymin,unzoom_ymax);
  505.            // make the command as short as possible so that it prints on one line
  506.          TextToClipboard ( s );
  507. -        sprintf(input_from_PM_Terminal,"%s",s); //fraba: send the command to gnuplot
  508. +        if (input_from_PM_Terminal)
  509. +        sprintf(input_from_PM_Terminal,"%s",s); //fraba: send the command to gnuplot
  510.          }
  511.          return 0L;
  512.  
  513. @@ -1013,13 +1035,16 @@ MRESULT WmClientCmdProc(HWND hWnd, ULONG
  514.      case IDM_MOUSE_GRID:
  515.              if (bhave_grid) { //fraba
  516.          bhave_grid = FALSE;
  517. -        sprintf(input_from_PM_Terminal,"set nogrid; replot");
  518. +        if (input_from_PM_Terminal)
  519. +            sprintf(input_from_PM_Terminal,"set nogrid; replot");
  520.              } else {
  521.          bhave_grid = TRUE;
  522.          #if 0 /* 0 ... main grid, 1 ... fine grid */
  523. -        sprintf(input_from_PM_Terminal,"set grid; replot");
  524. +        if (input_from_PM_Terminal)
  525. +            sprintf(input_from_PM_Terminal,"set grid; replot");
  526.          #else
  527. -        sprintf(input_from_PM_Terminal,"set mxtics 2; set mytics 2; set grid x y mx my; replot");
  528. +        if (input_from_PM_Terminal)
  529. +            sprintf(input_from_PM_Terminal,"set mxtics 2; set mytics 2; set grid x y mx my; replot");
  530.          #endif
  531.              }
  532.          return 0L;
  533. @@ -1028,8 +1053,9 @@ MRESULT WmClientCmdProc(HWND hWnd, ULONG
  534.          // NOTE: if log, then take care of positive y min!
  535.          if (bhave_log) { //fraba
  536.             bhave_log = FALSE;
  537. -           sprintf(input_from_PM_Terminal, "set nolog y; replot" );
  538. -        } else {
  539. +           if (input_from_PM_Terminal)
  540. +             sprintf(input_from_PM_Terminal, "set nolog y; replot" );
  541. +        } else if (input_from_PM_Terminal) {
  542.             if (gp4mouse.ymin <= 0 || gp4mouse.ymax <= 0) {
  543.           sprintf(input_from_PM_Terminal, "# Hey! y range must be greater than 0 for log scale.");
  544.           DosBeep(300,10);
  545. @@ -1422,6 +1448,23 @@ HPS InitScreenPS()
  546.                              LCOL_RESET,
  547.                              LCOLF_CONSECRGB,
  548.                              0, nColour, alColourTable ) ;
  549. +    if (!lCols_init) {
  550. +    int i = -1;
  551. +
  552. +    lCols_init = 1;
  553. +    GpiQueryLogColorTable( hpsScreen, 0, 0, 16, alColourTable + 2 ) ;
  554. +    alColourTable[2+CLR_WHITE] = 0xffffff;        // -2 
  555. +    alColourTable[2+CLR_BLACK] = 0;            // -1
  556. +    bkColor = alColourTable[2+CLR_BACKGROUND];
  557. +    while (i++ < 16) {
  558. +        if (alColourTable[2+lCols[i]] == bkColor) {
  559. +        while (i++ < 16)
  560. +            lCols[i - 1] = lCols[i];
  561. +        lCols_num--;
  562. +        break;
  563. +        }
  564. +    }
  565. +    }
  566.      return hpsScreen ;
  567.      }
  568.  
  569. @@ -1706,8 +1749,10 @@ server:
  570.      sprintf( mouseShareMemName, "\\SHAREMEM\\GP%i_Mouse_Input", (int)ppidGnu ); //PM 11.5.1999
  571.      if (DosGetNamedSharedMem(&input_from_PM_Terminal, //fraba
  572.          mouseShareMemName,
  573. -        PAG_WRITE))
  574. -       DosBeep(1440L,1000L); /* indicates error */
  575. +        PAG_WRITE)) {
  576. +       /* DosBeep(1440L,1000L); */ /* error indicated by graying menus */
  577. +       input_from_PM_Terminal = 0;
  578. +    }
  579.  
  580.  //        DosPostEventSem( semStartSeq ) ;         /* once we've got pidGnu */
  581.          WinPostMsg( hApp, WM_GPSTART, 0, 0 ) ;
  582. @@ -1902,7 +1947,7 @@ server:
  583.                      DosExitCritSec() ;
  584.                      BufRead(hRead, str, len*sizeof(int), &cbR) ;
  585.                      lCurCol = GpiQueryColor( hps ) ;
  586. -                    GpiSetColor( hps, CLR_BLACK ) ;
  587. +                    GpiSetColor( hps, CLR_NEUTRAL ) ;
  588.                      sw = QueryTextBox( hps, strlen(str), str ) ; 
  589.                      switch(jmode) {
  590.                      case LEFT:   sw = 0;     break;
  591. @@ -1974,7 +2019,7 @@ server:
  592.                      else GpiSetLineWidthGeom( hps, linewidth ) ;
  593.                      if( lt < 0 ) lt = 0 ;
  594.                  lt = (lt%8);
  595. -                col = (col+2)%16 ;
  596. +                col = (col+2) % lCols_num;
  597.                      GpiLabel( hps, lLineTypes[lt] ) ;
  598.  lOldLine=lt ;
  599.                      LType( (bLineTypes||bBW)?lt:0 ) ;
  600. @@ -1982,7 +2027,7 @@ lOldLine=lt ;
  601.                      if( !bBW ) { /* maintain some flexibility here in case we don't want
  602.                             the model T option */ 
  603.                          if( bColours ) GpiSetColor( hps, lCols[col] ) ;
  604. -                        else GpiSetColor( hps, CLR_BLACK ) ;
  605. +                        else GpiSetColor( hps, CLR_NEUTRAL ) ;
  606.                          }
  607.                      }
  608.                      break ;
  609. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/readline.c gnuplot-3.7.0.9.my/src/readline.c
  610. --- gnuplot-3.7.0.9-pm3d-patch/src/readline.c    Tue Jun 22 06:59:20 1999
  611. +++ gnuplot-3.7.0.9.my/src/readline.c    Thu Oct  7 02:26:18 1999
  612. @@ -584,7 +584,7 @@ const char *prompt;
  613.          redraw_line(prompt);
  614.  #endif /* VREPRINT */
  615.  #ifndef USE_MOUSE
  616. -#ifdef VSUSP
  617. +#if defined(VSUSP) && defined(SIGTSTP)
  618.      } else if (cur_char == term_chars[VSUSP]) {
  619.          reset_termio();
  620.          kill(0, SIGTSTP);
  621. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/set.c gnuplot-3.7.0.9.my/src/set.c
  622. --- gnuplot-3.7.0.9-pm3d-patch/src/set.c    Fri Mar  2 18:53:02 2001
  623. +++ gnuplot-3.7.0.9.my/src/set.c    Fri Oct  8 00:44:08 1999
  624. @@ -582,6 +582,10 @@ reset_command()
  625.      pointsize = 1.0;
  626.      encoding = ENCODING_DEFAULT;
  627.  
  628. +#ifdef PM3D
  629. +    pm3d.where[0] = 0;
  630. +#endif
  631. +
  632.      init_locale();
  633.      clear_loadpath();
  634.  
  635. diff -pru gnuplot-3.7.0.9-pm3d-patch/src/stdfn.c gnuplot-3.7.0.9.my/src/stdfn.c
  636. --- gnuplot-3.7.0.9-pm3d-patch/src/stdfn.c    Sat Jun 19 15:55:04 1999
  637. +++ gnuplot-3.7.0.9.my/src/stdfn.c    Thu Oct  7 02:53:28 1999
  638. @@ -416,7 +416,7 @@ size_t n;
  639.   * based in misc.c(instring) */
  640.  size_t
  641.  gp_strcspn(str1, str2)
  642. -const char *str1, str2;
  643. +const char *str1, *str2;
  644.  {
  645.      char *s;
  646.      size_t pos;
  647.