PLplot  5.10.0
plplotP.h
Go to the documentation of this file.
00001 //  Internal (private) macros and prototypes for the PLplot package.  This
00002 //  header file must be included before all others, including system header
00003 //  files.  This file is typically needed when including driver specific
00004 //  header files (e.g. pltkd.h).
00005 //
00006 //  Copyright (C) 1993, 1994, 1995  by
00007 //  Maurice J. LeBrun, Geoff Furnish, Tony Richardson.
00008 //
00009 //  Copyright (C) 2004  Rafael Laboissiere
00010 //  Copyright (C) 2004  Joao Cardoso
00011 //  Copyright (C) 2004  Andrew Roach
00012 //  Copyright (C) 2006  Andrew Ross
00013 //  Copyright (C) 2006  Hazen Babcock
00014 //
00015 //
00016 //  This file is part of PLplot.
00017 //
00018 //  PLplot is free software; you can redistribute it and/or modify
00019 //  it under the terms of the GNU Library General Public License as published
00020 //  by the Free Software Foundation; either version 2 of the License, or
00021 //  (at your option) any later version.
00022 //
00023 //  PLplot is distributed in the hope that it will be useful,
00024 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00025 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00026 //  GNU Library General Public License for more details.
00027 //
00028 //  You should have received a copy of the GNU Library General Public License
00029 //  along with PLplot; if not, write to the Free Software
00030 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00031 //
00032 //
00033 //
00034 
00035 #ifndef __PLPLOTP_H__
00036 #define __PLPLOTP_H__
00037 
00038 //--------------------------------------------------------------------------
00039 // Select environment.  Must be done before anything else.
00040 //
00041 // Basically we want the widest range of system services that are available.
00042 // Fortunately on many systems, that is the default.  To get "everything",
00043 // one of the following must be defined, as appropriate:
00044 //
00045 // _GNU_SOURCE     on Linux (default)
00046 // _OSF_SOURCE     on OSF1 (default)
00047 // _HPUX_SOURCE    on HP (not default)
00048 // _ALL_SOURCE     on AIX (no idea)
00049 //
00050 // To see where these are set, do the following:
00051 //
00052 //    cd /usr/include; grep SOURCE *.h | fgrep 'define '
00053 //
00054 // and the file containing lots of these is the one you want (features.h on
00055 // Linux, standards.h on OSF1, etc).  Follow the logic to see what needs to be
00056 // defined to get "everything", i.e. POSIX.*, XOPEN, etc.
00057 //
00058 // Note that for specific functionality, we test using autoconf.  Still it's
00059 // best to stick to ANSI C, POSIX.1, and POSIX.2, in that order, for maximum
00060 // portability.
00061 //--------------------------------------------------------------------------
00062 
00063 // HPUX - if this is no longer needed, please remove it
00064 #ifdef _HPUX
00065 #define _HPUX_SOURCE
00066 #endif
00067 
00068 // A/IX - if this is no longer needed, please remove it
00069 #ifdef _AIX
00070 #define _ALL_SOURCE
00071 #endif
00072 
00073 // Add others here as needed.
00074 
00075 //--------------------------------------------------------------------------
00076 //      Configuration settings
00077 //
00078 // Some of the macros set during configuration are described here.
00079 //
00080 // If HAVE_TERMIOS_H is set, we employ POSIX.1 tty terminal I/O.  One purpose
00081 // of this is to select character-oriented (CBREAK) i/o in the tek driver and
00082 // all its variants.  It is usable without this but not as powerful.  The
00083 // reason for using this is that some supported systems are still not
00084 // POSIX.1 compliant (and some may never be).
00085 //
00086 // If STDC_HEADERS is defined, the system's libc is ANSI-compliant.
00087 // ANSI libc calls are used for: (a) setting up handlers to be called
00088 // before program exit (via the "atexit" call), and (b) for seek
00089 // operations.  Again, the code is usable without these.  An ANSI libc
00090 // should be available, given the requirement of an ANSI compiler.  Some
00091 // reasons why not: (a) the vendor didn't supply a complete ANSI
00092 // environment, or (b) the ANSI libc calls are buggy, or (c) you ported
00093 // gcc to your system but not glibc (for whatever reason).  Note: without
00094 // an ANSI C lib, if you ^C out of a program using one of the PLplot tek
00095 // drivers, your terminal may be left in a strange state.
00096 //--------------------------------------------------------------------------
00097 
00098 #include "plConfig.h"
00099 #ifdef caddr_t
00100 #undef caddr_t
00101 #ifndef __USE_BSD
00102 typedef char * caddr_t;
00103 #endif
00104 #endif
00105 
00106 // System headers
00107 
00108 #include <ctype.h>
00109 #include <math.h>
00110 #include <string.h>
00111 #include <limits.h>
00112 #include <float.h>
00113 #ifdef PL_HAVE_UNISTD_H
00114 #include <unistd.h>
00115 #endif
00116 
00117 #include <locale.h>
00118 
00119 // (AM) Define M_PI if the platform does not include it
00120 // (MSVC for instance)
00121 #if !defined ( M_PI )
00122 #define M_PI    3.14159265358979323846
00123 #endif
00124 
00125 //
00126 // Macros for file positioning.  I tried switching to f[sg]etpos() because I
00127 // like the semantics better, but ran into the problem that fpos_t is not
00128 // always a base type (it may be a struct).  This is a problem because the
00129 // metafile driver needs to write relative offsets into the file itself.  So
00130 // instead we use f{seek,tell} at a low level but keep the f[sg]etpos
00131 // semantics using these macros.
00132 //
00133 
00134 #ifdef STDC_FPOS_T
00135 #undef STDC_FPOS_T
00136 #endif
00137 
00138 #ifdef STDC_FPOS_T
00139 #define FPOS_T    fpos_t
00140 #define pl_fsetpos( a, b )    fsetpos( a, b )
00141 #define pl_fgetpos( a, b )    fgetpos( a, b )
00142 
00143 #else
00144 #define FPOS_T    long
00145 #define pl_fsetpos( a, b )    fseek( a, *b, 0 )
00146 #define pl_fgetpos( a, b )    ( -1L == ( *b = ftell( a ) ) )
00147 #endif
00148 
00149 #include "pldll.h"
00150 
00151 // Include all externally-visible definitions and prototypes
00152 // plplot.h also includes some handy system header files
00153 
00154 #include "plplot.h"
00155 
00156 // plstream definition
00157 
00158 #include "plstrm.h"
00159 
00160 // If not including this file from inside of plcore.h, declare plsc
00161 
00162 #ifndef __PLCORE_H__
00163 #ifdef __cplusplus
00164 extern "C" {
00165 #endif
00166 // extern PLStream PLDLLIMPORT *plsc;
00167 extern PLDLLIMPEXP_DATA( PLStream * ) plsc;
00168 #ifdef __cplusplus
00169 }
00170 #endif
00171 #include "pldebug.h"
00172 #endif
00173 
00174 //--------------------------------------------------------------------------
00175 //                       Utility macros
00176 //--------------------------------------------------------------------------
00177 
00178 #ifndef TRUE
00179 #define TRUE     1
00180 #define FALSE    0
00181 #endif
00182 
00183 // Used to help ensure everything malloc'ed gets freed
00184 
00185 #define free_mem( a ) \
00186     if ( a != NULL ) { free( (void *) a ); a = NULL; }
00187 
00188 // Allows multi-argument setup calls to not affect selected arguments
00189 
00190 #define plsetvar( a, b ) \
00191     if ( b != PL_NOTSET ) a = b;
00192 
00193 // Lots of cool math macros
00194 
00195 #ifndef MAX
00196 #define MAX( a, b )                      ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
00197 #endif
00198 #ifndef MIN
00199 #define MIN( a, b )                      ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
00200 #endif
00201 #ifndef ABS
00202 #define ABS( a )                         ( ( a ) < 0 ? -( a ) : ( a ) )
00203 #endif
00204 #ifndef ROUND
00205 #define ROUND( a )                       (PLINT) ( ( a ) < 0. ? ( ( a ) - .5 ) : ( ( a ) + .5 ) )
00206 #endif
00207 #ifndef BETW
00208 #define BETW( ix, ia, ib )               ( ( ( ix ) <= ( ia ) && ( ix ) >= ( ib ) ) || ( ( ix ) >= ( ia ) && ( ix ) <= ( ib ) ) )
00209 #endif
00210 #ifndef SSQR
00211 #define SSQR( a, b )                     sqrt( ( a ) * ( a ) + ( b ) * ( b ) )
00212 #endif
00213 #ifndef SIGN
00214 #define SIGN( a )                        ( ( a ) < 0 ? -1 : 1 )
00215 #endif
00216 #ifndef TRANSFORM
00217 #define TRANSFORM( x, y, xnew, ynew )    if ( plsc->coordinate_transform ) { plsc->coordinate_transform( ( x ), ( y ), ( xnew ), ( ynew ), plsc->coordinate_transform_data ); } else { *xnew = x; *ynew = y; }
00218 #endif
00219 
00220 // A coordinate value that should never occur
00221 
00222 #define PL_UNDEFINED    -9999999
00223 
00224 // Declarations for save string functions
00225 
00226 #ifdef PL_HAVE_SNPRINTF
00227 // In case only _snprintf is declared (as for Visual C++ and
00228 // Borland compiler toolset) we redefine the function names
00229   #ifdef _PL_HAVE_SNPRINTF
00230     #define snprintf    _snprintf
00231     #define snscanf     _snscanf
00232   #endif // _PL_HAVE_SNPRINTF
00233 #else // !PL_HAVE_SNPRINTF
00234 // declare dummy functions which just call the unsafe
00235 // functions ignoring the size of the string
00236 int plsnprintf( char *buffer, int n, const char *format, ... );
00237 int plsnscanf( const char *buffer, int n, const char *format, ... );
00238   #define snprintf    plsnprintf
00239   #define snscanf     plsnscanf
00240 #endif // PL_HAVE_SNPRINTF
00241 
00242 //--------------------------------------------------------------------------
00243 // Add in missing isnan / isinf functions on some platforms
00244 //--------------------------------------------------------------------------
00245 
00246 #if defined ( PL__HAVE_ISNAN )
00247 #  define isnan    _isnan
00248 #  if defined ( _MSC_VER )
00249 #    include <float.h>
00250 #  endif
00251 #endif
00252 #if defined ( PL__HAVE_ISINF )
00253 #  define isinf       _isinf
00254 #endif
00255 #if defined ( PL_HAVE_FINITE )
00256 #  define isfinite    finite
00257 #endif
00258 #if defined ( PL__HAVE_FINITE )
00259 #  define isfinite    _finite
00260 #endif
00261 
00262 // Note these replacements follow the old BSD convention and not
00263 // C99. In particular isinf does not distinguish +/- inf.
00264 #if !defined ( PL_HAVE_ISNAN )
00265 #  define isnan( x )       ( ( x ) != ( x ) )
00266 #endif
00267 #if !defined ( PL_HAVE_ISINF )
00268 #  define isinf( x )       ( !isnan( x ) && isnan( x - x ) )
00269 #endif
00270 #if !defined ( PL_HAVE_ISFINITE )
00271 #  define isfinite( x )    ( !isnan( x - x ) )
00272 #endif
00273 
00274 // Check if C99 HUGE_VAL macro is available - if not then
00275 // define a replacement
00276 #ifndef HUGE_VAL
00277 #define HUGE_VAL    ( 1.0 / 0.0 )
00278 #endif
00279 
00280 //--------------------------------------------------------------------------
00281 //                       PLPLOT control macros
00282 //--------------------------------------------------------------------------
00283 
00284 // Some constants
00285 
00286 #define PL_MAXPOLY       256    // Max segments in polyline or polygon
00287 #define PL_NSTREAMS      100    // Max number of concurrent streams.
00288 #define PL_RGB_COLOR     -1     // A hack
00289 
00290 #define TEXT_MODE        0
00291 #define GRAPHICS_MODE    1
00292 #ifndef PI
00293 #define PI               3.1415926535897932384
00294 #endif
00295 
00296 // These define the virtual coordinate system used by the metafile driver.
00297 // Others are free to use it, or some variation, or define their own.
00298 
00299 // Note desktop monitors of reasonable quality typically have 0.25 mm spacing
00300 // between dots which corresponds to 4.0 dots per mm.  The parameters here
00301 // roughly correspond to a 14" monitor at 1024x768 resolution, which should
00302 // work fine at other sizes/resolutions.  The number of virtual dots per mm is
00303 // scaled by a factor of 32, with pixels scaled accordingly.  The customary
00304 // x/y ratio of 4:3 is used.
00305 //
00306 
00307 #define PIXELS_X    32768                // Number of virtual pixels in x
00308 #define PIXELS_Y    24576                // Number of virtual pixels in x
00309 #define DPMM        4.                   // dots per mm
00310 #define VDPMM       ( DPMM * 32 )        // virtual dots per mm
00311 #define LPAGE_X     ( PIXELS_X / VDPMM ) // virtual page length in x in mm (256)
00312 #define LPAGE_Y     ( PIXELS_Y / VDPMM ) // virtual page length in y in mm (192)
00313 
00314 // This defines the first argument of the plRotPhy invocation that is made
00315 // in a number of device drivers (e.g., found in ljii.c, ljiip.c, ps.c,
00316 // and pstex.c) to rotate them "permanently" from portrait mode to non-
00317 // portrait mode.  ORIENTATION of 1 corresponds to seascape mode (90 deg
00318 // clockwise rotation from portrait).  This is the traditional value
00319 // effectively used in all older versions of PLplot. ORIENTATION of 3
00320 // corresponds to landscape mode (90 deg *counter*-clockwise rotation from
00321 // portrait) which is the new default non-portrait orientation.
00322 
00323 #define ORIENTATION    3
00324 
00325 // Switches for state function call.
00326 
00327 #define PLSTATE_WIDTH     1             // pen width
00328 #define PLSTATE_COLOR0    2             // change to color in cmap 0
00329 #define PLSTATE_COLOR1    3             // change to color in cmap 1
00330 #define PLSTATE_FILL      4             // set area fill attribute
00331 #define PLSTATE_CMAP0     5             // change to cmap 0
00332 #define PLSTATE_CMAP1     6             // change to cmap 1
00333 
00334 // Bit switches used in the driver interface
00335 
00336 #define PLDI_MAP    0x01
00337 #define PLDI_ORI    0x02
00338 #define PLDI_PLT    0x04
00339 #define PLDI_DEV    0x08
00340 
00341 // Default size for family files, in KB.
00342 
00343 #ifndef PL_FILESIZE_KB
00344 #define PL_FILESIZE_KB    1000
00345 #endif
00346 
00347 // Font file names.
00348 
00349 #define PLPLOT5_FONTS
00350 
00351 #ifdef PLPLOT5_FONTS
00352 #define PL_XFONT    "plxtnd5.fnt"
00353 #define PL_SFONT    "plstnd5.fnt"
00354 #else
00355 #define PL_XFONT    "plxtnd4.fnt"
00356 #define PL_SFONT    "plstnd4.fnt"
00357 #endif
00358 
00359 //--------------------------------------------------------------------------
00360 // The following environment variables are defined:
00361 //
00362 //      PLPLOT_BIN      # where to find executables
00363 //      PLPLOT_LIB      # where to find library files (fonts, maps, etc)
00364 //      PLPLOT_TCL      # where to find tcl scripts
00365 //
00366 //      PLPLOT_HOME     # basename of plplot hierarchy
00367 //
00368 // search order:
00369 //      1)      the most specific possible locators, one of
00370 //                      $(PLPLOT_BIN)
00371 //                      $(PLPLOT_LIB)
00372 //                      $(PLPLOT_TCL)
00373 //              as appropriate
00374 //
00375 //      2)      the current directory
00376 //
00377 //      3)      one of  $(PLPLOT_HOME)/bin
00378 //                      $(PLPLOT_HOME)/lib
00379 //                      $(PLPLOT_HOME)/tcl
00380 //              as appropriate
00381 //
00382 //      4)      as appropriate, the compile-time (Makefile)
00383 //              BIN_DIR, LIB_DIR, TCL_DIR
00384 //
00385 //  8 Jun 1994  mj olesen (olesen@weber.me.queensu.ca)
00386 //
00387 // Other notes:
00388 //
00389 // In addition to the directories above, the following are also used:
00390 //
00391 // Lib file search path: PLLIBDEV (see plctrl.c).  This is checked last,
00392 // and is a system-dependent hardwired location.
00393 //
00394 // Tcl search path: $HOME/tcl is searched before the install location,
00395 // TCL_DIR.
00396 //--------------------------------------------------------------------------
00397 
00398 #define PLPLOT_BIN_ENV     "PLPLOT_BIN"
00399 #define PLPLOT_LIB_ENV     "PLPLOT_LIB"
00400 #define PLPLOT_TCL_ENV     "PLPLOT_TCL"
00401 #define PLPLOT_HOME_ENV    "PLPLOT_HOME"
00402 
00403 // Maximum size for path strings in the plplot code
00404 #define PLPLOT_MAX_PATH    1024
00405 
00406 //
00407 //   Some stuff that is included (and compiled into) plsym.h
00408 //   Other modules might want this, so we will "extern" it
00409 //
00410 //
00411 
00412 #ifndef __PLSYM_H__
00413 
00414 typedef struct
00415 {
00416     unsigned int Hershey;
00417     PLUNICODE    Unicode;
00418     char         Font;
00419 } Hershey_to_Unicode_table;
00420 
00421 extern int number_of_entries_in_hershey_to_unicode_table;
00422 extern Hershey_to_Unicode_table hershey_to_unicode_lookup_table[];
00423 
00424 
00425 #endif
00426 
00427 // Greek character translation array (defined in plcore.c)
00428 extern const char plP_greek_mnemonic[];
00429 
00430 //--------------------------------------------------------------------------
00431 //              Function Prototypes
00432 //
00433 // These typically should not be called directly by the user.
00434 //--------------------------------------------------------------------------
00435 
00436 #ifdef __cplusplus
00437 extern "C" {
00438 #endif
00439 
00440 // Number of elements in the affine vector representation of the affine
00441 // transformation matrix.
00442 #define NAFFINE    6
00443 
00444 // Returns affine identity matrix
00445 
00446 PLDLLIMPEXP void
00447 plP_affine_identity( PLFLT *affine_vector );
00448 
00449 // Translate new coordinate system axes relative to the old.
00450 
00451 PLDLLIMPEXP void
00452 plP_affine_translate( PLFLT *affine_vector, PLFLT xtranslate, PLFLT ytranslate );
00453 
00454 // Scale new coordinate system axes relative to the old.
00455 
00456 PLDLLIMPEXP void
00457 plP_affine_scale( PLFLT *affine_vector, PLFLT xscale, PLFLT yscale );
00458 
00459 // Rotate new coordinate system axes relative to the old.
00460 // angle is in degrees.
00461 
00462 PLDLLIMPEXP void
00463 plP_affine_rotate( PLFLT *affine_vector, PLFLT angle );
00464 
00465 // Skew new X coordinate axis relative to the old.
00466 // angle is in degrees.
00467 
00468 PLDLLIMPEXP void
00469 plP_affine_xskew( PLFLT *affine_vector, PLFLT angle );
00470 
00471 // Skew new Y coordinate axis relative to the old.
00472 // angle is in degrees.
00473 
00474 PLDLLIMPEXP void
00475 plP_affine_yskew( PLFLT *affine_vector, PLFLT angle );
00476 
00477 // Multiply two affine transformation matrices to form a third.
00478 //
00479 // A = B * C
00480 //
00481 //
00482 
00483 PLDLLIMPEXP void
00484 plP_affine_multiply(
00485     PLFLT *affine_vectorA,
00486     const PLFLT *affine_vectorB,
00487     const PLFLT *affine_vectorC );
00488 
00489 // Determines interval between numeric labels
00490 
00491 void
00492 pldtik( PLFLT vmin, PLFLT vmax, PLFLT *tick, PLINT *nsubt, PLBOOL ld );
00493 
00494 // Writes numeric labels on side(s) of box in custom locations
00495 
00496 void
00497 label_box_custom( const char *xopt, PLINT n_xticks, const PLFLT *xticks, const char *yopt, PLINT n_yticks, const PLFLT *yticks );
00498 
00499 // Determine factor to convert date / time in seconds to more natural
00500 // units
00501 
00502 void
00503 pldtfac( PLFLT vmin, PLFLT vmax, PLFLT *factor, PLFLT *tstart );
00504 
00505 // Determines precision of box labels
00506 
00507 void
00508 pldprec( PLFLT vmin, PLFLT vmax, PLFLT tick, PLINT lf,
00509          PLINT *mode, PLINT *prec, PLINT digmax, PLINT *scale );
00510 
00511 // Draws a polyline within the clip limits.
00512 
00513 void
00514 plP_pllclp( PLINT *x, PLINT *y, PLINT npts,
00515             PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax,
00516             void ( *draw )( short *, short *, PLINT ) );
00517 
00518 // Fills a polygon within the clip limits.
00519 
00520 void
00521 plP_plfclp( PLINT *x, PLINT *y, PLINT npts,
00522             PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax,
00523             void ( *draw )( short *, short *, PLINT ) );
00524 
00525 // Clip a polygon to the 3d bounding plane
00526 int
00527 plP_clip_poly( int Ni, PLFLT *Vi[3], int axis, PLFLT dir, PLFLT offset );
00528 
00529 // Get clipped endpoints
00530 
00531 int
00532 plP_clipline( PLINT *p_x1, PLINT *p_y1, PLINT *p_x2, PLINT *p_y2,
00533               PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax );
00534 
00535 // Stores hex digit value into FCI (font characterization integer).
00536 void
00537 plP_hex2fci( unsigned char hexdigit, unsigned char hexpower, PLUNICODE *pfci );
00538 
00539 // Retrieves hex digit value from FCI (font characterization integer).
00540 PLDLLIMPEXP void
00541 plP_fci2hex( PLUNICODE fci, unsigned char *phexdigit, unsigned char hexpower );
00542 
00543 // Pattern fills in software the polygon bounded by the input points.
00544 
00545 PLDLLIMPEXP void
00546 plfill_soft( short *x, short *y, PLINT npts );
00547 
00548 // In case of an abort this routine is called.  It just prints out an
00549 // error message and tries to clean up as much as possible.
00550 
00551 PLDLLIMPEXP void
00552 plexit( const char *errormsg );
00553 
00554 // Just a front-end to exit().
00555 
00556 void
00557 pl_exit( void );
00558 
00559 // A handy way to issue warnings, if need be.
00560 
00561 PLDLLIMPEXP void
00562 plwarn( const char *errormsg );
00563 
00564 // Same as plwarn(), but appends ", aborting plot" to the error message
00565 
00566 PLDLLIMPEXP void
00567 plabort( const char *errormsg );
00568 
00569 // Loads either the standard or extended font.
00570 
00571 void
00572 plfntld( PLINT fnt );
00573 
00574 // Release memory for fonts.
00575 
00576 void
00577 plfontrel( void );
00578 
00579 // A replacement for strdup(), which isn't portable.
00580 
00581 PLDLLIMPEXP char *
00582 plstrdup( const char *src );
00583 
00584 // Bin up cmap 1 space and assign colors to make inverse mapping easy.
00585 
00586 PLDLLIMPEXP void
00587 plcmap1_calc( void );
00588 
00589 // Draws a slanting tick at position (mx,my) (measured in mm) of
00590 // vector length (dx,dy).
00591 
00592 void
00593 plstik( PLFLT mx, PLFLT my, PLFLT dx, PLFLT dy );
00594 
00595 // Prints out a "string" at reference position with physical coordinates
00596 // (refx,refy).
00597 
00598 void
00599 plstr( PLINT base, PLFLT *xform, PLINT refx, PLINT refy, const char *string );
00600 
00601 // Draws a tick parallel to x.
00602 
00603 void
00604 plxtik( PLINT x, PLINT y, PLINT below, PLINT above );
00605 
00606 // Draws a tick parallel to y.
00607 
00608 void
00609 plytik( PLINT x, PLINT y, PLINT left, PLINT right );
00610 
00611 // Driver interface filter --
00612 // passes all coordinates through a variety of filters.
00613 
00614 PLDLLIMPEXP void
00615 difilt( PLINT *, PLINT *, PLINT,
00616         PLINT *, PLINT *, PLINT *, PLINT * );
00617 
00618 // Transforms the clipping region coordinates as necessary
00619 // based on the current plot orientation, etc.
00620 
00621 PLDLLIMPEXP void
00622 difilt_clip( PLINT *, PLINT * );
00623 
00624 // Calculate scale of font size and scale of magnitude of vertical
00625 // offset associated with superscripts and subscripts.
00626 
00627 PLDLLIMPEXP void
00628 plP_script_scale( PLBOOL ifupper, PLINT *level,
00629                   PLFLT *old_scale, PLFLT *scale,
00630                   PLFLT *old_offset, PLFLT *offset );
00631 
00632 // Driver draws text
00633 
00634 void
00635 plP_text( PLINT base, PLFLT just, PLFLT *xform, PLINT x, PLINT y,
00636           PLINT refx, PLINT refy, const char *string );
00637 
00638 // Save LC_NUMERIC locale string, then set "C" locale to protect
00639 // parts of PLplot which absolutely demand the LC_NUMERIC "C" locale.
00640 
00641 PLDLLIMPEXP char *
00642 plsave_set_locale( void );
00643 
00644 // Restore LC_NUMERIC locale that was determined by plsave_set_locale.
00645 
00646 PLDLLIMPEXP void
00647 plrestore_locale( char * save_lc_numeric_locale );
00648 
00649 // where should structure definitions that must be seen by drivers and core source files, be?
00650 
00651 // structure to be used by plcore.c and anydriver.c, related to plP_text()
00652 
00653 typedef struct
00654 {
00655     PLINT          base;           // ref point at base(1) or center(0) of text. Currently plplot only use 0
00656     PLFLT          just;           // continuos justification, 0 left, 0.5 center, 1 right
00657     PLFLT          *xform;         // transformation (rotation) matrix
00658     PLINT          x;              // raw reference point--after any transformation
00659     PLINT          y;
00660     PLINT          refx;           // processed ref. point--after justification, displacement, etc, processing
00661     PLINT          refy;
00662     char           font_face;      // font face OPTIONALLY used for rendering hershey codes
00663     // The following 3 fields are used by the alternative text handling pathway.
00664     // See drivers/cairo.h for details about how this works.
00665     PLUNICODE      n_fci;          // font storage for unicode font handling
00666     PLUNICODE      n_char;         // character storage for unicode font handling
00667     PLINT          n_ctrl_char;    // control character code storage for unicode font handling
00668     PLUNICODE      unicode_char;   // an int to hold either a Hershey, ASC-II, or Unicode value for plsym calls
00669     PLUNICODE      *unicode_array; // a pointer to an array of ints holding either a Hershey, ASC-II, or Unicode value for cached plsym
00670     unsigned short unicode_array_len;
00671     const char     *string;        // text to draw
00672 }EscText;
00673 
00674 //
00675 // structure that contains driver specific information, to be used by plargs.c and anydriver.c,
00676 // related to plParseDrvOpts() and plHelpDrvOpts()
00677 //
00678 
00679 typedef struct
00680 {
00681     const char *opt;     // a string with the name of the option
00682     PLINT      type;     // the type of the variable to be set, see bellow the available types
00683     void       *var_ptr; // a pointer to the variable to be set
00684     const char *hlp_msg; // help message of the option
00685 } DrvOpt;
00686 
00687 // the available variable types, DrvOpt.type, for driver specific options
00688 
00689 enum { DRV_INT, DRV_FLT, DRV_STR };
00690 
00691 // parse driver specific options, as in -drvopt <option[=value]>*
00692 
00693 PLDLLIMPEXP int
00694 plParseDrvOpts( DrvOpt * );
00695 
00696 // give help on driver specific options
00697 
00698 void
00699 plHelpDrvOpts( DrvOpt * );
00700 
00701 //
00702 // structures to store contour lines
00703 //
00704 
00705 #define LINE_ITEMS    20
00706 
00707 typedef struct cont_line
00708 {
00709     PLFLT            *x;
00710     PLFLT            *y;
00711     PLINT            npts;
00712     struct cont_line *next;
00713 } CONT_LINE;
00714 
00715 typedef struct cont_level
00716 {
00717     // INDENT-OFF (stop infinite recursion)
00718     PLFLT level;             // contour level
00719     struct cont_line  *line; // contour line struct
00720     struct cont_level *next; // contour level struct
00721     // INDENT-ON
00722 } CONT_LEVEL;
00723 
00724 void
00725 cont_store( const PLFLT * const *f, PLINT nx, PLINT ny,
00726             PLINT kx, PLINT lx, PLINT ky, PLINT ly,
00727             const PLFLT *clevel, PLINT nlevel,
00728             void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
00729             PLPointer pltr_data,
00730             CONT_LEVEL **contour );
00731 
00732 void
00733 cont_clean_store( CONT_LEVEL *ct );
00734 
00735 // Get the viewport boundaries in world coordinates, expanded slightly
00736 
00737 void
00738 plP_xgvpw( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax );
00739 
00740 // Get x-y domain in world coordinates for 3d plots
00741 
00742 void
00743 plP_gdom( PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax );
00744 
00745 // Get vertical (z) scale parameters for 3-d plot
00746 
00747 void
00748 plP_grange( PLFLT *p_zscl, PLFLT *p_zmin, PLFLT *p_zmax );
00749 
00750 // Get parameters used in 3d plots
00751 
00752 void
00753 plP_gw3wc( PLFLT *p_dxx, PLFLT *p_dxy, PLFLT *p_dyx, PLFLT *p_dyy,
00754            PLFLT *p_dyz );
00755 
00756 // Get clip boundaries in physical coordinates
00757 
00758 void
00759 plP_gclp( PLINT *p_ixmin, PLINT *p_ixmax, PLINT *p_iymin, PLINT *p_iymax );
00760 
00761 // Set clip boundaries in physical coordinates
00762 
00763 void
00764 plP_sclp( PLINT ixmin, PLINT ixmax, PLINT iymin, PLINT iymax );
00765 
00766 // Get physical device limits in physical coordinates
00767 
00768 PLDLLIMPEXP void
00769 plP_gphy( PLINT *p_ixmin, PLINT *p_ixmax, PLINT *p_iymin, PLINT *p_iymax );
00770 
00771 // Get number of subpages on physical device and current subpage
00772 
00773 PLDLLIMPEXP void
00774 plP_gsub( PLINT *p_nx, PLINT *p_ny, PLINT *p_cs );
00775 
00776 // Set number of subpages on physical device and current subpage
00777 
00778 PLDLLIMPEXP void
00779 plP_ssub( PLINT nx, PLINT ny, PLINT cs );
00780 
00781 // Set up plot parameters according to the number of subpages.
00782 
00783 void
00784 plP_subpInit( void );
00785 
00786 // Get number of pixels to a millimeter
00787 
00788 PLDLLIMPEXP void
00789 plP_gpixmm( PLFLT *p_x, PLFLT *p_y );
00790 
00791 // All the drivers call this to set physical pixels/mm.
00792 
00793 PLDLLIMPEXP void
00794 plP_setpxl( PLFLT xpmm0, PLFLT ypmm0 );
00795 
00796 // Get background parameters (including line width) for 3d plot.
00797 
00798 void
00799 plP_gzback( PLINT **zbf, PLINT **zbc, PLFLT **zbt, PLFLT **zbw );
00800 
00801 // Move to physical coordinates (x,y).
00802 
00803 void
00804 plP_movphy( PLINT x, PLINT y );
00805 
00806 // Draw to physical coordinates (x,y).
00807 
00808 void
00809 plP_draphy( PLINT x, PLINT y );
00810 
00811 // Move to world coordinates (x,y).
00812 
00813 void
00814 plP_movwor( PLFLT x, PLFLT y );
00815 
00816 // Draw to world coordinates (x,y).
00817 
00818 void
00819 plP_drawor( PLFLT x, PLFLT y );
00820 
00821 // Draw polyline in physical coordinates.
00822 
00823 void
00824 plP_draphy_poly( PLINT *x, PLINT *y, PLINT n );
00825 
00826 // Draw polyline in world coordinates.
00827 
00828 void
00829 plP_drawor_poly( const PLFLT *x, const PLFLT *y, PLINT n );
00830 
00831 // Sets up physical limits of plotting device.
00832 
00833 PLDLLIMPEXP void
00834 plP_setphy( PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax );
00835 
00836 // Set up the subpage boundaries according to the current subpage selected
00837 
00838 PLDLLIMPEXP void
00839 plP_setsub( void );
00840 
00841 // Get the floating point precision (in number of places) in numeric labels.
00842 
00843 void
00844 plP_gprec( PLINT *p_setp, PLINT *p_prec );
00845 
00846 // Get the date / time format for numeric labels
00847 
00848 const char *
00849 plP_gtimefmt( void );
00850 
00851 // Computes the length of a string in mm, including escape sequences.
00852 
00853 PLFLT
00854 plstrl( const char *string );
00855 
00856 // Similar to strpos, but searches for occurence of string str2.
00857 
00858 PLINT
00859 plP_stindex( const char *str1, const char *str2 );
00860 
00861 // Searches string str for first occurence of character chr.
00862 
00863 PLDLLIMPEXP PLINT
00864 plP_strpos( const char *str, int chr );
00865 
00866 // Searches string str for character chr (case insensitive).
00867 
00868 PLBOOL
00869 plP_stsearch( const char *str, int chr );
00870 
00871 // Conversion functions
00872 
00873 // device coords to physical coords (x)
00874 
00875 PLINT
00876 plP_dcpcx( PLFLT x );
00877 
00878 // device coords to physical coords (y)
00879 
00880 PLINT
00881 plP_dcpcy( PLFLT y );
00882 
00883 // millimeters from bottom left-hand corner to physical coords (x)
00884 
00885 PLINT
00886 plP_mmpcx( PLFLT x );
00887 
00888 // millimeters from bottom left-hand corner to physical coords (y)
00889 
00890 PLINT
00891 plP_mmpcy( PLFLT y );
00892 
00893 // world coords to physical coords (x)
00894 
00895 PLINT
00896 plP_wcpcx( PLFLT x );
00897 
00898 // world coords to physical coords (y)
00899 
00900 PLINT
00901 plP_wcpcy( PLFLT y );
00902 
00903 // physical coords to device coords (x)
00904 
00905 PLFLT
00906 plP_pcdcx( PLINT x );
00907 
00908 // physical coords to device coords (y)
00909 
00910 PLFLT
00911 plP_pcdcy( PLINT y );
00912 
00913 // millimeters from bottom left corner to device coords (x)
00914 
00915 PLFLT
00916 plP_mmdcx( PLFLT x );
00917 
00918 // millimeters from bottom left corner to device coords (y)
00919 
00920 PLFLT
00921 plP_mmdcy( PLFLT y );
00922 
00923 // world coords into device coords (x)
00924 
00925 PLFLT
00926 plP_wcdcx( PLFLT x );
00927 
00928 // world coords into device coords (y)
00929 
00930 PLFLT
00931 plP_wcdcy( PLFLT y );
00932 
00933 // subpage coords to device coords (x)
00934 
00935 PLFLT
00936 plP_scdcx( PLFLT x );
00937 
00938 // subpage coords to device coords (y)
00939 
00940 PLFLT
00941 plP_scdcy( PLFLT y );
00942 
00943 // device coords to millimeters from bottom left-hand corner (x)
00944 
00945 PLFLT
00946 plP_dcmmx( PLFLT x );
00947 
00948 // device coords to millimeters from bottom left-hand corner (y)
00949 
00950 PLFLT
00951 plP_dcmmy( PLFLT y );
00952 
00953 // world coords into millimeters (x)
00954 
00955 PLFLT
00956 plP_wcmmx( PLFLT x );
00957 
00958 // world coords into millimeters (y)
00959 
00960 PLFLT
00961 plP_wcmmy( PLFLT y );
00962 
00963 // device coords to subpage coords (x)
00964 
00965 PLFLT
00966 plP_dcscx( PLFLT x );
00967 
00968 // device coords to subpage coords (y)
00969 
00970 PLFLT
00971 plP_dcscy( PLFLT y );
00972 
00973 // 3-d coords to 2-d projection (x)
00974 
00975 PLFLT
00976 plP_w3wcx( PLFLT x, PLFLT y, PLFLT z );
00977 
00978 // 3-d coords to 2-d projection (y)
00979 
00980 PLFLT
00981 plP_w3wcy( PLFLT x, PLFLT y, PLFLT z );
00982 
00983 // 3-d coords to 2-d projection (z)
00984 
00985 PLFLT
00986 plP_w3wcz( PLFLT x, PLFLT y, PLFLT z );
00987 
00988 // Returns the rotation and shear angle and stride from a plplot transformation matrix
00989 
00990 PLDLLIMPEXP void
00991 plRotationShear( PLFLT *xFormMatrix, PLFLT *rotation, PLFLT *shear, PLFLT *stride );
00992 
00993 // Test whether a point is in a polygon.
00994 int
00995 plP_pointinpolygon( PLINT n, const PLFLT *x, const PLFLT *y,
00996                     PLFLT xp, PLFLT yp );
00997 
00998 // Driver calls
00999 
01000 // Initialize device.
01001 
01002 void
01003 plP_init( void );
01004 
01005 // Draw line between two points
01006 
01007 void
01008 plP_line( short *x, short *y );
01009 
01010 // Draw polyline
01011 
01012 void
01013 plP_polyline( short *x, short *y, PLINT npts );
01014 
01015 // Fill polygon
01016 
01017 void
01018 plP_fill( short *x, short *y, PLINT npts );
01019 
01020 // Render gradient
01021 
01022 void
01023 plP_gradient( short *x, short *y, PLINT npts );
01024 
01025 // draw image
01026 
01027 void
01028 plP_image( PLFLT *z, PLINT nx, PLINT ny, PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy,
01029            void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ), PLPointer pltr_data );
01030 
01031 // Structure for holding arc data
01032 typedef struct
01033 {
01034     PLFLT  x;
01035     PLFLT  y;
01036     PLFLT  a;
01037     PLFLT  b;
01038     PLFLT  angle1;
01039     PLFLT  angle2;
01040     PLFLT  rotate;
01041     PLBOOL fill;
01042 } arc_struct;
01043 
01044 // End of page
01045 
01046 PLDLLIMPEXP void
01047 plP_eop( void );
01048 
01049 // End of page
01050 
01051 PLDLLIMPEXP void
01052 plP_bop( void );
01053 
01054 // Tidy up device (flush buffers, close file, etc.)
01055 
01056 void
01057 plP_tidy( void );
01058 
01059 // Change state.
01060 
01061 PLDLLIMPEXP void
01062 plP_state( PLINT op );
01063 
01064 // Escape function, for driver-specific commands.
01065 
01066 PLDLLIMPEXP void
01067 plP_esc( PLINT op, void *ptr );
01068 
01069 // Set up plot window parameters.
01070 
01071 void
01072 plP_swin( PLWindow *plwin );
01073 
01074 // Return file pointer to lib file.
01075 
01076 FILE *
01077 plLibOpen( const char *fn );
01078 
01079 // Does required startup initialization of library.
01080 
01081 PLDLLIMPEXP void
01082 pllib_init( void );
01083 
01084 // Does preliminary setup of device driver.
01085 
01086 PLDLLIMPEXP void
01087 pllib_devinit( void );
01088 
01089 // Utility to copy one PLColor to another.
01090 
01091 PLDLLIMPEXP void
01092 pl_cpcolor( PLColor *to, PLColor *from );
01093 
01094 // Does required startup initialization of a stream.
01095 
01096 void
01097 plstrm_init( void );
01098 
01099 // Builds a list of the active devices/streams by device name
01100 
01101 void
01102 PLDLLIMPEXP plP_getinitdriverlist( char *names );
01103 
01104 // Checks a give list of device names against active streams and returns the number of matches
01105 
01106 PLINT
01107 plP_checkdriverinit( char *names );
01108 
01109 // disable writing to plot buffer and pixmap
01110 void
01111 NoBufferNoPixmap( void );
01112 
01113 // restart writing to plot buffer and pixmap
01114 void
01115 RestoreWrite2BufferPixmap( void );
01116 
01117 void
01118 grimage( short *x, short *y, unsigned short *z, PLINT nx, PLINT ny );
01119 
01120 PLDLLIMPEXP int
01121 plInBuildTree( void );
01122 
01123 void
01124 plimageslow( PLFLT *idata, PLINT nx, PLINT ny,
01125              PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy,
01126              void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
01127              PLPointer pltr_data );
01128 
01129 typedef struct
01130 {
01131     PLFLT xmin, ymin, dx, dy;
01132 } IMG_DT;
01133 
01134 //
01135 // void plfvect()
01136 //
01137 // Internal routine to plot a vector array with arbitrary coordinate
01138 // and vector transformations.
01139 // This is not currently intended to be called direct by the user
01140 //
01141 PLDLLIMPEXP void
01142 plfvect( PLFLT ( *plf2eval )( PLINT, PLINT, PLPointer ),
01143          PLPointer f2evalv_data, PLPointer f2evalc_data,
01144          PLINT nx, PLINT ny, PLFLT scale,
01145          void ( *pltr )( PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer ),
01146          PLPointer pltr_data );
01147 
01148 //
01149 //  Internal function to get an index to the hershey table
01150 //
01151 int
01152 plhershey2unicode( int in );
01153 
01154 // struct used for FCI to FontName lookups.
01155 typedef struct
01156 {
01157     PLUNICODE           fci;
01158     const unsigned char *pfont;
01159 } FCI_to_FontName_Table;
01160 
01161 // Internal function to obtain a pointer to a valid font name.
01162 PLDLLIMPEXP const char *
01163 plP_FCI2FontName( PLUNICODE fci,
01164                   const FCI_to_FontName_Table lookup[], const int nlookup );
01165 
01166 
01167 // Internal function to free memory from driver options
01168 void
01169 plP_FreeDrvOpts( void );
01170 
01171 // Convert a ucs4 unichar to utf8 char string
01172 PLDLLIMPEXP int
01173 ucs4_to_utf8( PLUNICODE unichar, char *ptr );
01174 
01175 //
01176 // Wrapper functions for the system IO routines fread, fwrite
01177 //
01178 
01179 // wraps fwrite
01180 
01181 void
01182 plio_fwrite( void *, size_t, size_t, FILE * );
01183 
01184 // wraps fread
01185 
01186 void
01187 plio_fread( void *, size_t, size_t, FILE * );
01188 
01189 // wraps fgets
01190 
01191 void
01192 plio_fgets( char *, int, FILE * );
01193 
01194 // Draws a tick parallel to x, using world coordinates
01195 void
01196 plwxtik( PLFLT x, PLFLT y, PLBOOL minor, PLBOOL invert );
01197 
01198 // Draws a tick parallel to y, using world coordinates
01199 void
01200 plwytik( PLFLT x, PLFLT y, PLBOOL minor, PLBOOL invert );
01201 
01202 // get drivers directory
01203 
01204 #ifdef ENABLE_DYNDRIVERS
01205 PLDLLIMPEXP const char*
01206 plGetDrvDir( void );
01207 #endif
01208 
01209 #ifdef PL_HAVE_FREETYPE
01210 PLDLLIMPEXP void
01211 plD_FreeType_init( PLStream * );
01212 
01213 PLDLLIMPEXP void
01214 plD_render_freetype_text( PLStream *, EscText * );
01215 
01216 PLDLLIMPEXP void
01217 plD_FreeType_Destroy( PLStream * );
01218 
01219 PLDLLIMPEXP void
01220 pl_set_extended_cmap0( PLStream *, int, int );
01221 
01222 #endif
01223 
01224 // Create a temporary file securely
01225 PLDLLIMPEXP FILE *
01226 pl_create_tempfile( char **fname );
01227 
01228 // Create a temporary fifo securely
01229 PLDLLIMPEXP char *
01230 pl_create_tempfifo( const char **p_fifoname, const char **p_dirname );
01231 
01232 #ifdef __cplusplus
01233 }
01234 #endif
01235 
01236 #endif  // __PLPLOTP_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines