xref: /plan9/sys/src/cmd/gs/src/gsdll.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1994-2001, Ghostgum Software Pty Ltd.  All rights reserved.
2   Portions Copyright (C) 1999 Aladdin Enterprises.  All rights reserved.
3 
4   This software is provided AS-IS with no warranty, either express or
5   implied.
6 
7   This software is distributed under license and may not be copied,
8   modified or distributed except as expressly authorized under the terms
9   of the license contained in the file LICENSE in this distribution.
10 
11   For more information about licensing, please refer to
12   http://www.ghostscript.com/licensing/. For information on
13   commercial licensing, go to http://www.artifex.com/licensing/ or
14   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
15   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
16  */
17 
18 
19 /* $Id: gsdll.h,v 1.7 2003/01/25 22:50:31 giles Exp $ */
20 
21 /* This interface is deprecated and will be removed in future
22  * ghostscript releases.  Use the interface described in
23  * API.htm and iapi.h.
24  */
25 
26 #ifndef gsdll_INCLUDED
27 #  define gsdll_INCLUDED
28 
29 #include "iapi.h"
30 
31 #ifdef __MACOS__
32 #define HWND char *
33 #include <QDOffscreen.h>
34 #pragma export on
35 #endif
36 
37 #ifdef __WINDOWS__
38 #define _Windows
39 #endif
40 
41 #ifdef __IBMC__
42 #define GSDLLCALLLINK _System
43 #else
44 #define GSDLLCALLLINK
45 #endif
46 
47 /* global pointer to callback */
48 typedef int (* GSDLLCALLLINK GSDLL_CALLBACK) (int, char *, unsigned long);
49 extern GSDLL_CALLBACK pgsdll_callback;
50 
51 /* message values for callback */
52 #define GSDLL_STDIN 1		/* get count characters to str from stdin */
53 			/* return number of characters read */
54 #define GSDLL_STDOUT 2		/* put count characters from str to stdout */
55 			/* return number of characters written */
56 #define GSDLL_DEVICE 3		/* device = str has been opened if count=1 */
57 			/*                    or closed if count=0 */
58 #define GSDLL_SYNC 4		/* sync_output for device str */
59 #define GSDLL_PAGE 5		/* output_page for device str */
60 #define GSDLL_SIZE 6		/* resize for device str */
61 			/* LOWORD(count) is new xsize */
62 			/* HIWORD(count) is new ysize */
63 #define GSDLL_POLL 7		/* Called from gp_check_interrupt */
64 			/* Can be used by caller to poll the message queue */
65 			/* Normally returns 0 */
66 			/* To abort gsdll_execute_cont(), return a */
67 			/* non zero error code until gsdll_execute_cont() */
68 			/* returns */
69 
70 /* return values from gsdll_init() */
71 #define GSDLL_INIT_IN_USE  100	/* DLL is in use */
72 #define GSDLL_INIT_QUIT    101	/* quit or EOF during init */
73 				  /* This is not an error. */
74 				  /* gsdll_exit() must not be called */
75 
76 
77 /* DLL exported  functions */
78 /* for load time dynamic linking */
79 GSDLLEXPORT int GSDLLAPI gsdll_revision(const char * * product, const char * * copyright, long * gs_revision, long * gs_revisiondate);
80 GSDLLEXPORT int GSDLLAPI gsdll_init(GSDLL_CALLBACK callback, HWND hwnd, int argc, char * * argv);
81 GSDLLEXPORT int GSDLLAPI gsdll_execute_begin(void);
82 GSDLLEXPORT int GSDLLAPI gsdll_execute_cont(const char * str, int len);
83 GSDLLEXPORT int GSDLLAPI gsdll_execute_end(void);
84 GSDLLEXPORT int GSDLLAPI gsdll_exit(void);
85 GSDLLEXPORT int GSDLLAPI gsdll_lock_device(unsigned char *device, int flag);
86 
87 /* Function pointer typedefs */
88 /* for run time dynamic linking */
89 typedef int (GSDLLAPIPTR PFN_gsdll_revision)(const char ** product,
90     const char ** copyright, long * revision, long * revisiondate);
91 typedef int (GSDLLAPIPTR PFN_gsdll_init) (GSDLL_CALLBACK, HWND, int argc, char * * argv);
92 typedef int (GSDLLAPIPTR PFN_gsdll_execute_begin) (void);
93 typedef int (GSDLLAPIPTR PFN_gsdll_execute_cont) (const char * str, int len);
94 typedef int (GSDLLAPIPTR PFN_gsdll_execute_end) (void);
95 typedef int (GSDLLAPIPTR PFN_gsdll_exit) (void);
96 typedef int (GSDLLAPIPTR PFN_gsdll_lock_device) (unsigned char *, int);
97 
98 #ifdef __MACOS__
99 #pragma export off
100 #endif
101 
102 #endif /* gsdll_INCLUDED */
103