18 // see initpool_data[] in pool.c
23 #define SOLVABLE_NAME 2
24 #define SOLVABLE_ARCH 3
25 #define SOLVABLE_EVR 4
26 #define SOLVABLE_PROVIDES 5
27 #define SOLVABLE_OBSOLETES 6
28 #define SOLVABLE_CONFLICTS 7
29 #define SOLVABLE_REQUIRES 8
30 #define SOLVABLE_RECOMMENDS 9
31 #define SOLVABLE_SUGGESTS 10
32 #define SOLVABLE_SUPPLEMENTS 11
33 #define SOLVABLE_ENHANCES 12
34 #define SOLVABLE_FRESHENS 13
35 #define RPM_RPMDBID 14
36 #define SOLVABLE_PREREQMARKER 15 // normal requires before this, prereqs after this
37 #define SOLVABLE_FILEMARKER 16 // normal provides before this, generated file provides after this
40 #define ARCH_NOARCH 19
42 //-----------------------------------------------
45 int verbose; // pool is used everywhere, so put the verbose flag here
47 Offset *strings; // table of offsets into stringspace, indexed by Id: Id -> Offset
48 int nstrings; // number of unique strings in stringspace
49 char *stringspace; // space for all unique strings: stringspace + Offset = string
50 Offset sstrings; // next free pos in stringspace
52 Hashtable stringhashtbl; // hash table: (string ->) Hash -> Id
53 Hashmask stringhashmask; // modulo value for hash table (size of table - 1)
55 Reldep *rels; // table of rels: Id -> Reldep
56 int nrels; // number of unique rels
57 Hashtable relhashtbl; // hash table: (name,evr,op ->) Hash -> Id
68 Id *id2arch; /* map arch ids to scores */
69 Id lastarch; /* last valid entry in id2arch */
71 /* providers data, as two-step indirect list
72 * whatprovides[Id] -> Offset into whatprovidesdata for name
73 * whatprovidesdata[Offset] -> ID_NULL-terminated list of solvables providing Id
75 Offset *whatprovides; /* Offset to providers of a specific name, Id -> Offset */
76 Id *whatprovidesdata; /* Ids of solvable providing Id */
77 Offset whatprovidesdataoff; /* next free slot within whatprovidesdata */
78 int whatprovidesdataleft; /* number of 'free slots' within whatprovidesdata */
82 #define TYPE_IDARRAY 2
85 #define TYPE_BITMAP 128
88 //-----------------------------------------------
91 // "foo" -> Id -> lookup in table, returns offset into whatprovidesdata where array of Ids providing 'foo' are located, 0-terminated
94 #define GET_PROVIDESP(d, v) (ISRELDEP(d) ? \
95 (v = GETRELID(pool, d), pool->whatprovides[v] ? \
96 pool->whatprovidesdata + pool->whatprovides[v] : \
97 addrelproviders(pool, d) \
99 (pool->whatprovidesdata + pool->whatprovides[d]))
101 /* loop over all providers of d */
102 #define FOR_PROVIDES(v, vp, d) \
103 for (vp = GET_PROVIDESP(d, v) ; (v = *vp++) != ID_NULL; )
105 /* mark dependencies with relation by setting bit31 */
107 #define MAKERELDEP(id) ((id) | 0x80000000)
108 #define ISRELDEP(id) (((id) & 0x80000000) != 0)
109 #define GETRELID(pool, id) ((pool)->nstrings + ((id) ^ 0x80000000)) /* returns Id */
110 #define GETRELDEP(pool, id) ((pool)->rels + ((id) ^ 0x80000000)) /* returns Reldep* */
116 extern Pool *pool_create(void);
117 extern void pool_free(Pool *pool);
118 extern void pool_freesource(Pool *pool, Source *source);
119 extern void pool_prepare(Pool *pool);
120 extern void pool_freewhatprovides(Pool *pool);
121 extern Id pool_queuetowhatprovides(Pool *pool, Queue *q);
123 extern Id *addrelproviders(Pool *pool, Id d);
125 extern Source *pool_source(Pool *pool, Solvable *s);