<commit_before>
/*
 * Copyright (C) <NAME>
 */


#ifndef _NGX_FILES_H_INCLUDED_
#define _NGX_FILES_H_INCLUDED_


#include <ngx_config.h>
#include <ngx_core.h>


/* INVALID_FILE_ATTRIBUTES is specified but not defined at least in MSVC6SP2 */
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES     0xffffffff
#endif

/* INVALID_SET_FILE_POINTER is not defined at least in MSVC6SP2 */
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER    0xffffffff
#endif


#define NGX_INVALID_FILE            INVALID_HANDLE_VALUE
#define NGX_FILE_ERROR              0


/*
 * FILE_FLAG_BACKUP_SEMANTICS allows to obtain a handle to a directory
 */

#define ngx_open_file(name, mode, create, access)                            \
    CreateFile((const char *) name, mode,                                    \
               FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,           \
               NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL)
#define ngx_open_file_n             "CreateFile()"

#define NGX_FILE_RDONLY             GENERIC_READ
#define NGX_FILE_WRONLY             GENERIC_WRITE
#define NGX_FILE_RDWR               GENERIC_READ|GENERIC_WRITE
#define NGX_FILE_CREATE_OR_OPEN     OPEN_ALWAYS
#define NGX_FILE_OPEN               OPEN_EXISTING
#define NGX_FILE_APPEND             0

#define NGX_FILE_DEFAULT_ACCESS     0


ngx_int_t ngx_file_append_mode(ngx_fd_t fd);
#define ngx_file_append_mode_n      "SetFilePointer()"


#define ngx_open_tempfile(name, persistent, access)                          \
    CreateFile((const char *) name,                                          \
               GENERIC_READ|GENERIC_WRITE,                                   \
               FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,           \
               NULL,                                                         \
               CREATE_NEW,                                                   \
               persistent ? 0:                                               \
                   FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,       \
               NULL);

#define ngx_open_tempfile_n         "CreateFile()"


#define ngx_close_file              CloseHandle
#define ngx_close_file_n            "CloseHandle()"


#define ngx_read_fd(fd, buf, size)  ReadFile(fd, buf, size, NULL, NULL)
#define ngx_read_fd_n               "ReadFile()"

#define ngx_write_fd(fd, buf, size) WriteFile(fd, buf, size, NULL, NULL)
#define ngx_write_fd_n              "WriteFile()"

#define ngx_linefeed(p)             *p++ = CR; *p++ = LF;
#define NGX_LINEFEED_SIZE           2


#define ngx_delete_file(name)       DeleteFile((const char *) name)
#define ngx_delete_file_n           "DeleteFile()"


#define ngx_rename_file(o, n)       MoveFile((const char *) o, (const char *) n)
#define ngx_rename_file_n           "MoveFile()"
ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
    ngx_pool_t *pool);



ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s);
#define ngx_set_file_time_n         "SetFileTime()"


ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi);
#define ngx_file_info_n             "GetFileAttributesEx()"


#define ngx_fd_info(fd, fi)         GetFileInformationByHandle(fd, fi)
#define ngx_fd_info_n               "GetFileInformationByHandle()"


#define ngx_is_dir(fi)      ((fi)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#define ngx_is_file(fi)     !((fi)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#define ngx_is_link(fi)     0

#define ngx_file_access(fi) 0<commit_msg>win32 ngx_is_exec() stub<commit_after>
/*
 * Copyright (C) <NAME>
 */


#ifndef _NGX_FILES_H_INCLUDED_
#define _NGX_FILES_H_INCLUDED_


#include <ngx_config.h>
#include <ngx_core.h>


/* INVALID_FILE_ATTRIBUTES is specified but not defined at least in MSVC6SP2 */
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES     0xffffffff
#endif

/* INVALID_SET_FILE_POINTER is not defined at least in MSVC6SP2 */
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER    0xffffffff
#endif


#define NGX_INVALID_FILE            INVALID_HANDLE_VALUE
#define NGX_FILE_ERROR              0


/*
 * FILE_FLAG_BACKUP_SEMANTICS allows to obtain a handle to a directory
 */

#define ngx_open_file(name, mode, create, access)                            \
    CreateFile((const char *) name, mode,                                    \
               FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,           \
               NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL)
#define ngx_open_file_n             "CreateFile()"

#define NGX_FILE_RDONLY             GENERIC_READ
#define NGX_FILE_WRONLY             GENERIC_WRITE
#define NGX_FILE_RDWR               GENERIC_READ|GENERIC_WRITE
#define NGX_FILE_CREATE_OR_OPEN     OPEN_ALWAYS
#define NGX_FILE_OPEN               OPEN_EXISTING
#define NGX_FILE_APPEND             0

#define NGX_FILE_DEFAULT_ACCESS     0


ngx_int_t ngx_file_append_mode(ngx_fd_t fd);
#define ngx_file_append_mode_n      "SetFilePointer()"


#define ngx_open_tempfile(name, persistent, access)                          \
    CreateFile((const char *) name,                                          \
               GENERIC_READ|GENERIC_WRITE,                                   \
               FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,           \
               NULL,                                                         \
               CREATE_NEW,                                                   \
               persistent ? 0:                                               \
                   FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,       \
               NULL);

#define ngx_open_tempfile_n         "CreateFile()"


#define ngx_close_file              CloseHandle
#define ngx_close_file_n            "CloseHandle()"


#define ngx_read_fd(fd, buf, size)  ReadFile(fd, buf, size, NULL, NULL)
#define ngx_read_fd_n               "ReadFile()"

#define ngx_write_fd(fd, buf, size) WriteFile(fd, buf, size, NULL, NULL)
#define ngx_write_fd_n              "WriteFile()"

#define ngx_linefeed(p)             *p++ = CR; *p++ = LF;
#define NGX_LINEFEED_SIZE           2


#define ngx_delete_file(name)       DeleteFile((const char *) name)
#define ngx_delete_file_n           "DeleteFile()"


#define ngx_rename_file(o, n)       MoveFile((const char *) o, (const char *) n)
#define ngx_rename_file_n           "MoveFile()"
ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to,
    ngx_pool_t *pool);



ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s);
#define ngx_set_file_time_n         "SetFileTime()"


ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi);
#define ngx_file_info_n             "GetFileAttributesEx()"


#define ngx_fd_info(fd, fi)         GetFileInformationByHandle(fd, fi)
#define ngx_fd_info_n               "GetFileInformationByHandle()"


#define ngx_is_dir(fi)      ((fi)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#define ngx_is_file(fi)     !((fi)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#define ngx_is_link(fi)     0
#define ngx_is_exec(fi)     0

#define ngx_file_access(fi) 0
{'fraction_non_alphanumeric': 0.07707317073170732, 'fraction_numerical': 0.004599303135888502, 'mean_word_length': 2.244122965641953, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4478649', 'n_tokens_mistral': 2445, 'n_tokens_neox': 2333, 'n_words': 454}