Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:14:27

0001 /*
0002   Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
0003   dedicated to making software imaging solutions freely available.
0004 
0005   You may not use this file except in compliance with the License.  You may
0006   obtain a copy of the License at
0007 
0008     https://imagemagick.org/script/license.php
0009 
0010   Unless required by applicable law or agreed to in writing, software
0011   distributed under the License is distributed on an "AS IS" BASIS,
0012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013   See the License for the specific language governing permissions and
0014   limitations under the License.
0015 
0016   MagickCore Windows NT utility methods.
0017 */
0018 #ifndef MAGICKCORE_NT_BASE_H
0019 #define MAGICKCORE_NT_BASE_H
0020 
0021 #include "MagickCore/exception.h"
0022 #include "MagickCore/geometry.h"
0023 
0024 #if defined(__cplusplus) || defined(c_plusplus)
0025 extern "C" {
0026 #endif
0027 
0028 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
0029 
0030 #define WIN32_LEAN_AND_MEAN
0031 #define VC_EXTRALEAN
0032 #if !defined(_CRT_SECURE_NO_DEPRECATE)
0033 #  define _CRT_SECURE_NO_DEPRECATE  1
0034 #endif
0035 #include <windows.h>
0036 #include <wchar.h>
0037 #include <winuser.h>
0038 #include <wingdi.h>
0039 #include <io.h>
0040 #include <process.h>
0041 #include <errno.h>
0042 #include <malloc.h>
0043 #include <sys/utime.h>
0044 #if defined(_DEBUG) && !defined(__MINGW32__)
0045 #include <crtdbg.h>
0046 #endif
0047 
0048 #define PROT_READ  0x01
0049 #define PROT_WRITE  0x02
0050 #define MAP_SHARED  0x01
0051 #define MAP_PRIVATE  0x02
0052 #define MAP_ANONYMOUS  0x20
0053 #define F_OK 0
0054 #define R_OK 4
0055 #define W_OK 2
0056 #define RW_OK 6
0057 #define _SC_PAGE_SIZE 1
0058 #define _SC_PHYS_PAGES 2
0059 #define _SC_OPEN_MAX 3
0060 #ifdef _WIN64
0061 #  if !defined(SSIZE_MAX)
0062 #    define SSIZE_MAX LLONG_MAX
0063 #  endif
0064 #  if defined(_MSC_VER)
0065 #    define MAGICKCORE_SIZEOF_SSIZE_T 8
0066 #  endif
0067 #else
0068 #  if !defined(SSIZE_MAX)
0069 #    define SSIZE_MAX LONG_MAX
0070 #  endif
0071 #  if defined(_MSC_VER)
0072 #    define MAGICKCORE_SIZEOF_SSIZE_T 4
0073 #  endif
0074 #endif
0075 #ifndef S_ISCHR
0076 #  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
0077 #endif
0078 
0079 #if defined(_MSC_VER)
0080 # if !defined(MAGICKCORE_MSC_VER)
0081 #   if (_MSC_VER >= 1930)
0082 #     define MAGICKCORE_MSC_VER 2022
0083 #   elif (_MSC_VER >= 1920)
0084 #     define MAGICKCORE_MSC_VER 2019
0085 #   elif (_MSC_VER >= 1910)
0086 #     define MAGICKCORE_MSC_VER 2017
0087 #   elif (_MSC_VER >= 1900)
0088 #     define MAGICKCORE_MSC_VER 2015
0089 #   elif (_MSC_VER >= 1800)
0090 #     define MAGICKCORE_MSC_VER 2013
0091 #   elif (_MSC_VER >= 1700)
0092 #     define MAGICKCORE_MSC_VER 2012
0093 #   endif
0094 # endif
0095 #endif
0096 
0097 #if !defined(chsize)
0098 # if defined(__BORLANDC__)
0099 #   define chsize(file,length)  chsize(file,length)
0100 # else
0101 #   define chsize(file,length)  _chsize(file,length)
0102 # endif
0103 #endif
0104 
0105 #if !defined(access)
0106 #if defined(_MSC_VER)
0107 #  define access(path,mode)  _access_s(path,mode)
0108 #endif
0109 #endif
0110 #if !defined(chdir)
0111 #  define chdir  _chdir
0112 #endif
0113 #if !defined(close)
0114 #  define close  _close
0115 #endif
0116 #if !defined(closedir)
0117 #  define closedir(directory)  NTCloseDirectory(directory)
0118 #endif
0119 #if !defined(MAGICKCORE_HAVE_ERF)
0120 #  define MAGICKCORE_HAVE_ERF
0121 #endif
0122 #if !defined(fdopen)
0123 #  define fdopen  _fdopen
0124 #endif
0125 #if !defined(fileno)
0126 #  define fileno  _fileno
0127 #endif
0128 #if !defined(freelocale)
0129 #  define freelocale  _free_locale
0130 #endif
0131 #if !defined(fsync)
0132 #  define fsync  _commit
0133 #endif
0134 #if !defined(ftruncate)
0135 #  define ftruncate(file,length)  NTTruncateFile(file,length)
0136 #endif
0137 #if !defined(getcwd)
0138 #  define getcwd  _getcwd
0139 #endif
0140 #if !defined(getpid)
0141 #  define getpid  _getpid
0142 #endif
0143 #if !defined(hypot)
0144 #  define hypot  _hypot
0145 #endif
0146 #if !defined(isatty)
0147 #  define isatty  _isatty
0148 #endif
0149 #if !defined(locale_t)
0150 #define locale_t _locale_t
0151 #endif
0152 #if !defined(MAGICKCORE_LTDL_DELEGATE)
0153 #if !defined(lt_dlclose)
0154 #  define lt_dlclose(handle)  NTCloseLibrary(handle)
0155 #endif
0156 #if !defined(lt_dlerror)
0157 #  define lt_dlerror()  NTGetLibraryError()
0158 #endif
0159 #if !defined(lt_dlopen)
0160 #  define lt_dlopen(filename)  NTOpenLibrary(filename)
0161 #endif
0162 #if !defined(lt_dlsym)
0163 #  define lt_dlsym(handle,name)  NTGetLibrarySymbol(handle,name)
0164 #endif
0165 #endif
0166 #if !defined(mkdir)
0167 #  define mkdir  _mkdir
0168 #endif
0169 #if !defined(mmap)
0170 #  define MAGICKCORE_HAVE_MMAP 1
0171 #  define mmap(address,length,protection,access,file,offset) \
0172   NTMapMemory(address,length,protection,access,file,offset)
0173 #endif
0174 #if !defined(munmap)
0175 #  define munmap(address,length)  NTUnmapMemory(address,length)
0176 #endif
0177 #if !defined(opendir)
0178 #  define opendir(directory)  NTOpenDirectory(directory)
0179 #endif
0180 #if !defined(open)
0181 #  define open  _open
0182 #endif
0183 #if !defined(pclose)
0184 #  define pclose  _pclose
0185 #endif
0186 #if !defined(popen)
0187 #  define popen  _popen
0188 #endif
0189 #if !defined(putenv)
0190 #  define putenv  _putenv
0191 #endif
0192 #if !defined(fprintf_l)
0193 #define fprintf_l  _fprintf_s_l
0194 #endif
0195 #if !defined(read)
0196 #  define read(fd,buffer,count)  _read(fd,buffer,(unsigned int) count)
0197 #endif
0198 #if !defined(readdir)
0199 #  define readdir(directory)  NTReadDirectory(directory)
0200 #endif
0201 #if !defined(setmode)
0202 #  define setmode  _setmode
0203 #endif
0204 #if !defined(spawnvp)
0205 #  define spawnvp  _spawnvp
0206 #endif
0207 #if !defined(strtod_l)
0208 #define strtod_l  _strtod_l
0209 #endif
0210 #if !defined(strcasecmp)
0211 #  define strcasecmp  _stricmp
0212 #endif
0213 #if !defined(strncasecmp)
0214 #  define strncasecmp  _strnicmp
0215 #endif
0216 #if !defined(sysconf)
0217 #  define sysconf(name)  NTSystemConfiguration(name)
0218 #  define MAGICKCORE_HAVE_SYSCONF 1
0219 #endif
0220 #if !defined(tempnam)
0221 #  define tempnam  _tempnam_s
0222 #endif
0223 #if !defined(tolower_l)
0224 #define tolower_l  _tolower_l
0225 #endif
0226 #if !defined(toupper_l)
0227 #define toupper_l  _toupper_l
0228 #endif
0229 #if !defined(umask)
0230 #  define umask  _umask
0231 #endif
0232 #if !defined(unlink)
0233 #  define unlink  _unlink
0234 #endif
0235 #define MAGICKCORE_HAVE_UTIME 1
0236 #if !defined(utime)
0237 #  define utime(filename,time)  _utime(filename,(struct _utimbuf*) time)
0238 #endif
0239 #if !defined(vfprintf_l)
0240 #define vfprintf_l  _vfprintf_l
0241 #endif
0242 #if !defined(vsnprintf) && !defined(_MSC_VER)
0243 #define vsnprintf _vsnprintf
0244 #endif
0245 #if !defined(vsnprintf_l)
0246 #define vsnprintf_l  _vsnprintf_l
0247 #endif
0248 #if !defined(write)
0249 #  define write(fd,buffer,count)  _write(fd,buffer,(unsigned int) count)
0250 #endif
0251 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
0252   !(defined(__BORLANDC__)) && \
0253   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
0254 #  if !defined(fseek)
0255 #    define fseek  _fseeki64
0256 #  endif
0257 #  if !defined(ftell)
0258 #    define ftell  _ftelli64
0259 #  endif
0260 #  if !defined(lseek)
0261 #    define lseek  _lseeki64
0262 #  endif
0263 #  if !defined(fstat)
0264 #    define fstat  _fstati64
0265 #  endif
0266 #  if !defined(stat)
0267 #    define stat  _stati64
0268 #  endif
0269 #  if !defined(tell)
0270 #    define tell  _telli64
0271 #  endif
0272 #  if !defined(wstat)
0273 #    define wstat  _wstati64
0274 #  endif
0275 #else
0276 #  if !defined(__MINGW32__)
0277 #    if !defined(fseek)
0278 #      define fseek  _fseek
0279 #    endif
0280 #    if !defined(ftell)
0281 #      define ftell  _ftell
0282 #    endif
0283 #  endif
0284 #  if !defined(lseek)
0285 #    define lseek  _lseek
0286 #  endif
0287 #  if !defined(fstat)
0288 #    define fstat  _fstat
0289 #  endif
0290 #  if !defined(stat)
0291 #    define stat  _stat
0292 #  endif
0293 #  if !defined(tell)
0294 #    define tell  _tell
0295 #  endif
0296 #  if !defined(wstat)
0297 #    define wstat  _wstat
0298 #  endif
0299 #endif
0300 
0301 #if defined(__BORLANDC__)
0302 #undef _O_RANDOM
0303 #define _O_RANDOM 0
0304 #undef _O_SEQUENTIAL
0305 #define _O_SEQUENTIAL 0
0306 #undef _O_SHORT_LIVED
0307 #define _O_SHORT_LIVED 0
0308 #undef _O_TEMPORARY
0309 #define _O_TEMPORARY 0
0310 #endif
0311 
0312 #undef gettimeofday
0313 
0314 typedef struct _GhostInfo
0315   GhostInfo_;
0316 
0317 extern MagickExport char
0318   **NTArgvToUTF8(const int argc,wchar_t **);
0319 
0320 extern MagickExport const GhostInfo_
0321   *NTGhostscriptDLLVectors(void);
0322 
0323 extern MagickExport void
0324   NTErrorHandler(const ExceptionType,const char *,const char *),
0325   NTGhostscriptUnLoadDLL(void),
0326   NTWarningHandler(const ExceptionType,const char *,const char *);
0327 
0328 #endif
0329 
0330 #if defined(__cplusplus) || defined(c_plusplus)
0331 }
0332 #endif
0333 
0334 #endif