Back to index

texmacs  1.0.7.15
__plt2ss__.m
Go to the documentation of this file.
00001 ## Copyright (C) 1996, 1997 John W. Eaton
00002 ##
00003 ## This file is part of Octave.
00004 ##
00005 ## Octave is free software; you can redistribute it and/or modify it
00006 ## under the terms of the GNU General Public License as published by
00007 ## the Free Software Foundation; either version 2, or (at your option)
00008 ## any later version.
00009 ##
00010 ## Octave is distributed in the hope that it will be useful, but
00011 ## WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 ## General Public License for more details.
00014 ##
00015 ## You should have received a copy of the GNU General Public License
00016 ## along with Octave; see the file COPYING.  If not, write to the Free
00017 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA
00018 ## 02111-1307, USA.
00019 
00020 ## -*- texinfo -*-
00021 ## @deftypefn {Function File} {} __plt2ss__ (@var{x}, @var{y}, @var{fmt})
00022 ## @end deftypefn
00023 
00024 ## Author: jwe
00025 
00026 ## Modified Jan. 2003 -- Added TeXmacs interface support
00027 ## Author: Michael Graffam <mgraffam@mathlab.sunysb.edu>
00028 
00029 function __plt2ss__ (x, y, fmt)
00030 
00031   if (nargin < 2 || nargin > 3)
00032     msg = sprintf ("__plt2ss__ (x, y)");
00033     msg = sprintf ("%s              __plt2ss__ (x, y, fmt)", msg);
00034     usage (msg);
00035   elseif (nargin == 2)
00036     fmt = "";
00037   elseif (rows (fmt) > 1)
00038     fmt = fmt (1, :);
00039   endif
00040 
00041   [x_nr, x_nc] = size (x);
00042   [y_nr, y_nc] = size (y);
00043 
00044   if (length(getenv("TEXMACS_PATH"))>0)
00045        gset output '/tmp/tmplot.eps';
00046   endif
00047 
00048   if (x_nr == 1 && x_nr == y_nr && x_nc == 1 && x_nc == y_nc)
00049     tmp = [x, y];
00050     cmd = sprintf ("gplot tmp %s", fmt);
00051     eval (cmd);
00052           if (length(getenv("TEXMACS_PATH"))>0)
00053                  P=[2;112;115;58]; #P= "\002ps:"
00054                 g=fopen("/tmp/tmplot.eps");
00055                 while (g==-1)
00056                         sleep(1);
00057                         g=fopen("/tmp/tmplot.eps");
00058                 endwhile
00059                 while (!feof(g))
00060                         f=fread(g,2048);
00061                         if (length(f))
00062                                 P=[P;f];
00063                         endif
00064                 endwhile
00065                 fclose(g);
00066                 P=[P;5];
00067                 disp(sprintf("%cverbatim:\n",2));
00068                 disp(setstr(P'));
00069                 system("rm /tmp/tmplot.eps");
00070         endif
00071   else
00072     error ("__plt2ss__: arguments must be scalars");
00073   endif
00074 
00075 endfunction