<commit_before>// NanoWin32
// -----------------------------------------------------------------------
// Simple library to subset Win32(64) API functions implemenation on POSIX
// This software distributed by MIT license

// Error suuport functions and constants

#if !defined(NanoWinErrorIncluded)
#define NanoWinErrorIncluded

#include "NanoWinTypes.h"

#if defined LINUX

// Error constants
// -----------------------------------------------------------------------
// Ordered by error code value, values match values in Win32 API

#define ERROR_SUCCESS                  (0x0)     //     0 // OK, no error

#define ERROR_INVALID_FUNCTION         (0x1)     //     1 // Incorrect function

#define ERROR_FILE_NOT_FOUND           (0x2)     //     2 // The system cannot find the file specified
#define ERROR_PATH_NOT_FOUND           (0x3)     //     3 // The system cannot find the path specified
#define ERROR_TOO_MANY_OPEN_FILES      (0x4)     //     4 // The system cannot open the file
#define ERROR_ACCESS_DENIED            (0x5)     //     5 // Access is denied
#define ERROR_INVALID_HANDLE           (0x6)     //     6 // The handle is invalid
#define ERROR_NOT_ENOUGH_MEMORY        (0x8)     //     8 // Not enough storage is available to process this command
#define ERROR_INVALID_DATA             (0xd)     //    13 // The data is invalid

#define ERROR_NOT_SUPPORTED            (0x32)    //    50 // The request is not supported
#define ERROR_ENVVAR_NOT_FOUND         (0XCB)    //   203 // The system could not find the environment option that was entered

#define ERROR_NO_UNICODE_TRANSLATION   (0x459)   //  1113 // No mapping for the Unicode character exists in the target multi-byte code page

// Error functions
// -----------------------------------------------------------------------

NW_EXTERN_C_BEGIN

extern  DWORD NanoWinGetLastError(void); // Return last eeror code

extern  DWORD NanoWinSetLastError  // Set last error code (Returns dwErrCode)
              (
                DWORD  dwErrCode
              );

extern  DWORD NanoWinSetLastErrorEx // Set last error code (Returns dwErrCode)
              (
                DWORD  dwErrCode,
                DWORD  dwType     // Ignored (as in Win32)
              );

#define NW_DEFAULT_ERROR_AT_FAIL   ERROR_INVALID_DATA

// Converts errno to Win32Error, converts errno=0 to specified value win32 error value<commit_msg>ERROR_ALREADY_EXISTS constant added to NanoWinError.h<commit_after>// NanoWin32
// -----------------------------------------------------------------------
// Simple library to subset Win32(64) API functions implemenation on POSIX
// This software distributed by MIT license

// Error suuport functions and constants

#if !defined(NanoWinErrorIncluded)
#define NanoWinErrorIncluded

#include "NanoWinTypes.h"

#if defined LINUX

// Error constants
// -----------------------------------------------------------------------
// Ordered by error code value, values match values in Win32 API

#define ERROR_SUCCESS                  (0x0)     //     0 // OK, no error

#define ERROR_INVALID_FUNCTION         (0x1)     //     1 // Incorrect function

#define ERROR_FILE_NOT_FOUND           (0x2)     //     2 // The system cannot find the file specified
#define ERROR_PATH_NOT_FOUND           (0x3)     //     3 // The system cannot find the path specified
#define ERROR_TOO_MANY_OPEN_FILES      (0x4)     //     4 // The system cannot open the file
#define ERROR_ACCESS_DENIED            (0x5)     //     5 // Access is denied
#define ERROR_INVALID_HANDLE           (0x6)     //     6 // The handle is invalid
#define ERROR_NOT_ENOUGH_MEMORY        (0x8)     //     8 // Not enough storage is available to process this command
#define ERROR_INVALID_DATA             (0xd)     //    13 // The data is invalid

#define ERROR_NOT_SUPPORTED            (0x32)    //    50 // The request is not supported
#define ERROR_ALREADY_EXISTS           (0XB7)    //   183 // Cannot create a file when that file already exists
#define ERROR_ENVVAR_NOT_FOUND         (0XCB)    //   203 // The system could not find the environment option that was entered

#define ERROR_NO_UNICODE_TRANSLATION   (0x459)   //  1113 // No mapping for the Unicode character exists in the target multi-byte code page

// Error functions
// -----------------------------------------------------------------------

NW_EXTERN_C_BEGIN

extern  DWORD NanoWinGetLastError(void); // Return last eeror code

extern  DWORD NanoWinSetLastError  // Set last error code (Returns dwErrCode)
              (
                DWORD  dwErrCode
              );

extern  DWORD NanoWinSetLastErrorEx // Set last error code (Returns dwErrCode)
              (
                DWORD  dwErrCode,
                DWORD  dwType     // Ignored (as in Win32)
              );

#define NW_DEFAULT_ERROR_AT_FAIL   ERROR_INVALID_DATA

// Converts errno to Win32Error, converts errno=0 to specified value win32 error value
{'fraction_non_alphanumeric': 0.1488673139158576, 'fraction_numerical': 0.02487864077669903, 'mean_word_length': 1.7260198456449836, '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': '465509', 'n_tokens_mistral': 1390, 'n_tokens_neox': 1301, 'n_words': 463}