extern.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* This file is part of the GNU plotutils package. Copyright (C) 1989,
  2. 1990, 1991, 1995, 1996, 1997, 1998, 1999, 2000, 2005, 2008, Free
  3. Software Foundation, Inc.
  4. The GNU plotutils package is free software. You may redistribute it
  5. and/or modify it under the terms of the GNU General Public License as
  6. published by the Free Software foundation; either version 2, or (at your
  7. option) any later version.
  8. The GNU plotutils package is distributed in the hope that it will be
  9. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License along
  13. with the GNU plotutils package; see the file COPYING. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor,
  15. Boston, MA 02110-1301, USA. */
  16. extern const char *progname; /* program name */
  17. /* Definition of the Point structure. The point-reader (in reader.c)
  18. returns a list of these from a specified input stream, and the
  19. multigrapher (in plotter.c) interprets them as polyline vertices, and
  20. plots the resulting polyline(s). Each polyline comprises a run of
  21. points, each (except the first) connected to the previous point,
  22. provided that `pendown' is true. The final seven fields should be the
  23. same for each point in a polyline. */
  24. typedef struct
  25. {
  26. double x, y; /* location of the point in user coordinates */
  27. bool have_x_errorbar, have_y_errorbar;
  28. double xmin, xmax; /* meaningful only if have_x_errorbar field is set */
  29. double ymin, ymax; /* meaningful only if have_y_errorbar field is set */
  30. bool pendown; /* connect to previous point? (if false, polyline ends) */
  31. /* following fields are polyline attributes: constant over a polyline */
  32. int symbol; /* either a number indicating which standard marker
  33. symbol is to be plotted at the point (<0 means none)
  34. or an character to be plotted, depending on the value:
  35. 0-31: a marker number, or 32-up: a character. */
  36. double symbol_size; /* symbol size, as frac. of size of plotting area */
  37. const char *symbol_font_name; /* font from which symbols >= 32 are taken */
  38. const char *line_color; /* explicitly replace color in linemode */
  39. int linemode; /* linemode of polyline (<0 means no polyline) */
  40. double line_width; /* line width as fraction of size of the display */
  41. double fill_fraction; /* in interval [0,1], <0 means polyline isn't filled */
  42. bool use_color; /* color/monochrome interpretation of linemode */
  43. } Point;
  44. /* type of data in input stream */
  45. typedef enum
  46. {
  47. T_ASCII, T_SINGLE, T_DOUBLE, T_INTEGER, T_GNUPLOT, T_ASCII_ERRORBAR
  48. } data_type;
  49. /* style of graph frame; the 1st four of these are increasingly fancy, but
  50. the last (AXES_AT_ORIGIN) is an altogether different style */
  51. typedef enum
  52. {
  53. NO_AXES = 0, AXES = 1, AXES_AND_BOX = 2, AXES_AND_BOX_AND_GRID = 3, AXES_AT_ORIGIN = 4, BOX = 5
  54. } grid_type;
  55. #define NORMAL_AXES(grid_spec) \
  56. ((grid_spec == AXES) || (grid_spec == AXES_AND_BOX) \
  57. || (grid_spec == AXES_AND_BOX_AND_GRID))
  58. /* bit fields in portmanteau variables */
  59. enum { X_AXIS = 0x1, Y_AXIS = 0x2 };
  60. #define NO_OF_LINEMODES 5 /* see linemode.c */
  61. #define MAX_COLOR_NAME_LEN 32 /* long enough for all of libplot's colors */
  62. /* types of line */
  63. extern const char *linemodes[NO_OF_LINEMODES];
  64. extern const char *colorstyle[NO_OF_LINEMODES];
  65. /*----------------- prototypes for functions in plotter.h -------------------*/
  66. typedef struct MultigrapherStruct Multigrapher;
  67. extern Multigrapher * new_multigrapher (const char *output_format, const char *bg_color, const char *bitmap_size, const char *emulate_color, const char *max_line_length, const char *meta_portable, const char *page_size, const char *rotation_angle, bool save_screen);
  68. extern int delete_multigrapher (Multigrapher *multigrapher);
  69. extern void begin_graph (Multigrapher *multigrapher, double scale, double trans_x, double trans_y);
  70. extern void end_graph (Multigrapher *multigrapher);
  71. extern void set_graph_parameters (Multigrapher *multigrapher, double frame_line_width, const char *frame_color, const char *title, const char *title_font_name, double title_font_size, double tick_size, grid_type grid_spec, double x_min, double x_max, double x_spacing, double y_min, double y_max, double y_spacing, bool spec_x_spacing, bool spec_y_spacing, double width, double height, double up, double right, const char *x_font_name, double x_font_size, const char *x_label, const char *y_font_name, double y_font_size, const char *y_label, bool no_rotate_y_label, int log_axis, int round_to_next_tick, int switch_axis_end, int omit_labels, int clip_mode, double blankout_fraction, bool transpose_axes);
  72. extern void draw_frame_of_graph (Multigrapher *multigrapher, bool draw_canvas);
  73. extern void plot_point (Multigrapher *multigrapher, const Point *point);
  74. extern void plot_point_array (Multigrapher *multigrapher, const Point *p, int length);
  75. typedef struct
  76. {
  77. Point point;
  78. char const * label;
  79. } Legend;
  80. extern void plot_legend (Multigrapher *multigrapher, Legend *legends, int length, double x, double y, double font_size);
  81. extern void add_legend (Legend **legends, int *length, const Point *point, char const *label);
  82. extern void end_polyline_and_flush (Multigrapher *multigrapher);
  83. /*----------------- prototypes for functions in reader.h -------------------*/
  84. typedef struct ReaderStruct Reader;
  85. extern Reader * new_reader (FILE *input, data_type input_type, bool auto_abscissa, double delta_x, double abscissa, bool transpose_axes, int log_axis, bool auto_bump, int symbol, double symbol_size, const char *symbol_font_name, const char *line_color, int linemode, double line_width, double fill_fraction, bool use_color);
  86. extern void delete_reader (Reader *reader);
  87. extern void read_file (Reader *reader, Point **p, int *length, int *no_of_points);
  88. extern void read_and_plot_file (Reader *reader, Multigrapher *multigrapher, int *no_of_points, bool *new_legend_label, Legend **legends, int *no_of_legends, char const *legend_label);
  89. extern void alter_reader_parameters (Reader *reader, FILE *input, data_type input_type, bool auto_abscissa, double delta_x, double abscissa, int symbol, double symbol_size, const char *symbol_font_name, const char *line_color, int linemode, double line_width, double fill_fraction, bool use_color, bool new_symbol, bool new_symbol_size, bool new_symbol_font_name, bool new_line_color, bool new_linemode, bool new_line_width, bool new_fill_fraction, bool new_use_color);
  90. /*----------------- prototypes for functions in misc.h -------------------*/
  91. extern void array_bounds (const Point *p, int length, bool transpose_axes, int clip_mode, double *min_x, double *min_y, double *max_x, double *max_y, bool spec_min_x, bool spec_min_y, bool spec_max_x, bool spec_max_y);
  92. /*------------------------------------------------------------------------*/
  93. /*
  94. Local Variables:
  95. c-file-style: "gnu"
  96. tab-width: 8
  97. End:
  98. */