<commit_before>/*
 * Copyright 2013 10gen Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
#error "Only <bson/bson.h> can be included directly."
#endif


#ifndef BSON_TYPES_H
#define BSON_TYPES_H


#include <stdlib.h>

#include "bson-macros.h"
#include "bson-memory.h"
#include "bson-stdint.h"


BSON_BEGIN_DECLS


typedef uint32_t bson_bool_t;
typedef int8_t   bson_int8_t;
typedef int16_t  bson_int16_t;
typedef int32_t  bson_int32_t;
typedef int64_t  bson_int64_t;
typedef uint8_t  bson_uint8_t;
typedef uint16_t bson_uint16_t;
typedef uint32_t bson_uint32_t;
typedef uint64_t bson_uint64_t;
typedef uint32_t bson_unichar_t;

typedef ssize_t (*bson_read_func_t) (int fd, void *buf, size_t count);

/**
 * bson_context_flags_t:
 *
 * This enumeration is used to configure a bson_context_t.
 *
 * %BSON_CONTEXT_NONE: Use default options.
 * %BSON_CONTEXT_THREAD_SAFE: Context will be called from multiple threads.
 * %BSON_CONTEXT_DISABLE_PID_CACHE: Call getpid() instead of caching the
 *   result of getpid() when initializing the context.
 * %BSON_CONTEXT_DISABLE_HOST_CACHE: Call gethostname() instead of caching the
 *   result of gethostname() when initializing the context.
 */
typedef enum
{
   BSON_CONTEXT_NONE               = 0,
   BSON_CONTEXT_THREAD_SAFE        = 1 << 0,
   BSON_CONTEXT_DISABLE_HOST_CACHE = 1 << 1,
   BSON_CONTEXT_DISABLE_PID_CACHE  = 1 << 2,
#if defined(__linux__)
   BSON_CONTEXT_USE_TASK_ID        = 1 << 3,
#endif
} bson_context_flags_t;
<commit_msg>types: add documentation for bson_read_func_t.<commit_after>/*
 * Copyright 2013 10gen Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#if !defined (BSON_INSIDE) && !defined (BSON_COMPILATION)
#error "Only <bson/bson.h> can be included directly."
#endif


#ifndef BSON_TYPES_H
#define BSON_TYPES_H


#include <stdlib.h>

#include "bson-macros.h"
#include "bson-memory.h"
#include "bson-stdint.h"


BSON_BEGIN_DECLS


typedef uint32_t bson_bool_t;
typedef int8_t   bson_int8_t;
typedef int16_t  bson_int16_t;
typedef int32_t  bson_int32_t;
typedef int64_t  bson_int64_t;
typedef uint8_t  bson_uint8_t;
typedef uint16_t bson_uint16_t;
typedef uint32_t bson_uint32_t;
typedef uint64_t bson_uint64_t;
typedef uint32_t bson_unichar_t;


/**
 * bson_read_func_t:
 * @fd: The file descriptor to read from.
 * @buf: The buffer to read into.
 * @count: The number of bytes to read.
 *
 * This function describes a read function that can be used to read from a file
 * descriptor.
 *
 * Returns: -1 on failure and errno is set, otherwise the number of bytes read.
 *    0 may be returned on end of stream.
 */
typedef ssize_t (*bson_read_func_t) (int     fd,
                                     void   *buf,
                                     size_t  count);

/**
 * bson_context_flags_t:
 *
 * This enumeration is used to configure a bson_context_t.
 *
 * %BSON_CONTEXT_NONE: Use default options.
 * %BSON_CONTEXT_THREAD_SAFE: Context will be called from multiple threads.
 * %BSON_CONTEXT_DISABLE_PID_CACHE: Call getpid() instead of caching the
 *   result of getpid() when initializing the context.
 * %BSON_CONTEXT_DISABLE_HOST_CACHE: Call gethostname() instead of caching the
 *   result of gethostname() when initializing the context.
 */
typedef enum
{
   BSON_CONTEXT_NONE               = 0,
   BSON_CONTEXT_THREAD_SAFE        = 1 << 0,
   BSON_CONTEXT_DISABLE_HOST_CACHE = 1 << 1,
   BSON_CONTEXT_DISABLE_PID_CACHE  = 1 << 2,
#if defined(__linux__)
   BSON_CONTEXT_USE_TASK_ID        = 1 << 3,
#endif
} bson_context_flags_t;

{'fraction_non_alphanumeric': 0.07875894988066826, 'fraction_numerical': 0.022564547624213494, 'mean_word_length': 3.8834745762711864, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3258316', 'n_tokens_mistral': 1665, 'n_tokens_neox': 1566, 'n_words': 497}