<commit_before>#ifndef UTIL_H
#define UTIL_H

#include <stdio.h>
#include <stdlib.h>

#define FALSE ( 0 )
#define TRUE  ( 1 )

/*
 * Typedefs
 */

typedef int ps_status_t;

/*
 * Error codes
 */

#define PS_SUCCESS          ( 101 )
#define PS_ERROR_COPY       ( 102 )
#define PS_ERROR_ALLOCATION ( 103 )
#define PS_ERROR_WRONG_ARGUMENTS  ( 104 )
#define PS_ERROR_OBJ_CREATE ( 105 )

// I/O
#define PS_ERROR_FAILED_TO_OPEN_FILE ( 201 )
#define PS_ERROR_FAILED_TO_SEEK ( 202 )
#define PS_ERROR_FAILED_TO_CALC_SIZE ( 203 )

// Regex
#define PS_ERROR_REGEX_FOUND_IS_FALSE ( 301 )

// MPI
#define PS_MPI_COMMON_ERROR ( 401 )

/*
 * Error handling
 */
#define PS_CALL(R) if((rv=R) != PS_SUCCESS) goto error;

#define PS_COMP_VAL_AND_GOTO_WITH_RV(R, OP, VAL, GO, RV)         \
    if(R OP VAL) {                \
        rv = RV;                                                    \
        log_err("file : %s line: %d func: %s rv:%d", __FILE__, __LINE__, __func__, rv);\
        goto GO;                          \
    }

#define PS_MPI_CHECK_ERR(R) PS_COMP_VAL_AND_GOTO_WITH_RV(R, !=, MPI_SUCCESS, error, PS_MPI_COMMON_ERROR)

#define PS_CHECK_VAL_GO_ERR(R, VAL, RV) PS_COMP_VAL_AND_GOTO_WITH_RV(R, !=, VAL, error, RV)

#define PS_CHECK_NEG_VAL_GO_ERR(R, RV) PS_COMP_VAL_AND_GOTO_WITH_RV(R, <, 0, error, RV)

#define PS_COMP(VAL1, VAL2, RV) PS_COMP_VAL_AND_GOTO_WITH_RV(VAL1, !=, VAL2, error, RV)

#define PS_CHECK_VAL_AND_GOTO(RV, VAL, GO)         \
    if(RV != VAL) {                \
        log_err("file : %s line: %d func: %s", __FILE__, __LINE__, __func__);\
        goto GO;                          \<commit_msg>remove mpi depend macro.<commit_after>#ifndef UTIL_H
#define UTIL_H

#include <stdio.h>
#include <stdlib.h>

#define FALSE ( 0 )
#define TRUE  ( 1 )

/*
 * Typedefs
 */

typedef int ps_status_t;

/*
 * Error codes
 */

#define PS_SUCCESS          ( 101 )
#define PS_ERROR_COPY       ( 102 )
#define PS_ERROR_ALLOCATION ( 103 )
#define PS_ERROR_WRONG_ARGUMENTS  ( 104 )
#define PS_ERROR_OBJ_CREATE ( 105 )

// I/O
#define PS_ERROR_FAILED_TO_OPEN_FILE ( 201 )
#define PS_ERROR_FAILED_TO_SEEK ( 202 )
#define PS_ERROR_FAILED_TO_CALC_SIZE ( 203 )

// Regex
#define PS_ERROR_REGEX_FOUND_IS_FALSE ( 301 )

// MPI
#define PS_MPI_COMMON_ERROR ( 401 )

/*
 * Error handling
 */
#define PS_CALL(R) if((rv=R) != PS_SUCCESS) goto error;

#define PS_COMP_VAL_AND_GOTO_WITH_RV(R, OP, VAL, GO, RV)         \
    if(R OP VAL) {                \
        rv = RV;                                                    \
        log_err("file : %s line: %d func: %s rv:%d", __FILE__, __LINE__, __func__, rv);\
        goto GO;                          \
    }

#define PS_CHECK_VAL_GO_ERR(R, VAL, RV) PS_COMP_VAL_AND_GOTO_WITH_RV(R, !=, VAL, error, RV)

#define PS_CHECK_NEG_VAL_GO_ERR(R, RV) PS_COMP_VAL_AND_GOTO_WITH_RV(R, <, 0, error, RV)

#define PS_COMP(VAL1, VAL2, RV) PS_COMP_VAL_AND_GOTO_WITH_RV(VAL1, !=, VAL2, error, RV)

#define PS_CHECK_VAL_AND_GOTO(RV, VAL, GO)         \
    if(RV != VAL) {                \
        log_err("file : %s line: %d func: %s", __FILE__, __LINE__, __func__);\
        goto GO;                          \
{'fraction_non_alphanumeric': 0.1216948072634597, 'fraction_numerical': 0.023574386747371775, 'mean_word_length': 2.5241301907968574, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3157612', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1215, 'n_words': 259}