]> git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/gpcheck.h
Import cups.org releases
[thirdparty/cups.git] / pstoraster / gpcheck.h
1 /* Copyright (C) 1992, 1994 Aladdin Enterprises. All rights reserved.
2
3 This file is part of GNU Ghostscript.
4
5 GNU Ghostscript is distributed in the hope that it will be useful, but
6 WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
7 to anyone for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing. Refer
9 to the GNU General Public License for full details.
10
11 Everyone is granted permission to copy, modify and redistribute GNU
12 Ghostscript, but only under the conditions described in the GNU General
13 Public License. A copy of this license is supposed to have been given
14 to you along with GNU Ghostscript so you can know your rights and
15 responsibilities. It should be in a file named COPYING. Among other
16 things, the copyright notice and this notice must be preserved on all
17 copies.
18
19 Aladdin Enterprises supports the work of the GNU Project, but is not
20 affiliated with the Free Software Foundation or the GNU Project. GNU
21 Ghostscript, as distributed by Aladdin Enterprises, does not require any
22 GNU software to build or run it.
23 */
24
25 /*$Id$ */
26 /* Interrupt check interface */
27
28 #ifndef gpcheck_INCLUDED
29 # define gpcheck_INCLUDED
30
31 /*
32 * On some platforms, the interpreter must check periodically for user-
33 * initiated actions. (Eventually, this may be extended to all platforms,
34 * to handle multi-tasking through the 'context' facility.) Routines that
35 * run for a long time must periodically call gp_check_interrupts(), and
36 * if it returns true, must clean up whatever they are doing and return an
37 * e_interrupted (or gs_error_interrupted) exceptional condition.
38 * The return_if_interrupt macro provides a convenient way to do this.
39 *
40 * On platforms that require an interrupt check, the makefile defines
41 * a symbol CHECK_INTERRUPTS. Currently this is only the Microsoft
42 * Windows platform.
43 */
44
45 #ifdef CHECK_INTERRUPTS
46 int gp_check_interrupts(P0());
47 int gs_return_check_interrupt(P1(int code));
48
49 # define process_interrupts() discard(gp_check_interrupts())
50 # define return_if_interrupt()\
51 { int icode_ = gp_check_interrupts();\
52 if ( icode_ )\
53 return gs_note_error((icode_ > 0 ? gs_error_interrupt : icode_));\
54 }
55 # define return_check_interrupt(code)\
56 return gs_return_check_interrupt(code)
57 #else
58 # define gp_check_interrupts() 0
59 # define process_interrupts() DO_NOTHING
60 # define return_if_interrupt() DO_NOTHING
61 # define return_check_interrupt(code)\
62 return (code)
63 #endif
64
65 #endif /* gpcheck_INCLUDED */