"Fossies" - the Fresh Open Source Software Archive

Member "epstool-3.08/src/capp.h" (10 Jun 2005, 6165 Bytes) of package /linux/misc/old/ghost/ghostgum/epstool-3.08-os2.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Copyright (C) 2001-2003 Ghostgum Software Pty Ltd.  All rights reserved.
    2 
    3   This software is provided AS-IS with no warranty, either express or
    4   implied.
    5 
    6   This software is distributed under licence and may not be copied,
    7   modified or distributed except as expressly authorised under the terms
    8   of the licence contained in the file LICENCE in this distribution.
    9 
   10   For more information about licensing, please refer to
   11   http://www.ghostgum.com.au/ or contact Ghostsgum Software Pty Ltd, 
   12   218 Gallaghers Rd, Glen Waverley VIC 3150, AUSTRALIA, 
   13   Fax +61 3 9886 6616.
   14 */
   15 
   16 /* $Id: capp.h,v 1.7 2003/01/18 02:36:40 ghostgum Exp $ */
   17 /* Application header */
   18 
   19 /* Public */
   20 
   21 int app_platform_init(GSview *a);
   22 int app_platform_finish(GSview *a);
   23 int app_gssrv_request(GSview *a, GSREQ *reqnew);
   24 int app_plsrv_request(GSview *a, GSREQ *reqnew);
   25 GSview *app_new(void *handle, BOOL multithread);
   26 int app_free(GSview *a);
   27 int app_ref(GSview *a);
   28 int app_unref(GSview *a);
   29 GSDLL **app_dll(GSview *a);
   30 PLDLL **app_pldll(GSview *a);
   31 Doc **app_docs(GSview *a);
   32 OPTION *app_option(GSview *a);
   33 PAGECACHE **app_pagecache(GSview *a);
   34 BOOL app_multithread(GSview *a);
   35 int app_lock(GSview *a);
   36 int app_unlock(GSview *a);
   37 #define MAX_LAST_FILES 4
   38 void app_update_last_files(GSview *a, LPCTSTR filename);
   39 LPCTSTR app_last_files(GSview *a, int i);
   40 int app_read_last_files(GSview *a, LPCTSTR filename);
   41 int app_write_last_files(GSview *a, LPCTSTR filename);
   42 
   43 int zlib_load(GSview *a);
   44 void zlib_free(GSview *a);
   45 int zlib_uncompress(GSview *app, GFile *outfile, const char *filename);
   46 #ifdef __cplusplus
   47 extern "C" {
   48 #endif
   49     /* for zlib gunzip decompression */
   50     typedef void *gzFile ;
   51     typedef gzFile (WINAPI *PFN_gzopen)(const char *path, const char *mode);
   52     typedef int (WINAPI *PFN_gzread)(gzFile file, void *buf, unsigned len);
   53     typedef int (WINAPI *PFN_gzclose)(gzFile file);
   54 #ifdef __cplusplus
   55 }
   56 #endif
   57 
   58 int bzip2_load(GSview *a);
   59 void bzip2_free(GSview *a);
   60 int bzip2_uncompress(GSview *app, GFile *outfile, const char *filename);
   61 #ifdef __cplusplus
   62 extern "C" {
   63 #endif
   64     /* for bzip2 decompression */
   65     typedef void *bzFile ;
   66     typedef bzFile (WINAPI *PFN_bzopen)(const char *path, const char *mode);
   67     typedef int (WINAPI *PFN_bzread)(bzFile file, void *buf, unsigned len);
   68     typedef int (WINAPI *PFN_bzclose)(bzFile file);
   69 #ifdef __cplusplus
   70 }
   71 #endif
   72 
   73 /* Write text messages to log window */
   74 void app_log(const char *str, int len);
   75 int app_msgf(GSview *a, const char *fmt, ...);
   76 int app_msg(GSview *a, const char *str);
   77 int app_msg_len(GSview *a, const char *str, int len);
   78 int app_msg_len_nolock(GSview *a, const char *str, int len);
   79 int app_csmsgf(GSview *a, LPCTSTR fmt, ...);
   80 int app_csmsg(GSview *a, LPCTSTR wstr);
   81 int app_csmsg_len(GSview *a, LPCTSTR wstr, int wlen);
   82 int app_csmsg_len_nolock(GSview *a, LPCTSTR wstr, int wlen);
   83 
   84 int load_string(GSview *app, int i, TCHAR *buf, int len);
   85 const char *get_string(GSview *a, int id);  /* Not Windows */
   86 int get_dsc_response(GSview *app, LPCTSTR str);
   87 GFile *app_temp_gfile(GSview *app, TCHAR *fname, int len);
   88 FILE *app_temp_file(GSview *app, TCHAR *fname, int len);
   89 int app_msg_box(GSview *a, LPCTSTR str, int icon);
   90 
   91 
   92 extern const char szAppName[];      /* GLOBAL */
   93 
   94 
   95 /****************************************************/
   96 /* Private */
   97 #ifdef DEFINE_CAPP
   98 
   99 typedef struct STRING_s STRING;
  100 
  101 typedef struct ZLIB_s ZLIB;
  102 struct ZLIB_s {
  103     BOOL loaded;
  104     GGMODULE hmodule;
  105     PFN_gzopen gzopen;
  106     PFN_gzread gzread;
  107     PFN_gzclose gzclose;
  108 };
  109 
  110 typedef struct BZIP2_s BZIP2;
  111 struct BZIP2_s {
  112     BOOL loaded;
  113     GGMODULE hmodule;
  114     PFN_bzopen bzopen;
  115     PFN_bzread bzread;
  116     PFN_bzclose bzclose;
  117 };
  118 
  119 struct GSview_s {
  120     void *handle;   /* Platform specific handle */
  121             /* e.g. pointer to MFC theApp */
  122 
  123     int refcount;   /* number of references to Application */
  124     /* MRU files */
  125     TCHAR last_files[MAX_LAST_FILES][MAXSTR]; /* last 4 files used */
  126     int last_files_count;           /* number of files known */
  127 
  128     /* List of documents */
  129     Doc *doclist;
  130 
  131     /* Ghostscript DLL */
  132     GSDLL *gsdll;
  133 
  134     /* GhostPCL DLL */
  135     PLDLL *pldll;
  136 
  137     /* The server thread which executes ghostscript */
  138     /* and handles requests for rendering and printing. */
  139     GSSRV *gssrv;
  140 
  141     /* The server thread which executes GhostPCL */
  142     /* and handles requests for rendering and printing. */
  143     GSSRV *plsrv;
  144 
  145     /* The list of rendered pages that we have cached */
  146     PAGECACHE *pagecache;
  147 
  148     /* Options */
  149     OPTION option;
  150     TCHAR option_name[MAXSTR];  /* filename for options */
  151 
  152     /* Compression libraries */
  153     ZLIB zlib;
  154     BZIP2 bzip2;
  155 
  156     /* TRUE if application is shutting down */
  157     BOOL quitnow;
  158 
  159     /* When running single threaded, we need to return to main
  160      * loop to complete some commands.
  161      */
  162     BOOL in_main;   /* TRUE if in main loop */
  163     BOOL go_main;   /* TRUE if we should return to main loop */
  164 
  165     /* We can run as either single thread, or multithread with
  166      * Ghostscript on the second thread.
  167      */
  168     BOOL multithread;
  169 
  170     /* When running multithread, we use a mutex to protect
  171      * access to resources.
  172      */
  173     GGMUTEX hmutex;
  174     int lock_count; /* for debugging lock */
  175 
  176     /* Text Window for Ghostscript Messages */
  177     /* This is maintained in narrow characters, even if the user
  178      * interface is using wide characters.  This is because we
  179      * want to have a simple file for sending bug reports,
  180      * and because Ghostscript is taking all input and filenames
  181      * as narrow characters. If a wide character filename is
  182      * not translated to narrow characters correctly, this
  183      * should show up in the message log.
  184      */
  185 #ifdef _Windows
  186 #define TWLENGTH 61440
  187 #endif
  188 #ifdef OS2
  189 #define TWLENGTH 16384
  190 #endif
  191 #ifndef TWLENGTH
  192 #define TWLENGTH 61440
  193 #endif
  194 #define TWSCROLL 1024
  195     char twbuf[TWLENGTH];
  196     int twend;
  197 
  198     STRING *strings;    /* translation strings */
  199 };
  200 
  201 int free_strings(STRING *s);
  202 int init_strings(GSview *a, const char *filename);
  203 
  204 float app_get_points(GSview *a, const TCHAR *str);
  205 void app_put_points(GSview *a, UNIT unit, TCHAR *buf, int len, float n);
  206 
  207 #endif /* DEFINE_CAPP */
  208