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

Generated on 18 Nov 2020 for MagickCore by  doxygen 1.6.1