<commit_before>#if !macintosh
#include <sys/types.h>
#else
#include <SizeTDef.h>
#endif
#include <string.h>
#include <regex.h>
#include <mlvalues.h>
#include <alloc.h>
#include <fail.h>
#include <memory.h>
#include <str.h>

struct regexp_struct {
  final_fun finalization;
  struct re_pattern_buffer re;
};

typedef struct regexp_struct * regexp;

static void free_regexp(value vexpr)
{
  regexp expr = (regexp) Bp_val(vexpr);
  expr->re.translate = NULL;
  regfree(&(expr->re));
}

static regexp alloc_regexp(void)
{
  value res =
    alloc_final(sizeof(struct regexp_struct) / sizeof(value),
                free_regexp, 1, 1000);
  return (regexp) res;
}

#define RE_SYNTAX RE_SYNTAX_EMACS

static char * case_fold_table = NULL;

value str_compile_regexp(value src, value fold) /* ML */
{
  regexp expr;
  char * msg;

  Begin_root(src);
  expr = alloc_regexp();
  End_roots();
  re_syntax_options = RE_SYNTAX;
  if (Bool_val(fold) && case_fold_table == NULL) {<commit_msg>modif parametres alloc_final<commit_after>#if !macintosh
#include <sys/types.h>
#else
#include <SizeTDef.h>
#endif
#include <string.h>
#include <regex.h>
#include <mlvalues.h>
#include <alloc.h>
#include <fail.h>
#include <memory.h>
#include <str.h>

struct regexp_struct {
  final_fun finalization;
  struct re_pattern_buffer re;
};

typedef struct regexp_struct * regexp;

static void free_regexp(value vexpr)
{
  regexp expr = (regexp) Bp_val(vexpr);
  expr->re.translate = NULL;
  regfree(&(expr->re));
}

static regexp alloc_regexp(void)
{
  value res =
    alloc_final(sizeof(struct regexp_struct) / sizeof(value),
                free_regexp, 1, 10000);
  return (regexp) res;
}

#define RE_SYNTAX RE_SYNTAX_EMACS

static char * case_fold_table = NULL;

value str_compile_regexp(value src, value fold) /* ML */
{
  regexp expr;
  char * msg;

  Begin_root(src);
  expr = alloc_regexp();
  End_roots();
  re_syntax_options = RE_SYNTAX;
  if (Bool_val(fold) && case_fold_table == NULL) {
{'fraction_non_alphanumeric': 0.13109756097560976, 'fraction_numerical': 0.005589430894308943, 'mean_word_length': 4.484679665738161, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, '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': '738605', 'n_tokens_mistral': 787, 'n_tokens_neox': 750, 'n_words': 172}