• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

plplotP.h

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

Generated on Wed Oct 12 2011 20:42:22 for PLplot by  doxygen 1.7.1