<commit_before>#include <stdio.h>
#include <gmp.h>

#include "m-variant.h"
#include "m-string.h"
#include "m-dict.h"
#include "m-array.h"

/* Define a variant over two integers named integer_t
   Notice than mpz_t has special init & clear functions.
*/
VARIANT_DEF2(integer,
             (n, long long, M_DEFAULT_OPLIST),
             (z, mpz_t, M_CLASSIC_OPLIST(mpz)))
/* Define the oplist associated to this variant */
#define INTEGER_OPLIST VARIANT_OPLIST(integer, M_DEFAULT_OPLIST, M_CLASSIC_OPLIST(mpz))

/* Define a dictionary of string --> integer named dict_my_t */
DICT_DEF2(my,
          string_t, STRING_OPLIST,
          integer_t, INTEGER_OPLIST)
/* Define the oplist associated to this dictionary */
#define MY_DICT_OPLIST DICT_OPLIST(my, STRING_OPLIST, INTEGER_OPLIST)

/* Define an array of such dictionary named array_my_t */
ARRAY_DEF(my, dict_my_t, MY_DICT_OPLIST)
/* Define the oplist associated to this array of dictionary of variant */
#define MY_ARRAY_OPLIST ARRAY_OPLIST(my, MY_DICT_OPLIST)

int main()
{
  M_LET(z, INTEGER_OPLIST)            /* Define & init & clear a variant of integer */
    M_LET(dict, MY_DICT_OPLIST)       /* Define & init & clear a dictionary of variant */
    M_LET(array, MY_ARRAY_OPLIST)     /* Define & init & clear an array of dictionary of variant */
    M_LET(gmp, M_CLASSIC_OPLIST(mpz)) /* M_LET allows even with non container type */
    {
      integer_set_n (z, 17LL);        // Set z as the long long 17 
      dict_my_set_at(dict, STRING_CTE("n1"), z); // Push it in the dictionary
      mpz_set_str(gmp, "25446846874687468746874687468746874686874", 10);
      integer_set_z (z, gmp);         // Set z as the mpz_t variable
      dict_my_set_at(dict, STRING_CTE("n2"), z); // Push it in the dictionary
      array_my_push_back (array, dict); // Push the dictionary in the array

      // Iterate over the container
      for M_EACH(item, array, MY_ARRAY_OPLIST) {
          for M_EACH(p, *item, MY_DICT_OPLIST) {
              // Dictionary iterator are pair (key,value)
              if (integer_n_p((*p)->value)) {
                printf ("It is a long long, value = %Ld\n",
                        *integer_get_n((*p)->value));
              }
              if (integer_z_p((*p)->value)) {
                printf ("It is a mpz_t, value =");
                mpz_out_str(stdout, 10, *integer_get_z((*p)->value));
                printf("\n");
              }
            }
        }
    } /* All variables are automaticaly cleared beyond this point */
}<commit_msg>Improve comments.<commit_after>#include <stdio.h>
#include <gmp.h>

#include "m-variant.h"
#include "m-string.h"
#include "m-dict.h"
#include "m-array.h"

/* Define a variant over two integers named integer_t
   Notice than mpz_t has special init & clear functions.
*/
VARIANT_DEF2(integer,
             (n, long long, M_DEFAULT_OPLIST),
             (z, mpz_t, M_CLASSIC_OPLIST(mpz)))
/* Define the oplist associated to this variant */
#define INTEGER_OPLIST VARIANT_OPLIST(integer, M_DEFAULT_OPLIST, M_CLASSIC_OPLIST(mpz))

/* Define a dictionary of string --> integer named dict_my_t */
DICT_DEF2(my,
          string_t, STRING_OPLIST,
          integer_t, INTEGER_OPLIST)
/* Define the oplist associated to this dictionary */
#define MY_DICT_OPLIST DICT_OPLIST(my, STRING_OPLIST, INTEGER_OPLIST)

/* Define an array of such dictionary named array_my_t */
ARRAY_DEF(my, dict_my_t, MY_DICT_OPLIST)
/* Define the oplist associated to this array of dictionary of variant */
#define MY_ARRAY_OPLIST ARRAY_OPLIST(my, MY_DICT_OPLIST)

int main()
{
  M_LET(z, INTEGER_OPLIST)            /* Define & init & clear an instance of a variant of integer */
    M_LET(dict, MY_DICT_OPLIST)       /* Define & init & clear an instance of a dictionary of variant */
    M_LET(array, MY_ARRAY_OPLIST)     /* Define & init & clear an intance of an array of dictionary of variant */
    M_LET(gmp, M_CLASSIC_OPLIST(mpz)) /* M_LET allows even with non container type */
    {
      integer_set_n (z, 17LL);                   // Set z as the long long 17
      dict_my_set_at(dict, STRING_CTE("n1"), z); // Push it in the dictionary
      mpz_set_str(gmp, "25446846874687468746874687468746874686874", 10); // Set gmp to a very long integer.
      integer_set_z (z, gmp);                    // Set z as the mpz_t variable
      dict_my_set_at(dict, STRING_CTE("n2"), z); // Push it in the dictionary
      array_my_push_back (array, dict);          // Push the dictionary in the array

      // Iterate over the array container
      for M_EACH(item, array, MY_ARRAY_OPLIST) {
          // Iterate over the dictionary container
          for M_EACH(p, *item, MY_DICT_OPLIST) {
              // Dictionary iterator are pair (key,value)
              if (integer_n_p((*p)->value)) {
                printf ("It is a long long, value = %Ld\n",
                        *integer_get_n((*p)->value));
              }
              if (integer_z_p((*p)->value)) {
                printf ("It is a mpz_t, value =");
                mpz_out_str(stdout, 10, *integer_get_z((*p)->value));
                printf("\n");
              }
            }
        }
    } /* All variables are automatically cleared beyond this point */
}
{'fraction_non_alphanumeric': 0.10790128180600728, 'fraction_numerical': 0.020279318920987183, 'mean_word_length': 2.60551724137931, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '2042561', 'n_tokens_mistral': 1813, 'n_tokens_neox': 1705, 'n_words': 491}