| 1 | /* |
| 2 | * |
| 3 | * Test pattern generator for Gimp-Print |
| 4 | * |
| 5 | * Copyright 2001 Robert Krawitz <[email protected]> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the Free |
| 9 | * Software Foundation; either version 2 of the License, or (at your option) |
| 10 | * any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 15 | * for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifdef HAVE_CONFIG_H |
| 22 | #include <config.h> |
| 23 | #endif |
| 24 | |
| 25 | #include <gutenprint/gutenprint.h> |
| 26 | #include <stdio.h> |
| 27 | |
| 28 | typedef struct |
| 29 | { |
| 30 | enum { |
| 31 | E_PATTERN, |
| 32 | E_XPATTERN, |
| 33 | E_IMAGE, |
| 34 | E_GRID |
| 35 | } type; |
| 36 | union { |
| 37 | struct { |
| 38 | double mins[STP_CHANNEL_LIMIT]; |
| 39 | double vals[STP_CHANNEL_LIMIT]; |
| 40 | double gammas[STP_CHANNEL_LIMIT]; |
| 41 | double levels[STP_CHANNEL_LIMIT]; |
| 42 | double lower; |
| 43 | double upper; |
| 44 | } pattern; |
| 45 | struct { |
| 46 | int ticks; |
| 47 | } grid; |
| 48 | struct { |
| 49 | int x; |
| 50 | int y; |
| 51 | int bits; |
| 52 | const char *data; |
| 53 | } image; |
| 54 | } d; |
| 55 | } testpattern_t; |
| 56 | |
| 57 | /* |
| 58 | * At least with flex, this forbids the scanner from reading ahead. |
| 59 | * This is necessary for parsing images. |
| 60 | */ |
| 61 | #define YY_ALWAYS_INTERACTIVE 1 |
| 62 | |
| 63 | typedef enum { |
| 64 | SIZE_RELATIVE, |
| 65 | SIZE_PT, |
| 66 | SIZE_IN, |
| 67 | SIZE_MM |
| 68 | } size_mode_t; |
| 69 | |
| 70 | extern stp_vars_t *global_vars; |
| 71 | extern double global_levels[]; |
| 72 | extern double global_gammas[]; |
| 73 | extern double global_gamma; |
| 74 | extern int global_steps; |
| 75 | extern double global_ink_limit; |
| 76 | extern char *global_printer; |
| 77 | extern double global_density; |
| 78 | extern double global_xtop; |
| 79 | extern double global_xleft; |
| 80 | extern size_mode_t global_size_mode; |
| 81 | extern double global_hsize; |
| 82 | extern double global_vsize; |
| 83 | extern int global_noblackline; |
| 84 | extern int global_colorline; |
| 85 | extern const char *global_image_type; |
| 86 | extern int global_color_model; |
| 87 | extern int global_bit_depth; |
| 88 | extern int global_channel_depth; |
| 89 | extern int global_did_something; |
| 90 | extern int global_invert_data; |
| 91 | extern int global_noscale; |
| 92 | extern int global_round_size; |
| 93 | extern char *global_output; |
| 94 | extern int global_quiet; |
| 95 | extern FILE *output; |
| 96 | extern int start_job; |
| 97 | extern int end_job; |
| 98 | |
| 99 | extern char *c_strdup(const char *s); |
| 100 | extern testpattern_t *get_next_testpattern(void); |
| 101 | extern void close_output(void); |
| 102 | |
| 103 | typedef struct yylv { |
| 104 | int ival; |
| 105 | double dval; |
| 106 | char *sval; |
| 107 | } YYSTYPE; |
| 108 | |
| 109 | #define YYSTYPE_IS_DECLARED 1 |
| 110 | |
| 111 | #include "testpatterny.h" |