nt-base.h

Go to the documentation of this file.
00001 /*
00002   Copyright 1999-2020 ImageMagick Studio LLC, a non-profit organization
00003   dedicated to making software imaging solutions freely available.
00004 
00005   You may not use this file except in compliance with the License.  You may
00006   obtain a copy of the License at
00007 
00008     https://imagemagick.org/script/license.php
00009 
00010   Unless required by applicable law or agreed to in writing, software
00011   distributed under the License is distributed on an "AS IS" BASIS,
00012   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013   See the License for the specific language governing permissions and
00014   limitations under the License.
00015 
00016   MagickCore Windows NT utility methods.
00017 */
00018 #ifndef MAGICKCORE_NT_BASE_H
00019 #define MAGICKCORE_NT_BASE_H
00020 
00021 #include "magick/exception.h"
00022 #include "magick/geometry.h"
00023 
00024 #if defined(__cplusplus) || defined(c_plusplus)
00025 extern "C" {
00026 #endif
00027 
00028 #if defined(MAGICKCORE_WINDOWS_SUPPORT)
00029 
00030 #define WIN32_LEAN_AND_MEAN
00031 #define VC_EXTRALEAN
00032 #define _CRT_SECURE_NO_DEPRECATE  1
00033 #include <windows.h>
00034 #include <wchar.h>
00035 #include <winuser.h>
00036 #include <wingdi.h>
00037 #include <io.h>
00038 #include <process.h>
00039 #include <errno.h>
00040 #include <malloc.h>
00041 #include <sys/utime.h>
00042 #if defined(_DEBUG) && !defined(__MINGW32__)
00043 #include <crtdbg.h>
00044 #endif
00045 
00046 #define PROT_READ  0x01
00047 #define PROT_WRITE  0x02
00048 #define MAP_SHARED  0x01
00049 #define MAP_PRIVATE  0x02
00050 #define MAP_ANONYMOUS  0x20
00051 #define F_OK 0
00052 #define R_OK 4
00053 #define W_OK 2
00054 #define RW_OK 6
00055 #define _SC_PAGE_SIZE 1
00056 #define _SC_PHYS_PAGES 2
00057 #define _SC_OPEN_MAX 3
00058 #if !defined(SSIZE_MAX)
00059 #define SSIZE_MAX  0x7fffffffL
00060 #endif
00061 
00062 /*
00063   _MSC_VER values:
00064     1100 MSVC 5.0
00065     1200 MSVC 6.0
00066     1300 MSVC 7.0 Visual C++ .NET 2002
00067     1310 Visual c++ .NET 2003
00068     1400 Visual C++ 2005
00069     1500 Visual C++ 2008
00070     1600 Visual C++ 2010
00071     1700 Visual C++ 2012
00072     1800 Visual C++ 2013
00073     1900 Visual C++ 2015
00074 */
00075 
00076 #if !defined(chsize)
00077 # if defined(__BORLANDC__)
00078 #   define chsize(file,length)  chsize(file,length)
00079 # else
00080 #   define chsize(file,length)  _chsize(file,length)
00081 # endif
00082 #endif
00083 
00084 #if !defined(access)
00085 #if defined(_VISUALC_) && (_MSC_VER >= 1400)
00086 #  define access(path,mode)  _access_s(path,mode)
00087 #endif
00088 #endif
00089 #if !defined(chdir)
00090 #  define chdir  _chdir
00091 #endif
00092 #if !defined(close)
00093 #  define close  _close
00094 #endif
00095 #if !defined(closedir)
00096 #  define closedir(directory)  NTCloseDirectory(directory)
00097 #endif
00098 #if !defined(fdopen)
00099 #  define fdopen  _fdopen
00100 #endif
00101 #if !defined(fileno)
00102 #  define fileno  _fileno
00103 #endif
00104 #if !defined(freelocale)
00105 #  define freelocale  _free_locale
00106 #endif
00107 #if !defined(fseek) && !defined(__MINGW32__)
00108 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00109   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00110   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00111 #  define fseek  _fseeki64
00112 #endif
00113 #endif
00114 #if !defined(fstat) && !defined(__BORLANDC__)
00115 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00116   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00117   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00118 #  define fstat  _fstati64
00119 #else
00120 #  define fstat  _fstat
00121 #endif
00122 #endif
00123 #if !defined(fsync)
00124 #  define fsync  _commit
00125 #endif
00126 #if !defined(ftell) && !defined(__MINGW32__)
00127 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00128   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00129   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00130 #  define ftell  _ftelli64
00131 #endif
00132 #endif
00133 #if !defined(ftruncate)
00134 #  define ftruncate(file,length)  NTTruncateFile(file,length)
00135 #endif
00136 #if !defined(getcwd)
00137 #  define getcwd  _getcwd
00138 #endif
00139 #if !defined(getpid)
00140 #  define getpid  _getpid
00141 #endif
00142 #if !defined(hypot)
00143 #  define hypot  _hypot
00144 #endif
00145 #if !defined(inline)
00146 #  define inline __inline
00147 #endif
00148 #if !defined(isatty)
00149 #  define isatty  _isatty
00150 #endif
00151 #if !defined(locale_t)
00152 #define locale_t _locale_t
00153 #endif
00154 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00155   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00156   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00157 #if !defined(lseek)
00158 #  define lseek  _lseeki64
00159 #endif
00160 #else
00161 #if !defined(lseek)
00162 #  define lseek  _lseek
00163 #endif
00164 #endif
00165 #if !defined(MAGICKCORE_LTDL_DELEGATE)
00166 #if !defined(lt_dlclose)
00167 #  define lt_dlclose(handle)  NTCloseLibrary(handle)
00168 #endif
00169 #if !defined(lt_dlerror)
00170 #  define lt_dlerror()  NTGetLibraryError()
00171 #endif
00172 #if !defined(lt_dlexit)
00173 #  define lt_dlexit()  NTExitLibrary()
00174 #endif
00175 #if !defined(lt_dlinit)
00176 #  define lt_dlinit()  NTInitializeLibrary()
00177 #endif
00178 #if !defined(lt_dlopen)
00179 #  define lt_dlopen(filename)  NTOpenLibrary(filename)
00180 #endif
00181 #if !defined(lt_dlsetsearchpath)
00182 #  define lt_dlsetsearchpath(path)  NTSetSearchPath(path)
00183 #endif
00184 #if !defined(lt_dlsym)
00185 #  define lt_dlsym(handle,name)  NTGetLibrarySymbol(handle,name)
00186 #endif
00187 #endif
00188 #if !defined(mkdir)
00189 #  define mkdir  _mkdir
00190 #endif
00191 #if !defined(mmap)
00192 #  define mmap(address,length,protection,access,file,offset) \
00193   NTMapMemory(address,length,protection,access,file,offset)
00194 #endif
00195 #if !defined(munmap)
00196 #  define munmap(address,length)  NTUnmapMemory(address,length)
00197 #endif
00198 #if !defined(opendir)
00199 #  define opendir(directory)  NTOpenDirectory(directory)
00200 #endif
00201 #if !defined(open)
00202 #  define open  _open
00203 #endif
00204 #if !defined(pclose)
00205 #  define pclose  _pclose
00206 #endif
00207 #if !defined(popen)
00208 #  define popen  _popen
00209 #endif
00210 #if !defined(fprintf_l)
00211 #define fprintf_l  _fprintf_s_l
00212 #endif
00213 #if !defined(read)
00214 #  define read(fd,buffer,count)  _read(fd,buffer,(unsigned int) count)
00215 #endif
00216 #if !defined(readdir)
00217 #  define readdir(directory)  NTReadDirectory(directory)
00218 #endif
00219 #if !defined(setmode)
00220 #  define setmode  _setmode
00221 #endif
00222 #if !defined(spawnvp)
00223 #  define spawnvp  _spawnvp
00224 #endif
00225 #if !defined(strtod_l)
00226 #define strtod_l  _strtod_l
00227 #endif
00228 #if !defined(stat) && !defined(__BORLANDC__)
00229 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00230   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00231   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00232 #  define stat  _stati64
00233 #else
00234 #  define stat  _stat
00235 #endif
00236 #endif
00237 #if !defined(strcasecmp)
00238 #  define strcasecmp  _stricmp
00239 #endif
00240 #if !defined(strncasecmp)
00241 #  define strncasecmp  _strnicmp
00242 #endif
00243 #if !defined(sysconf)
00244 #  define sysconf(name)  NTSystemConfiguration(name)
00245 #endif
00246 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00247   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00248   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00249 #  define tell  _telli64
00250 #else
00251 #  define tell  _tell
00252 #endif
00253 #if !defined(tempnam)
00254 #  define tempnam  _tempnam_s
00255 #endif
00256 #if !defined(tolower_l)
00257 #define tolower_l  _tolower_l
00258 #endif
00259 #if !defined(toupper_l)
00260 #define toupper_l  _toupper_l
00261 #endif
00262 #if !defined(umask)
00263 #  define umask  _umask
00264 #endif
00265 #if !defined(unlink)
00266 #  define unlink  _unlink
00267 #endif
00268 #if !defined(utime)
00269 #  define utime  _utime
00270 #endif
00271 #if !defined(vfprintf_l)
00272 #define vfprintf_l  _vfprintf_l
00273 #endif
00274 #if !defined(vsnprintf)
00275 #if !defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER < 1500)
00276 #define vsnprintf _vsnprintf
00277 #endif
00278 #endif
00279 #if !defined(vsnprintf_l)
00280 #define vsnprintf_l  _vsnprintf_l
00281 #endif
00282 #if !defined(write)
00283 #  define write(fd,buffer,count)  _write(fd,buffer,(unsigned int) count)
00284 #endif
00285 #if !defined(wstat) && !defined(__BORLANDC__)
00286 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00287   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00288   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00289 #  define wstat  _wstati64
00290 #else
00291 #  define wstat  _wstat
00292 #endif
00293 #endif
00294 
00295 #if defined(__BORLANDC__)
00296 #undef _O_RANDOM
00297 #define _O_RANDOM 0
00298 #undef _O_SEQUENTIAL
00299 #define _O_SEQUENTIAL 0
00300 #undef _O_SHORT_LIVED
00301 #define _O_SHORT_LIVED 0
00302 #undef _O_TEMPORARY
00303 #define _O_TEMPORARY 0
00304 #endif
00305 
00306 #undef gettimeofday
00307 
00308 typedef struct _GhostInfo
00309   GhostInfo_;
00310 
00311 extern MagickExport char
00312   **NTArgvToUTF8(const int argc,wchar_t **);
00313 
00314 extern MagickExport const GhostInfo_
00315   *NTGhostscriptDLLVectors(void);
00316 
00317 extern MagickExport int
00318   NTGhostscriptUnLoadDLL(void);
00319 
00320 extern MagickExport void
00321   NTErrorHandler(const ExceptionType,const char *,const char *),
00322   NTWarningHandler(const ExceptionType,const char *,const char *);
00323 
00324 #endif
00325 
00326 #if defined(__cplusplus) || defined(c_plusplus)
00327 }
00328 #endif
00329 
00330 #endif

Generated on 3 Aug 2020 for MagickCore by  doxygen 1.6.1