Revision: 75516
http://sourceforge.net/p/brlcad/code/75516
Author: starseeker
Date: 2020-04-22 01:06:53 +0000 (Wed, 22 Apr 2020)
Log Message:
-----------
Blast. Archer implicitly depends on the output of the dm_list_types function
being in priority order.
Modified Paths:
--------------
brlcad/branches/dm-fb-merge/src/libdm/dm_plugins.cpp
Modified: brlcad/branches/dm-fb-merge/src/libdm/dm_plugins.cpp
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/dm_plugins.cpp 2020-04-22
00:47:14 UTC (rev 75515)
+++ brlcad/branches/dm-fb-merge/src/libdm/dm_plugins.cpp 2020-04-22
01:06:53 UTC (rev 75516)
@@ -46,6 +46,15 @@
bu_vls_sprintf(&sep, "%s", separator);
}
+ // TODO - the first method below is independent of specific backends,
+ // and preferable for that reason. Unfortunately, Archer is calling
+ // dm_list_tcl, which calls this function, and implicitly expects the
+ // returned list to be in priority order - it takes the first one
+ // assuming it is the "best". What should happen is that Archer should
+ // encode it's own preferences at the app level, but for the moment
+ // respect the priority ordering in the returned list to keep Archer
+ // working
+#if 0
std::map<std::string, const struct dm *> *dmb = (std::map<std::string,
const struct dm *> *)dm_backends;
std::map<std::string, const struct dm *>::iterator d_it;
for (d_it = dmb->begin(); d_it != dmb->end(); d_it++) {
@@ -56,7 +65,26 @@
}
if (strlen(bu_vls_cstr(list)) > 0) bu_vls_printf(list, "%s",
bu_vls_cstr(&sep));
bu_vls_printf(list, "nu");
+#else
+ static const char *priority_list[] = {"osgl", "wgl", "ogl", "X", "tk",
"nu"};
+ std::map<std::string, const struct dm *> *dmb = (std::map<std::string,
const struct dm *> *)dm_backends;
+ int i = 0;
+ const char *b = priority_list[i];
+ while (!BU_STR_EQUAL(b, "nu")) {
+ std::map<std::string, const struct dm *>::iterator d_it =
dmb->find(std::string(b));
+ if (d_it == dmb->end()) {
+ i++;
+ b = priority_list[i];
+ continue;
+ }
+ const struct dm *d = d_it->second;
+ if (strlen(bu_vls_cstr(list)) > 0) bu_vls_printf(list, "%s",
bu_vls_cstr(&sep));
+ bu_vls_printf(list, "%s", dm_get_name(d));
+ i++;
+ b = priority_list[i];
+ }
+#endif
return list;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits