1 /* types.h: general types. 2 * 3 * Copyright (C) 1992 Free Software Foundation, Inc. 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3, or (at your option) 8 * any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef TYPES_H 20 #define TYPES_H 21 22 /* Booleans. */ 23 typedef enum { false = 0, true = 1 } boolean; 24 25 /* The X11 library defines `FALSE' and `TRUE', and so we only want to 26 define them if necessary. */ 27 #ifndef FALSE 28 #define FALSE false 29 #define TRUE true 30 #endif /* FALSE */ 31 32 /* The usual null-terminated string. */ 33 typedef char *string; 34 35 /* A generic pointer in ANSI C. */ 36 typedef void *address; 37 38 /* We use `real' for our floating-point variables. */ 39 typedef double real; 40 41 /* A character code. Perhaps someday we will allow for 16-bit 42 character codes, but for now we are restricted to 256 characters per 43 font (like TeX and PostScript). */ 44 typedef unsigned char charcode_type; 45 46 47 /* Used in file formats. */ 48 typedef unsigned char one_byte; 49 typedef signed char signed_byte; 50 typedef unsigned short two_bytes; 51 typedef short signed_2_bytes; 52 typedef unsigned int four_bytes; 53 typedef int signed_4_bytes; 54 typedef int byte_count_type; 55 56 /* These are intended to be used for output in file formats where a 57 ``byte'' is defined to be eight bits, regardless of the hardware. */ 58 #define ONE_BYTE_BIG (1 << 8) 59 #define TWO_BYTES_BIG (1 << 16) 60 #define THREE_BYTES_BIG (1 << 24) 61 62 63 /* Complex numbers. */ 64 typedef struct 65 { 66 real real; 67 real imag; 68 } complex; 69 typedef enum { first_complex_part, second_complex_part} complex_part_type; 70 typedef enum { polar_rep, rectangular_rep} complex_rep_type; 71 72 73 /* Dimensions of a rectangle. */ 74 typedef struct 75 { 76 unsigned height, width; 77 } dimensions_type; 78 79 #define DIMENSIONS_HEIGHT(d) ((d).height) 80 #define DIMENSIONS_WIDTH(d) ((d).width) 81 82 83 /* Cartesian points. */ 84 typedef struct 85 { 86 int x, y; 87 } coordinate_type; 88 89 typedef struct 90 { 91 double x, y; 92 } real_coordinate_type; 93 94 #if 0 95 typedef struct 96 { 97 double align_threshold; 98 double corner_always_threshold; 99 unsigned int corner_surround; 100 double corner_threshold; 101 double error_threshold; 102 unsigned int filter_alternative_surround; 103 double filter_epsilon; 104 unsigned int filter_iteration_count; 105 double filter_percent; 106 unsigned int filter_secondary_surround; 107 unsigned int filter_surround; 108 boolean keep_knees; 109 double line_reversion_threshold; 110 double line_threshold; 111 double reparameterize_improvement; 112 double reparameterize_threshold; 113 double subdivide_search; 114 unsigned int subdivide_surround; 115 double subdivide_threshold; 116 unsigned int tangent_surround; 117 } SELVALS; 118 119 #else 120 121 typedef struct 122 { 123 double align_threshold; 124 double corner_always_threshold; 125 double corner_surround; 126 double corner_threshold; 127 double error_threshold; 128 double filter_alternative_surround; 129 double filter_epsilon; 130 double filter_iteration_count; 131 double filter_percent; 132 double filter_secondary_surround; 133 double filter_surround; 134 boolean keep_knees; 135 double line_reversion_threshold; 136 double line_threshold; 137 double reparameterize_improvement; 138 double reparameterize_threshold; 139 double subdivide_search; 140 double subdivide_surround; 141 double subdivide_threshold; 142 double tangent_surround; 143 } SELVALS; 144 145 #endif /* 1 */ 146 147 #endif /* not TYPES_H */ 148