# HG changeset patch
# User Rüdiger Sonderfeld <ruediger@c-plusplus.de>
# Date 1380932470 -7200
# Branch my-patches
# Node ID dc3ef94b7f31f289155ba395c30f3833cc6a2d94
# Parent  6d96d21eec933596912fe22cf253a0585c1ac6d3
doc: Generate ascii images for txt output.

This patch changes two of the doc image generators as an example of
ascii output.

* doc/interpreter/interpimages.m (interpimages): Use dumb terminal
  for txt files.
  (image_as_txt): Remove function.
* doc/interpreter/plotimages.m (plotimages): Use dumb terminal for txt
  files.
  (image_as_txt): Remove function.

diff --git a/doc/interpreter/interpimages.m b/doc/interpreter/interpimages.m
--- a/doc/interpreter/interpimages.m
+++ b/doc/interpreter/interpimages.m
@@ -25,13 +25,13 @@
   endif
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
+  elseif (strcmp (typ, "txt"))
+    d_typ = "-ddumb";
   else
     d_typ = ["-d", typ];
   endif
 
-  if (strcmp (typ, "txt"))
-    image_as_txt (nm);
-  elseif (strcmp (nm, "interpft"))
+  if (strcmp (nm, "interpft"))
     t = 0 : 0.3 : pi; dt = t(2)-t(1);
     n = length (t); k = 100;
     ti = t(1) + [0 : k-1]*dt*n/k;
@@ -93,14 +93,3 @@
   f = figure (1);
   set (f, "visible", "off");
 endfunction
-
-## generate something for the texinfo @image command to process
-function image_as_txt(nm)
-  fid = fopen (sprintf ("%s.txt", nm), "wt");
-  fputs (fid, "\n");
-  fputs (fid, "+---------------------------------+\n");
-  fputs (fid, "| Image unavailable in text mode. |\n");
-  fputs (fid, "+---------------------------------+\n");
-  fclose (fid);
-endfunction
-
diff --git a/doc/interpreter/plotimages.m b/doc/interpreter/plotimages.m
--- a/doc/interpreter/plotimages.m
+++ b/doc/interpreter/plotimages.m
@@ -25,13 +25,13 @@
   endif
   if (strcmp (typ, "eps"))
     d_typ = "-depsc2";
+  elseif (strcmp (typ, "txt"))
+    d_typ = "-ddumb";
   else
     d_typ = ["-d", typ];
   endif
 
-  if (strcmp(typ , "txt"))
-    image_as_txt(nm);
-  elseif (strcmp (nm, "plot"))
+  if (strcmp (nm, "plot"))
     x = -10:0.1:10;
     plot (x, sin (x));
     xlabel ("x");
@@ -116,13 +116,3 @@
   f = figure (1);
   set (f, "visible", "off");
 endfunction
-
-## generate something for the texinfo @image command to process
-function image_as_txt(nm)
-  fid = fopen (sprintf ("%s.txt", nm), "wt");
-  fputs (fid, "\n");
-  fputs (fid, "+---------------------------------+\n");
-  fputs (fid, "| Image unavailable in text mode. |\n");
-  fputs (fid, "+---------------------------------+\n");
-  fclose (fid);
-endfunction
# HG changeset patch
# User Rüdiger Sonderfeld <ruediger@c-plusplus.de>
# Date 1380932016 -7200
# Branch my-patches
# Node ID 6d96d21eec933596912fe22cf253a0585c1ac6d3
# Parent  ea93b1c9eb339a0f8070dd3995c5d024c321eebe
print: Add support for dumb/ascii output.

Gnuplot supports ascii output (dumb) terminals.  This should be available through print.

* scripts/plot/print.m (print): Documentation update.
* scripts/plot/private/__gnuplot_print__.m (__gnuplot_print__):
  Support dumb terminals.
* scripts/plot/private/__print_parse_opts__.m (__print_parse_opts__):
  Support -ddumb.

diff --git a/scripts/plot/print.m b/scripts/plot/print.m
--- a/scripts/plot/print.m
+++ b/scripts/plot/print.m
@@ -160,6 +160,9 @@
 ##   @item pbm
 ##     PBMplus
 ##
+##   @item dumb
+##     ASCII art (only available for the Gnuplot graphics toolkit)
+##
 ##   @item svg
 ##     Scalable vector graphics
 ##
diff --git a/scripts/plot/private/__gnuplot_print__.m b/scripts/plot/private/__gnuplot_print__.m
--- a/scripts/plot/private/__gnuplot_print__.m
+++ b/scripts/plot/private/__gnuplot_print__.m
@@ -116,6 +116,8 @@
       endif
     case {"canvas", "dxf", "hpgl", "mf", "gif", "pstricks", "texdraw"}
       local_drawnow ([opts.devopt " " gp_opts], opts.name, opts);
+    case "dumb"
+      local_drawnow ("dumb size 72,24", opts.name, opts);
     case opts.ghostscript.device
       gp_opts = font_spec (opts, "devopt", "eps");
       opts.ghostscript.output = opts.name;
diff --git a/scripts/plot/private/__print_parse_opts__.m b/scripts/plot/private/__print_parse_opts__.m
--- a/scripts/plot/private/__print_parse_opts__.m
+++ b/scripts/plot/private/__print_parse_opts__.m
@@ -215,7 +215,7 @@
     arg_st.devopt = "jpeg";
   endif
 
-  dev_list = {"aifm", "corel", "fig", "png", "jpeg", ...
+  dev_list = {"aifm", "corel", "dumb", "fig", "png", "jpeg", ...
               "gif", "pbm", "pbmraw", "dxf", "mf", ...
               "svg", "hpgl", "ps", "ps2", "psc", ...
               "psc2", "eps", "eps2", "epsc", "epsc2", ...
@@ -227,7 +227,7 @@
               "pdfcairo", "pngcairo", "pstricks", ...
               "epswrite", "pswrite", "ps2write", "pdfwrite"};
 
-  suffixes = {"ai", "cdr", "fig", "png", "jpg", ...
+  suffixes = {"ai", "cdr", "txt", "fig", "png", "jpg", ...
               "gif", "pbm", "pbm", "dxf", "mf", ...
               "svg", "hpgl", "ps", "ps", "ps", ...
               "ps", "eps", "eps", "eps", "eps", ...
