~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to src/dwmain.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2001-2006 Artifex Software, Inc.
2
 
   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, modified
8
 
   or distributed except as expressly authorized under the terms of that
9
 
   license.  Refer to licensing information at http://www.artifex.com/
10
 
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11
 
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
 
*/
13
 
/* $Id: dwmain.c 8022 2007-06-05 22:23:38Z giles $ */
14
 
/* Ghostscript DLL loader for Windows */
15
 
 
16
 
#include "windows_.h"
17
 
#include <shellapi.h>
18
 
#include <stdio.h>
19
 
#include <string.h>
20
 
#include <stdlib.h>
21
 
#include "gscdefs.h"
22
 
#define GSREVISION gs_revision
23
 
#include "ierrors.h"
24
 
#include "iapi.h"
25
 
#include "vdtrace.h"
26
 
 
27
 
#include "dwmain.h"
28
 
#include "dwdll.h"
29
 
#include "dwtext.h"
30
 
#include "dwimg.h"
31
 
#include "dwtrace.h"
32
 
#include "dwreg.h"
33
 
#include "gdevdsp.h"
34
 
 
35
 
/* public handles */
36
 
HINSTANCE ghInstance;
37
 
 
38
 
/* redirected stdio */
39
 
TW *tw;
40
 
 
41
 
static const LPSTR szAppName = "Ghostscript";
42
 
 
43
 
const LPSTR szIniName = "gswin32.ini";
44
 
const char *szDllName = "gsdll32.dll";
45
 
const LPSTR szIniSection = "Text";
46
 
 
47
 
 
48
 
GSDLL gsdll;
49
 
void *instance;
50
 
HWND hwndtext;
51
 
 
52
 
char start_string[] = "systemdict /start get exec\n";
53
 
 
54
 
static int poll(void)
55
 
{
56
 
    MSG msg;
57
 
    while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
58
 
        TranslateMessage(&msg);
59
 
        DispatchMessage(&msg);
60
 
    }
61
 
    /* If text window closing then abort Ghostscript */
62
 
    if (tw->quitnow)
63
 
        return e_Fatal;
64
 
    return 0;
65
 
}
66
 
 
67
 
/*********************************************************************/
68
 
/* stdio functions */
69
 
static int GSDLLCALL
70
 
gsdll_stdin(void *instance, char *buf, int len)
71
 
{
72
 
    return text_read_line(tw, buf, len);
73
 
}
74
 
 
75
 
static int GSDLLCALL
76
 
gsdll_stdout(void *instance, const char *str, int len)
77
 
{
78
 
    text_write_buf(tw, str, len);
79
 
    return len;
80
 
}
81
 
 
82
 
static int GSDLLCALL
83
 
gsdll_stderr(void *instance, const char *str, int len)
84
 
{
85
 
    text_write_buf(tw, str, len);
86
 
    return len;
87
 
}
88
 
 
89
 
/* Poll the caller for cooperative multitasking. */
90
 
/* If this function is NULL, polling is not needed */
91
 
static int GSDLLCALL gsdll_poll(void *handle)
92
 
{
93
 
    return poll();
94
 
}
95
 
/*********************************************************************/
96
 
 
97
 
/* new dll display device */
98
 
/* 
99
 
#define DISPLAY_DEBUG
100
 
 */
101
 
 
102
 
/* New device has been opened */
103
 
/* This is the first event from this device. */
104
 
static int display_open(void *handle, void *device)
105
 
{
106
 
    IMAGE *img;
107
 
#ifdef DISPLAY_DEBUG
108
 
    char buf[256];
109
 
    sprintf(buf, "display_open(0x%x, 0x%x)\n", handle, device);
110
 
    text_puts(tw, buf);
111
 
#endif
112
 
    img = image_new(handle, device);    /* create and add to list */
113
 
    if (img)
114
 
        image_open(img);
115
 
    return 0;
116
 
}
117
 
 
118
 
/* Device is about to be closed. */
119
 
/* Device will not be closed until this function returns. */
120
 
static int display_preclose(void *handle, void *device)
121
 
{
122
 
#ifdef DISPLAY_DEBUG
123
 
    char buf[256];
124
 
    sprintf(buf, "display_preclose(0x%x, 0x$x)\n", handle, device);
125
 
    text_puts(tw, buf);
126
 
#endif
127
 
    /* do nothing - no thread synchonisation needed */
128
 
    return 0;
129
 
}
130
 
 
131
 
/* Device has been closed. */
132
 
/* This is the last event from this device. */
133
 
static int display_close(void *handle, void *device)
134
 
{
135
 
    IMAGE *img;
136
 
#ifdef DISPLAY_DEBUG
137
 
    char buf[256];
138
 
    sprintf(buf, "display_close(0x%x, 0x$x)\n", handle, device);
139
 
    text_puts(tw, buf);
140
 
#endif
141
 
    img = image_find(handle, device);
142
 
    if (img) {
143
 
        image_delete(img);      /* remove from list but don't free */
144
 
        image_close(img);
145
 
    }
146
 
    return 0;
147
 
}
148
 
 
149
 
/* Device is about to be resized. */
150
 
/* Resize will only occur if this function returns 0. */
151
 
static int display_presize(void *handle, void *device, int width, int height, 
152
 
        int raster, unsigned int format)
153
 
{
154
 
#ifdef DISPLAY_DEBUG
155
 
    char buf[256];
156
 
    sprintf(buf, "display_presize(0x%x, 0x%x, width=%d height=%d raster=%d\n\
157
 
  format=%d)\n", 
158
 
       handle, device, width, height, raster, format);
159
 
    text_puts(tw, buf);
160
 
#endif
161
 
    return 0;
162
 
}
163
 
   
164
 
/* Device has been resized. */
165
 
/* New pointer to raster returned in pimage */
166
 
static int display_size(void *handle, void *device, int width, int height, 
167
 
        int raster, unsigned int format, unsigned char *pimage)
168
 
{
169
 
    IMAGE *img;
170
 
#ifdef DISPLAY_DEBUG
171
 
    char buf[256];
172
 
    sprintf(buf, "display_size(0x%x, 0x%x, width=%d height=%d raster=%d\n\
173
 
  format=%d image=0x%x)\n", 
174
 
       handle, device, width, height, raster, format, pimage);
175
 
    text_puts(tw, buf);
176
 
#endif
177
 
    img = image_find(handle, device);
178
 
    image_size(img, width, height, raster, format, pimage);
179
 
    image_updatesize(img);
180
 
    return 0;
181
 
}
182
 
   
183
 
/* flushpage */
184
 
static int display_sync(void *handle, void *device)
185
 
{
186
 
    IMAGE *img;
187
 
#ifdef DISPLAY_DEBUG
188
 
    char buf[256];
189
 
    sprintf(buf, "display_sync(0x%x, 0x%x)\n", handle, device);
190
 
    text_puts(tw, buf);
191
 
#endif
192
 
    img = image_find(handle, device);
193
 
    image_sync(img);
194
 
    return 0;
195
 
}
196
 
 
197
 
/* showpage */
198
 
/* If you want to pause on showpage, then don't return immediately */
199
 
static int display_page(void *handle, void *device, int copies, int flush)
200
 
{
201
 
    IMAGE *img;
202
 
#ifdef DISPLAY_DEBUG
203
 
    char buf[256];
204
 
    sprintf(buf, "display_page(0x%x, 0x%x, copies=%d flush=%d)\n", 
205
 
        handle, device, copies, flush);
206
 
    text_puts(tw, buf);
207
 
#endif
208
 
    img = image_find(handle, device);
209
 
    image_page(img);
210
 
    return 0;
211
 
}
212
 
 
213
 
/* Poll the caller for cooperative multitasking. */
214
 
/* If this function is NULL, polling is not needed */
215
 
static int display_update(void *handle, void *device, 
216
 
    int x, int y, int w, int h)
217
 
{
218
 
    IMAGE *img;
219
 
    img = image_find(handle, device);
220
 
    image_poll(img);    /* redraw the window periodically */
221
 
    return poll();
222
 
}
223
 
 
224
 
int display_separation(void *handle, void *device, 
225
 
   int comp_num, const char *name,
226
 
   unsigned short c, unsigned short m,
227
 
   unsigned short y, unsigned short k)
228
 
{
229
 
    IMAGE *img;
230
 
#ifdef DISPLAY_DEBUG
231
 
    fprintf(stdout, "display_separation(0x%x, 0x%x, %d '%s' %d,%d,%d,%d)\n", 
232
 
        handle, device, comp_num, name, (int)c, (int)m, (int)y, (int)k);
233
 
#endif
234
 
    img = image_find(handle, device);
235
 
    if (img)
236
 
        image_separation(img, comp_num, name, c, m, y, k);
237
 
    return 0;
238
 
}
239
 
 
240
 
display_callback display = { 
241
 
    sizeof(display_callback),
242
 
    DISPLAY_VERSION_MAJOR,
243
 
    DISPLAY_VERSION_MINOR,
244
 
    display_open,
245
 
    display_preclose,
246
 
    display_close,
247
 
    display_presize,
248
 
    display_size,
249
 
    display_sync,
250
 
    display_page,
251
 
    display_update,
252
 
    NULL,       /* memalloc */
253
 
    NULL,       /* memfree */
254
 
    display_separation
255
 
};
256
 
 
257
 
 
258
 
/*********************************************************************/
259
 
 
260
 
/* program really starts at WinMain */
261
 
int new_main(int argc, char *argv[])
262
 
{
263
 
    int code, code1;
264
 
    int exit_status;
265
 
    int exit_code;
266
 
    int nargc;
267
 
    char **nargv;
268
 
    char dformat[64];
269
 
    char ddpi[64];
270
 
    char buf[256];
271
 
 
272
 
    memset(buf, 0, sizeof(buf));
273
 
    if (load_dll(&gsdll, buf, sizeof(buf))) {
274
 
        text_puts(tw, "Can't load Ghostscript DLL\n");
275
 
        text_puts(tw, buf);
276
 
        text_puts(tw, "\n");
277
 
        return 1;
278
 
    }
279
 
 
280
 
    if (gsdll.new_instance(&instance, NULL) < 0) {
281
 
        text_puts(tw, "Can't create Ghostscript instance\n");
282
 
        return 1;
283
 
    }
284
 
 
285
 
#ifdef DEBUG
286
 
    visual_tracer_init();
287
 
    gsdll.set_visual_tracer(&visual_tracer);
288
 
#endif
289
 
 
290
 
    gsdll.set_stdio(instance, gsdll_stdin, gsdll_stdout, gsdll_stderr);
291
 
    gsdll.set_poll(instance, gsdll_poll);
292
 
    gsdll.set_display_callback(instance, &display);
293
 
 
294
 
    /* insert display device defaults as first arguments */
295
 
    {   int format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | 
296
 
                DISPLAY_DEPTH_1 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
297
 
        HDC hdc = GetDC(NULL);  /* get hdc for desktop */
298
 
        int depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
299
 
        sprintf(ddpi, "-dDisplayResolution=%d", GetDeviceCaps(hdc, LOGPIXELSY));
300
 
        ReleaseDC(NULL, hdc);
301
 
        if (depth == 32)
302
 
            format = DISPLAY_COLORS_RGB | DISPLAY_UNUSED_LAST | 
303
 
                DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
304
 
        else if (depth == 16)
305
 
            format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | 
306
 
                DISPLAY_DEPTH_16 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST |
307
 
                DISPLAY_NATIVE_555;
308
 
        else if (depth > 8)
309
 
            format = DISPLAY_COLORS_RGB | DISPLAY_ALPHA_NONE | 
310
 
                DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
311
 
        else if (depth >= 8)
312
 
            format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | 
313
 
                DISPLAY_DEPTH_8 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
314
 
        else if (depth >= 4)
315
 
            format = DISPLAY_COLORS_NATIVE | DISPLAY_ALPHA_NONE | 
316
 
                DISPLAY_DEPTH_4 | DISPLAY_LITTLEENDIAN | DISPLAY_BOTTOMFIRST;
317
 
        sprintf(dformat, "-dDisplayFormat=%d", format);
318
 
    }
319
 
    nargc = argc + 2;
320
 
    nargv = (char **)malloc((nargc + 1) * sizeof(char *));
321
 
    nargv[0] = argv[0];
322
 
    nargv[1] = dformat;
323
 
    nargv[2] = ddpi;
324
 
    memcpy(&nargv[3], &argv[1], argc * sizeof(char *));
325
 
 
326
 
#if defined(_MSC_VER) || defined(__BORLANDC__)
327
 
    __try {
328
 
#endif
329
 
    code = gsdll.init_with_args(instance, nargc, nargv);
330
 
    if (code == 0)
331
 
        code = gsdll.run_string(instance, start_string, 0, &exit_code);
332
 
    code1 = gsdll.exit(instance);
333
 
    if (code == 0 || (code == e_Quit && code1 != 0))
334
 
        code = code1;
335
 
#if defined(_MSC_VER) || defined(__BORLANDC__)
336
 
    } __except(exception_code() == EXCEPTION_STACK_OVERFLOW) {
337
 
        code = e_Fatal;
338
 
        text_puts(tw, "*** C stack overflow. Quiting...\n");
339
 
    }
340
 
#endif
341
 
 
342
 
    gsdll.delete_instance(instance);
343
 
 
344
 
#ifdef DEBUG
345
 
    visual_tracer_close();
346
 
#endif
347
 
 
348
 
    unload_dll(&gsdll);
349
 
 
350
 
    free(nargv);
351
 
 
352
 
    exit_status = 0;
353
 
    switch (code) {
354
 
        case 0:
355
 
        case e_Quit:
356
 
            break;
357
 
        case e_Fatal:
358
 
            exit_status = 1;
359
 
            break;
360
 
        case e_Info:
361
 
        default:
362
 
            exit_status = 255;
363
 
    }
364
 
    
365
 
    return exit_status;
366
 
}
367
 
 
368
 
 
369
 
 
370
 
void
371
 
set_font(void)
372
 
{
373
 
    int fontsize;
374
 
    char fontname[256];
375
 
    char buf[32];
376
 
 
377
 
    /* read ini file */
378
 
    GetPrivateProfileString(szIniSection, "FontName", "Courier New", fontname, sizeof(fontname), szIniName);
379
 
    fontsize = GetPrivateProfileInt(szIniSection, "FontSize", 10, szIniName);
380
 
 
381
 
    /* set font */
382
 
    text_font(tw, fontname, fontsize); 
383
 
 
384
 
    /* write ini file */
385
 
    WritePrivateProfileString(szIniSection, "FontName", fontname, szIniName);
386
 
    sprintf(buf, "%d", fontsize);
387
 
    WritePrivateProfileString(szIniSection, "FontSize", buf, szIniName);
388
 
}
389
 
 
390
 
int PASCAL 
391
 
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int cmdShow)
392
 
{
393
 
    int dll_exit_status;
394
 
#define MAXCMDTOKENS 128
395
 
    /* BC++ 4.5 will give us _argc and _argv[], but they will be */
396
 
    /* incorrect if there is a space in the program name. */
397
 
    /* Provide our own parsing code to create argc and argv[]. */
398
 
    int argc;
399
 
    LPSTR argv[MAXCMDTOKENS];
400
 
    LPSTR p;
401
 
    char command[256];
402
 
    char *args;
403
 
    char *d, *e;
404
 
    char winposbuf[256];
405
 
    int len = sizeof(winposbuf);
406
 
    int x, y, cx, cy;
407
 
 
408
 
    /* copy the hInstance into a variable so it can be used */
409
 
    ghInstance = hInstance;
410
 
 
411
 
    if (hPrevInstance) {
412
 
        MessageBox((HWND)NULL,"Can't run twice", szAppName, 
413
 
                MB_ICONHAND | MB_OK);
414
 
        return FALSE;
415
 
    }
416
 
 
417
 
    /* If called with "gswin32c.exe arg1 arg2"
418
 
     * lpszCmdLine returns:
419
 
     *    "arg1 arg2" if called with CreateProcess(NULL, command, ...)
420
 
     *    "arg2"      if called with CreateProcess(command, args, ...)
421
 
     * GetCommandLine() returns
422
 
     *    ""gswin32c.exe" arg1 arg2" 
423
 
     *          if called with CreateProcess(NULL, command, ...)
424
 
     *    "  arg1 arg2"      
425
 
     *          if called with CreateProcess(command, args, ...)
426
 
     * Consequently we must use GetCommandLine() 
427
 
     */
428
 
    p = GetCommandLine();
429
 
 
430
 
    argc = 0;
431
 
    args = (char *)malloc(lstrlen(p)+1);
432
 
    if (args == (char *)NULL) {
433
 
        fprintf(stdout, "Insufficient memory in WinMain()\n");
434
 
        return 1;
435
 
    }
436
 
   
437
 
    /* Parse command line handling quotes. */
438
 
    d = args;
439
 
    while (*p) {
440
 
        /* for each argument */
441
 
 
442
 
        if (argc >= MAXCMDTOKENS - 1)
443
 
            break;
444
 
 
445
 
        e = d;
446
 
        while ((*p) && (*p != ' ')) {
447
 
            if (*p == '\042') {
448
 
                /* Remove quotes, skipping over embedded spaces. */
449
 
                /* Doesn't handle embedded quotes. */
450
 
                p++;
451
 
                while ((*p) && (*p != '\042'))
452
 
                    *d++ =*p++;
453
 
            }
454
 
            else 
455
 
                *d++ = *p;
456
 
            if (*p)
457
 
                p++;
458
 
        }
459
 
        *d++ = '\0';
460
 
        argv[argc++] = e;
461
 
 
462
 
        while ((*p) && (*p == ' '))
463
 
            p++;        /* Skip over trailing spaces */
464
 
    }
465
 
    argv[argc] = NULL;
466
 
 
467
 
    if (strlen(argv[0]) == 0) {
468
 
        GetModuleFileName(hInstance, command, sizeof(command)-1);
469
 
        argv[0] = command;
470
 
    }
471
 
 
472
 
 
473
 
    tw = text_new();
474
 
    if (tw == NULL) {
475
 
        MessageBox((HWND)NULL, "Can't create text window", 
476
 
                szAppName, MB_OK | MB_ICONSTOP);
477
 
        return 1;
478
 
    }
479
 
 
480
 
    /* start up the text window */
481
 
    if (!hPrevInstance) {
482
 
        HICON hicon = LoadIcon(hInstance, (LPSTR)MAKEINTRESOURCE(GSTEXT_ICON));
483
 
        text_register_class(tw, hicon);
484
 
    }
485
 
    set_font();
486
 
    text_size(tw, 80, 80);
487
 
    text_drag(tw, "(", ") run\r");
488
 
    if (win_get_reg_value("Text", winposbuf, &len) == 0) {
489
 
        if (sscanf(winposbuf, "%d %d %d %d", &x, &y, &cx, &cy) == 4)
490
 
            text_setpos(tw, x, y, cx, cy);
491
 
    }
492
 
 
493
 
    /* create the text window */
494
 
    if (text_create(tw, szAppName, cmdShow))
495
 
        exit(1);
496
 
 
497
 
    hwndtext = text_get_handle(tw);
498
 
 
499
 
    dll_exit_status = new_main(argc, argv);
500
 
    
501
 
    if (dll_exit_status && !tw->quitnow) {
502
 
        /* display error message in text window */
503
 
        MSG msg;
504
 
        text_puts(tw, "\nClose this window with the close button on the title bar or the system menu.\n");
505
 
        if (IsIconic(text_get_handle(tw)))
506
 
            ShowWindow(text_get_handle(tw), SW_SHOWNORMAL);
507
 
        BringWindowToTop(text_get_handle(tw));  /* make text window visible */
508
 
        FlashWindow(text_get_handle(tw), TRUE);
509
 
        /* Wait until error message is read */
510
 
        while (!tw->quitnow && GetMessage(&msg, (HWND)NULL, 0, 0)) {
511
 
            TranslateMessage(&msg);
512
 
            DispatchMessage(&msg);
513
 
        }
514
 
    }
515
 
 
516
 
    /* Save the text window size */
517
 
    if (text_getpos(tw, &x, &y, &cx, &cy) == 0) {
518
 
        sprintf(winposbuf, "%d %d %d %d", x, y, cx, cy);
519
 
        win_set_reg_value("Text", winposbuf);
520
 
    }
521
 
 
522
 
    text_destroy(tw);
523
 
    tw = NULL;
524
 
 
525
 
    return dll_exit_status;
526
 
}
527
 
 
528
 
 
529