<commit_before>/**
 ** \file object/primitives.hh
 ** \brief Definition of the root Objects.
 */

#ifndef OBJECT_PRIMITIVES_HH
# define OBJECT_PRIMITIVES_HH

# include "libport/compiler.hh"

# include "object/fwd.hh"
# include "object/symbols.hh"

# include "object/alien-class.hh"
# include "object/call-class.hh"
# include "object/code-class.hh"
# include "object/delegate-class.hh"
# include "object/lobby-class.hh"
# include "object/float-class.hh"
# include "object/integer-class.hh"
# include "object/list-class.hh"
# include "object/object-class.hh"
# include "object/primitive-class.hh"
# include "object/string-class.hh"
# include "object/task-class.hh"
# include "object/urbi-exception.hh"

namespace object
{
  void root_classes_initialize ();
}; // namespace object

  /*-------------------.
  | Primitives macros  |
  `-------------------*/

/**
 * Throw an exception if \a Obj is not of type \a Type.
 */
#define TYPE_CHECK(Obj, Type)                                           \
  do {									\
    if (!(Obj)->type_is<Type>())					\
      throw object::WrongArgumentType(object::Object::kind_type(Type::kind), \
				      Obj->kind_get(),			\
				      "");				\
  } while (0)

/**
 * Fetch the N-th argument, of type Type. Name it 'arg ## N'.
 * If the argument's type is wrong, throw an UrbiException.
 */
#define FETCH_ARG(N, Type)				\
  TYPE_CHECK(args[N], Type);				\
  r ## Type arg ## N = args[N].unsafe_cast<Type>()

/**
 * Check argument's count and throw an Urbi exception if it is wrong.
 * \param N expected number of arguments (including self).
 */
#define CHECK_ARG_COUNT(N)                              \
  check_arg_count(N, args.size(), __PRETTY_FUNCTION__)

/**
 * Check argument count and throw an Urbi exception if it does not<commit_msg>Convert TYPE_CHECK to use boost::throw_exception<commit_after>/**
 ** \file object/primitives.hh
 ** \brief Definition of the root Objects.
 */

#ifndef OBJECT_PRIMITIVES_HH
# define OBJECT_PRIMITIVES_HH

# include "libport/compiler.hh"

# include "object/fwd.hh"
# include "object/symbols.hh"

# include "object/alien-class.hh"
# include "object/call-class.hh"
# include "object/code-class.hh"
# include "object/delegate-class.hh"
# include "object/lobby-class.hh"
# include "object/float-class.hh"
# include "object/integer-class.hh"
# include "object/list-class.hh"
# include "object/object-class.hh"
# include "object/primitive-class.hh"
# include "object/string-class.hh"
# include "object/task-class.hh"
# include "object/urbi-exception.hh"

namespace object
{
  void root_classes_initialize ();
}; // namespace object

  /*-------------------.
  | Primitives macros  |
  `-------------------*/

/**
 * Throw an exception if \a Obj is not of type \a Type.
 */
#define TYPE_CHECK(Obj, Type)				\
  do {							\
    if (!(Obj)->type_is<Type>())			\
      boost::throw_exception				\
	(object::WrongArgumentType			\
	 (object::Object::kind_type(Type::kind),	\
	  (Obj)->kind_get(),				\
	  ""));						\
  } while (0)

/**
 * Fetch the N-th argument, of type Type. Name it 'arg ## N'.
 * If the argument's type is wrong, throw an UrbiException.
 */
#define FETCH_ARG(N, Type)				\
  TYPE_CHECK(args[N], Type);				\
  r ## Type arg ## N = args[N].unsafe_cast<Type>()

/**
 * Check argument's count and throw an Urbi exception if it is wrong.
 * \param N expected number of arguments (including self).
 */
#define CHECK_ARG_COUNT(N)                              \
  check_arg_count(N, args.size(), __PRETTY_FUNCTION__)

/**
 * Check argument count and throw an Urbi exception if it does not
{'fraction_non_alphanumeric': 0.16605890603085555, 'fraction_numerical': 0.0005610098176718093, 'mean_word_length': 2.7855626326963905, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4592523', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1182, 'n_words': 290}