<commit_before>#include "plat_primary_identify.h"
#include "plat_arch_identify.h"

/* Platform specifications:
 * COFFEE_ARCH_LLP64 - Uses ull as opposed to ul
 * COFFEE_USE_TERMINAL_CTL - insert ASCII commands for color and etc.
 * COFFEE_USE_UNWIND - use Unwind stack backtracing
 * COFFEE_USE_IOCTL_TERM_SIZE - allow requesting terminal size from ioctl()
 *
 * COFFEE_LIL_ENDIAN - Little endian system
 * COFFEE_BIG_ENDIAN - Big endian system, quite rare
 *
 * COFFEE_USE_EXCEPTIONS - do use exceptions
 * COFFEE_USE_RTTI - do use RTTI
 *
 * COFFEE_LIMIT_INLINE - disable inlining for code size reduction
 *
 * Quirks:
 * COFFEE_NO_FUTURES - std::future does not exist
 * COFFEE_USE_POSIX_BASENAME - using POSIX basename() or a custom implementation
 * COFFEE_DISABLE_SRGB_SUPPORT - deny sRGB framebuffers, some platforms shouldn't check for it
 * COFFEE_USE_IMMERSIVE_VIEW - use fullscreen at all times
 * ASIO_USE_SSL - whether to disable ASIO's SSL support, useful if SSL does not exist on a platform
 * COFFEE_NO_HUGETLB - disable non-standard HUGE_TLB flag for file mapping
 * COFFEE_NO_RUSAGE_THREAD - disable rusage statistics per-thread
 * COFFEE_LINKED_GLES - disables dynamic loading of GLES symbols, links them. Android, Maemo, RPi and Apple do this
 * COFFEE_LINKED_GLES30 - GLES 3.0 linked headers
 * COFFEE_LINKED_GLES31 - GLES 3.1 linked headers
 * COFFEE_LINKED_GLES32 - GLES 3.2 linked headers
 * COFFEE_ONLY_GLES20 - allow only GLES 2.0, for RPi, old Android and Maemo
 * COFFEE_USE_MAEMO_EGL - uses a piece of EGL to load a GL context, quite fast, only ~100 EGL calls as opposed to SDL's thousands
 * COFFEE_USE_MAEMO_X11 - uses a tiny loader for X11, creates a window with minimal functionality
 * COFFEE_FRAGILE_FRAMEBUFFER - make windowing system more careful with resizes that may crash some devices (Maemo)
 * COFFEE_ALWAYS_VSYNC - for devices which force VSYNC
 * COFFEE_NO_PTHREAD_SETNAME_NP - platforms that do not support pthread thread names
 * COFFEE_SLAP_LOWMEM - if system is x86 and does not PAE, give up
 *
 * COFFEE_STUBBED_ENVIRONMENT - stubs environment functions, because they are impossible to fulfull
 * COFFEE_STUBBED_PROCESS - stubs process functions, same reason as above
 * COFFEE_STUBBED_STACKTRACE - stubs stacktracing
 * COFFEE_STUBBED_CFILE - stubs FILE functionality
 * COFFEE_STUBBED_DYNLOADER - stubs dynamic library loading
 *
 * COFFEE_NO_EXECVPE - platforms that do not support execvpe
 * COFFEE_NO_SYSTEM_CMD - disables system() code, either if it does not exist or for security
 *
 * COFFEE_PLATFORM_OUTPUT_FORMAT - platforms that do logging in a special way, less processing
 *
 * COFFEE_NO_TLS - disallowing thread-local storage
 *
 */

#define COFFEE_SLAP_LOWMEM

/* For Android 32-bit, we need this neat little trick. */
/* This might apply to win32 and lin32 as well, but they don't exist */
#if defined(COFFEE_WINDOWS) || defined(COFFEE_APPLE) || defined(COFFEE_EMSCRIPTEN) \
    || (defined(COFFEE_ANDROID) && defined(COFFEE_ARCH_ARM32)) \
    || (defined(COFFEE_ANDROID) && defined(COFFEE_ARCH_MIPS)) \
    || (defined(COFFEE_ANDROID) && defined(COFFEE_ARCH_X86))
#define COFFEE_ARCH_LLP64
#endif

/* Unwind and terminal control signals are desktop-only */
#if (defined(COFFEE_LINUX) || defined(COFFEE_APPLE)) \
    && !defined(COFFEE_ANDROID) && !defined(__STEAMOS__) \
    && !defined(COFFEE_APPLE_MOBILE)
#define COFFEE_USE_TERMINAL_CTL
#define COFFEE_USE_UNWIND
#endif

/* Terminal size: useless on Android */
#if defined(COFFEE_LINUX) && !defined(COFFEE_ANDROID)
#define COFFEE_USE_IOCTL_TERM_SIZE
#endif

/* So far, no issues with big-endian vs lil' endian, but we will keep it in mind */
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define COFFEE_BIG_ENDIAN
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define COFFEE_LIL_ENDIAN
#endif

/* Disabling exceptions and RTTI in release for size reasons */
#if !defined(COFFEE_ANDROID) && !defined(NDEBUG)
#define COFFEE_USE_EXCEPTIONS
#define COFFEE_USE_RTTI
#endif

#if defined(COFFEE_ANDROID)
/* For Android, we limit inlining for size reasons */
#define COFFEE_LIMIT_INLINE
#endif

/* This enables safer, but a bit slower functions for some core functions */
/* dirname(), basename() */
#define COFFEE_USE_POSIX_BASENAME

/* OpenSSL is difficult on Windows... */
#if !defined(COFFEE_WINDOWS) && !defined(COFFEE_ANDROID)
#define ASIO_USE_SSL
#endif

/* thread_local workarounds */
#if defined(COFFEE_APPLE_MOBILE)
#define thread_local
#elif defined(COFFEE_APPLE)
#define thread_local __thread
#endif

#if defined(COFFEE_RASPBERRYPI) || defined(COFFEE_MAEMO)
#define COFFEE_LINKED_GLES
#endif

#if defined(COFFEE_RASPBERRYPI) || defined(COFFEE_MAEMO) || defined(COFFEE_ANDROID)
#define COFFEE_DISABLE_SRGB_SUPPORT
#define COFFEE_USE_IMMERSIVE_VIEW
#endif


#if defined(COFFEE_RASPBERRYPI) || defined(COFFEE_MAEMO)
#define COFFEE_ONLY_GLES20
#endif

#if defined(COFFEE_ANDROID)
#define COFFEE_LINKED_GLES
#define COFFEE_ONLY_GLES20
#endif

#if defined(COFFEE_MAEMO)
#define COFFEE_NO_FUTURES
#define COFFEE_NO_HUGETLB

#define COFFEE_NO_RUSAGE_THREAD
#define COFFEE_FRAGILE_FRAMEBUFFER
#define COFFEE_ALWAYS_VSYNC
#define COFFEE_X11_HILDON
#endif

//#define COFFEE_LINKED_GLES
//#define COFFEE_ONLY_GLES20
//#define COFFEE_LINUX_LIGHTWEIGHT_WM

#if defined(COFFEE_LINUX_LIGHTWEIGHT_WM) || defined(COFFEE_MAEMO)
#define COFFEE_USE_MAEMO_EGL
#define COFFEE_USE_MAEMO_X11
#endif

#if defined(COFFEE_ANDROID) || defined(__EMSCRIPTEN__) || defined(COFFEE_NACL) \
    || defined(COFFEE_MAEMO) || defined(COFFEE_APPLE)
#define COFFEE_NO_EXECVPE
#endif

#if defined(COFFEE_UNIXPLAT)
#define COFFEE_USE_EXECVPE
#endif

#if defined(__EMSCRIPTEN__) || defined(COFFEE_NACL) || defined(COFFEE_MAEMO)
#define COFFEE_NO_PTHREAD_SETNAME_NP
#endif

#if defined(__EMSCRIPTEN__)
#define COFFEE_NO_TLS<commit_msg> - Fix execvpe() quirk for Android<commit_after>#include "plat_primary_identify.h"
#include "plat_arch_identify.h"

/* Platform specifications:
 * COFFEE_ARCH_LLP64 - Uses ull as opposed to ul
 * COFFEE_USE_TERMINAL_CTL - insert ASCII commands for color and etc.
 * COFFEE_USE_UNWIND - use Unwind stack backtracing
 * COFFEE_USE_IOCTL_TERM_SIZE - allow requesting terminal size from ioctl()
 *
 * COFFEE_LIL_ENDIAN - Little endian system
 * COFFEE_BIG_ENDIAN - Big endian system, quite rare
 *
 * COFFEE_USE_EXCEPTIONS - do use exceptions
 * COFFEE_USE_RTTI - do use RTTI
 *
 * COFFEE_LIMIT_INLINE - disable inlining for code size reduction
 *
 * Quirks:
 * COFFEE_NO_FUTURES - std::future does not exist
 * COFFEE_USE_POSIX_BASENAME - using POSIX basename() or a custom implementation
 * COFFEE_DISABLE_SRGB_SUPPORT - deny sRGB framebuffers, some platforms shouldn't check for it
 * COFFEE_USE_IMMERSIVE_VIEW - use fullscreen at all times
 * ASIO_USE_SSL - whether to disable ASIO's SSL support, useful if SSL does not exist on a platform
 * COFFEE_NO_HUGETLB - disable non-standard HUGE_TLB flag for file mapping
 * COFFEE_NO_RUSAGE_THREAD - disable rusage statistics per-thread
 * COFFEE_LINKED_GLES - disables dynamic loading of GLES symbols, links them. Android, Maemo, RPi and Apple do this
 * COFFEE_LINKED_GLES30 - GLES 3.0 linked headers
 * COFFEE_LINKED_GLES31 - GLES 3.1 linked headers
 * COFFEE_LINKED_GLES32 - GLES 3.2 linked headers
 * COFFEE_ONLY_GLES20 - allow only GLES 2.0, for RPi, old Android and Maemo
 * COFFEE_USE_MAEMO_EGL - uses a piece of EGL to load a GL context, quite fast, only ~100 EGL calls as opposed to SDL's thousands
 * COFFEE_USE_MAEMO_X11 - uses a tiny loader for X11, creates a window with minimal functionality
 * COFFEE_FRAGILE_FRAMEBUFFER - make windowing system more careful with resizes that may crash some devices (Maemo)
 * COFFEE_ALWAYS_VSYNC - for devices which force VSYNC
 * COFFEE_NO_PTHREAD_SETNAME_NP - platforms that do not support pthread thread names
 * COFFEE_SLAP_LOWMEM - if system is x86 and does not PAE, give up
 *
 * COFFEE_STUBBED_ENVIRONMENT - stubs environment functions, because they are impossible to fulfull
 * COFFEE_STUBBED_PROCESS - stubs process functions, same reason as above
 * COFFEE_STUBBED_STACKTRACE - stubs stacktracing
 * COFFEE_STUBBED_CFILE - stubs FILE functionality
 * COFFEE_STUBBED_DYNLOADER - stubs dynamic library loading
 *
 * COFFEE_NO_EXECVPE - platforms that do not support execvpe
 * COFFEE_NO_SYSTEM_CMD - disables system() code, either if it does not exist or for security
 *
 * COFFEE_PLATFORM_OUTPUT_FORMAT - platforms that do logging in a special way, less processing
 *
 * COFFEE_NO_TLS - disallowing thread-local storage
 *
 */

#define COFFEE_SLAP_LOWMEM

/* For Android 32-bit, we need this neat little trick. */
/* This might apply to win32 and lin32 as well, but they don't exist */
#if defined(COFFEE_WINDOWS) || defined(COFFEE_APPLE) || defined(COFFEE_EMSCRIPTEN) \
    || (defined(COFFEE_ANDROID) && defined(COFFEE_ARCH_ARM32)) \
    || (defined(COFFEE_ANDROID) && defined(COFFEE_ARCH_MIPS)) \
    || (defined(COFFEE_ANDROID) && defined(COFFEE_ARCH_X86))
#define COFFEE_ARCH_LLP64
#endif

/* Unwind and terminal control signals are desktop-only */
#if (defined(COFFEE_LINUX) || defined(COFFEE_APPLE)) \
    && !defined(COFFEE_ANDROID) && !defined(__STEAMOS__) \
    && !defined(COFFEE_APPLE_MOBILE)
#define COFFEE_USE_TERMINAL_CTL
#define COFFEE_USE_UNWIND
#endif

/* Terminal size: useless on Android */
#if defined(COFFEE_LINUX) && !defined(COFFEE_ANDROID)
#define COFFEE_USE_IOCTL_TERM_SIZE
#endif

/* So far, no issues with big-endian vs lil' endian, but we will keep it in mind */
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define COFFEE_BIG_ENDIAN
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define COFFEE_LIL_ENDIAN
#endif

/* Disabling exceptions and RTTI in release for size reasons */
#if !defined(COFFEE_ANDROID) && !defined(NDEBUG)
#define COFFEE_USE_EXCEPTIONS
#define COFFEE_USE_RTTI
#endif

#if defined(COFFEE_ANDROID)
/* For Android, we limit inlining for size reasons */
#define COFFEE_LIMIT_INLINE
#endif

/* This enables safer, but a bit slower functions for some core functions */
/* dirname(), basename() */
#define COFFEE_USE_POSIX_BASENAME

/* OpenSSL is difficult on Windows... */
#if !defined(COFFEE_WINDOWS) && !defined(COFFEE_ANDROID)
#define ASIO_USE_SSL
#endif

/* thread_local workarounds */
#if defined(COFFEE_APPLE_MOBILE)
#define thread_local
#elif defined(COFFEE_APPLE)
#define thread_local __thread
#endif

#if defined(COFFEE_RASPBERRYPI) || defined(COFFEE_MAEMO)
#define COFFEE_LINKED_GLES
#endif

#if defined(COFFEE_RASPBERRYPI) || defined(COFFEE_MAEMO) || defined(COFFEE_ANDROID)
#define COFFEE_DISABLE_SRGB_SUPPORT
#define COFFEE_USE_IMMERSIVE_VIEW
#endif


#if defined(COFFEE_RASPBERRYPI) || defined(COFFEE_MAEMO)
#define COFFEE_ONLY_GLES20
#endif

#if defined(COFFEE_ANDROID)
#define COFFEE_LINKED_GLES
#define COFFEE_ONLY_GLES20
#endif

#if defined(COFFEE_MAEMO)
#define COFFEE_NO_FUTURES
#define COFFEE_NO_HUGETLB

#define COFFEE_NO_RUSAGE_THREAD
#define COFFEE_FRAGILE_FRAMEBUFFER
#define COFFEE_ALWAYS_VSYNC
#define COFFEE_X11_HILDON
#endif

//#define COFFEE_LINKED_GLES
//#define COFFEE_ONLY_GLES20
//#define COFFEE_LINUX_LIGHTWEIGHT_WM

#if defined(COFFEE_LINUX_LIGHTWEIGHT_WM) || defined(COFFEE_MAEMO)
#define COFFEE_USE_MAEMO_EGL
#define COFFEE_USE_MAEMO_X11
#endif

#if defined(COFFEE_ANDROID) || defined(__EMSCRIPTEN__) || defined(COFFEE_NACL) \
    || defined(COFFEE_MAEMO) || defined(COFFEE_APPLE)
#define COFFEE_NO_EXECVPE
#endif

#if defined(COFFEE_UNIXPLAT) && !defined(COFFEE_ANDROID)
#define COFFEE_USE_EXECVPE
#endif

#if defined(__EMSCRIPTEN__) || defined(COFFEE_NACL) || defined(COFFEE_MAEMO)
#define COFFEE_NO_PTHREAD_SETNAME_NP
#endif

#if defined(__EMSCRIPTEN__)
#define COFFEE_NO_TLS
{'fraction_non_alphanumeric': 0.07724586794553395, 'fraction_numerical': 0.008392566583882847, 'mean_word_length': 5.696100917431193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2266245', 'n_tokens_mistral': 4462, 'n_tokens_neox': 4319, 'n_words': 1091}