Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   Related Pages   Examples  

extern.h

00001 #include "config.h"
00002 
00003 #ifdef HAVE_LIBPLOTTER
00004 
00005 #ifndef EXTERN_H
00006 #define EXTERN_H
00007 
00008 extern const char *progname;    /* program name */
00009 
00010 /* Definition of the Point structure.  The point-reader (in reader.c)
00011    returns a list of these from a specified input stream, and the
00012    multigrapher (in plotter.c) interprets them as polyline vertices, and
00013    plots the resulting polyline(s).  Each polyline comprises a run of
00014    points, each (except the first) connected to the previous point,
00015    provided that `pendown' is true.  The final seven fields should be the
00016    same for each point in a polyline. */
00017 
00018 typedef struct
00019 {
00020   double x, y;      /* location of the point in user coordinates */
00021   bool have_x_errorbar, have_y_errorbar;
00022   double xmin, xmax; /* meaningful only if have_x_errorbar field is set */
00023   double ymin, ymax; /* meaningful only if have_y_errorbar field is set */
00024   bool pendown;  /* connect to previous point? (if false, polyline ends) */
00025   /* following fields are polyline attributes: constant over a polyline */
00026   int symbol;       /* either a number indicating which standard marker
00027                      symbol is to be plotted at the point (<0 means none)
00028                      or an character to be plotted, depending on the value:
00029                      0-31: a marker number, or 32-up: a character. */
00030   double symbol_size;   /* symbol size, as frac. of size of plotting area */
00031   const char *symbol_font_name; /* font from which symbols >= 32 are taken */
00032   int linemode;         /* linemode of polyline (<0 means no polyline) */
00033   double line_width;    /* line width as fraction of size of the display */
00034   double fill_fraction; /* in interval [0,1], <0 means polyline isn't filled */
00035   bool use_color;       /* color/monochrome interpretation of linemode */
00036 } Point;
00037 
00038 /* type of data in input stream */
00039 typedef enum
00040 {
00041   T_ASCII, T_SINGLE, T_DOUBLE, T_INTEGER, T_GNUPLOT, T_ASCII_ERRORBAR
00042 } data_type;
00043 
00044 /* style of graph frame; the 1st four of these are increasingly fancy, but
00045    the last (AXES_AT_ORIGIN) is an altogether different style */
00046 typedef enum
00047 {
00048   NO_AXES = 0, AXES = 1, AXES_AND_BOX = 2, AXES_AND_BOX_AND_GRID = 3, AXES_AT_ORIGIN = 4
00049 } grid_type;
00050 
00051 #define NORMAL_AXES(grid_spec) \
00052 ((grid_spec == AXES) || (grid_spec == AXES_AND_BOX) \
00053  || (grid_spec == AXES_AND_BOX_AND_GRID))
00054 
00055 /* bit fields in portmanteau variables */
00056 enum { X_AXIS = 0x1, Y_AXIS = 0x2 };
00057 
00058 #define NO_OF_LINEMODES 5       /* see linemode.c */
00059 #define MAX_COLOR_NAME_LEN 32   /* long enough for all of libplot's colors */
00060 
00061 /* types of line */
00062 extern const char *linemodes[NO_OF_LINEMODES];
00063 extern const char *colorstyle[NO_OF_LINEMODES];
00064 
00065 /*------------prototypes for libcommon functions----------------------------*/
00066 
00067 extern "C" char * xstrdup ____P((const char *s));
00068 extern int display_fonts ____P((const char *display_type, const char *progname));
00069 extern int list_fonts ____P((const char *display_type, const char *progname));
00070 extern void display_usage ____P((const char *progname, const int *omit_vals, const char *appendage, bool fonts));
00071 extern void display_version ____P((const char *progname));
00072 extern "C" voidptr_t xmalloc ____P ((size_t length));
00073 extern voidptr_t xrealloc ____P ((voidptr_t p, size_t length));
00074 
00075 /*----------------- prototypes for functions in plotter.h -------------------*/
00076 
00077 typedef struct MultigrapherStruct Multigrapher;
00078 
00079 extern Multigrapher * new_multigrapher ____P((const char *display_type, 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));
00080 
00081 extern int delete_multigrapher ____P((Multigrapher *multigrapher));
00082 
00083 extern void begin_graph ____P((Multigrapher *multigrapher, double scale, double trans_x, double trans_y));
00084 
00085 extern void end_graph ____P((Multigrapher *multigrapher));
00086 
00087 extern void set_graph_parameters ____P((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));
00088 
00089 extern void draw_frame_of_graph ____P((Multigrapher *multigrapher, bool draw_canvas));
00090 
00091 extern void plot_point ____P((Multigrapher *multigrapher, const Point *point));
00092 
00093 extern void plot_point_array ____P((Multigrapher *multigrapher, const Point *p, int length));
00094 
00095 extern void end_polyline_and_flush ____P((Multigrapher *multigrapher));
00096 
00097 /*----------------- prototypes for functions in reader.h -------------------*/
00098 
00099 typedef struct ReaderStruct Reader;
00100 
00101 extern Reader * new_reader ____P((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, int linemode, double line_width, double fill_fraction, bool use_color));
00102 
00103 extern void delete_reader ____P((Reader *reader));
00104 
00105 extern void read_file ____P((Reader *reader, Point **p, int *length, int *no_of_points));
00106 
00107 extern void read_and_plot_file ____P((Reader *reader, Multigrapher *multigrapher));
00108 
00109 extern void alter_reader_parameters ____P((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, 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_linemode, bool new_line_width, bool new_fill_fraction, bool new_use_color));
00110 
00111 /*----------------- prototypes for functions in misc.h -------------------*/
00112 
00113 extern void array_bounds ____P((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));
00114 
00115 /*------------------------------------------------------------------------*/
00116 
00117 #endif
00118 
00119 #endif