<commit_before>/* $Id$ */

#ifndef _COMPAT_H
#define _COMPAT_H

/* This header includes and defines everything needed for a given OS/compiler */
#if defined(__UNIX__) || defined(__MAC__)
#include "config.h"

#include <sys/stat.h>
#include <unistd.h>
void msleep(long period);
#endif /* Unix */

#ifndef __TARGET__
#define __TARGET__ "dw"
#endif

#include <sys/types.h>
#if HAVE_DIRENT_H
#include <dirent.h>
#define NAMLEN(dirent) strlen((dirent)->d_name)
#else
#define dirent direct
#define NAMLEN(dirent) (dirent)->d_namlen
#if HAVE_SYS_NDIR_H
#include <sys/ndir.h>
#endif /* HAVE_SYS_NDIR_H */
#if HAVE_SYS_DIR_H
#include <sys/dir.h>
#endif /* HAVE_SYS_DIR_H */
#if HAVE_NDIR_H
#include <ndir.h>
#endif /* HAVE_NDIR_H */
#endif /* HAVE_DIRENT_H */

#ifdef DIRSEP
#undef DIRSEP
#endif

#if defined(__EMX__) || defined(__OS2__) || defined(__WIN32__) || defined(WINNT)
#include <io.h>
#include <process.h>

#define DIRSEP "\\"
#define TYPDIR "."
#else
#define DIRSEP "/"
#define TYPDIR "/usr/local/" __TARGET__
#endif
#define INIDIR "~/." __TARGET__

/* OS/2 */
#if defined(__EMX__) || defined(__OS2__)
#define INCL_WIN
#define INCL_GPI
#define INCL_VIO
#define INCL_NLS
#define INCL_DOS
#define INCL_DEV
#define INCL_DOSERRORS

#ifdef __OS2__
# if (defined(__IBMC__) || defined(__WATCOMC__) || defined(_System)) && !defined(API)
# define API _System
# endif
#endif

#ifndef API
#define API
#endif

#define msleep(a) DosSleep(a)

#ifdef __EMX__
#include "platform/dirent.h"
#include <sys/stat.h>
#define HAVE_PIPE
#ifdef FD_SETSIZE
#undef FD_SETSIZE
#endif
#define FD_SETSIZE 1024
#endif /* __EMX__ */

#if defined(__EMX__) || defined(__WATCOMC__)
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif

#ifndef OS2
#define OS2
#endif /* OS2 */

#include <os2.h>

#ifndef BKS_TABBEDDIALOG
#define BKS_TABBEDDIALOG          0x0800
#endif

#define PIPENAME "\\socket\\" __TARGET__ "%d"
#define TPIPENAME "\\socket\\" __TARGET__ "%d"
#else
#define PIPENAME "/tmp/" __TARGET__ "%d"
#define TPIPENAME "/tmp/" __TARGET__ "%d"
#endif /* __EMX__ || __IBMC__ */

#if defined(__OS2__) && (defined(__IBMC__) || defined(__WATCOMC__))
#define BSD_SELECT

#include <types.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <sys/ioctl.h>
#include <direct.h>
#include <stdarg.h>
/* For VAC we are using the Mozilla dirent.c */
#ifndef __WATCOMC__
#include "platform/dirent.h"
#endif
#endif

/* Windows */
#if defined(__WIN32__) || defined(WINNT)

#if defined(MSVC) && !defined(API)
# ifdef __MINGW32__
#  ifdef BUILD_DLL
#   define API APIENTRY __declspec(dllexport)
#  else
#   define API APIENTRY __declspec(dllimport)
#  endif
# else
#  define API _cdecl
# endif
#endif

#include <windows.h>
#include <winsock.h>
#include <time.h>
#include <process.h>
#include <sys/stat.h>

#ifdef MSVC
#include "platform/dirent.h"
#define alloca _alloca
#else
#include <dir.h>
#include <dirent.h>
#endif

#include <stdarg.h>

#if defined(__CYGWIN32__) /*|| defined(__MINGW32__)*/
#include <sys/un.h>
#endif /* __CYGWIN32__ || __MINGW32__ */

#ifndef __CYGWIN32__<commit_msg>Added dwstat #define in compat.h which will be the 64bit stat struct if available on the given platform.<commit_after>/* $Id$ */

#ifndef _COMPAT_H
#define _COMPAT_H

/* This header includes and defines everything needed for a given OS/compiler */
#if defined(__UNIX__) || defined(__MAC__)
#include "config.h"

#include <sys/stat.h>
#include <unistd.h>
void msleep(long period);
#endif /* Unix */

#ifndef __TARGET__
#define __TARGET__ "dw"
#endif

#include <sys/types.h>
#if HAVE_DIRENT_H
#include <dirent.h>
#define NAMLEN(dirent) strlen((dirent)->d_name)
#else
#define dirent direct
#define NAMLEN(dirent) (dirent)->d_namlen
#if HAVE_SYS_NDIR_H
#include <sys/ndir.h>
#endif /* HAVE_SYS_NDIR_H */
#if HAVE_SYS_DIR_H
#include <sys/dir.h>
#endif /* HAVE_SYS_DIR_H */
#if HAVE_NDIR_H
#include <ndir.h>
#endif /* HAVE_NDIR_H */
#endif /* HAVE_DIRENT_H */

#ifdef DIRSEP
#undef DIRSEP
#endif

#if defined(__EMX__) || defined(__OS2__) || defined(__WIN32__) || defined(WINNT)
#include <io.h>
#include <process.h>

#define DIRSEP "\\"
#define TYPDIR "."
#else
#define DIRSEP "/"
#define TYPDIR "/usr/local/" __TARGET__
#endif
#define INIDIR "~/." __TARGET__

/* OS/2 */
#if defined(__EMX__) || defined(__OS2__)
#define INCL_WIN
#define INCL_GPI
#define INCL_VIO
#define INCL_NLS
#define INCL_DOS
#define INCL_DEV
#define INCL_DOSERRORS

#ifdef __OS2__
# if (defined(__IBMC__) || defined(__WATCOMC__) || defined(_System)) && !defined(API)
# define API _System
# endif
#endif

#ifndef API
#define API
#endif

#define msleep(a) DosSleep(a)

#ifdef __EMX__
#include "platform/dirent.h"
#include <sys/stat.h>
#define HAVE_PIPE
#ifdef FD_SETSIZE
#undef FD_SETSIZE
#endif
#define FD_SETSIZE 1024
#endif /* __EMX__ */

#if defined(__EMX__) || defined(__WATCOMC__)
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif

#ifndef OS2
#define OS2
#endif /* OS2 */

#include <os2.h>

#ifndef BKS_TABBEDDIALOG
#define BKS_TABBEDDIALOG          0x0800
#endif

#define PIPENAME "\\socket\\" __TARGET__ "%d"
#define TPIPENAME "\\socket\\" __TARGET__ "%d"
#else
#define PIPENAME "/tmp/" __TARGET__ "%d"
#define TPIPENAME "/tmp/" __TARGET__ "%d"
#endif /* __EMX__ || __IBMC__ */

#if defined(__OS2__) && (defined(__IBMC__) || defined(__WATCOMC__))
#define BSD_SELECT

#include <types.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/select.h>
#include <sys/ioctl.h>
#include <direct.h>
#include <stdarg.h>
/* For VAC we are using the Mozilla dirent.c */
#ifndef __WATCOMC__
#include "platform/dirent.h"
#endif
#endif

/* Windows */
#if defined(__WIN32__) || defined(WINNT)

#if defined(MSVC) && !defined(API)
# ifdef __MINGW32__
#  ifdef BUILD_DLL
#   define API APIENTRY __declspec(dllexport)
#  else
#   define API APIENTRY __declspec(dllimport)
#  endif
# else
#  define API _cdecl
# endif
#endif

#include <windows.h>
#include <winsock.h>
#include <time.h>
#include <process.h>
#include <sys/stat.h>

#ifdef MSVC
#include "platform/dirent.h"
#define alloca _alloca
#ifdef __stat64
#undef stat
#define stat(a, b) _stat64(a, b)
#define dwstat __stat64
#endif
#else
#include <dir.h>
#include <dirent.h>
#define dwstat stat
#endif

#include <stdarg.h>

#if defined(__CYGWIN32__) /*|| defined(__MINGW32__)*/
#include <sys/un.h>
#endif /* __CYGWIN32__ || __MINGW32__ */

#ifndef __CYGWIN32__
{'fraction_non_alphanumeric': 0.14766472715835824, 'fraction_numerical': 0.011951564711432616, 'mean_word_length': 5.091954022988506, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1604224', 'n_tokens_mistral': 2608, 'n_tokens_neox': 2530, 'n_words': 636}