<commit_before>#ifndef GRAPH_INSTANCE_H
#define GRAPH_INSTANCE_H 1

#include <time.h>

#include "graph_types.h"
#include "graph_ident.h"
#include "utils_array.h"

/*
 * Methods
 */
graph_instance_t *inst_create (graph_config_t *cfg,
		const graph_ident_t *ident);

void inst_destroy (graph_instance_t *inst);

int inst_add_file (graph_instance_t *inst, const graph_ident_t *file);

graph_instance_t *inst_get_selected (graph_config_t *cfg);

int inst_get_params (graph_config_t *cfg, graph_instance_t *inst,
    char *buffer, size_t buffer_size);

int inst_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst,
    str_array_t *args);

graph_ident_t *inst_get_selector (graph_instance_t *inst);

int inst_compare_ident (graph_instance_t *inst, const graph_ident_t *ident);

_Bool inst_matches_ident (graph_instance_t *inst, const graph_ident_t *ident);

_Bool inst_matches_string (graph_config_t *cfg, graph_instance_t *inst,
    const char *term);

_Bool inst_matches_field (graph_instance_t *inst,
    graph_ident_field_t field, const char *field_value);

int inst_describe (graph_config_t *cfg, graph_instance_t *inst,
    char *buffer, size_t buffer_size);

time_t inst_get_mtime (graph_instance_t *inst);

#endif /* GRAPH_INSTANCE_H */
/* vim: set sw=2 sts=2 et fdm=marker : */
<commit_msg>src/graph_instance.h: Document the behavior of "inst_matches_field".<commit_after>#ifndef GRAPH_INSTANCE_H
#define GRAPH_INSTANCE_H 1

#include <time.h>

#include "graph_types.h"
#include "graph_ident.h"
#include "utils_array.h"

/*
 * Methods
 */
graph_instance_t *inst_create (graph_config_t *cfg,
		const graph_ident_t *ident);

void inst_destroy (graph_instance_t *inst);

int inst_add_file (graph_instance_t *inst, const graph_ident_t *file);

graph_instance_t *inst_get_selected (graph_config_t *cfg);

int inst_get_params (graph_config_t *cfg, graph_instance_t *inst,
    char *buffer, size_t buffer_size);

int inst_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst,
    str_array_t *args);

graph_ident_t *inst_get_selector (graph_instance_t *inst);

int inst_compare_ident (graph_instance_t *inst, const graph_ident_t *ident);

_Bool inst_matches_ident (graph_instance_t *inst, const graph_ident_t *ident);

_Bool inst_matches_string (graph_config_t *cfg, graph_instance_t *inst,
    const char *term);

/* Compares the given string with the appropriate field of the selector or, if
 * the selector field is "/all/", iterates over all the files of the instance
 * and checks the appropriate field. Returns true if the field of the selector
 * or of one of the files matches. The string must match entirely but
 * comparison is done case-insensitive. */
_Bool inst_matches_field (graph_instance_t *inst,
    graph_ident_field_t field, const char *field_value);

int inst_describe (graph_config_t *cfg, graph_instance_t *inst,
    char *buffer, size_t buffer_size);

time_t inst_get_mtime (graph_instance_t *inst);

#endif /* GRAPH_INSTANCE_H */
/* vim: set sw=2 sts=2 et fdm=marker : */

{'fraction_non_alphanumeric': 0.09060626249167222, 'fraction_numerical': 0.001998667554963358, 'mean_word_length': 6.099290780141844, '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': '1638679', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1053, 'n_words': 285}