1 /* $Id: plplotP.h,v 1.6 2009/01/26 14:28:59 rice Exp $ 2 3 Internal (private) macros and prototypes for the PLplot package. This 4 header file must be included before all others, including system header 5 files. This file is typically needed when including driver specific 6 header files (e.g. pltkd.h). 7 8 Copyright (C) 1993, 1994, 1995 by 9 Maurice J. LeBrun, Geoff Furnish, Tony Richardson. 10 11 Copyright (C) 2004 Rafael Laboissiere 12 Copyright (C) 2004 Joao Cardoso 13 Copyright (C) 2004 Andrew Roach 14 Copyright (C) 2006 Andrew Ross 15 Copyright (C) 2006 Hazen Babcock 16 17 18 This file is part of PLplot. 19 20 PLplot is free software; you can redistribute it and/or modify 21 it under the terms of the GNU General Library Public License as published 22 by the Free Software Foundation; either version 2 of the License, or 23 (at your option) any later version. 24 25 PLplot is distributed in the hope that it will be useful, 26 but WITHOUT ANY WARRANTY; without even the implied warranty of 27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 GNU Library General Public License for more details. 29 30 You should have received a copy of the GNU Library General Public License 31 along with PLplot; if not, write to the Free Software 32 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 33 34 35 */ 36 37 #ifndef __PLPLOTP_H__ 38 #define __PLPLOTP_H__ 39 40 /*--------------------------------------------------------------------------*\ 41 * Select environment. Must be done before anything else. 42 * 43 * Basically we want the widest range of system services that are available. 44 * Fortunately on many systems, that is the default. To get "everything", 45 * one of the following must be defined, as appropriate: 46 * 47 * _GNU_SOURCE on Linux (default) 48 * _OSF_SOURCE on OSF1 (default) 49 * _HPUX_SOURCE on HP (not default) 50 * _ALL_SOURCE on AIX (no idea) 51 * 52 * To see where these are set, do the following: 53 * 54 * cd /usr/include; grep SOURCE *.h | fgrep 'define ' 55 * 56 * and the file containing lots of these is the one you want (features.h on 57 * Linux, standards.h on OSF1, etc). Follow the logic to see what needs to be 58 * defined to get "everything", i.e. POSIX.*, XOPEN, etc. 59 * 60 * Note that for specific functionality, we test using autoconf. Still it's 61 * best to stick to ANSI C, POSIX.1, and POSIX.2, in that order, for maximum 62 * portability. 63 \*--------------------------------------------------------------------------*/ 64 65 /* HPUX - if this is no longer needed, please remove it */ 66 #ifdef _HPUX 67 #define _HPUX_SOURCE 68 #endif 69 70 /* A/IX - if this is no longer needed, please remove it */ 71 #ifdef _AIX 72 #define _ALL_SOURCE 73 #endif 74 75 /* Add others here as needed. */ 76 77 /*--------------------------------------------------------------------------*\ 78 * Configuration settings 79 * 80 * Some of the macros set during configuration are described here. 81 * 82 * If HAVE_TERMIOS_H is set, we employ POSIX.1 tty terminal I/O. One purpose 83 * of this is to select character-oriented (CBREAK) i/o in the tek driver and 84 * all its variants. It is usable without this but not as powerful. The 85 * reason for using this is that some supported systems are still not 86 * POSIX.1 compliant (and some may never be). 87 * 88 * If STDC_HEADERS is defined, the system's libc is ANSI-compliant. 89 * ANSI libc calls are used for: (a) setting up handlers to be called 90 * before program exit (via the "atexit" call), and (b) for seek 91 * operations. Again, the code is usable without these. An ANSI libc 92 * should be available, given the requirement of an ANSI compiler. Some 93 * reasons why not: (a) the vendor didn't supply a complete ANSI 94 * environment, or (b) the ANSI libc calls are buggy, or (c) you ported 95 * gcc to your system but not glibc (for whatever reason). Note: without 96 * an ANSI C lib, if you ^C out of a program using one of the PLplot tek 97 * drivers, your terminal may be left in a strange state. 98 \*--------------------------------------------------------------------------*/ 99 100 #include "plConfig.h" 101 #ifdef caddr_t 102 #undef caddr_t 103 #ifndef __USE_BSD 104 typedef char * caddr_t; 105 #endif 106 #endif 107 108 /* System headers */ 109 110 #include <ctype.h> 111 #include <math.h> 112 #include <string.h> 113 #include <limits.h> 114 #include <float.h> 115 #if defined(PLPLOT_WINTK) 116 #elif defined(WIN32) &! defined (__GNUC__) 117 /* Redefine tmpfile()! (AM)*/ 118 #define tmpfile w32_tmpfile 119 #else 120 #include <unistd.h> 121 #endif 122 123 /* (AM) Define M_PI if the platform does not include it 124 (MSVC for instance) */ 125 #if !defined(M_PI) 126 #define M_PI 3.14159265358979323846 127 #endif 128 129 #if HAVE_DIRENT_H 130 /* The following conditional is a workaround for a bug in the MacOSX system. 131 When the dirent.h file will be fixed upstream by Apple Inc, this should 132 go away. */ 133 # ifdef NEED_SYS_TYPE_H 134 # include <sys/types.h> 135 # endif 136 # include <dirent.h> 137 # define NAMLEN(dirent) strlen((dirent)->d_name) 138 #else 139 # define dirent direct 140 # define NAMLEN(dirent) (dirent)->d_namlen 141 # if HAVE_SYS_NDIR_H 142 # include <sys/ndir.h> 143 # endif 144 # if HAVE_SYS_DIR_H 145 # include <sys/dir.h> 146 # endif 147 # if HAVE_NDIR_H 148 # include <ndir.h> 149 # endif 150 #endif 151 152 /* 153 * Macros for file positioning. I tried switching to f[sg]etpos() because I 154 * like the semantics better, but ran into the problem that fpos_t is not 155 * always a base type (it may be a struct). This is a problem because the 156 * metafile driver needs to write relative offsets into the file itself. So 157 * instead we use f{seek,tell} at a low level but keep the f[sg]etpos 158 * semantics using these macros. 159 */ 160 161 #ifdef STDC_FPOS_T 162 #undef STDC_FPOS_T 163 #endif 164 165 #ifdef STDC_FPOS_T 166 #define FPOS_T fpos_t 167 #define pl_fsetpos(a,b) fsetpos(a, b) 168 #define pl_fgetpos(a,b) fgetpos(a, b) 169 170 #else 171 #define FPOS_T long 172 #define pl_fsetpos(a,b) fseek(a, *b, 0) 173 #define pl_fgetpos(a,b) (-1L == (*b = ftell(a))) 174 #endif 175 176 /* Include all externally-visible definitions and prototypes */ 177 /* plplot.h also includes some handy system header files */ 178 179 #include "plplot.h" 180 181 /* plstream definition */ 182 183 #include "plstrm.h" 184 185 /* If not including this file from inside of plcore.h, declare plsc */ 186 187 #ifndef __PLCORE_H__ 188 #ifdef __cplusplus 189 extern "C" { 190 #endif 191 /* extern PLStream PLDLLIMPORT *plsc; */ 192 extern PLDLLIMPEXP_DATA(PLStream *)plsc; 193 #ifdef __cplusplus 194 } 195 #endif 196 #include "pldebug.h" 197 #endif 198 199 /*--------------------------------------------------------------------------*\ 200 * Utility macros 201 \*--------------------------------------------------------------------------*/ 202 203 #ifndef TRUE 204 #define TRUE 1 205 #define FALSE 0 206 #endif 207 208 /* Used to help ensure everything malloc'ed gets freed */ 209 210 #define free_mem(a) \ 211 if (a != NULL) { free((void *) a); a = NULL; } 212 213 /* Allows multi-argument setup calls to not affect selected arguments */ 214 215 #define plsetvar(a, b) \ 216 if (b != PL_NOTSET) a = b; 217 218 /* Lots of cool math macros */ 219 220 #ifndef MAX 221 #define MAX(a,b) (((a) > (b)) ? (a) : (b)) 222 #endif 223 #ifndef MIN 224 #define MIN(a,b) (((a) < (b)) ? (a) : (b)) 225 #endif 226 #ifndef ABS 227 #define ABS(a) ((a)<0 ? -(a) : (a)) 228 #endif 229 #ifndef ROUND 230 #define ROUND(a) (PLINT)((a)<0. ? ((a)-.5) : ((a)+.5)) 231 #endif 232 #ifndef BETW 233 #define BETW(ix,ia,ib) (((ix)<=(ia)&&(ix)>=(ib)) || ((ix)>=(ia)&&(ix)<=(ib))) 234 #endif 235 #ifndef SSQR 236 #define SSQR(a,b) sqrt((a)*(a)+(b)*(b)) 237 #endif 238 #ifndef SIGN 239 #define SIGN(a) ((a)<0 ? -1 : 1) 240 #endif 241 242 /* A coordinate value that should never occur */ 243 244 #define PL_UNDEFINED -9999999 245 246 /*--------------------------------------------------------------------------*\ 247 * PLPLOT control macros 248 \*--------------------------------------------------------------------------*/ 249 250 /* Some constants */ 251 252 #define PL_MAXPOLY 256 /* Max segments in polyline or polygon */ 253 #define PL_NSTREAMS 100 /* Max number of concurrent streams. */ 254 #define PL_RGB_COLOR -1 /* A hack */ 255 256 #define TEXT_MODE 0 257 #define GRAPHICS_MODE 1 258 #ifndef PI 259 #define PI 3.1415926535897932384 260 #endif 261 262 /* These define the virtual coordinate system used by the metafile driver. 263 Others are free to use it, or some variation, or define their own. */ 264 265 /* Note desktop monitors of reasonable quality typically have 0.25 mm spacing 266 * between dots which corresponds to 4.0 dots per mm. The parameters here 267 * roughly correspond to a 14" monitor at 1024x768 resolution, which should 268 * work fine at other sizes/resolutions. The number of virtual dots per mm is 269 * scaled by a factor of 32, with pixels scaled accordingly. The customary 270 * x/y ratio of 4:3 is used. 271 */ 272 273 #define PIXELS_X 32768 /* Number of virtual pixels in x */ 274 #define PIXELS_Y 24576 /* Number of virtual pixels in x */ 275 #define DPMM 4. /* dots per mm */ 276 #define VDPMM (DPMM*32) /* virtual dots per mm */ 277 #define LPAGE_X (PIXELS_X/VDPMM) /* virtual page length in x in mm (256) */ 278 #define LPAGE_Y (PIXELS_Y/VDPMM) /* virtual page length in y in mm (192) */ 279 280 /* This defines the first argument of the plRotPhy invocation that is made 281 * in a number of device drivers (e.g., found in ljii.c, ljiip.c, ps.c, 282 * and pstex.c) to rotate them "permanently" from portrait mode to non- 283 * portrait mode. ORIENTATION of 1 corresponds to seascape mode (90 deg 284 * clockwise rotation from portrait). This is the traditional value 285 * effectively used in all older versions of PLplot. ORIENTATION of 3 286 * corresponds to landscape mode (90 deg *counter*-clockwise rotation from 287 * portrait) which is the new default non-portrait orientation. */ 288 289 #define ORIENTATION 3 290 291 /* Switches for state function call. */ 292 293 #define PLSTATE_WIDTH 1 /* pen width */ 294 #define PLSTATE_COLOR0 2 /* change to color in cmap 0 */ 295 #define PLSTATE_COLOR1 3 /* change to color in cmap 1 */ 296 #define PLSTATE_FILL 4 /* set area fill attribute */ 297 #define PLSTATE_CMAP0 5 /* change to cmap 0 */ 298 #define PLSTATE_CMAP1 6 /* change to cmap 1 */ 299 300 /* Bit switches used in the driver interface */ 301 302 #define PLDI_MAP 0x01 303 #define PLDI_ORI 0x02 304 #define PLDI_PLT 0x04 305 #define PLDI_DEV 0x08 306 307 /* Default size for family files, in KB. */ 308 309 #ifndef PL_FILESIZE_KB 310 #define PL_FILESIZE_KB 1000 311 #endif 312 313 /* Font file names. */ 314 315 #define PLPLOT5_FONTS 316 317 #ifdef PLPLOT5_FONTS 318 #define PL_XFONT "plxtnd5.fnt" 319 #define PL_SFONT "plstnd5.fnt" 320 #else 321 #define PL_XFONT "plxtnd4.fnt" 322 #define PL_SFONT "plstnd4.fnt" 323 #endif 324 325 /*--------------------------------------------------------------------------*\ 326 * The following environment variables are defined: 327 * 328 * PLPLOT_BIN # where to find executables 329 * PLPLOT_LIB # where to find library files (fonts, maps, etc) 330 * PLPLOT_TCL # where to find tcl scripts 331 * 332 * PLPLOT_HOME # basename of plplot hierarchy 333 * 334 * search order: 335 * 1) the most specific possible locators, one of 336 * $(PLPLOT_BIN) 337 * $(PLPLOT_LIB) 338 * $(PLPLOT_TCL) 339 * as appropriate 340 * 341 * 2) the current directory 342 * 343 * 3) one of $(PLPLOT_HOME)/bin 344 * $(PLPLOT_HOME)/lib 345 * $(PLPLOT_HOME)/tcl 346 * as appropriate 347 * 348 * 4) as appropriate, the compile-time (Makefile) 349 * BIN_DIR, LIB_DIR, TCL_DIR 350 * 351 * 8 Jun 1994 mj olesen (olesen@weber.me.queensu.ca) 352 * 353 * Other notes: 354 * 355 * In addition to the directories above, the following are also used: 356 * 357 * Lib file search path: PLLIBDEV (see plctrl.c). This is checked last, 358 * and is a system-dependent hardwired location. 359 * 360 * Tcl search path: $HOME/tcl is searched before the install location, 361 * TCL_DIR. 362 \*--------------------------------------------------------------------------*/ 363 364 #define PLPLOT_BIN_ENV "EPLPLOT_BIN" 365 #define PLPLOT_LIB_ENV "EPLPLOT_LIB" 366 #define PLPLOT_TCL_ENV "EPLPLOT_TCL" 367 #define PLPLOT_HOME_ENV "EPLPLOT_HOME" 368 369 /* 370 * Some stuff that is included (and compiled into) plsym.h 371 * Other modules might want this, so we will "extern" it 372 * 373 */ 374 375 #ifndef __PLSYM_H__ 376 377 typedef struct { 378 unsigned int Hershey; 379 PLUNICODE Unicode; 380 char Font; 381 char padding[3]; /* pad to align */ 382 } Hershey_to_Unicode_table; 383 384 extern int number_of_entries_in_hershey_to_unicode_table; 385 extern Hershey_to_Unicode_table hershey_to_unicode_lookup_table[]; 386 387 388 #endif 389 390 /* Greek character translation array (defined in plcore.c) */ 391 extern const char plP_greek_mnemonic[]; 392 393 394 /*--------------------------------------------------------------------------*\ 395 * Function Prototypes 396 * 397 * These typically should not be called directly by the user. 398 \*--------------------------------------------------------------------------*/ 399 400 #ifdef __cplusplus 401 extern "C" { 402 #endif 403 404 /* Determines interval between numeric labels */ 405 406 void 407 pldtik(PLFLT vmin, PLFLT vmax, PLFLT *tick, PLINT *nsubt); 408 409 /* Determines precision of box labels */ 410 411 void 412 pldprec(PLFLT vmin, PLFLT vmax, PLFLT tick, PLINT lf, 413 PLINT *mode, PLINT *prec, PLINT digmax, PLINT *scale); 414 415 /* Draws a polyline within the clip limits. */ 416 417 void 418 plP_pllclp(PLINT *x, PLINT *y, PLINT npts, 419 PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax, 420 void (*draw) (short *, short *, PLINT)); 421 422 /* Fills a polygon within the clip limits. */ 423 424 void 425 plP_plfclp(PLINT *x, PLINT *y, PLINT npts, 426 PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax, 427 void (*draw) (short *, short *, PLINT)); 428 429 /* Clip a polygon to the 3d bounding plane */ 430 int 431 plP_clip_poly(int Ni, PLFLT *Vi[3], int axis, PLFLT dir, PLFLT offset); 432 433 /* Stores hex digit value into FCI (font characterization integer). */ 434 void 435 plP_hex2fci(unsigned char hexdigit, unsigned char hexpower, PLUNICODE *pfci); 436 437 /* Retrieves hex digit value from FCI (font characterization integer). */ 438 void 439 plP_fci2hex(PLUNICODE fci, unsigned char *phexdigit, unsigned char hexpower); 440 441 /* Pattern fills in software the polygon bounded by the input points. */ 442 443 void 444 plfill_soft(short *x, short *y, PLINT npts); 445 446 /* In case of an abort this routine is called. It just prints out an */ 447 /* error message and tries to clean up as much as possible. */ 448 449 PLDLLIMPEXP void 450 plexit(const char *errormsg); /* pmr: const */ 451 452 /* Just a front-end to exit(). */ 453 454 void 455 pl_exit(void); 456 457 /* A handy way to issue warnings, if need be. */ 458 459 PLDLLIMPEXP void 460 plwarn(const char *errormsg); /* pmr: const */ 461 462 /* Same as plwarn(), but appends ", aborting plot" to the error message */ 463 464 PLDLLIMPEXP void 465 plabort(const char *errormsg); /* pmr: const */ 466 467 /* Loads either the standard or extended font. */ 468 469 void 470 plfntld(PLINT fnt); 471 472 /* Release memory for fonts. */ 473 474 void 475 plfontrel(void); 476 477 /* A replacement for strdup(), which isn't portable. */ 478 479 char PLDLLIMPEXP * 480 plstrdup(const char *src); 481 482 /* Bin up cmap 1 space and assign colors to make inverse mapping easy. */ 483 484 void 485 plcmap1_calc(void); 486 487 /* Draws a slanting tick at position (mx,my) (measured in mm) of */ 488 /* vector length (dx,dy). */ 489 490 void 491 plstik(PLFLT mx, PLFLT my, PLFLT dx, PLFLT dy); 492 493 /* Prints out a "string" at reference position with physical coordinates */ 494 /* (refx,refy). */ 495 496 void 497 plstr(PLINT base, PLFLT *xform, PLINT refx, PLINT refy, const char *string); 498 499 /* Draws a tick parallel to x. */ 500 501 void 502 plxtik(PLINT x, PLINT y, PLINT below, PLINT above); 503 504 /* Draws a tick parallel to y. */ 505 506 void 507 plytik(PLINT x, PLINT y, PLINT left, PLINT right); 508 509 /* Driver interface filter -- 510 passes all coordinates through a variety of filters. */ 511 512 void 513 difilt(PLINT *, PLINT *, PLINT, 514 PLINT *, PLINT *, PLINT *, PLINT *); 515 516 /* Driver draws text */ 517 518 void 519 plP_text(PLINT base, PLFLT just, PLFLT *xform, PLINT x, PLINT y, 520 PLINT refx, PLINT refy, const char *string); 521 522 /* where should structure definitions that must be seen by drivers and core source files, be? */ 523 524 /* structure to be used by plcore.c and anydriver.c, related to plP_text() */ 525 526 typedef struct { 527 PLINT base; /* ref point at base(1) or center(0) of text. Currently plplot only use 0 */ 528 PLFLT just; /* continuos justification, 0 left, 0.5 center, 1 right */ 529 PLFLT *xform; /* transformation (rotation) matrix */ 530 PLINT x; /* raw reference point--after any transformation */ 531 PLINT y; 532 PLINT refx; /* processed ref. point--after justification, displacement, etc, processing */ 533 PLINT refy; 534 PLUNICODE unicode_char; /* an int to hold either a Hershey, ASC-II, or Unicode value for plsym calls */ 535 char Padding1[4]; 536 537 PLUNICODE *unicode_array; /* a pointer to an array of ints holding either a Hershey, ASC-II, or Unicode value for cached plsym */ 538 const char *string; /* text to draw */ 539 unsigned short unicode_array_len; /* pmr: swap to align */ 540 char font_face; /* font face OPTIONALLY used for rendering hershey codes */ 541 char padding[5]; /* pad to align */ 542 }EscText; 543 544 /* 545 * structure that contains driver specific information, to be used by plargs.c and anydriver.c, 546 * related to plParseDrvOpts() and plHelpDrvOpts() 547 */ 548 549 typedef struct { 550 const char *opt; /* a string with the name of the option */ 551 PLINT type; /* the type of the variable to be set, see bellow the available types */ 552 PLINT Padding; 553 void *var_ptr; /* a pointer to the variable to be set */ 554 const char *hlp_msg; /* help message of the option */ 555 } DrvOpt; 556 557 /* the available variable types, DrvOpt.type, for driver specific options */ 558 559 enum {DRV_INT, DRV_FLT, DRV_STR}; 560 561 /* parse driver specific options, as in -drvopt <option[=value]>* */ 562 563 int 564 plParseDrvOpts(DrvOpt *); 565 566 /* give help on driver specific options */ 567 568 void 569 plHelpDrvOpts(DrvOpt *); 570 571 /* 572 * structures to store contour lines 573 */ 574 575 #define LINE_ITEMS 20 576 577 typedef struct cont_line { 578 PLFLT *x; 579 PLFLT *y; 580 PLINT npts; 581 char Padding1[4]; 582 struct cont_line *next; 583 } CONT_LINE; 584 585 typedef struct cont_level { 586 PLFLT level; 587 char Padding1[4]; 588 struct cont_line *line; /* contour line */ 589 struct cont_level *next; /* contour level */ 590 } CONT_LEVEL; 591 592 void 593 cont_store(PLFLT **f, PLINT nx, PLINT ny, 594 PLINT kx, PLINT lx, PLINT ky, PLINT ly, 595 PLFLT *clevel, PLINT nlevel, 596 void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), 597 PLPointer pltr_data, 598 CONT_LEVEL **contour); 599 600 void 601 cont_clean_store(CONT_LEVEL *ct); 602 603 /* Get x-y domain in world coordinates for 3d plots */ 604 605 void 606 plP_gdom(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax); 607 608 /* Get vertical (z) scale parameters for 3-d plot */ 609 610 void 611 plP_grange(PLFLT *p_zscl, PLFLT *p_zmin, PLFLT *p_zmax); 612 613 /* Get parameters used in 3d plots */ 614 615 void 616 plP_gw3wc(PLFLT *p_dxx, PLFLT *p_dxy, PLFLT *p_dyx, PLFLT *p_dyy, 617 PLFLT *p_dyz); 618 619 /* Get clip boundaries in physical coordinates */ 620 621 void 622 plP_gclp(PLINT *p_ixmin, PLINT *p_ixmax, PLINT *p_iymin, PLINT *p_iymax); 623 624 /* Set clip boundaries in physical coordinates */ 625 626 void 627 plP_sclp(PLINT ixmin, PLINT ixmax, PLINT iymin, PLINT iymax); 628 629 /* Get physical device limits in physical coordinates */ 630 631 PLDLLIMPEXP void 632 plP_gphy(PLINT *p_ixmin, PLINT *p_ixmax, PLINT *p_iymin, PLINT *p_iymax); 633 634 /* Get number of subpages on physical device and current subpage */ 635 636 PLDLLIMPEXP void 637 plP_gsub(PLINT *p_nx, PLINT *p_ny, PLINT *p_cs); 638 639 /* Set number of subpages on physical device and current subpage */ 640 641 PLDLLIMPEXP void 642 plP_ssub(PLINT nx, PLINT ny, PLINT cs); 643 644 /* Set up plot parameters according to the number of subpages. */ 645 646 void 647 plP_subpInit(void); 648 649 /* Get number of pixels to a millimeter */ 650 651 PLDLLIMPEXP void 652 plP_gpixmm(PLFLT *p_x, PLFLT *p_y); 653 654 /* All the drivers call this to set physical pixels/mm. */ 655 656 void 657 plP_setpxl(PLFLT xpmm0, PLFLT ypmm0); 658 659 /* Get background parameters (including line width) for 3d plot. */ 660 661 void 662 plP_gzback(PLINT **zbf, PLINT **zbc, PLFLT **zbt, PLINT **zbw); 663 664 /* Move to physical coordinates (x,y). */ 665 666 void 667 plP_movphy(PLINT x, PLINT y); 668 669 /* Draw to physical coordinates (x,y). */ 670 671 void 672 plP_draphy(PLINT x, PLINT y); 673 674 /* Move to world coordinates (x,y). */ 675 676 void 677 plP_movwor(PLFLT x, PLFLT y); 678 679 /* Draw to world coordinates (x,y). */ 680 681 void 682 plP_drawor(PLFLT x, PLFLT y); 683 684 /* Draw polyline in physical coordinates. */ 685 686 void 687 plP_draphy_poly(PLINT *x, PLINT *y, PLINT n); 688 689 /* Draw polyline in world coordinates. */ 690 691 void 692 plP_drawor_poly(PLFLT *x, PLFLT *y, PLINT n); 693 694 /* Sets up physical limits of plotting device. */ 695 696 void 697 plP_setphy(PLINT xmin, PLINT xmax, PLINT ymin, PLINT ymax); 698 699 /* Set up the subpage boundaries according to the current subpage selected */ 700 701 PLDLLIMPEXP void 702 plP_setsub(void); 703 704 /* Get the floating point precision (in number of places) in numeric labels. */ 705 706 void 707 plP_gprec(PLINT *p_setp, PLINT *p_prec); 708 709 /* Computes the length of a string in mm, including escape sequences. */ 710 711 PLFLT 712 plstrl(const char *string); 713 714 /* Similar to strpos, but searches for occurence of string str2. */ 715 716 PLINT 717 plP_stindex(const char *str1, const char *str2); 718 719 /* Searches string str for first occurence of character chr. */ 720 721 PLINT 722 plP_strpos(const char *str, int chr); 723 724 /* Searches string str for character chr (case insensitive). */ 725 726 PLINT 727 plP_stsearch(const char *str, int chr); 728 729 /* Conversion functions */ 730 731 /* device coords to physical coords (x) */ 732 733 PLINT 734 plP_dcpcx(PLFLT x); 735 736 /* device coords to physical coords (y) */ 737 738 PLINT 739 plP_dcpcy(PLFLT y); 740 741 /* millimeters from bottom left-hand corner to physical coords (x) */ 742 743 PLINT 744 plP_mmpcx(PLFLT x); 745 746 /* millimeters from bottom left-hand corner to physical coords (y) */ 747 748 PLINT 749 plP_mmpcy(PLFLT y); 750 751 /* world coords to physical coords (x) */ 752 753 PLINT 754 plP_wcpcx(PLFLT x); 755 756 /* world coords to physical coords (y) */ 757 758 PLINT 759 plP_wcpcy(PLFLT y); 760 761 /* physical coords to device coords (x) */ 762 763 PLFLT 764 plP_pcdcx(PLINT x); 765 766 /* physical coords to device coords (y) */ 767 768 PLFLT 769 plP_pcdcy(PLINT y); 770 771 /* millimeters from bottom left corner to device coords (x) */ 772 773 PLFLT 774 plP_mmdcx(PLFLT x); 775 776 /* millimeters from bottom left corner to device coords (y) */ 777 778 PLFLT 779 plP_mmdcy(PLFLT y); 780 781 /* world coords into device coords (x) */ 782 783 PLFLT 784 plP_wcdcx(PLFLT x); 785 786 /* world coords into device coords (y) */ 787 788 PLFLT 789 plP_wcdcy(PLFLT y); 790 791 /* subpage coords to device coords (x) */ 792 793 PLFLT 794 plP_scdcx(PLFLT x); 795 796 /* subpage coords to device coords (y) */ 797 798 PLFLT 799 plP_scdcy(PLFLT y); 800 801 /* device coords to millimeters from bottom left-hand corner (x) */ 802 803 PLFLT 804 plP_dcmmx(PLFLT x); 805 806 /* device coords to millimeters from bottom left-hand corner (y) */ 807 808 PLFLT 809 plP_dcmmy(PLFLT y); 810 811 /* world coords into millimeters (x) */ 812 813 PLFLT 814 plP_wcmmx(PLFLT x); 815 816 /* world coords into millimeters (y) */ 817 818 PLFLT 819 plP_wcmmy(PLFLT y); 820 821 /* device coords to subpage coords (x) */ 822 823 PLFLT 824 plP_dcscx(PLFLT x); 825 826 /* device coords to subpage coords (y) */ 827 828 PLFLT 829 plP_dcscy(PLFLT y); 830 831 /* 3-d coords to 2-d projection (x) */ 832 833 PLFLT 834 plP_w3wcx(PLFLT x, PLFLT y, PLFLT z); 835 836 /* 3-d coords to 2-d projection (y) */ 837 838 PLFLT 839 plP_w3wcy(PLFLT x, PLFLT y, PLFLT z); 840 841 /* Driver calls */ 842 843 /* Initialize device. */ 844 845 void 846 plP_init(void); 847 848 /* Draw line between two points */ 849 850 void 851 plP_line(short *x, short *y); 852 853 /* Draw polyline */ 854 855 void 856 plP_polyline(short *x, short *y, PLINT npts); 857 858 /* Fill polygon */ 859 860 void 861 plP_fill(short *x, short *y, PLINT npts); 862 863 /* draw image */ 864 865 void 866 plP_image(short *x, short *y, unsigned short *z, PLINT nx, PLINT ny, PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy, unsigned short zmin, unsigned short zmax); 867 868 /* End of page */ 869 870 PLDLLIMPEXP void 871 plP_eop(void); 872 873 /* End of page */ 874 875 PLDLLIMPEXP void 876 plP_bop(void); 877 878 /* Tidy up device (flush buffers, close file, etc.) */ 879 880 void 881 plP_tidy(void); 882 883 /* Change state. */ 884 885 PLDLLIMPEXP void 886 plP_state(PLINT op); 887 888 /* Escape function, for driver-specific commands. */ 889 890 void 891 plP_esc(PLINT op, void *ptr); 892 893 /* Set up plot window parameters. */ 894 895 void 896 plP_swin(PLWindow *plwin); 897 898 /* Return file pointer to lib file. */ 899 900 FILE * 901 plLibOpen(const char *fn); 902 903 /* Does required startup initialization of library. */ 904 905 void 906 pllib_init(void); 907 908 /* Does preliminary setup of device driver. */ 909 910 void 911 pllib_devinit(void); 912 913 /* Utility to copy one PLColor to another. */ 914 915 void 916 pl_cpcolor(PLColor *to, PLColor *from); 917 918 /* Does required startup initialization of a stream. */ 919 920 void 921 plstrm_init(void); 922 923 /* Builds a list of the active devices/streams by device name */ 924 925 void 926 plP_getinitdriverlist(char *names); 927 928 /* Checks a give list of device names against active streams and returns the number of matches */ 929 930 PLINT 931 plP_checkdriverinit( char *names); 932 933 /* disable writing to plot buffer and pixmap */ 934 void 935 NoBufferNoPixmap(void); 936 937 /* restart writing to plot buffer and pixmap */ 938 void 939 RestoreWrite2BufferPixmap(void); 940 941 void 942 grimage(short *x, short *y, unsigned short *z, PLINT nx, PLINT ny); 943 944 int PLDLLIMPEXP 945 plInBuildTree(void); /* pmr: fix prototype */ 946 947 void 948 plimageslow(short *x, short *y, unsigned short *data, PLINT nx, PLINT ny, 949 PLFLT xmin, PLFLT ymin, PLFLT dx, PLFLT dy, 950 unsigned short zmin, unsigned short zmax); 951 952 typedef struct { 953 PLFLT xmin, ymin, dx, dy;} IMG_DT; 954 955 /* 956 * void plfvect() 957 * 958 * Internal routine to plot a vector array with arbitrary coordinate 959 * and vector transformations. 960 * This is not currently intended to be called direct by the user 961 */ 962 void PLDLLIMPEXP 963 plfvect(PLFLT (*plf2eval) (PLINT, PLINT, PLPointer), 964 PLPointer f2evalv_data, PLPointer f2evalc_data, 965 PLINT nx, PLINT ny, PLFLT scale, 966 void (*pltr) (PLFLT, PLFLT, PLFLT *, PLFLT *, PLPointer), 967 PLPointer pltr_data); 968 969 /* 970 * Internal function to get an index to the hershey table 971 */ 972 int 973 plhershey2unicode ( unsigned int in ); 974 975 /* struct used for FCI to FontName lookups. */ 976 typedef struct 977 { 978 PLINT padding; 979 PLUNICODE fci; 980 const unsigned char *pfont; 981 } FCI_to_FontName_Table; 982 983 /* Internal function to obtain a pointer to a valid font name. */ 984 const unsigned char * 985 plP_FCI2FontName ( PLUNICODE fci, 986 const FCI_to_FontName_Table lookup[], const int nlookup); 987 988 989 /* Internal function to free memory from driver options */ 990 void 991 plP_FreeDrvOpts(void); /* pmr: fix prototype */ 992 993 /* Convert a ucs4 unichar to utf8 char string*/ 994 int 995 ucs4_to_utf8(PLUNICODE unichar, char *ptr); 996 997 /* 998 * Wrapper functions for the system IO routines fread, fwrite 999 */ 1000 1001 /* wraps fwrite */ 1002 1003 void 1004 plio_fwrite(void *, size_t, size_t, FILE *); 1005 1006 /* wraps fread */ 1007 1008 void 1009 plio_fread(void *, size_t, size_t, FILE *); 1010 1011 /* wraps fgets */ 1012 1013 void 1014 plio_fgets(char *, int, FILE *); 1015 1016 #ifdef __cplusplus 1017 } 1018 #endif 1019 1020 #endif /* __PLPLOTP_H__ */ 1021