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 "MagickCore/exception.h"
00022 #include "MagickCore/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 #define MAGICKCORE_HAVE_ERF
00099 #if defined(_VISUALC_) && (_MSC_VER < 1700)
00100 #  define erf(x)  NTErf(x)
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) && !defined(Windows95) && \
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) && !defined(Windows95) && \
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) && !defined(Windows95) && \
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(isatty)
00150 #  define isatty  _isatty
00151 #endif
00152 #if !defined(locale_t)
00153 #define locale_t _locale_t
00154 #endif
00155 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00156   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00157   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00158 #if !defined(lseek)
00159 #  define lseek  _lseeki64
00160 #endif
00161 #else
00162 #if !defined(lseek)
00163 #  define lseek  _lseek
00164 #endif
00165 #endif
00166 #if !defined(MAGICKCORE_LTDL_DELEGATE)
00167 #if !defined(lt_dlclose)
00168 #  define lt_dlclose(handle)  NTCloseLibrary(handle)
00169 #endif
00170 #if !defined(lt_dlerror)
00171 #  define lt_dlerror()  NTGetLibraryError()
00172 #endif
00173 #if !defined(lt_dlexit)
00174 #  define lt_dlexit()  NTExitLibrary()
00175 #endif
00176 #if !defined(lt_dlinit)
00177 #  define lt_dlinit()  NTInitializeLibrary()
00178 #endif
00179 #if !defined(lt_dlopen)
00180 #  define lt_dlopen(filename)  NTOpenLibrary(filename)
00181 #endif
00182 #if !defined(lt_dlsetsearchpath)
00183 #  define lt_dlsetsearchpath(path)  NTSetSearchPath(path)
00184 #endif
00185 #if !defined(lt_dlsym)
00186 #  define lt_dlsym(handle,name)  NTGetLibrarySymbol(handle,name)
00187 #endif
00188 #endif
00189 #if !defined(mkdir)
00190 #  define mkdir  _mkdir
00191 #endif
00192 #if !defined(mmap)
00193 #  define mmap(address,length,protection,access,file,offset) \
00194   NTMapMemory(address,length,protection,access,file,offset)
00195 #endif
00196 #if !defined(munmap)
00197 #  define munmap(address,length)  NTUnmapMemory(address,length)
00198 #endif
00199 #if !defined(opendir)
00200 #  define opendir(directory)  NTOpenDirectory(directory)
00201 #endif
00202 #if !defined(open)
00203 #  define open  _open
00204 #endif
00205 #if !defined(pclose)
00206 #  define pclose  _pclose
00207 #endif
00208 #if !defined(popen)
00209 #  define popen  _popen
00210 #endif
00211 #if !defined(fprintf_l)
00212 #define fprintf_l  _fprintf_s_l
00213 #endif
00214 #if !defined(read)
00215 #  define read(fd,buffer,count)  _read(fd,buffer,(unsigned int) count)
00216 #endif
00217 #if !defined(readdir)
00218 #  define readdir(directory)  NTReadDirectory(directory)
00219 #endif
00220 #if !defined(setmode)
00221 #  define setmode  _setmode
00222 #endif
00223 #if !defined(spawnvp)
00224 #  define spawnvp  _spawnvp
00225 #endif
00226 #if !defined(strtod_l)
00227 #define strtod_l  _strtod_l
00228 #endif
00229 #if !defined(stat) && !defined(__BORLANDC__)
00230 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00231   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00232   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00233 #  define stat  _stati64
00234 #else
00235 #  define stat  _stat
00236 #endif
00237 #endif
00238 #if !defined(strcasecmp)
00239 #  define strcasecmp  _stricmp
00240 #endif
00241 #if !defined(strncasecmp)
00242 #  define strncasecmp  _strnicmp
00243 #endif
00244 #if !defined(sysconf)
00245 #  define sysconf(name)  NTSystemConfiguration(name)
00246 #endif
00247 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00248   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00249   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00250 #  define tell  _telli64
00251 #else
00252 #  define tell  _tell
00253 #endif
00254 #if !defined(tempnam)
00255 #  define tempnam  _tempnam_s
00256 #endif
00257 #if !defined(tolower_l)
00258 #define tolower_l  _tolower_l
00259 #endif
00260 #if !defined(toupper_l)
00261 #define toupper_l  _toupper_l
00262 #endif
00263 #if !defined(umask)
00264 #  define umask  _umask
00265 #endif
00266 #if !defined(unlink)
00267 #  define unlink  _unlink
00268 #endif
00269 #if !defined(utime)
00270 #  define utime(filename,time)  _utime(filename,(struct _utimbuf*) time)
00271 #endif
00272 #if !defined(vfprintf_l)
00273 #define vfprintf_l  _vfprintf_l
00274 #endif
00275 #if !defined(vsnprintf)
00276 #if !defined(_MSC_VER) || (defined(_MSC_VER) && _MSC_VER < 1500)
00277 #define vsnprintf _vsnprintf
00278 #endif
00279 #endif
00280 #if !defined(vsnprintf_l)
00281 #define vsnprintf_l  _vsnprintf_l
00282 #endif
00283 #if !defined(write)
00284 #  define write(fd,buffer,count)  _write(fd,buffer,(unsigned int) count)
00285 #endif
00286 #if !defined(wstat) && !defined(__BORLANDC__)
00287 #if defined(MAGICKCORE_WINDOWS_SUPPORT) && !defined(Windows95) && \
00288   !(defined(_MSC_VER) && (_MSC_VER < 1400)) && \
00289   !(defined(__MSVCRT_VERSION__) && (__MSVCRT_VERSION__ < 0x800))
00290 #  define wstat  _wstati64
00291 #else
00292 #  define wstat  _wstat
00293 #endif
00294 #endif
00295 
00296 #if defined(__BORLANDC__)
00297 #undef _O_RANDOM
00298 #define _O_RANDOM 0
00299 #undef _O_SEQUENTIAL
00300 #define _O_SEQUENTIAL 0
00301 #undef _O_SHORT_LIVED
00302 #define _O_SHORT_LIVED 0
00303 #undef _O_TEMPORARY
00304 #define _O_TEMPORARY 0
00305 #endif
00306 
00307 #undef gettimeofday
00308 
00309 typedef struct _GhostInfo
00310   GhostInfo_;
00311 
00312 extern MagickExport char
00313   **NTArgvToUTF8(const int argc,wchar_t **);
00314 
00315 extern MagickExport const GhostInfo_
00316   *NTGhostscriptDLLVectors(void);
00317 
00318 extern MagickExport void
00319   NTErrorHandler(const ExceptionType,const char *,const char *),
00320   NTGhostscriptUnLoadDLL(void),
00321   NTWarningHandler(const ExceptionType,const char *,const char *);
00322 
00323 #endif
00324 
00325 #if defined(__cplusplus) || defined(c_plusplus)
00326 }
00327 #endif
00328 
00329 #endif

Generated on 17 Aug 2020 for MagickCore by  doxygen 1.6.1