"Fossies" - the Fresh Open Source Software Archive

Member "epstool-3.08/src/cplat.h" (10 Jun 2005, 6088 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-2005 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: cplat.h,v 1.17 2005/06/10 09:39:24 ghostgum Exp $ */
   17 /* Platform specific includes and types */
   18 
   19 /*
   20  * ZLIBNAME is name of zlib DLL/shared library
   21  * BZIP2NAME is name of bzip2 DLL/shared library
   22  * PATHSEP is a string containing the directory path separator.
   23  * INTPTR is an unsigned integer the same size as a pointer.
   24  * INTPTR_FORMAT is the printf format specifier used for INTPTR.
   25  * GGMODULE is a DLL/shared library handle.
   26  * GGMUTEX is mutual exclusion semaphore handle.
   27  * GGEVENT is an event semaphore handle.
   28  * GGTHREAD is a thread handle for the C run time library.
   29  */
   30 
   31 #ifndef CPLAT_INCLUDED
   32 #define CPLAT_INCLUDED
   33 
   34 #if defined(_WIN32) || defined(_WIN64)
   35 # ifndef _Windows
   36 # define _Windows
   37 # endif
   38 #endif
   39 
   40 #ifdef _WINDOWS
   41 # ifndef _Windows
   42 # define _Windows
   43 # endif
   44 #endif
   45 
   46 #ifdef _Windows
   47 # include <windows.h> /* must be included before stdio.h */
   48 # include <direct.h>
   49 # include <io.h>
   50 # include "wgsver.h"
   51 # define ZLIBNAME "zlib32.dll"
   52 # define BZIP2NAME "libbz2.dll"
   53 # define PATHSEP "\\"
   54 # define EOLSTR "\r\n"
   55 # ifdef _WIN64
   56 #  define INTPTR __int64  /* an integer that same size as a pointer */
   57 #  define INTPTR_FORMAT "%I64u"
   58 # else
   59 #  define INTPTR unsigned long
   60 #  define INTPTR_FORMAT "%lu"
   61 # endif
   62 /* BYTE  is a predefined type in windows.h */
   63 /* WORD  is a predefined type in windows.h */
   64 /* DWORD is a predefined type in windows.h */
   65 /* LONG  is a predefined type in windows.h */
   66 /* TCHAR is a predefined type in windows.h */
   67 /* LPTSTR is a predefined type in windows.h */
   68 /* LPCTSTR is a predefined type in windows.h */
   69 # define GGMODULE HMODULE
   70 # define GGMUTEX HANDLE
   71 # define GGEVENT HANDLE
   72 # if _MSC_VER >= 1300
   73 #  define GGTHREAD uintptr_t
   74 # else
   75 #  define GGTHREAD unsigned long
   76 # endif
   77 /* WINAPI already defined in windows.h */
   78 #define snprintf _snprintf
   79 #define vsnprintf _vsnprintf
   80 #endif
   81 
   82 #ifdef OS2
   83 #define INCL_DOS
   84 # include <os2.h>
   85 # include <io.h>
   86 # define PATHSEP "\\"
   87 # define EOLSTR "\r\n"
   88 # define ZLIBNAME "zlib2.dll"  /* never used */
   89 # define BZIP2NAME "bzip2.dll"  /* never used */
   90 # define INTPTR unsigned long
   91 # define INTPTR_FORMAT "%lu"
   92 # define TCHAR char
   93 # define LPTSTR TCHAR *
   94 # define LPCTSTR const TCHAR *
   95 # define GGMODULE HMODULE
   96 # define GGMUTEX HMTX
   97 # define GGEVENT HEVENT
   98 # define GGTHREAD int
   99 # define WINAPI _System
  100 # define BI_RGB (0L)
  101 # define BI_BITFIELDS (3L)
  102 typedef unsigned short WORD; /* 16-bits */
  103 typedef unsigned long DWORD; /* 32-bits (or longer)*/
  104 typedef struct POINT_s {
  105     int x;
  106     int y;
  107 } POINT;
  108 #endif
  109 
  110 #ifdef UNIX
  111 # ifdef GTK
  112 #  include <gtk/gtk.h>
  113 # else
  114 typedef struct _GdkRgbCmap GdkRgbCmap;
  115 # endif
  116 # include <unistd.h>
  117 # define __USE_GNU  /* we might need recursive mutex */
  118 # include <semaphore.h>
  119 # include <pthread.h>
  120 # define ZLIBNAME "libz.so"
  121 # define BZIP2NAME "libbz2.so"
  122 # define PATHSEP "/"
  123 # define EOLSTR "\n"
  124 # define INTPTR unsigned long
  125 # define INTPTR_FORMAT "%lu"
  126 # define TCHAR char
  127 # define LPTSTR TCHAR *
  128 # define LPCTSTR const TCHAR *
  129 # define GGMODULE void *
  130 # define GGMUTEX pthread_mutex_t
  131 # define GGEVENT sem_t
  132 # define GGTHREAD pthread_t
  133 # define WINAPI 
  134 # define stricmp strcasecmp
  135 /* FIX: these shouldn't be here */
  136 /* Windows IDs */
  137 #define IDOK  1
  138 #define IDCANCEL  2
  139 #define IDYES 6
  140 #define IDNO 7
  141 
  142 #define MB_OK       0x0
  143 #define MB_OKCANCEL     0x1
  144 #define MB_YESNO    0x4
  145 #define MB_TYPEMASK 0xf
  146 #define MB_ICONHAND    0x10
  147 #define MB_ICONQUESTION    0x20
  148 #define MB_ICONEXCLAMATION 0x30
  149 #define MB_ICONASTERISK    0x40
  150 
  151 # define CW_USEDEFAULT (-32768)
  152 # define BI_RGB (0L)
  153 # define BI_BITFIELDS (3L)
  154 typedef int BOOL;
  155 typedef unsigned char BYTE; /* 8-bits */
  156 typedef unsigned short WORD; /* 16-bits */
  157 typedef unsigned long DWORD; /* 32-bits (or longer)*/
  158 typedef long LONG;       /* signed 32-bits (or longer)*/
  159 typedef struct POINT_s {
  160     int x;
  161     int y;
  162 } POINT;
  163 # ifndef FALSE
  164 #  define FALSE (0)
  165 # endif
  166 # ifndef TRUE
  167 #  define TRUE (!(FALSE))
  168 # endif
  169 # ifdef NO_SNPRINTF
  170 int snprintf(char *buffer, size_t count, const char *fmt, ...);
  171 int vsnprintf(char *buffer, size_t count, const char *fmt, va_list argptr);
  172 # endif
  173 #endif
  174 
  175 
  176 /* Stuff for handling UNICODE */
  177 
  178 #ifndef TEXT
  179 # define TEXT(s) s  /* for Unicode strings */
  180 #endif
  181 
  182 /* Functions prefixed by "cs" take a character string
  183  * as an argument that may be Unicode or narrow
  184  * depending on the platform.
  185  */
  186 #if defined(UNICODE) && defined(_Windows)
  187 # define csncpy(s,t,n) wcsncpy(s,t,n)
  188 # define csncat(s,t,n) wcsncat(s,t,n)
  189 # define cscmp(s,t) wcscmp(s,t)
  190 # define csicmp(s,t) wcsicmp(s,t)
  191 # define csncmp(s,t,n) wcsncmp(s,t,n)
  192 # define csrchr(s,c) wcsrchr(s,c)
  193 # define cslen(s) wcslen(s)
  194 # define csnprintf _snwprintf
  195 # define csvnprintf _vsnwprintf
  196 # define cstoi _wtoi
  197 # define csfopen(s,m) _wfopen(s, m)
  198 # define csunlink(s) _wunlink(s)
  199 # define csgetcwd(s, n) _wgetcwd(s, n)
  200 # define csmktemp(s) _wmktemp(s)
  201 # define csgetenv(s) _wgetenv(s)
  202 #else
  203 # define csncpy(s,t,n) strncpy(s,t,n)
  204 # define csncat(s,t,n) strncat(s,t,n)
  205 # define cscmp(s,t) strcmp(s,t)
  206 # define csicmp(s,t) stricmp(s,t)
  207 # define csncmp(s,t,n) strncmp(s,t,n)
  208 # define csrchr(s,c) strrchr(s,c)
  209 # define cslen(s) strlen(s)
  210 # define csnprintf snprintf
  211 # define csvnprintf vsnprintf
  212 # define cstoi atoi
  213 # define csfopen(s,m) fopen(s, m)
  214 # define csunlink(s) unlink(s)
  215 # define csgetcwd(s, n) getcwd(s, n)
  216 # define csmktemp(s) mktemp(s)
  217 # define csgetenv(s) getenv(s)
  218 #endif
  219 
  220 #ifdef DO_NOT_USE_THESE
  221 #define strcpy DO_NOT_USE_strcpy
  222 #define strcat DO_NOT_USE_strcat
  223 #define sprintf DO_NOT_USE_sprintf
  224 #endif
  225 
  226 #endif /* CPLAT_INCLUDED */
  227