<commit_before>#ifndef NIT_COMMON_H
#define NIT_COMMON_H

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

#ifdef WITH_LIBGC
#include <gc/gc.h>
#define malloc(x) GC_MALLOC((x))
#define calloc(x,y) GC_MALLOC((x)*(y))
#endif



/* *** Types *** */
typedef signed long int bigint;	/* standard int value, must be larger that any poiner */
typedef bigint (*fun_t) (bigint);	     				/* generic function pointer */
typedef bigint cid_t;					/* class identifier */
typedef bigint val_t;	/* value (everything is a val_t) */
typedef union obj_tu {union classtable_elt_tu * vft; val_t attr;} *obj_t; /* standard object */
typedef union classtable_elt_tu { bigint i; fun_t f; cid_t cid;} classtable_elt_t;	/* classtable element */

typedef classtable_elt_t * classtable_t;    	 		/* classtable */

/*****************************************************************************
 * Types macros (primitive and less primitives) ******************************
 *****************************************************************************
 *
 * ** types are: **
 * 
 * OBJ	(obj_t)	: standard object representation (including boxes + NIL)
 * Int	(int)	: integers
 * Char	(car)	: characters
 * Bool	(int)	: booleans (true or false)
 * 
 * X	(x_t)	: generic representatio of the previous four types
 *
 * ** macros are: **
 *
 * int ISX(val_t v)		: true if v is a X
 * x_t VAL2X(val_t v)		: convert a val_t to a primitive type (you should check ISX before)
 * val_t X2VAL(x_t x)		: convert a type to a val_t
 * int XTAG			: numeric identifier of a type
 * int TAG(val_t v)		: return the XTAG (ie TAG(Char2VAL('e')) == CharTag)
 * 
 * classtable_t VAL2VFT(val_t v): the virtual function table of a value
 *
 * val_t NIT_NULL		: the instance of the None class
 *****************************************************************************/

#define TAG(x) ((int)(x) & 3)
#ifndef IntTAG 
#	define IntTAG 1
#endif
#define TAG_Int(x) ((val_t)(((x)<<2)|IntTAG))
#define UNTAG_Int(x) ((bigint)(x)>>2)
#ifndef CharTAG
#	define CharTAG 2
#endif
#define TAG_Char(x) ((val_t)((((int)(x))<<2)|CharTAG))
#define UNTAG_Char(x) ((char)((int)(x)>>2))
#ifndef BoolTAG
#	define BoolTAG 3
#endif
#define TAG_Bool(x) ((val_t)(((x)<<2)|BoolTAG))
#define UNTAG_Bool(x) ((int)(x)>>2)
#ifndef OBJTAG
#	define OBJTAG 0
#endif
	
#define ISOBJ(x) (TAG((x)) == OBJTAG)
#define VAL2OBJ(x) ((obj_t)(x))
#define OBJ2VAL(o) ((val_t)(o))
#define VAL2VFT(x) (ISOBJ(x) ? VAL2OBJ(x)->vft : TAG2VFT[TAG(x)])
/*#define VAL2CID(x) (ISOBJ(x) ? (VAL2OBJ(x)->vft->cid) : (-TAG(x)))*/
#define VAL2CID(x) (VAL2OBJ(x)->vft->cid)

#define NIT_NULL ((val_t)0)
#define ISNULL(x) ((x)==NIT_NULL)<commit_msg>clib: clean spaces in nit_common.h<commit_after>#ifndef NIT_COMMON_H
#define NIT_COMMON_H

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

#ifdef WITH_LIBGC
#include <gc/gc.h>
#define malloc(x) GC_MALLOC((x))
#define calloc(x,y) GC_MALLOC((x)*(y))
#endif



/* *** Types *** */
typedef signed long int bigint;	/* standard int value, must be larger that any poiner */
typedef bigint (*fun_t) (bigint);					/* generic function pointer */
typedef bigint cid_t;					/* class identifier */
typedef bigint val_t;	/* value (everything is a val_t) */
typedef union obj_tu {union classtable_elt_tu * vft; val_t attr;} *obj_t; /* standard object */
typedef union classtable_elt_tu { bigint i; fun_t f; cid_t cid;} classtable_elt_t;	/* classtable element */

typedef classtable_elt_t * classtable_t;			/* classtable */

/*****************************************************************************
 * Types macros (primitive and less primitives) ******************************
 *****************************************************************************
 *
 * ** types are: **
 *
 * OBJ	(obj_t)	: standard object representation (including boxes + NIL)
 * Int	(int)	: integers
 * Char	(car)	: characters
 * Bool	(int)	: booleans (true or false)
 *
 * X	(x_t)	: generic representatio of the previous four types
 *
 * ** macros are: **
 *
 * int ISX(val_t v)		: true if v is a X
 * x_t VAL2X(val_t v)		: convert a val_t to a primitive type (you should check ISX before)
 * val_t X2VAL(x_t x)		: convert a type to a val_t
 * int XTAG			: numeric identifier of a type
 * int TAG(val_t v)		: return the XTAG (ie TAG(Char2VAL('e')) == CharTag)
 *
 * classtable_t VAL2VFT(val_t v): the virtual function table of a value
 *
 * val_t NIT_NULL		: the instance of the None class
 *****************************************************************************/

#define TAG(x) ((int)(x) & 3)
#ifndef IntTAG
#	define IntTAG 1
#endif
#define TAG_Int(x) ((val_t)(((x)<<2)|IntTAG))
#define UNTAG_Int(x) ((bigint)(x)>>2)
#ifndef CharTAG
#	define CharTAG 2
#endif
#define TAG_Char(x) ((val_t)((((int)(x))<<2)|CharTAG))
#define UNTAG_Char(x) ((char)((int)(x)>>2))
#ifndef BoolTAG
#	define BoolTAG 3
#endif
#define TAG_Bool(x) ((val_t)(((x)<<2)|BoolTAG))
#define UNTAG_Bool(x) ((int)(x)>>2)
#ifndef OBJTAG
#	define OBJTAG 0
#endif

#define ISOBJ(x) (TAG((x)) == OBJTAG)
#define VAL2OBJ(x) ((obj_t)(x))
#define OBJ2VAL(o) ((val_t)(o))
#define VAL2VFT(x) (ISOBJ(x) ? VAL2OBJ(x)->vft : TAG2VFT[TAG(x)])
/*#define VAL2CID(x) (ISOBJ(x) ? (VAL2OBJ(x)->vft->cid) : (-TAG(x)))*/
#define VAL2CID(x) (VAL2OBJ(x)->vft->cid)

#define NIT_NULL ((val_t)0)
#define ISNULL(x) ((x)==NIT_NULL)
{'fraction_non_alphanumeric': 0.24943481537302187, 'fraction_numerical': 0.009419743782969104, 'mean_word_length': 5.180442374854482, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 33, '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': '6912012', 'n_tokens_mistral': 2085, 'n_tokens_neox': 1974, 'n_words': 531}