/*
- * Copyright (c) 2007, Novell Inc.
+ * Copyright (c) 2007-2011, Novell Inc.
*
* This program is licensed under the BSD license, read LICENSE.BSD
* for further information
#ifndef SATSOLVER_BITMAP_H
#define SATSOLVER_BITMAP_H
-#include <string.h>
-
typedef struct _Map {
unsigned char *map;
int size;
} Map;
#define MAPZERO(m) (memset((m)->map, 0, (m)->size))
-#define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7)) // Set Bit
-#define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7))) // Reset Bit
-#define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7))) // Test Bit
-
-static inline void
-map_empty(Map *m)
-{
- MAPZERO(m);
-}
+/* set bit */
+#define MAPSET(m, n) ((m)->map[(n) >> 3] |= 1 << ((n) & 7))
+/* clear bit */
+#define MAPCLR(m, n) ((m)->map[(n) >> 3] &= ~(1 << ((n) & 7)))
+/* test bit */
+#define MAPTST(m, n) ((m)->map[(n) >> 3] & (1 << ((n) & 7)))
extern void map_init(Map *m, int n);
extern void map_init_clone(Map *t, Map *s);
extern void map_grow(Map *m, int n);
extern void map_free(Map *m);
+static inline void map_empty(Map *m)
+{
+ MAPZERO(m);
+}
+static inline void map_set(Map *m, int n)
+{
+ MAPSET(m, n);
+}
+static inline void map_clr(Map *m, int n)
+{
+ MAPCLR(m, n);
+}
+static inline int map_tst(Map *m, int n)
+{
+ return MAPTST(m, n);
+}
+
#endif /* SATSOLVER_BITMAP_H */
#if defined(DEBIAN_SEMANTICS) || defined(MULTI_SEMANTICS)
#ifdef MULTI_SEMANTICS
-# define vercmp vercmp_deb
+# define sat_vercmp sat_vercmp_deb
#endif
/* debian type version compare */
int
-vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
+sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
{
int r, c1, c2;
while (1)
}
#ifdef MULTI_SEMANTICS
-# undef vercmp
+# undef sat_vercmp
#endif
#endif
/* note: the code assumes that *q1 and *q2 are not alphanumeric! */
int
-vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
+sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
{
int r = 0;
const char *e1, *e2;
#endif
#if defined(MULTI_SEMANTICS)
-# define vercmp (*(pool->disttype == DISTTYPE_DEB ? &vercmp_deb : &ver##cmp))
+# define sat_vercmp (*(pool->disttype == DISTTYPE_DEB ? &sat_vercmp_deb : &sat_ver##cmp))
#endif
/* edition (e:v-r) compare */
int
-evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
+pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
{
int r;
const char *s1, *s2;
}
int
-evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
+pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
{
const char *evr1, *evr2;
if (evr1id == evr2id)
}
int
-evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release)
+pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release)
{
const char *evr1;
const char *s1;
return 0;
}
-// EOF
#define EVRCMP_MATCH 2
#define EVRCMP_COMPARE_EVONLY 3
-extern int vercmp(const char *s1, const char *q1, const char *s2, const char *q2);
-extern int evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode);
-extern int evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode);
-extern int evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release);
+extern int sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2);
+
+extern int pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode);
+extern int pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode);
+extern int pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release);
+
+/* obsolete, do not use in new code */
+static inline int vercmp(const char *s1, const char *q1, const char *s2, const char *q2)
+{
+ return sat_vercmp(s1, q1, s2, q2);
+}
+static inline int evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
+{
+ return pool_evrcmp_str(pool, evr1, evr2, mode);
+}
+static inline int evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode)
+{
+ return pool_evrcmp(pool, evr1id, evr2id, mode);
+}
+static inline int evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release)
+{
+ return pool_evrmatch(pool, evrid, epoch, version, release);
+}
#ifdef __cplusplus
}
return pool->solvables + p;
}
-extern const char *solvable2str(Pool *pool, Solvable *s);
+extern const char *pool_solvable2str(Pool *pool, Solvable *s);
+static inline const char *pool_solvid2str(Pool *pool, Id p)
+{
+ return pool_solvable2str(pool, pool->solvables + p);
+}
+
+/* obsolete, do not use anymore */
+static inline const char *solvable2str(Pool *pool, Solvable *s)
+{
+ return pool_solvable2str(pool, s);
+}
static inline const char *solvid2str(Pool *pool, Id p)
{
- return solvable2str(pool, pool->solvables + p);
+ return pool_solvable2str(pool, pool->solvables + p);
}
void pool_set_languages(Pool *pool, const char **languages, int nlanguages);
/* intern string into pool, return id */
Id
-str2id(Pool *pool, const char *str, int create)
+pool_str2id(Pool *pool, const char *str, int create)
{
int oldnstrings = pool->ss.nstrings;
Id id = stringpool_str2id(&pool->ss, str, create);
}
Id
-strn2id(Pool *pool, const char *str, unsigned int len, int create)
+pool_strn2id(Pool *pool, const char *str, unsigned int len, int create)
{
int oldnstrings = pool->ss.nstrings;
Id id = stringpool_strn2id(&pool->ss, str, len, create);
}
Id
-rel2id(Pool *pool, Id name, Id evr, int flags, int create)
+pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create)
{
Hashval h;
unsigned int hh;
// for rels (returns name only) and strings
//
const char *
-id2str(const Pool *pool, Id id)
+pool_id2str(const Pool *pool, Id id)
{
if (ISRELDEP(id))
{
// get operator for RelId
const char *
-id2rel(const Pool *pool, Id id)
+pool_id2rel(const Pool *pool, Id id)
{
Reldep *rd;
if (!ISRELDEP(id))
// get e:v.r for Id
//
const char *
-id2evr(const Pool *pool, Id id)
+pool_id2evr(const Pool *pool, Id id)
{
Reldep *rd;
if (!ISRELDEP(id))
}
const char *
-dep2str(Pool *pool, Id id)
+pool_dep2str(Pool *pool, Id id)
{
char *p;
if (!ISRELDEP(id))
#include "pooltypes.h"
#include "hash.h"
-//-----------------------------------------------
-// Id's with relation
+/*-----------------------------------------------
+ * Ids with relation
+ */
typedef struct _Reldep {
Id name; // "package"
int flags; // operation/relation, see REL_x in pool.h
} Reldep;
-extern Id str2id(Pool *pool, const char *, int);
-extern Id strn2id(Pool *pool, const char *, unsigned int, int);
-extern Id rel2id(Pool *pool, Id, Id, int, int);
-extern const char *id2str(const Pool *pool, Id);
-extern const char *dep2str(Pool *pool, Id); /* might alloc tmpspace */
-extern const char *id2rel(const Pool *pool, Id);
-extern const char *id2evr(const Pool *pool, Id);
+extern Id pool_str2id(Pool *pool, const char *, int);
+extern Id pool_strn2id(Pool *pool, const char *, unsigned int, int);
+extern Id pool_rel2id(Pool *pool, Id, Id, int, int);
+extern const char *pool_id2str(const Pool *pool, Id);
+extern const char *pool_id2rel(const Pool *pool, Id);
+extern const char *pool_id2evr(const Pool *pool, Id);
+extern const char *pool_dep2str(Pool *pool, Id); /* might alloc tmpspace */
extern void pool_shrink_strings(Pool *pool);
extern void pool_shrink_rels(Pool *pool);
extern void pool_freeidhashes(Pool *pool);
+
+/* deprecated names, do not use in new code */
+static inline Id str2id(Pool *pool, const char *str, int create)
+{
+ return pool_str2id(pool, str, create);
+}
+static inline Id strn2id(Pool *pool, const char *str, unsigned int len, int create)
+{
+ return pool_strn2id(pool, str, len, create);
+}
+static inline Id rel2id(Pool *pool, Id name, Id evr, int flags, int create)
+{
+ return pool_rel2id(pool, name, evr, flags, create);
+}
+static inline const char *id2str(const Pool *pool, Id id)
+{
+ return pool_id2str(pool, id);
+}
+static inline const char *id2rel(const Pool *pool, Id id)
+{
+ return pool_id2rel(pool, id);
+}
+static inline const char *id2evr(const Pool *pool, Id id)
+{
+ return pool_id2evr(pool, id);
+}
+static inline const char *dep2str(Pool *pool, Id id)
+{
+ return pool_dep2str(pool, id);
+}
+
#endif /* SATSOLVER_POOLID_H */
#include "chksum.h"
const char *
-solvable2str(Pool *pool, Solvable *s)
+pool_solvable2str(Pool *pool, Solvable *s)
{
const char *n, *e, *a;
char *p;