]> git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/gsinit.c
Import cups.org releases
[thirdparty/cups.git] / pstoraster / gsinit.c
1 /* Copyright (C) 1989, 1995, 1996 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 to
7 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 to
9 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 to
14 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 is not affiliated with the Free Software Foundation or
20 the GNU Project. GNU Ghostscript, as distributed by Aladdin Enterprises,
21 does not depend on any other GNU software.
22 */
23
24 /* gsinit.c */
25 /* Initialization for the imager */
26 #include "stdio_.h"
27 #include "memory_.h"
28 #include "gdebug.h"
29 #include "gscdefs.h"
30 #include "gsmemory.h"
31 #include "gp.h"
32 #include "gslib.h" /* interface definition */
33
34 /* Imported from gsmisc.c */
35 extern FILE *gs_debug_out;
36
37 /* Imported from gsmemory.c */
38 void gs_malloc_init(P0());
39 void gs_malloc_release(P0());
40
41 /* Configuration information from gconfig.c. */
42 extern_gx_init_table();
43
44 /* Initialization to be done before anything else. */
45 void
46 gs_lib_init(FILE *debug_out)
47 { gs_lib_init0(debug_out);
48 gs_lib_init1(&gs_memory_default);
49 }
50 void
51 gs_lib_init0(FILE *debug_out)
52 { gs_debug_out = debug_out;
53 gs_malloc_init();
54 /* Reset debugging flags */
55 memset(gs_debug, 0, 128);
56 gs_log_errors = 0;
57 }
58 void
59 gs_lib_init1(gs_memory_t *mem)
60 { /* Run configuration-specific initialization procedures. */
61 { void (**ipp)(P1(gs_memory_t *));
62 for ( ipp = gx_init_table; *ipp != 0; ++ipp )
63 (**ipp)(mem);
64 }
65 }
66
67 /* Clean up after execution. */
68 void
69 gs_lib_finit(int exit_status, int code)
70 { fflush(stderr); /* in case of error exit */
71 /* Do platform-specific cleanup. */
72 gp_exit(exit_status, code);
73 gs_malloc_release();
74 }