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 # ifdef _WIN64
00060 #   define SSIZE_MAX LLONG_MAX
00061 # else
00062 #   define SSIZE_MAX LONG_MAX
00063 # endif
00064 #endif
00065 
00066 /*
00067   _MSC_VER values:
00068     1100 MSVC 5.0
00069     1200 MSVC 6.0
00070     1300 MSVC 7.0 Visual C++ .NET 2002
00071     1310 Visual c++ .NET 2003
00072     1400 Visual C++ 2005
00073     1500 Visual C++ 2008
00074     1600 Visual C++ 2010
00075     1700 Visual C++ 2012
00076     1800 Visual C++ 2013
00077     1900 Visual C++ 2015
00078 */
00079 
00080 #if !defined(chsize)
00081 # if defined(__BORLANDC__)
00082 #   define chsize(file,length)  chsize(file,length)
00083 # else
00084 #   define chsize(file,length)  _chsize(file,length)
00085 # endif
00086 #endif
00087 
00088 #if !defined(access)
00089 #if defined(_VISUALC_) && (_MSC_VER >= 1400)
00090 #  define access(path,mode)  _access_s(path,mode)
00091 #endif
00092 #endif
00093 #if !defined(chdir)
00094 #  define chdir  _chdir
00095 #endif
00096 #if !defined(close)
00097 #  define close  _close
00098 #endif
00099 #if !defined(closedir)
00100 #  define closedir(directory)  NTCloseDirectory(directory)
00101 #endif
00102 #if !defined(fdopen)
00103 #  define fdopen  _fdopen
00104 #endif
00105 #if !defined(fileno)
00106 #  define fileno  _fileno
00107 #endif
00108 #if !defined(freelocale)
00109 #  define freelocale  _free_locale
00110 #endif
00111 #if !defined(fseek) && !defined(__MINGW32__)
00112 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
00113   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00114   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00115 #  define fseek  _fseeki64
00116 #endif
00117 #endif
00118 #if !defined(fstat) && !defined(__BORLANDC__)
00119 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
00120   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00121   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00122 #  define fstat  _fstati64
00123 #else
00124 #  define fstat  _fstat
00125 #endif
00126 #endif
00127 #if !defined(fsync)
00128 #  define fsync  _commit
00129 #endif
00130 #if !defined(ftell) && !defined(__MINGW32__)
00131 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
00132   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00133   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00134 #  define ftell  _ftelli64
00135 #endif
00136 #endif
00137 #if !defined(ftruncate)
00138 #  define ftruncate(file,length)  NTTruncateFile(file,length)
00139 #endif
00140 #if !defined(getcwd)
00141 #  define getcwd  _getcwd
00142 #endif
00143 #if !defined(getpid)
00144 #  define getpid  _getpid
00145 #endif
00146 #if !defined(hypot)
00147 #  define hypot  _hypot
00148 #endif
00149 #if !defined(inline)
00150 #  define inline __inline
00151 #endif
00152 #if !defined(isatty)
00153 #  define isatty  _isatty
00154 #endif
00155 #if !defined(locale_t)
00156 #define locale_t _locale_t
00157 #endif
00158 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
00159   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00160   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00161 #if !defined(lseek)
00162 #  define lseek  _lseeki64
00163 #endif
00164 #else
00165 #if !defined(lseek)
00166 #  define lseek  _lseek
00167 #endif
00168 #endif
00169 #if !defined(MAGICKCORE_LTDL_DELEGATE)
00170 #if !defined(lt_dlclose)
00171 #  define lt_dlclose(handle)  NTCloseLibrary(handle)
00172 #endif
00173 #if !defined(lt_dlerror)
00174 #  define lt_dlerror()  NTGetLibraryError()
00175 #endif
00176 #if !defined(lt_dlexit)
00177 #  define lt_dlexit()  NTExitLibrary()
00178 #endif
00179 #if !defined(lt_dlinit)
00180 #  define lt_dlinit()  NTInitializeLibrary()
00181 #endif
00182 #if !defined(lt_dlopen)
00183 #  define lt_dlopen(filename)  NTOpenLibrary(filename)
00184 #endif
00185 #if !defined(lt_dlsetsearchpath)
00186 #  define lt_dlsetsearchpath(path)  NTSetSearchPath(path)
00187 #endif
00188 #if !defined(lt_dlsym)
00189 #  define lt_dlsym(handle,name)  NTGetLibrarySymbol(handle,name)
00190 #endif
00191 #endif
00192 #if !defined(mkdir)
00193 #  define mkdir  _mkdir
00194 #endif
00195 #if !defined(mmap)
00196 #  define mmap(address,length,protection,access,file,offset) \
00197   NTMapMemory(address,length,protection,access,file,offset)
00198 #endif
00199 #if !defined(munmap)
00200 #  define munmap(address,length)  NTUnmapMemory(address,length)
00201 #endif
00202 #if !defined(opendir)
00203 #  define opendir(directory)  NTOpenDirectory(directory)
00204 #endif
00205 #if !defined(open)
00206 #  define open  _open
00207 #endif
00208 #if !defined(pclose)
00209 #  define pclose  _pclose
00210 #endif
00211 #if !defined(popen)
00212 #  define popen  _popen
00213 #endif
00214 #if !defined(fprintf_l)
00215 #define fprintf_l  _fprintf_s_l
00216 #endif
00217 #if !defined(read)
00218 #  define read(fd,buffer,count)  _read(fd,buffer,(unsigned int) count)
00219 #endif
00220 #if !defined(readdir)
00221 #  define readdir(directory)  NTReadDirectory(directory)
00222 #endif
00223 #if !defined(setmode)
00224 #  define setmode  _setmode
00225 #endif
00226 #if !defined(spawnvp)
00227 #  define spawnvp  _spawnvp
00228 #endif
00229 #if !defined(strtod_l)
00230 #define strtod_l  _strtod_l
00231 #endif
00232 #if !defined(stat) && !defined(__BORLANDC__)
00233 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
00234   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00235   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00236 #  define stat  _stati64
00237 #else
00238 #  define stat  _stat
00239 #endif
00240 #endif
00241 #if !defined(strcasecmp)
00242 #  define strcasecmp  _stricmp
00243 #endif
00244 #if !defined(strncasecmp)
00245 #  define strncasecmp  _strnicmp
00246 #endif
00247 #if !defined(sysconf)
00248 #  define sysconf(name)  NTSystemConfiguration(name)
00249 #endif
00250 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
00251   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00252   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00253 #  define tell  _telli64
00254 #else
00255 #  define tell  _tell
00256 #endif
00257 #if !defined(tempnam)
00258 #  define tempnam  _tempnam_s
00259 #endif
00260 #if !defined(tolower_l)
00261 #define tolower_l  _tolower_l
00262 #endif
00263 #if !defined(toupper_l)
00264 #define toupper_l  _toupper_l
00265 #endif
00266 #if !defined(umask)
00267 #  define umask  _umask
00268 #endif
00269 #if !defined(unlink)
00270 #  define unlink  _unlink
00271 #endif
00272 #if !defined(utime)
00273 #  define utime  _utime
00274 #endif
00275 #if !defined(vfprintf_l)
00276 #define vfprintf_l  _vfprintf_l
00277 #endif
00278 #if !defined(vsnprintf)
00279 #if !defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER < 1500)
00280 #define vsnprintf _vsnprintf
00281 #endif
00282 #endif
00283 #if !defined(vsnprintf_l)
00284 #define vsnprintf_l  _vsnprintf_l
00285 #endif
00286 #if !defined(write)
00287 #  define write(fd,buffer,count)  _write(fd,buffer,(unsigned int) count)
00288 #endif
00289 #if !defined(wstat) && !defined(__BORLANDC__)
00290 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && \
00291   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00292   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00293 #  define wstat  _wstati64
00294 #else
00295 #  define wstat  _wstat
00296 #endif
00297 #endif
00298 
00299 #if defined(__BORLANDC__)
00300 #undef _O_RANDOM
00301 #define _O_RANDOM 0
00302 #undef _O_SEQUENTIAL
00303 #define _O_SEQUENTIAL 0
00304 #undef _O_SHORT_LIVED
00305 #define _O_SHORT_LIVED 0
00306 #undef _O_TEMPORARY
00307 #define _O_TEMPORARY 0
00308 #endif
00309 
00310 #undef gettimeofday
00311 
00312 typedef struct _GhostInfo
00313   GhostInfo_;
00314 
00315 extern MagickExport char
00316   **NTArgvToUTF8(const int argc,wchar_t **);
00317 
00318 extern MagickExport const GhostInfo_
00319   *NTGhostscriptDLLVectors(void);
00320 
00321 extern MagickExport int
00322   NTGhostscriptUnLoadDLL(void);
00323 
00324 extern MagickExport void
00325   NTErrorHandler(const ExceptionType,const char *,const char *),
00326   NTWarningHandler(const ExceptionType,const char *,const char *);
00327 
00328 #endif
00329 
00330 #if defined(__cplusplus) || defined(c_plusplus)
00331 }
00332 #endif
00333 
00334 #endif

Generated on 30 Nov 2020 for MagickCore by  doxygen 1.6.1