! plot_all.MBS
! Plot every Table, Range, and Glyph.

global drawing module plot_all(int verbosity);

int    table_number, range_number, glyph_number;
int    rc;

! parameters necessary for check_*(), but discarded
int    range_start, range_stop, range_radius;
string name*132;

constant int toplevel_false = 0;
constant int toplevel_true  = 1;

! box_visibility values
constant int plain = 0;
constant int boxed = 1;

beginmodule

! plot tables
table_number := 0;
plot_tables:;
   ! Check that the table exists; name discarded
   part(#10,check_table(table_number, rc, name, verbosity));
   if rc <> 0 then
      if verbosity > 0 then
         lst_lin("plot_all: table number " +
                 str(table_number,1,0) + " not found");
      endif;
   else
      clear_gm();
      clear_pm();
      csys_1p(#11,"table",vec(0,0):blank=1);
      part(#12, show_one_table(table_number, 
                               toplevel_true, plain, verbosity), #11);
      clear_gm();
      clear_pm();
      csys_1p(#13,"table",vec(0,0):blank=1);
      part(#14, show_one_table(table_number, 
                               toplevel_true, boxed, verbosity), #13);
   endif;
   table_number := table_number + 1;
if table_number <= 2 then
   goto plot_tables;
else
   goto plot_ranges;
endif;

range_number := 0;
plot_ranges:;
   ! Check that the range exists; start, stop, radius, name discarded
   part(#20,check_range(range_number, rc, 
                        range_start, range_stop, range_radius, name, 
                        verbosity));
   if rc <> 0 then
      if verbosity > 0 then
         lst_lin("plot_all: range number " +
                 str(range_number,1,0) + " not found");
      endif;
   else
      clear_gm();
      clear_pm();
      csys_1p(#21,"range",vec(0,0):blank=1);
      part(#22, show_one_range(range_number, 
                               toplevel_true, plain, verbosity), #21);
      clear_gm();
      clear_pm();
      csys_1p(#23,"range",vec(0,0):blank=1);
      part(#24, show_one_range(range_number, 
                               toplevel_true, boxed, verbosity), #23);
   endif;
   range_number := range_number + 1;
if range_number <= 191 then
   goto plot_ranges;
else
   goto plot_glyphs;
endif;

! I don't really need to plot all the many hundreds of glyphs,
! so this one is left as an exercise to the reader.
glyph_number := 0;
plot_glyphs:;

endmodule

! Copyright 2005 by David M. MacMillan

! This work is free software; you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation; either version 2 of the License, or
! (at your option) any later version.

! NOTICE OF DISCLAIMER OF WARRANTY AND LIABILITY:

! This work is distributed WITHOUT ANY WARRANTY;
! without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
! See the GNU General Public License for more details.

! In no event will the author(s), editor(s), or publisher(s) of this work
! be liable to you or to any other party for damages,
! including but not limited to any general, special, incidental
! or consequential damages arising out of your use of or inability to use this
! work or the information contained in it, even if you have been advised
! of the possibility of such damages.

! In no event will the author(s), editor(s), or publisher(s) of this work
! be liable to you or to any other party for any injury, death,
! disfigurement, or other personal damage arising out of your use of
! or inability to use this work or the information
! contained in it, even if you have been advised of the
! possibility of such injury, death, disfigurement, or other
! personal damage.

! You should have received a copy of the GNU General Public License
! along with this work; if not, write to the
! Free Software Foundation, Inc., 59 Temple Place - Suite 330,
! Boston, MA  02111-1307, USA.

