<commit_before>/*
 * pool.h
 * 
 */

#ifndef POOL_H
#define POOL_H

#ifdef __cplusplus
extern "C" {
#endif

#include "pooltypes.h"
#include "poolid.h"
#include "repo.h"
#include "solvable.h"
#include "queue.h"

// see initpool_data[] in pool.c

/* well known ids */
#define ID_NULL			0
#define ID_EMPTY		1
#define SOLVABLE_NAME		2
#define SOLVABLE_ARCH		3
#define SOLVABLE_EVR		4
#define SOLVABLE_PROVIDES	5
#define SOLVABLE_OBSOLETES	6
#define SOLVABLE_CONFLICTS	7
#define SOLVABLE_REQUIRES	8
#define SOLVABLE_RECOMMENDS	9
#define SOLVABLE_SUGGESTS	10
#define SOLVABLE_SUPPLEMENTS	11
#define SOLVABLE_ENHANCES	12
#define SOLVABLE_FRESHENS	13
#define RPM_RPMDBID		14
#define SOLVABLE_PREREQMARKER	15		// normal requires before this, prereqs after this
#define SOLVABLE_FILEMARKER	16		// normal provides before this, generated file provides after this
#define NAMESPACE_INSTALLED	17
#define NAMESPACE_MODALIAS	18
#define SYSTEM_SYSTEM		19
#define ARCH_SRC		20
#define ARCH_NOSRC		21
#define ARCH_NOARCH		22

/* well known solvable */
#define SYSTEMSOLVABLE		1


/* how many strings to maintain (round robin) */
#define DEP2STRBUF 16


//-----------------------------------------------

struct _Pool {
  int verbose;		// pool is used everywhere, so put the verbose flag here

  Offset *strings;            // table of offsets into stringspace, indexed by Id: Id -> Offset
  int nstrings;               // number of unique strings in stringspace
  char *stringspace;          // space for all unique strings: stringspace + Offset = string
  Offset sstrings;            // next free pos in stringspace

  Hashtable stringhashtbl;    // hash table: (string ->) Hash -> Id
  Hashmask stringhashmask;    // modulo value for hash table (size of table - 1)

  Reldep *rels;               // table of rels: Id -> Reldep
  int nrels;                  // number of unique rels
  Hashtable relhashtbl;       // hash table: (name,evr,op ->) Hash -> Id
  Hashmask relhashmask;

  Repo **repos;
  int nrepos;

  Solvable *solvables;
  int nsolvables;

  int promoteepoch;

  Id *id2arch;			/* map arch ids to scores */
  Id lastarch;			/* last valid entry in id2arch */

  /* providers data, as two-step indirect list
   * whatprovides[Id] -> Offset into whatprovidesdata for name
   * whatprovidesdata[Offset] -> ID_NULL-terminated list of solvables providing Id
   */
  Offset *whatprovides;		/* Offset to providers of a specific name, Id -> Offset  */
  Id *whatprovidesdata;		/* Ids of solvable providing Id */
  Offset whatprovidesdataoff;	/* next free slot within whatprovidesdata */
  int whatprovidesdataleft;	/* number of 'free slots' within whatprovidesdata */

  Id (*nscallback)(struct _Pool *, void *data, Id name, Id evr);
  void *nscallbackdata;

  /* our dep2str string space */
  char *dep2strbuf[DEP2STRBUF];
  int   dep2strlen[DEP2STRBUF];
  int   dep2strn;<commit_msg>keep 'bool'ness in the comment<commit_after>/*
 * pool.h
 * 
 */

#ifndef POOL_H
#define POOL_H

#ifdef __cplusplus
extern "C" {
#endif

#include "pooltypes.h"
#include "poolid.h"
#include "repo.h"
#include "solvable.h"
#include "queue.h"

// see initpool_data[] in pool.c

/* well known ids */
#define ID_NULL			0
#define ID_EMPTY		1
#define SOLVABLE_NAME		2
#define SOLVABLE_ARCH		3
#define SOLVABLE_EVR		4
#define SOLVABLE_PROVIDES	5
#define SOLVABLE_OBSOLETES	6
#define SOLVABLE_CONFLICTS	7
#define SOLVABLE_REQUIRES	8
#define SOLVABLE_RECOMMENDS	9
#define SOLVABLE_SUGGESTS	10
#define SOLVABLE_SUPPLEMENTS	11
#define SOLVABLE_ENHANCES	12
#define SOLVABLE_FRESHENS	13
#define RPM_RPMDBID		14
#define SOLVABLE_PREREQMARKER	15		// normal requires before this, prereqs after this
#define SOLVABLE_FILEMARKER	16		// normal provides before this, generated file provides after this
#define NAMESPACE_INSTALLED	17
#define NAMESPACE_MODALIAS	18
#define SYSTEM_SYSTEM		19
#define ARCH_SRC		20
#define ARCH_NOSRC		21
#define ARCH_NOARCH		22

/* well known solvable */
#define SYSTEMSOLVABLE		1


/* how many strings to maintain (round robin) */
#define DEP2STRBUF 16


//-----------------------------------------------

struct _Pool {
  int verbose;		// pool is used everywhere, so put the verbose flag here

  Offset *strings;            // table of offsets into stringspace, indexed by Id: Id -> Offset
  int nstrings;               // number of unique strings in stringspace
  char *stringspace;          // space for all unique strings: stringspace + Offset = string
  Offset sstrings;            // next free pos in stringspace

  Hashtable stringhashtbl;    // hash table: (string ->) Hash -> Id
  Hashmask stringhashmask;    // modulo value for hash table (size of table - 1)

  Reldep *rels;               // table of rels: Id -> Reldep
  int nrels;                  // number of unique rels
  Hashtable relhashtbl;       // hash table: (name,evr,op ->) Hash -> Id
  Hashmask relhashmask;

  Repo **repos;
  int nrepos;

  Solvable *solvables;
  int nsolvables;

  int promoteepoch;             /* 0/1  */

  Id *id2arch;			/* map arch ids to scores */
  Id lastarch;			/* last valid entry in id2arch */

  /* providers data, as two-step indirect list
   * whatprovides[Id] -> Offset into whatprovidesdata for name
   * whatprovidesdata[Offset] -> ID_NULL-terminated list of solvables providing Id
   */
  Offset *whatprovides;		/* Offset to providers of a specific name, Id -> Offset  */
  Id *whatprovidesdata;		/* Ids of solvable providing Id */
  Offset whatprovidesdataoff;	/* next free slot within whatprovidesdata */
  int whatprovidesdataleft;	/* number of 'free slots' within whatprovidesdata */

  Id (*nscallback)(struct _Pool *, void *data, Id name, Id evr);
  void *nscallbackdata;

  /* our dep2str string space */
  char *dep2strbuf[DEP2STRBUF];
  int   dep2strlen[DEP2STRBUF];
  int   dep2strn;
{'fraction_non_alphanumeric': 0.10114107883817428, 'fraction_numerical': 0.017289073305670817, 'mean_word_length': 3.0854519774011298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '3972542', 'n_tokens_mistral': 2088, 'n_tokens_neox': 1941, 'n_words': 638}