2017-11-27 11:54:18 +00:00
|
|
|
/* Copyright (C) 2001-2017 Peter Selinger.
|
2010-06-10 18:43:12 +00:00
|
|
|
* This file is part of Potrace. It is free software and it is covered
|
|
|
|
* by the GNU General Public License. See the file COPYING for details. */
|
|
|
|
|
|
|
|
/* this header file contains some platform dependent stuff */
|
|
|
|
|
|
|
|
#ifndef PLATFORM_H
|
|
|
|
#define PLATFORM_H
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
2017-11-27 11:54:18 +00:00
|
|
|
#include <config.h>
|
2010-06-10 18:43:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* in Windows, set all file i/o to binary */
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
#include <fcntl.h>
|
|
|
|
unsigned int _CRT_fmode = _O_BINARY;
|
2015-12-03 15:46:17 +00:00
|
|
|
static inline void platform_init( void )
|
|
|
|
{
|
|
|
|
_setmode( _fileno( stdin ), _O_BINARY );
|
|
|
|
_setmode( _fileno( stdout ), _O_BINARY );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
2010-06-10 18:43:12 +00:00
|
|
|
|
|
|
|
#ifdef __CYGWIN__
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <io.h>
|
|
|
|
static inline void platform_init( void )
|
|
|
|
{
|
|
|
|
setmode( 0, O_BINARY );
|
|
|
|
setmode( 1, O_BINARY );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
static inline void platform_init( void )
|
|
|
|
{
|
|
|
|
/* NOP */
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-03 15:46:17 +00:00
|
|
|
#endif
|
2010-06-10 18:43:12 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* PLATFORM_H */
|