summaryrefslogtreecommitdiff
path: root/src/main/gutenprint-internal.h
blob: 9de82148f66424cd732a9bb788573177687bb39d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * "$Id: gutenprint-internal.h,v 1.6 2014/01/04 00:31:38 rlk Exp $"
 *
 *   Print plug-in header file for the GIMP.
 *
 *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
 *	Robert Krawitz (rlk@alum.mit.edu)
 *
 *   This program is free software; you can redistribute it and/or modify it
 *   under the terms of the GNU General Public License as published by the Free
 *   Software Foundation; either version 2 of the License, or (at your option)
 *   any later version.
 *
 *   This program is distributed in the hope that it will be useful, but
 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *   for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Revision History:
 *
 *   See ChangeLog
 */

/*
 * This file must include only standard C header files.  The core code must
 * compile on generic platforms that don't support glib, gimp, gtk, etc.
 */

#ifndef GUTENPRINT_INTERNAL_INTERNAL_H
#define GUTENPRINT_INTERNAL_INTERNAL_H

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <gutenprint/gutenprint-module.h>

/**
 * Utility functions (internal).
 *
 * @defgroup util_internal util-internal
 * @{
 */

extern void stpi_init_paper(void);
extern void stpi_init_dither(void);
extern void stpi_init_printer(void);
extern void stpi_vars_print_error(const stp_vars_t *v, const char *prefix);
#define BUFFER_FLAG_FLIP_X	0x1
#define BUFFER_FLAG_FLIP_Y	0x2
extern stp_image_t* stpi_buffer_image(stp_image_t* image, unsigned int flags);

#define STPI_ASSERT(x,v)						\
do									\
{									\
  if (stp_get_debug_level() & STP_DBG_ASSERTIONS)			\
    stp_erprintf("DEBUG: Testing assertion %s file %s line %d\n",	\
		 #x, __FILE__, __LINE__);				\
  if (!(x))								\
    {									\
      stp_erprintf("\nERROR: ***Gutenprint %s assertion %s failed!"	\
		   " file %s, line %d.  %s\n", PACKAGE_VERSION,		\
		   #x, __FILE__, __LINE__, "Please report this bug!");	\
      if ((v)) stpi_vars_print_error((v), "ERROR");			\
      stp_abort();							\
    }									\
} while (0)

/** @} */

#define CAST_IS_SAFE GCC_DIAG_OFF(cast-qual)
#define CAST_IS_UNSAFE GCC_DIAG_ON(cast-qual)

#pragma GCC diagnostic ignored "-Woverlength-strings"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
static inline void *
stpi_cast_safe(const void *ptr)
{
  return (void *)ptr;
}
#pragma GCC diagnostic pop

#ifdef __cplusplus
  }
#endif

#endif /* GUTENPRINT_INTERNAL_INTERNAL_H */
/*
 * End of "$Id: gutenprint-internal.h,v 1.6 2014/01/04 00:31:38 rlk Exp $".
 */