Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.4KB

  1. diff --git a/src/lilv_internal.h b/src/lilv_internal.h
  2. index af8e31a..72be413 100644
  3. --- a/src/lilv_internal.h
  4. +++ b/src/lilv_internal.h
  5. @@ -185,6 +185,8 @@ struct LilvWorldImpl {
  6. SordNode* lv2_requiredFeature;
  7. SordNode* lv2_symbol;
  8. SordNode* lv2_prototype;
  9. + SordNode* mod_builderVersion;
  10. + SordNode* mod_releaseNumber;
  11. SordNode* owl_Ontology;
  12. SordNode* pset_value;
  13. SordNode* rdf_a;
  14. @@ -238,8 +240,10 @@ struct LilvUIImpl {
  15. };
  16. typedef struct LilvVersion {
  17. + int builder;
  18. int minor;
  19. int micro;
  20. + int release;
  21. } LilvVersion;
  22. /*
  23. @@ -335,6 +339,42 @@ lilv_version_cmp(const LilvVersion* a, const LilvVersion* b)
  24. }
  25. }
  26. +static inline int
  27. +lilv_version_cmp_mod(const LilvVersion* a, const LilvVersion* b)
  28. +{
  29. + // same version
  30. + if (a->builder == b->builder && a->minor == b->minor
  31. + && a->micro == b->micro && a->release == b->release)
  32. + return 0;
  33. +
  34. + // check builder
  35. + if (a->builder < b->builder)
  36. + return -1;
  37. + if (a->builder > b->builder)
  38. + return 1;
  39. +
  40. + // check minor
  41. + if (a->minor < b->minor)
  42. + return -1;
  43. + if (a->minor > b->minor)
  44. + return 1;
  45. +
  46. + // check micro
  47. + if (a->micro < b->micro)
  48. + return -1;
  49. + if (a->micro > b->micro)
  50. + return 1;
  51. +
  52. + // check release
  53. + if (a->release < b->release)
  54. + return -1;
  55. + if (a->release > b->release)
  56. + return 1;
  57. +
  58. + // huh!?
  59. + return 0;
  60. +}
  61. +
  62. struct LilvHeader*
  63. lilv_collection_get_by_uri(const ZixTree* seq, const LilvNode* uri);
  64. diff --git a/src/world.c b/src/world.c
  65. index 1e51a2d..d52edf4 100644
  66. --- a/src/world.c
  67. +++ b/src/world.c
  68. @@ -78,6 +78,8 @@ lilv_world_new(void)
  69. world->uris.lv2_requiredFeature = NEW_URI(LV2_CORE__requiredFeature);
  70. world->uris.lv2_symbol = NEW_URI(LV2_CORE__symbol);
  71. world->uris.lv2_prototype = NEW_URI(LV2_CORE__prototype);
  72. + world->uris.mod_builderVersion = NEW_URI("http://moddevices.com/ns/mod#builderVersion");
  73. + world->uris.mod_releaseNumber = NEW_URI("http://moddevices.com/ns/mod#releaseNumber");
  74. world->uris.owl_Ontology = NEW_URI(NS_OWL "Ontology");
  75. world->uris.pset_value = NEW_URI(LV2_PRESETS__value);
  76. world->uris.rdf_a = NEW_URI(LILV_NS_RDF "type");
  77. @@ -657,17 +659,27 @@ load_plugin_model(LilvWorld* world,
  78. static LilvVersion
  79. get_version(LilvWorld* world, SordModel* model, const LilvNode* subject)
  80. {
  81. + const SordNode* builder_node = sord_get(
  82. + model, subject->node, world->uris.mod_builderVersion, NULL, NULL);
  83. const SordNode* minor_node = sord_get(
  84. model, subject->node, world->uris.lv2_minorVersion, NULL, NULL);
  85. const SordNode* micro_node = sord_get(
  86. model, subject->node, world->uris.lv2_microVersion, NULL, NULL);
  87. + const SordNode* release_node = sord_get(
  88. + model, subject->node, world->uris.mod_releaseNumber, NULL, NULL);
  89. - LilvVersion version = { 0, 0 };
  90. + LilvVersion version = { 0, 0, 0, 0 };
  91. + if (builder_node) {
  92. + version.builder = atoi((const char*)sord_node_get_string(builder_node));
  93. + }
  94. if (minor_node && micro_node) {
  95. version.minor = atoi((const char*)sord_node_get_string(minor_node));
  96. version.micro = atoi((const char*)sord_node_get_string(micro_node));
  97. }
  98. + if (release_node) {
  99. + version.release = atoi((const char*)sord_node_get_string(release_node));
  100. + }
  101. return version;
  102. }
  103. @@ -720,17 +732,19 @@ lilv_world_load_bundle(LilvWorld* world, const LilvNode* bundle_uri)
  104. LilvVersion last_version = get_version(world, last_model, plugin_uri);
  105. sord_free(this_model);
  106. sord_free(last_model);
  107. - const int cmp = lilv_version_cmp(&this_version, &last_version);
  108. + const int cmp = lilv_version_cmp_mod(&this_version, &last_version);
  109. if (cmp > 0) {
  110. zix_tree_insert((ZixTree*)unload_uris,
  111. lilv_node_duplicate(plugin_uri),
  112. NULL);
  113. - LILV_WARNF("Replacing version %d.%d of <%s> from <%s>\n",
  114. - last_version.minor, last_version.micro,
  115. + LILV_WARNF("Replacing version %d:%d.%d-%d of <%s> from <%s>\n",
  116. + last_version.builder, last_version.minor,
  117. + last_version.micro, last_version.release,
  118. sord_node_get_string(plug),
  119. sord_node_get_string(last_bundle->node));
  120. - LILV_NOTEF("New version %d.%d found in <%s>\n",
  121. - this_version.minor, this_version.micro,
  122. + LILV_NOTEF("New version %d:%d.%d-%d found in <%s>\n",
  123. + this_version.builder, this_version.minor,
  124. + this_version.micro, this_version.release,
  125. sord_node_get_string(bundle_node));
  126. } else if (cmp < 0) {
  127. LILV_WARNF("Ignoring bundle <%s>\n",