home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / gmt_os2.zip / src / pslib_inc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-22  |  3.3 KB  |  112 lines

  1. /*--------------------------------------------------------------------
  2.  *    The GMT-system:    @(#)pslib_inc.h    2.15  4/11/95
  3.  *
  4.  *    Copyright (c) 1991-1995 by P. Wessel and W. H. F. Smith
  5.  *    See README file for copying and redistribution conditions.
  6.  *--------------------------------------------------------------------*/
  7. /*
  8.  * This include file is only included in pslib.c.  Calling programs must
  9.  * include file pslib.h
  10.  *
  11.  * Author:    Paul Wessel
  12.  * Date:    9-JAN-1991-1995
  13.  */
  14.  
  15. #define Version (2.3)
  16.  
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <math.h>
  21. #include <memory.h>
  22. #include <time.h>
  23. #include <ctype.h>
  24. #include "values.h"
  25.  
  26. #ifdef sony
  27. typedef long time_t;
  28. #endif
  29.  
  30. #ifndef R2D
  31. #define R2D (180.0/M_PI)
  32. #endif
  33. #define SMALL 1.0e-10
  34. #define MAX_PATH 1500 /* Max path length in Level 1 implementations */
  35. #define I_255 (1.0 / 255.0)
  36. #ifndef MIN
  37. #define MIN(x, y) (((x) < (y)) ? (x) : (y))
  38. #endif
  39. #ifndef MAX
  40. #define MAX(x, y) (((x) > (y)) ? (x) : (y))
  41. #endif
  42. #ifndef TRUE
  43. #define TRUE 1
  44. #endif
  45. #ifndef FALSE
  46. #define FALSE 0
  47. #endif
  48.  
  49. /* Misc macros */
  50.  
  51. #ifdef hpux
  52. #define copysign(x,y) ((y) < 0.0 ? -fabs(x) : fabs(x))
  53. #endif
  54. #ifdef aux
  55. #define copysign(x,y) ((y) < 0.0 ? -fabs(x) : fabs(x))
  56. #endif
  57. #ifdef ultrix
  58. #define copysign(x,y) ((y) < 0.0 ? -fabs(x) : fabs(x))
  59. #endif
  60. #ifndef rint
  61. #define rint(x) ((double)(int)(((x) < 0.0) ? (x) - 0.5 : (x) + 0.5))
  62. #endif
  63. #ifndef ceil
  64. #define ceil(x) ((double)(int)(((x) < 0.0 || (x) == (int)(x)) ? (x) : (x) + 1.0))
  65. #endif
  66. #ifndef floor
  67. #define floor(x) ((double)(int)(((x) > 0.0 || (x) == (int)(x)) ? (x) : (x) - 1.0))
  68. #endif
  69.  
  70. /* Global structure used internally by pslib */
  71.  
  72. struct {
  73.     FILE *fp;        /* PS output file pointer. NULL = stdout    */
  74.     int font_no;        /* Current font number                */
  75.     int mode;        /* 0 = Landscape, 1 = Portrait            */
  76.     int ix, iy;        /* Absolute coordinates of last point        */
  77.     int npath;        /* Length of current unstroked path        */
  78.     char bw_format[8];    /* Format used for grayshade value        */
  79.     char rgb_format[20];    /* Same, for color triplets            */
  80.     double xscl, yscl;    /* Global scale values [1.0]            */
  81.     double xoff, yoff;    /* Origin offset [1/1]                */
  82.     double scale;        /* Must be set through plotinit();        */
  83.     double p_width;        /* Paper width, set in plotinit();        */
  84.     double points_pr_unit;    /* # of points pr measure unit (e.g., 72/inch    */
  85.     int v1_path_length_limit;    /* Implementation limit on path lengths    in Level 1 PostScript    */
  86.     int max_path_length;    /* Maximum path length encountered during execution    */
  87.     int clip_path_length;    /* Current length of clip path            */
  88.     int hex_image;        /* TRUE writes images in hex, FALSE uses binary    */
  89. } ps;
  90.  
  91.     /* Font information */
  92.     
  93. #define N_FONTS    34    /* Current no of fonts;  To add more, modify the file
  94.              * PS_font_names.h and PS_font_heights.h and set N_FONTS */
  95.  
  96. double ps_font_height[N_FONTS] = {    /* Based on the size of A devided by fontsize */
  97. #include "PS_font_heights.h"
  98. };
  99.  
  100. char *ps_font_name[N_FONTS] = {
  101. #include "PS_font_names.h"
  102. };
  103.  
  104.     /* Pattern information */
  105.     
  106. #define N_PATTERNS 33    /* Current number of predefined patterns, #32 is user-supplied */
  107.  
  108. char ps_pattern_status[N_PATTERNS][2];
  109. int ps_pattern_nx[N_PATTERNS][2];
  110. int ps_pattern_ny[N_PATTERNS][2];
  111. int ps_pattern_dx[N_PATTERNS][2];
  112.