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