<commit_before>/**
 * Clever programming language
 * Copyright (c) Clever Team
 *
 * This file is distributed under the MIT license. See LICENSE for details.
 */

#ifndef CLEVER_H
#define CLEVER_H

#include <sstream>
#include <cstdarg>
#include <setjmp.h>
#include <vector>
#include <map>

#include "core/platform.h"

namespace clever {

class CException;
class Type;
class Value;

#define CLEVER_THROW(val, ...) exception->setException(val, ##__VA_ARGS__)

extern jmp_buf fatal_error;

// Version macros
#define CLEVER_VERSION 100    // 0.1.0
#define CLEVER_VERSION_STRING "0.1.0-dev"

// Disables copy constructor and copy assignment
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
	TypeName(const TypeName&);             \
	void operator=(const TypeName&)

// Utility functions and macros
#ifdef CLEVER_DEBUG
/**
 * @brief makes an assertion about an expression and aborts the execution on failure
 *
 * @note This function is only available when clever is compiled in debug mode.
 *
 * @note You should use the clever_assert(), clever_assert_null() and clever_assert_not_null()
 *       instead of this function.
 *
 * @param file file to report in the message
 * @param function function to report in the message
 * @param line line to report in the message
 * @param expr expression in string form to report in the message
 * @param hypothesis evaluated expression value (0 or non-0)
 * @param format vsprintf format string
 */
void clever_assert_(const char* file, const char* function, long line, const char* expr,
		int hypothesis, const char* format, ...);

#define clever_assert(hypothesis, format, ...) \
	clever::clever_assert_(__FILE__, CLEVER_CURRENT_FUNCTION, __LINE__, #hypothesis, (hypothesis), format)

#define clever_assert_null(hypothesis) \
	clever::clever_assert_(__FILE__, CLEVER_CURRENT_FUNCTION, __LINE__, #hypothesis, (hypothesis) == NULL, #hypothesis " must be NULL")

#define clever_assert_not_null(hypothesis) \
	clever::clever_assert_(__FILE__, CLEVER_CURRENT_FUNCTION, __LINE__, #hypothesis, (hypothesis) != NULL, #hypothesis " must not be NULL")

/**<commit_msg>- Fix for clever_assert() macro<commit_after>/**
 * Clever programming language
 * Copyright (c) Clever Team
 *
 * This file is distributed under the MIT license. See LICENSE for details.
 */

#ifndef CLEVER_H
#define CLEVER_H

#include <sstream>
#include <cstdarg>
#include <setjmp.h>
#include <vector>
#include <map>

#include "core/platform.h"

namespace clever {

class CException;
class Type;
class Value;

#define CLEVER_THROW(val, ...) exception->setException(val, ##__VA_ARGS__)

extern jmp_buf fatal_error;

// Version macros
#define CLEVER_VERSION 100    // 0.1.0
#define CLEVER_VERSION_STRING "0.1.0-dev"

// Disables copy constructor and copy assignment
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
	TypeName(const TypeName&);             \
	void operator=(const TypeName&)

// Utility functions and macros
#ifdef CLEVER_DEBUG
/**
 * @brief makes an assertion about an expression and aborts the execution on failure
 *
 * @note This function is only available when clever is compiled in debug mode.
 *
 * @note You should use the clever_assert(), clever_assert_null() and clever_assert_not_null()
 *       instead of this function.
 *
 * @param file file to report in the message
 * @param function function to report in the message
 * @param line line to report in the message
 * @param expr expression in string form to report in the message
 * @param hypothesis evaluated expression value (0 or non-0)
 * @param format vsprintf format string
 */
void clever_assert_(const char* file, const char* function, long line, const char* expr,
		int hypothesis, const char* format, ...);

#define clever_assert(hypothesis, format, ...) \
	clever::clever_assert_(__FILE__, CLEVER_CURRENT_FUNCTION, __LINE__, #hypothesis, (hypothesis), format, ##__VA_ARGS__)

#define clever_assert_null(hypothesis) \
	clever::clever_assert_(__FILE__, CLEVER_CURRENT_FUNCTION, __LINE__, #hypothesis, (hypothesis) == NULL, #hypothesis " must be NULL")

#define clever_assert_not_null(hypothesis) \
	clever::clever_assert_(__FILE__, CLEVER_CURRENT_FUNCTION, __LINE__, #hypothesis, (hypothesis) != NULL, #hypothesis " must not be NULL")

/**
{'fraction_non_alphanumeric': 0.10101968223855821, 'fraction_numerical': 0.005216978894949016, 'mean_word_length': 4.866481223922114, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '4350013', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1272, 'n_words': 439}