Revision: 76633
http://sourceforge.net/p/brlcad/code/76633
Author: starseeker
Date: 2020-08-01 20:46:02 +0000 (Sat, 01 Aug 2020)
Log Message:
-----------
Switch to bu_ptbl instead of bu_list for views
Modified Paths:
--------------
brlcad/branches/bioh/include/ged/defines.h
brlcad/branches/bioh/src/libged/ged.c
brlcad/branches/bioh/src/libged/ged_util.c
brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c
brlcad/branches/bioh/src/libtclcad/view/autoview.c
brlcad/branches/bioh/src/libtclcad/view/refresh.c
Modified: brlcad/branches/bioh/include/ged/defines.h
===================================================================
--- brlcad/branches/bioh/include/ged/defines.h 2020-08-01 12:50:29 UTC (rev
76632)
+++ brlcad/branches/bioh/include/ged/defines.h 2020-08-01 20:46:02 UTC (rev
76633)
@@ -193,8 +193,7 @@
struct rt_wdb *ged_wdbp;
// The full set of bviews associated with this ged object
- //struct bu_ptbl ged_views;
- struct bview go_head_views;
+ struct bu_ptbl ged_views;
void *u_data; /**< @brief User data associated with
this ged instance */
Modified: brlcad/branches/bioh/src/libged/ged.c
===================================================================
--- brlcad/branches/bioh/src/libged/ged.c 2020-08-01 12:50:29 UTC (rev
76632)
+++ brlcad/branches/bioh/src/libged/ged.c 2020-08-01 20:46:02 UTC (rev
76633)
@@ -165,9 +165,8 @@
// Since libged does not link libdm, it's also the responsibility of the
// caller to close any display managers associated with the view.
struct bview *gdvp;
-// for (size_t i = 0; i < BU_PTBL_LEN(&gedp->ged_views); i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(&gedp->ged_views, i);
- while (BU_LIST_WHILE(gdvp, bview, &gedp->go_head_views.l)) {
+ for (size_t i = 0; i < BU_PTBL_LEN(&gedp->ged_views); i++) {
+ gdvp = (struct bview *)BU_PTBL_GET(&gedp->ged_views, i);
BU_LIST_DEQUEUE(&(gdvp->l));
bu_vls_free(&gdvp->gv_name);
bu_ptbl_free(gdvp->callbacks);
@@ -174,7 +173,7 @@
BU_PUT(gdvp->callbacks, struct bu_ptbl);
bu_free((void *)gdvp, "bview");
}
-// bu_ptbl_free(&gedp->ged_views);
+ bu_ptbl_free(&gedp->ged_views);
if (gedp->ged_gdp != GED_DRAWABLE_NULL) {
if (gedp->ged_gdp->gd_headDisplay)
@@ -234,8 +233,7 @@
// TODO - rename to ged_name
bu_vls_init(&gedp->go_name);
- BU_LIST_INIT(&gedp->go_head_views.l);
-// BU_PTBL_INIT(&gedp->ged_views);
+ BU_PTBL_INIT(&gedp->ged_views);
BU_GET(gedp->ged_log, struct bu_vls);
bu_vls_init(gedp->ged_log);
Modified: brlcad/branches/bioh/src/libged/ged_util.c
===================================================================
--- brlcad/branches/bioh/src/libged/ged_util.c 2020-08-01 12:50:29 UTC (rev
76632)
+++ brlcad/branches/bioh/src/libged/ged_util.c 2020-08-01 20:46:02 UTC (rev
76633)
@@ -54,8 +54,6 @@
ged_find_view(struct ged *gedp, const char *key)
{
struct bview *gdvp = NULL;
-#if 0
- // TODO - use this when we replace with bu_ptbl
for (size_t i = 0; i < BU_PTBL_LEN(&gedp->ged_views); i++) {
gdvp = (struct bview *)BU_PTBL_GET(&gedp->ged_views, i);
if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), key))
@@ -62,16 +60,7 @@
break;
gdvp = NULL;
}
-#endif
- for (BU_LIST_FOR(gdvp, bview, &gedp->go_head_views.l)) {
- if (BU_STR_EQUAL(bu_vls_addr(&gdvp->gv_name), key))
- break;
- }
- if (BU_LIST_IS_HEAD(&gdvp->l, &gedp->go_head_views.l)) {
- gdvp = NULL;
- }
-
return gdvp;
}
Modified: brlcad/branches/bioh/src/libtclcad/tclcad_obj.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_obj.c 2020-08-01 12:50:29 UTC
(rev 76632)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_obj.c 2020-08-01 20:46:02 UTC
(rev 76633)
@@ -1101,9 +1101,8 @@
// Clean up the libtclcad view data.
struct bview *gdvp = NULL;
- for (BU_LIST_FOR(gdvp, bview, &top->to_gedp->go_head_views.l)) {
-// for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
+ for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
+ gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
// There is a top level command created in the Tcl interp that is
the name
// of the dm. Clear that command.
@@ -3752,9 +3751,8 @@
return GED_ERROR;
}
- for (BU_LIST_FOR(gdvp, bview, ¤t_top->to_gedp->go_head_views.l)) {
-// for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
+ for (size_t i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views); i++)
{
+ gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
bu_vls_printf(gedp->ged_result_str, "%s ", bu_vls_addr(&gdvp->gv_name));
}
@@ -3790,9 +3788,8 @@
{
struct bview *gdvp;
- for (BU_LIST_FOR(gdvp, bview, ¤t_top->to_gedp->go_head_views.l)) {
-// for (size_t i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views);
i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
+ for (size_t i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views); i++)
{
+ gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
gedp->ged_gvp = gdvp;
(*func)(gedp, argc, (const char **)argv);
}
@@ -4486,8 +4483,7 @@
bu_vls_printf(&new_gdvp->gv_name, "%s", argv[name_index]);
ged_view_init(new_gdvp);
- BU_LIST_INSERT(¤t_top->to_gedp->go_head_views.l, &new_gdvp->l);
- //bu_ptbl_ins(¤t_top->to_gedp->ged_views, (long *)new_gdvp);
+ bu_ptbl_ins(¤t_top->to_gedp->ged_views, (long *)new_gdvp);
new_gdvp->gv_point_scale = 1.0;
new_gdvp->gv_curve_scale = 1.0;
@@ -6332,9 +6328,8 @@
struct tclcad_ged_data *tgd = (struct tclcad_ged_data
*)current_top->to_gedp->u_data;
-// for (size_t i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views);
i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
- for (BU_LIST_FOR(gdvp, bview, ¤t_top->to_gedp->go_head_views.l)) {
+ for (size_t i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views); i++)
{
+ gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
if (tgd->go_dlist_on && to_is_viewable(gdvp)) {
(void)dm_make_current((struct dm *)gdvp->dmp);
@@ -6382,9 +6377,8 @@
struct bview *gdvp;
struct tclcad_ged_data *tgd = (struct tclcad_ged_data
*)current_top->to_gedp->u_data;
-// for (size_t i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views);
i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
- for (BU_LIST_FOR(gdvp, bview, ¤t_top->to_gedp->go_head_views.l)) {
+ for (size_t i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views); i++)
{
+ gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
if (tgd->go_dlist_on && to_is_viewable(gdvp)) {
(void)dm_make_current((struct dm *)gdvp->dmp);
(void)dm_free_dlists((struct dm *)gdvp->dmp, dlist, range);
Modified: brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c 2020-08-01
12:50:29 UTC (rev 76632)
+++ brlcad/branches/bioh/src/libtclcad/tclcad_obj_wrapper.c 2020-08-01
20:46:02 UTC (rev 76633)
@@ -67,9 +67,8 @@
if (!rflag && ret == GED_OK && strlen(bu_vls_addr(gedp->ged_result_str))
== 0)
aflag = 1;
- for (BU_LIST_FOR(gdvp, bview, ¤t_top->to_gedp->go_head_views.l)) {
-// for (i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views); i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
+ for (i = 0; i < BU_PTBL_LEN(¤t_top->to_gedp->ged_views); i++) {
+ gdvp = (struct bview *)BU_PTBL_GET(¤t_top->to_gedp->ged_views, i);
if (to_is_viewable(gdvp)) {
gedp->ged_gvp->gv_x_samples = dm_get_width((struct dm *)gdvp->dmp);
gedp->ged_gvp->gv_y_samples = dm_get_height((struct dm *)gdvp->dmp);
Modified: brlcad/branches/bioh/src/libtclcad/view/autoview.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/autoview.c 2020-08-01 12:50:29 UTC
(rev 76632)
+++ brlcad/branches/bioh/src/libtclcad/view/autoview.c 2020-08-01 20:46:02 UTC
(rev 76633)
@@ -97,9 +97,8 @@
{
struct bview *gdvp;
- for (BU_LIST_FOR(gdvp, bview, &top->to_gedp->go_head_views.l)) {
-// for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
+ for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
+ gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
to_autoview_view(gdvp, NULL);
}
}
Modified: brlcad/branches/bioh/src/libtclcad/view/refresh.c
===================================================================
--- brlcad/branches/bioh/src/libtclcad/view/refresh.c 2020-08-01 12:50:29 UTC
(rev 76632)
+++ brlcad/branches/bioh/src/libtclcad/view/refresh.c 2020-08-01 20:46:02 UTC
(rev 76633)
@@ -155,9 +155,8 @@
{
struct bview *gdvp;
- for (BU_LIST_FOR(gdvp, bview, &top->to_gedp->go_head_views.l)) {
-// for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
-// gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
+ for (size_t i = 0; i < BU_PTBL_LEN(&top->to_gedp->ged_views); i++) {
+ gdvp = (struct bview *)BU_PTBL_GET(&top->to_gedp->ged_views, i);
to_refresh_view(gdvp);
}
}
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