Skip to content

Commit

Permalink
lstopo/draw: use a bitmask of backend flags instead of the no_half_li…
Browse files Browse the repository at this point in the history
…nes field

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Sep 16, 2021
1 parent cfbb184 commit c5b4948
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions utils/lstopo/lstopo-ascii.c
@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2020 Inria. All rights reserved.
* Copyright © 2009-2021 Inria. All rights reserved.
* Copyright © 2009-2012, 2020 Université Bordeaux
* Copyright © 2009-2018 Cisco Systems, Inc. All rights reserved.
* See COPYING in top-level directory.
Expand Down Expand Up @@ -462,7 +462,7 @@ output_ascii(struct lstopo_output *loutput, const char *filename)
loutput->linespacing = 10;

/* cannot write between lines of the terminal */
loutput->no_half_lines = 1;
loutput->backend_flags |= LSTOPO_BACKEND_FLAG_NO_HALF_LINES;

#ifdef HWLOC_HAVE_LIBTERMCAP
/* If we are outputing to a tty, use colors */
Expand Down
2 changes: 1 addition & 1 deletion utils/lstopo/lstopo-draw.c
Expand Up @@ -1126,7 +1126,7 @@ pci_device_draw(struct lstopo_output *loutput, hwloc_obj_t level, unsigned depth
} else {
overlaidoffset = gridsize/2;
}
if (loutput->no_half_lines)
if (loutput->backend_flags & LSTOPO_BACKEND_FLAG_NO_HALF_LINES)
overlaidoffset *= 2;
}

Expand Down
2 changes: 1 addition & 1 deletion utils/lstopo/lstopo.c
Expand Up @@ -756,9 +756,9 @@ main (int argc, char *argv[])
loutput.nr_cpukind_styles = 0;

loutput.backend_data = NULL;
loutput.backend_flags = 0;
loutput.methods = NULL;

loutput.no_half_lines = 0;
loutput.plain_children_order = 0;
loutput.fontsize = 10;
loutput.gridsize = 7;
Expand Down
3 changes: 2 additions & 1 deletion utils/lstopo/lstopo.h
Expand Up @@ -102,7 +102,6 @@ struct lstopo_output {
unsigned int gridsize, fontsize, linespacing, thickness;
float text_xscale;
enum lstopo_orient_e force_orient[HWLOC_OBJ_TYPE_MAX]; /* orientation of children within an object of the given type */
unsigned no_half_lines; /* set by ASCII backend because it cannot write between lines of the terminal */
int show_indexes[HWLOC_OBJ_TYPE_MAX]; /* enabled by global toggle index_type */
int show_text_enabled; /* global toggle for interactive keyboard shortcuts */
int show_text[HWLOC_OBJ_TYPE_MAX];
Expand All @@ -120,6 +119,8 @@ struct lstopo_output {

/* draw internal data */
void *backend_data;
#define LSTOPO_BACKEND_FLAG_NO_HALF_LINES (1UL<<0) /* ASCII backend cannot draw lines between grid lines */
unsigned long backend_flags;
struct draw_methods *methods;
enum lstopo_drawing_e drawing;
unsigned width, height; /* total output size */
Expand Down

0 comments on commit c5b4948

Please sign in to comment.