OSDN Git Service

Initial revision
[pf3gnuchains/pf3gnuchains3x.git] / tix / win / tixWCmpt.c
1 /* 
2  * tixWCmpt.c --
3  *
4  *      Windows compatibility module: implements missing functions in Windows.
5  */
6
7 #include <tkWinInt.h>
8 #include <tixPort.h>
9 #include <tixInt.h>
10
11 #ifndef strcasecmp
12 int strcasecmp(char * a, char *b)
13 {
14     while (1) {
15         if (*a== 0 && *b==0) {
16             return 0;
17         }
18         if (*a==0) {
19             return (1);
20         }
21         if (*b==0) {
22             return (-1);
23         }
24         if (tolower(*a)>tolower(*b)) {
25             return (-1);
26         }
27         if (tolower(*b)>tolower(*a)) {
28             return (1);
29         }
30         a++; b++;
31     }
32 }
33 #endif
34 \f
35 /*
36  *----------------------------------------------------------------------
37  *
38  * XLowerWindow --
39  *
40  *      Change the stacking order of a window.
41  *
42  * Results:
43  *      None.
44  *
45  * Side effects:
46  *      Changes the stacking order of the specified window.
47  *
48  *----------------------------------------------------------------------
49  */
50 void
51 XLowerWindow(display, w)
52     Display* display;
53     Window w;
54 {
55     HWND window = TkWinGetHWND(w);
56
57     display->request++;
58     SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0,
59             SWP_NOMOVE | SWP_NOSIZE);
60 }
61 \f
62
63
64 #if 1
65 void XDrawPoints(display, d, gc, points, npoints, mode)
66     Display*            display;
67     Drawable            d;
68     GC                  gc;
69     XPoint*             points;
70     int                 npoints;
71     int                 mode;
72 {
73     int i;
74
75     for (i=0; i<npoints; i++) {
76         XDrawLine(display, d, gc, points[i].x, points[i].y,
77             points[i].x, points[i].y);
78     }
79 }
80
81 #endif
82
83 #if 1
84
85 /*
86  * The following declaration is for the VC++ DLL entry point.
87  */
88
89 BOOL APIENTRY           DllMain _ANSI_ARGS_((HINSTANCE hInst,
90                             DWORD reason, LPVOID reserved));
91
92 /* CYGNUS LOCAL */
93 #ifdef __CYGWIN32__
94 /* cygwin32 requires an impure pointer variable, which must be
95    explicitly initialized when the DLL starts up.  */
96 struct _reent *_impure_ptr;
97 extern struct _reent *_imp__reent_data;
98 #endif
99 /* END CYGNUS LOCAL */
100
101 /*
102  *----------------------------------------------------------------------
103  *
104  * DllEntryPoint --
105  *
106  *      This wrapper function is used by Borland to invoke the
107  *      initialization code for Tk.  It simply calls the DllMain
108  *      routine.
109  *
110  * Results:
111  *      See DllMain.
112  *
113  * Side effects:
114  *      See DllMain.
115  *
116  *----------------------------------------------------------------------
117  */
118
119 BOOL APIENTRY
120 DllEntryPoint(hInst, reason, reserved)
121     HINSTANCE hInst;            /* Library instance handle. */
122     DWORD reason;               /* Reason this function is being called. */
123     LPVOID reserved;            /* Not used. */
124 {
125     return DllMain(hInst, reason, reserved);
126 }
127 \f
128 /*
129  *----------------------------------------------------------------------
130  *
131  * DllMain --
132  *
133  *      DLL entry point.
134  *
135  * Results:
136  *      TRUE on sucess, FALSE on failure.
137  *
138  * Side effects:
139  *      None.
140  *
141  *----------------------------------------------------------------------
142  */
143
144 BOOL APIENTRY
145 DllMain(hInstance, reason, reserved)
146     HINSTANCE hInstance;
147     DWORD reason;
148     LPVOID reserved;
149 {
150     /* CYGNUS LOCAL */
151 #ifdef __CYGWIN32__
152     /* cygwin32 requires the impure data pointer to be initialized
153        when the DLL starts up.  */
154     _impure_ptr = _imp__reent_data;
155 #endif
156     /* END CYGNUS LOCAL */
157
158     /*
159      * If we are attaching to the DLL from a new process, tell Tk about
160      * the hInstance to use. If we are detaching then clean up any
161      * data structures related to this DLL.
162      */
163     
164     return(TRUE);
165 }
166 #else
167
168 #define DllExport       __declspec( dllexport )
169
170 DllExport
171 DllEntryPoint(hInst, reason, reserved)
172     HINSTANCE hInst;            /* Library instance handle. */
173     DWORD reason;               /* Reason this function is being called. */
174     LPVOID reserved;            /* Not used. */
175 {
176     return TRUE;
177 }
178
179 #endif
180
181 int TixPlatformInit(Tcl_Interp * interp)
182 {
183     return Tcl_GlobalEval(interp, "set tix(isWindows) 1");
184 }