summaryrefslogtreecommitdiff
path: root/gs/src/dwdll.h
blob: 946d0d00a672b28f21f401f7074ff52abc59d399 (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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* Copyright (C) 1996, Russell Lang.  All rights reserved.

   This file is part of Aladdin Ghostscript.

   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
   or distributor accepts any responsibility for the consequences of using it,
   or for whether it serves any particular purpose or works at all, unless he
   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
   License (the "License") for full details.

   Every copy of Aladdin Ghostscript must include a copy of the License,
   normally in a plain ASCII text file named PUBLIC.  The License grants you
   the right to copy, modify and redistribute Aladdin Ghostscript, but only
   under certain conditions described in the License.  Among other things, the
   License requires that the copyright notice and this notice be preserved on
   all copies.
 */




// gsdll_class for MS-Windows

#ifndef _GSDLL_H
extern "C" {
#include "gsdll.h"
}
#endif
#ifndef _GSDLL_CLASS_H
#define _GSDLL_CLASS_H


class gsdll_class {
    // instance of caller
    HINSTANCE hinstance;
    // handle to DLL.  Non-zero of loaded.
    HINSTANCE hmodule;
    // handle to parent window.  Can be NULL.
    HWND hwnd;
    // text description of last error
    char last_error[128];
    // true if init and execute_begin have been called
    BOOL initialized;
    // return code from last c_execute_end
    int execute_code;

    // pointer to callback from DLL
    GSDLL_CALLBACK callback;

    // pointers to DLL functions
    PFN_gsdll_revision c_revision;
    PFN_gsdll_init c_init;
    PFN_gsdll_execute_begin c_execute_begin;
    PFN_gsdll_execute_cont c_execute_cont;
    PFN_gsdll_execute_end c_execute_end;
    PFN_gsdll_exit c_exit;
    PFN_gsdll_lock_device c_lock_device;
    PFN_gsdll_copy_dib c_copy_dib;
    PFN_gsdll_copy_palette c_copy_palette;
    PFN_gsdll_draw c_draw;

    // pointer to os2dll or mswindll device
    // this needs to be extended to support multiple devices
    // also need to have one window per device
    char FAR *device;


        public:
    // Load DLL
    // Arguments:
    //   instance of calling EXE
    //   name of DLL, may include path
    //   expected version number of DLL
    // Returns:
    //   zero on success
    //   non-zero on error.  Error message available from get_last_error()
    // do nothing if DLL already loaded
    int load(const HINSTANCE hinstance, const char *name, const long version);

    // Get revision number of DLL
    int revision(char FAR * FAR *, char FAR * FAR *, long FAR *, long FAR *);

    // Unload DLL
    int unload(void);

    // Initialise DLL
    // Arguments:
    //   pointer to C callback function
    //   window handle of parent
    //   argc  (normal C command line)
    //   argv  (normal C command line)
    int init(GSDLL_CALLBACK callback, HWND hwnd, int argc, char FAR * FAR * argv);

    // Restart DLL
    int restart(int argc, char FAR * FAR * argv);

    // Execute string
    int execute(const char FAR *, int len);

    // Get last error string
    int get_last_error(char *str, int len);

    // lock device
    int gsdll_class::lock_device(const char FAR * device, int lock);

    // draw bitmap
    int gsdll_class::draw(const char FAR * device, HDC hdc, int dx, int dy, int wx, int wy, int sx, int sy);

    // copy bitmap
    HGLOBAL gsdll_class::copy_dib(const char FAR * device);

    // copy palette
    HPALETTE gsdll_class::copy_palette(const char FAR * device);
};

#endif // _GSDLL_CLASS_H