<commit_before>#ifndef _SEED_MODULE_H_
#define _SEED_MODULE_H_

#include <seed.h>

#define PLURALIZE_ARG_COUNT(c) \
	((c == 1) ? #c " argument" : #c " arguments")

#define CHECK_ARG_COUNT(name, argnum) \
	if ( argument_count != argnum ) \
	{ \
		char * msg; \
		asprintf(&msg, "%s expected %s got %Zd", name, \
		         PLURALIZE_ARG_COUNT(argnum), argument_count); \
		seed_make_exception (ctx, exception, "ArgumentError", "%s", msg); \
		return seed_make_undefined (ctx); \
	}

#endif
<commit_msg>[modules] DEFINE_ENUM_MEMBER macro<commit_after>#ifndef _SEED_MODULE_H_
#define _SEED_MODULE_H_

#include <seed.h>

// Pluralize an argument count ("1 argument", "2 arguments", etc), given an int
#define PLURALIZE_ARG_COUNT(c) \
	((c == 1) ? #c " argument" : #c " arguments")

// Check that the required number of arguments were passed into a seed callback.
// If this is not true, raise an exception and return null.
// This requires the callback to use "argument_count", "ctx", and "exception"
// as the names of the various function arguments.
#define CHECK_ARG_COUNT(name, argnum) \
	if ( argument_count != argnum ) \
	{ \
		char * msg; \
		asprintf(&msg, "%s expected %s got %Zd", name, \
		         PLURALIZE_ARG_COUNT(argnum), argument_count); \
		seed_make_exception (ctx, exception, "ArgumentError", "%s", msg); \
		g_free(msg); \
		return seed_make_undefined (ctx); \
	}

// Defines a property on holder for the given enum member, with the given name
#define DEFINE_ENUM_MEMBER(holder, name, val) \
	seed_object_set_property(ctx, holder, name, \
	                         seed_value_from_long(ctx, val, NULL))

#endif

{'fraction_non_alphanumeric': 0.13014119091467158, 'fraction_numerical': 0.0024554941682013503, 'mean_word_length': 3.8656716417910446, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5356778', 'n_tokens_mistral': 580, 'n_tokens_neox': 555, 'n_words': 163}