[zypp-commit] r9196 - in /trunk/sat-solver/src: CMakeLists.txt knownid.h pool.c pool.h
Author: mlschroe Date: Tue Mar 18 20:18:26 2008 New Revision: 9196 URL: http://svn.opensuse.org/viewcvs/zypp?rev=9196&view=rev Log: - move known id definitions to one file, lets see if g++ likes it Added: trunk/sat-solver/src/knownid.h Modified: trunk/sat-solver/src/CMakeLists.txt trunk/sat-solver/src/pool.c trunk/sat-solver/src/pool.h Modified: trunk/sat-solver/src/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/CMakeLists.txt?rev=9196&r1=9195&r2=9196&view=diff ============================================================================== --- trunk/sat-solver/src/CMakeLists.txt (original) +++ trunk/sat-solver/src/CMakeLists.txt Tue Mar 18 20:18:26 2008 @@ -4,7 +4,7 @@ ADD_LIBRARY(satsolver STATIC ${libsatsolver_SRCS}) -SET(libsatsolver_HEADERS bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h poolid.h pooltypes.h queue.h solvable.h solver.h repo.h repodata.h repo_solv.h repo_helix.h util.h strpool.h dirpool.h) +SET(libsatsolver_HEADERS bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h poolid.h pooltypes.h queue.h solvable.h solver.h repo.h repodata.h repo_solv.h repo_helix.h util.h strpool.h dirpool.h knownid.h) SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC" ) Added: trunk/sat-solver/src/knownid.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/knownid.h?rev=9196&view=auto ============================================================================== --- trunk/sat-solver/src/knownid.h (added) +++ trunk/sat-solver/src/knownid.h Tue Mar 18 20:18:26 2008 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2007, Novell Inc. + * + * This program is licensed under the BSD license, read LICENSE.BSD + * for further information + */ + +/* + * knownid.h + * + */ + +#undef KNOWNID +#ifdef KNOWNID_INITIALIZE +# define KNOWNID(a, b) b +static const char *initpool_data[] = { +#else +# define KNOWNID(a, b) a +enum sat_knownid { +#endif + +KNOWNID(ID_NULL, "<NULL>"), +KNOWNID(ID_EMPTY, ""), +KNOWNID(SOLVABLE_NAME, "solvable:name"), +KNOWNID(SOLVABLE_ARCH, "solvable:arch"), +KNOWNID(SOLVABLE_EVR, "solvable:evr"), +KNOWNID(SOLVABLE_VENDOR, "solvable:vendor"), +KNOWNID(SOLVABLE_PROVIDES, "solvable:provides"), +KNOWNID(SOLVABLE_OBSOLETES, "solvable:obsoletes"), +KNOWNID(SOLVABLE_CONFLICTS, "solvable:conflicts"), +KNOWNID(SOLVABLE_REQUIRES, "solvable:requires"), +KNOWNID(SOLVABLE_RECOMMENDS, "solvable:recommends"), +KNOWNID(SOLVABLE_SUGGESTS, "solvable:suggests"), +KNOWNID(SOLVABLE_SUPPLEMENTS, "solvable:supplements"), +KNOWNID(SOLVABLE_ENHANCES, "solvable:enhances"), +KNOWNID(SOLVABLE_FRESHENS, "solvable:freshens"), +KNOWNID(RPM_RPMDBID, "rpm:dbid"), +/* normal requires before this, prereqs after this */ +KNOWNID(SOLVABLE_PREREQMARKER, "solvable:prereqmarker"), +/* normal provides before this, generated file provides after this */ +KNOWNID(SOLVABLE_FILEMARKER, "solvable:filemarker"), +KNOWNID(NAMESPACE_INSTALLED, "namespace:installed"), +KNOWNID(NAMESPACE_MODALIAS, "namespace:modalias"), +KNOWNID(NAMESPACE_SPLITPROVIDES, "namespace:splitprovides"), +KNOWNID(NAMESPACE_LANGUAGE, "namespace:language"), +KNOWNID(NAMESPACE_FILESYSTEM, "namespace:filesystem"), +KNOWNID(SYSTEM_SYSTEM, "system:system"), +KNOWNID(ARCH_SRC, "src"), +KNOWNID(ARCH_NOSRC, "nosrc"), +KNOWNID(ARCH_NOARCH, "noarch"), +KNOWNID(REPODATA_EXTERNAL, "repodata:external"), +KNOWNID(REPODATA_KEYS, "repodata:keys"), +KNOWNID(REPODATA_LOCATION, "repodata:location"), + +/* The void type is usable to encode one-valued attributes, they have + no associated data. This is useful to encode values which many solvables + have in common, and whose overall set is relatively limited. A prime + example would be the media number. The actual value is encoded in the + SIZE member of the key structure. Be warned: careless use of this + leads to combinatoric explosion of number of schemas. */ +KNOWNID(REPOKEY_TYPE_VOID, "repokey:type:void"), +KNOWNID(REPOKEY_TYPE_CONSTANT, "repokey:type:constant"), +KNOWNID(REPOKEY_TYPE_CONSTANTID, "repokey:type:constantid"), +KNOWNID(REPOKEY_TYPE_ID, "repokey:type:id"), +KNOWNID(REPOKEY_TYPE_NUM, "repokey:type:num"), +KNOWNID(REPOKEY_TYPE_U32, "repokey:type:num32"), +KNOWNID(REPOKEY_TYPE_DIR, "repokey:type:dir"), +KNOWNID(REPOKEY_TYPE_STR, "repokey:type:str"), +KNOWNID(REPOKEY_TYPE_IDARRAY, "repokey:type:idarray"), +KNOWNID(REPOKEY_TYPE_REL_IDARRAY, "repokey:type:relidarray"), +KNOWNID(REPOKEY_TYPE_DIRSTRARRAY, "repokey:type:dirstrarray"), +KNOWNID(REPOKEY_TYPE_DIRNUMNUMARRAY, "repokey:type:dirnumnumarray"), + +KNOWNID(SOLVABLE_SUMMARY, "solvable:summary"), +KNOWNID(SOLVABLE_DESCRIPTION, "solvable:description"), +KNOWNID(SOLVABLE_AUTHORS, "solvable:authors"), +KNOWNID(SOLVABLE_GROUP, "solvable:group"), +KNOWNID(SOLVABLE_KEYWORDS, "solvable:keywords"), +KNOWNID(SOLVABLE_LICENSE, "solvable:license"), +KNOWNID(SOLVABLE_BUILDTIME, "solvable:buildtime"), +KNOWNID(SOLVABLE_EULA, "solvable:eula"), +KNOWNID(SOLVABLE_MESSAGEINS, "solvable:messageins"), +KNOWNID(SOLVABLE_MESSAGEDEL, "solvable:messagedel"), +KNOWNID(SOLVABLE_INSTALLSIZE, "solvable:installsize"), +KNOWNID(SOLVABLE_DISKUSAGE, "solvable:diskusage"), +KNOWNID(SOLVABLE_FILELIST, "solvable:filelist"), +KNOWNID(SOLVABLE_INSTALLTIME, "solvable:installtime"), +KNOWNID(SOLVABLE_MEDIADIR, "solvable:mediadir"), +KNOWNID(SOLVABLE_MEDIAFILE, "solvable:mediafile"), +KNOWNID(SOLVABLE_MEDIANR, "solvable:medianr"), +KNOWNID(SOLVABLE_DOWNLOADSIZE, "solvable:downloadsize"), +KNOWNID(SOLVABLE_SOURCEARCH, "solvable:sourcearch"), +KNOWNID(SOLVABLE_SOURCENAME, "solvable:sourcename"), +KNOWNID(SOLVABLE_SOURCEEVR, "solvable:sourceevr"), +KNOWNID(SOLVABLE_ISVISIBLE, "solvable:isvisible"), + +KNOWNID(SOLVABLE_PATCHCATEGORY, "solvable:patchcategory"), +KNOWNID(SOLVABLE_HEADEREND, "solvable:headerend"), + +KNOWNID(ID_NUM_INTERNAL, 0) + +#ifdef KNOWNID_INITIALIZE +}; +#else +}; +#endif + +#undef KNOWNID + Modified: trunk/sat-solver/src/pool.c URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.c?rev=9196&r1=9195&r2=9196&view=diff ============================================================================== --- trunk/sat-solver/src/pool.c (original) +++ trunk/sat-solver/src/pool.c Tue Mar 18 20:18:26 2008 @@ -29,89 +29,9 @@ #define SOLVABLE_BLOCK 255 -/* - * list of string constants, so we can do pointer/Id instead of string comparison - * index into array matches ID_xxx constants in pool.h - */ - -static const char *initpool_data[] = { - "<NULL>", // ID_NULL - "", // ID_EMPTY - "solvable:name", - "solvable:arch", - "solvable:evr", - "solvable:vendor", - "solvable:provides", - "solvable:obsoletes", - "solvable:conflicts", - "solvable:requires", - "solvable:recommends", - "solvable:suggests", - "solvable:supplements", - "solvable:enhances", - "solvable:freshens", - "rpm:dbid", /* direct key into rpmdb */ - "solvable:prereqmarker", - "solvable:filemarker", - "namespace:installed", - "namespace:modalias", - "namespace:splitprovides", - "namespace:language", - "namespace:filesystem", - "system:system", - "src", - "nosrc", - "noarch", - "repodata:external", - "repodata:keys", - "repodata:location", - "repokey:type:void", - "repokey:type:constant", - "repokey:type:constantid", - "repokey:type:id", - "repokey:type:num", - "repokey:type:num32", - "repokey:type:dir", - "repokey:type:str", - "repokey:type:idarray", - "repokey:type:relidarray", - "repokey:type:dirstrarray", - "repokey:type:dirnumnumarray", - - "solvable:summary", - "solvable:description", - "solvable:authors", - "solvable:group", - "solvable:keywords", - "solvable:license", - "solvable:buildtime", - - "solvable:eula", - "solvable:messageins", - "solvable:messagedel", - - "solvable:installsize", - "solvable:diskusage", - "solvable:filelist", - - "solvable:installtime", - - "solvable:mediadir", - "solvable:mediafile", - "solvable:medianr", - "solvable:downloadsize", - - "solvable:sourcearch", - "solvable:sourcename", - "solvable:sourceevr", - - "solvable:isvisible", /* from susetags */ - - "solvable:patchcategory", - "solvable:headerend", - - 0 -}; +#define KNOWNID_INITIALIZE +#include "knownid.h" +#undef KNOWNID_INITIALIZE /* create pool */ Pool * Modified: trunk/sat-solver/src/pool.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/src/pool.h?rev=9196&r1=9195&r2=9196&view=diff ============================================================================== --- trunk/sat-solver/src/pool.h (original) +++ trunk/sat-solver/src/pool.h Tue Mar 18 20:18:26 2008 @@ -26,87 +26,8 @@ #include "queue.h" #include "strpool.h" -// see initpool_data[] in pool.c - /* well known ids */ -#define ID_NULL STRID_NULL -#define ID_EMPTY STRID_EMPTY -#define SOLVABLE_NAME 2 -#define SOLVABLE_ARCH 3 -#define SOLVABLE_EVR 4 -#define SOLVABLE_VENDOR 5 -#define SOLVABLE_PROVIDES 6 -#define SOLVABLE_OBSOLETES 7 -#define SOLVABLE_CONFLICTS 8 -#define SOLVABLE_REQUIRES 9 -#define SOLVABLE_RECOMMENDS 10 -#define SOLVABLE_SUGGESTS 11 -#define SOLVABLE_SUPPLEMENTS 12 -#define SOLVABLE_ENHANCES 13 -#define SOLVABLE_FRESHENS 14 -#define RPM_RPMDBID 15 -#define SOLVABLE_PREREQMARKER 16 // normal requires before this, prereqs after this -#define SOLVABLE_FILEMARKER 17 // normal provides before this, generated file provides after this -#define NAMESPACE_INSTALLED 18 -#define NAMESPACE_MODALIAS 19 -#define NAMESPACE_SPLITPROVIDES 20 -#define NAMESPACE_LANGUAGE 21 -#define NAMESPACE_FILESYSTEM 22 -#define SYSTEM_SYSTEM 23 -#define ARCH_SRC 24 -#define ARCH_NOSRC 25 -#define ARCH_NOARCH 26 -#define REPODATA_EXTERNAL 27 -#define REPODATA_KEYS 28 -#define REPODATA_LOCATION 29 - -/* The void type is usable to encode one-valued attributes, they have - no associated data. This is useful to encode values which many solvables - have in common, and whose overall set is relatively limited. A prime - example would be the media number. The actual value is encoded in the - SIZE member of the key structure. Be warned: careless use of this - leads to combinatoric explosion of number of schemas. */ -#define REPOKEY_TYPE_VOID 30 -#define REPOKEY_TYPE_CONSTANT 31 -#define REPOKEY_TYPE_CONSTANTID 32 -#define REPOKEY_TYPE_ID 33 -#define REPOKEY_TYPE_NUM 34 -#define REPOKEY_TYPE_U32 35 -#define REPOKEY_TYPE_DIR 36 -#define REPOKEY_TYPE_STR 37 -#define REPOKEY_TYPE_IDARRAY 38 -#define REPOKEY_TYPE_REL_IDARRAY 39 -#define REPOKEY_TYPE_DIRSTRARRAY 40 -#define REPOKEY_TYPE_DIRNUMNUMARRAY 41 - -#define SOLVABLE_SUMMARY 42 -#define SOLVABLE_DESCRIPTION 43 -#define SOLVABLE_AUTHORS 44 -#define SOLVABLE_GROUP 45 -#define SOLVABLE_KEYWORDS 46 -#define SOLVABLE_LICENSE 47 -#define SOLVABLE_BUILDTIME 48 -#define SOLVABLE_EULA 49 -#define SOLVABLE_MESSAGEINS 50 -#define SOLVABLE_MESSAGEDEL 51 -#define SOLVABLE_INSTALLSIZE 52 -#define SOLVABLE_DISKUSAGE 53 -#define SOLVABLE_FILELIST 54 -#define SOLVABLE_INSTALLTIME 55 -#define SOLVABLE_MEDIADIR 56 -#define SOLVABLE_MEDIAFILE 57 -#define SOLVABLE_MEDIANR 58 -#define SOLVABLE_DOWNLOADSIZE 59 -#define SOLVABLE_SOURCEARCH 60 -#define SOLVABLE_SOURCENAME 61 -#define SOLVABLE_SOURCEEVR 62 -#define SOLVABLE_ISVISIBLE 63 - -#define SOLVABLE_PATCHCATEGORY 64 -#define SOLVABLE_HEADEREND 65 - -#define ID_NUM_INTERNAL 66 - +#include "knownid.h" /* well known solvable */ #define SYSTEMSOLVABLE 1 -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
mlschroe@svn.opensuse.org