<commit_before>/**
 * RSyntax.h
 * A ray of light in the realm of darkness.
 * Some syntax additions to C.
 * If You don't like it,
 * You can preprocess file, to get pure-C code.
 * Author <NAME> (<EMAIL>)
 * 2014 <NAME>
 *  _         _ _ _
 * | |       (_|_) |
 * | | _____  _ _| |__   __ _
 * | |/ / _ \| | | '_ \ / _` |
 * |   < (_) | | | |_) | (_| |
 * |_|\_\___/| |_|_.__/ \__,_|
 *          _/ |
 *         |__/
 **/

#ifndef __R_SYNTAX_H__
#define __R_SYNTAX_H__

#include <RayCheckFoundation.h>
#include <RColors.h>
#include <RayBase.h>
#include <RErrors.h>

// working defines
#define _TOSTRING(x)                                      #x
#define toString(x)                                       _TOSTRING(x)        // gets c-string from define or some code

#define _concatenate(one, two)                            one##two
#define concatenate(one, two)                             _concatenate(one, two)  // concatenate two words: concatenate(Hello, World) -> HelloWorld

#define initRClock()                                      clock_t tic = clock(); \
                                                          clock_t diff = 0, toc = 0;

#define tickRClock()                                      toc = clock(); \
                                                          diff = toc - tic; \
                                                          tic = clock(); \
                                                          RPrintf("Elapsed: %f seconds\n", (double)(diff) / CLOCKS_PER_SEC);

#define RAY_TEST(conditionZero, message, errorCode)       if(conditionZero) { \
                                                              RFPrintf(stderr, "ERROR. TESTS. " message "\n"); \
                                                              return errorCode;\
                                                          }

#define RPrintLn(string)                                  RPrintf("%s\n", string)

// typedefs
typedef void*   pointer;

#ifdef _WIN32
    #undef byte
#endif
typedef uint8_t byte;

typedef byte    rbool;
#define yes                                               ((rbool)   1)
#define no                                                ((rbool)   0)
#define nil                                               ((pointer) 0)

// declarations
#define class(className)                                  typedef struct className { \
                                                          size_t classId;
#define protocol(protocolName)                            typedef struct protocolName {

#define discipleOf(className)                             className *concatenate(master, concatenate(className, Object));
#define endOf(className)                                  } className;

#define allocator(className)                              RAlloc(sizeof(className))
#define arrayAllocator(className, size)                   RAlloc(sizeof(className) * (size))
#define arraySize(className, size)                        (sizeof(className) * size)
#define deallocator(object)                               RFree(object)

#define method(returnValue, methodName, className)        returnValue concatenate(methodName, className)(className *object
#define constMethod(returnValue, methodName, className)   returnValue concatenate(methodName, className)(const className *const object

#define constructor(className)                            className* concatenate(constructorOf,className) (className *object
#define destructor(className)                             void concatenate(destructorOf,className) (className *object)
#define printer(className)                                method(void, printerOf, className))

#define singleton(className)                              className* concatenate(singletonOf,className)(void)
#define staticMethod(returnValue, methodName, className)  returnValue concatenate(concatenate(staticMethod, methodName), concatenate(Of, className))(className *deprecatedObject
#define virtualMethod(returnValue, methodName)            returnValue (*methodName)
#define linkMethod(object, virtualName, realName)         object->virtualName = realName;

// calls<commit_msg>Fix branches.<commit_after>/**
 * RSyntax.h
 * A ray of light in the realm of darkness.
 * Some syntax additions to C.
 * If You don't like it,
 * You can preprocess file, to get pure-C code.
 * Author <NAME> (<EMAIL>)
 * 2014 <NAME>
 *  _         _ _ _
 * | |       (_|_) |
 * | | _____  _ _| |__   __ _
 * | |/ / _ \| | | '_ \ / _` |
 * |   < (_) | | | |_) | (_| |
 * |_|\_\___/| |_|_.__/ \__,_|
 *          _/ |
 *         |__/
 **/

#ifndef __R_SYNTAX_H__
#define __R_SYNTAX_H__

#include <RayCheckFoundation.h>
#include <RColors.h>
#include <RayBase.h>
#include <RErrors.h>

// working defines
#define _TOSTRING(x)                                      #x
#define toString(x)                                       _TOSTRING(x)        // gets c-string from define or some code

#define _concatenate(one, two)                            one##two
#define concatenate(one, two)                             _concatenate(one, two)  // concatenate two words: concatenate(Hello, World) -> HelloWorld

#define initRClock()                                      clock_t tic = clock(); \
                                                          clock_t diff = 0, toc = 0;

#define tickRClock()                                      toc = clock(); \
                                                          diff = toc - tic; \
                                                          tic = clock(); \
                                                          RPrintf("Elapsed: %f seconds\n", (double)(diff) / CLOCKS_PER_SEC);

#define RAY_TEST(conditionZero, message, errorCode)       if(conditionZero) { \
                                                              RFPrintf(stderr, "ERROR. TESTS. " message "\n"); \
                                                              return errorCode;\
                                                          }

#define RPrintLn(string)                                  RPrintf("%s\n", string)

// typedefs
typedef void*   pointer;

#ifdef _WIN32
    #undef byte
#endif
typedef uint8_t byte;

typedef byte    rbool;
#define yes                                               ((rbool)   1)
#define no                                                ((rbool)   0)
#define nil                                               ((pointer) 0)

// declarations
#define class(className)                                  typedef struct className { \
                                                          size_t classId;
#define protocol(protocolName)                            typedef struct protocolName {

#define discipleOf(className)                             className *concatenate(master, concatenate(className, Object));
#define endOf(className)                                  } className;

#define allocator(className)                              RAlloc(sizeof(className))
#define arrayAllocator(className, size)                   RAlloc(sizeof(className) * (size))
#define arraySize(className, size)                        (sizeof(className) * (size))
#define deallocator(object)                               RFree(object)

#define method(returnValue, methodName, className)        returnValue concatenate(methodName, className)(className *object
#define constMethod(returnValue, methodName, className)   returnValue concatenate(methodName, className)(const className *const object

#define constructor(className)                            className* concatenate(constructorOf,className) (className *object
#define destructor(className)                             void concatenate(destructorOf,className) (className *object)
#define printer(className)                                method(void, printerOf, className))

#define singleton(className)                              className* concatenate(singletonOf,className)(void)
#define staticMethod(returnValue, methodName, className)  returnValue concatenate(concatenate(staticMethod, methodName), concatenate(Of, className))(className *deprecatedObject
#define virtualMethod(returnValue, methodName)            returnValue (*methodName)
#define linkMethod(object, virtualName, realName)         object->virtualName = realName;

// calls
{'fraction_non_alphanumeric': 0.09601449275362318, 'fraction_numerical': 0.002898550724637681, 'mean_word_length': 1.4377391816308507, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 60, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4529873', 'n_tokens_mistral': 2023, 'n_tokens_neox': 1944, 'n_words': 484}