vppinfra: move format_table from perfmon

This code seems really usefull for reuse in
other plugins, for pretty table formatting

Type: feature

Change-Id: Ib5784a0dfc81b7d5a5d1f5ccdd02072e460a50fb
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
diff --git a/src/plugins/perfmon/CMakeLists.txt b/src/plugins/perfmon/CMakeLists.txt
index e2f8888..060c425 100644
--- a/src/plugins/perfmon/CMakeLists.txt
+++ b/src/plugins/perfmon/CMakeLists.txt
@@ -21,7 +21,6 @@
   dispatch_wrapper.c
   linux.c
   perfmon.c
-  table.c
   intel/core.c
   intel/uncore.c
   intel/bundle/membw_bound.c
diff --git a/src/plugins/perfmon/cli.c b/src/plugins/perfmon/cli.c
index ce191ea..2c0ff9e 100644
--- a/src/plugins/perfmon/cli.c
+++ b/src/plugins/perfmon/cli.c
@@ -15,7 +15,7 @@
 
 #include <vnet/vnet.h>
 #include <perfmon/perfmon.h>
-#include <perfmon/table.h>
+#include <vppinfra/format_table.h>
 
 uword
 unformat_perfmon_bundle_name (unformat_input_t *input, va_list *args)
diff --git a/src/vppinfra/CMakeLists.txt b/src/vppinfra/CMakeLists.txt
index c682d70..8114ea1 100644
--- a/src/vppinfra/CMakeLists.txt
+++ b/src/vppinfra/CMakeLists.txt
@@ -57,6 +57,7 @@
   error.c
   fifo.c
   format.c
+  format_table.c
   graph.c
   hash.c
   heap.c
@@ -134,6 +135,7 @@
   fifo.h
   file.h
   format.h
+  format_table.h
   graph.h
   hash.h
   heap.h
diff --git a/src/plugins/perfmon/table.c b/src/vppinfra/format_table.c
similarity index 98%
rename from src/plugins/perfmon/table.c
rename to src/vppinfra/format_table.c
index e3fc098..5d83f7a 100644
--- a/src/plugins/perfmon/table.c
+++ b/src/vppinfra/format_table.c
@@ -22,7 +22,7 @@
 */
 
 #include <vppinfra/format.h>
-#include "table.h"
+#include <vppinfra/format_table.h>
 
 static table_text_attr_t default_title = {
   .flags = TTAF_FG_COLOR_SET | TTAF_BOLD,
diff --git a/src/plugins/perfmon/table.h b/src/vppinfra/format_table.h
similarity index 73%
rename from src/plugins/perfmon/table.h
rename to src/vppinfra/format_table.h
index 93102a0..f9b66a7 100644
--- a/src/plugins/perfmon/table.h
+++ b/src/vppinfra/format_table.h
@@ -21,8 +21,8 @@
   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#ifndef __table_h__
-#define __table_h__
+#ifndef __format_table_h__
+#define __format_table_h__
 
 typedef enum
 {
@@ -81,18 +81,19 @@
   int n_footer_cols;
 } table_t;
 
-format_function_t format_table;
+__clib_export format_function_t format_table;
 
-void table_format_title (table_t *t, char *fmt, ...);
-void table_format_cell (table_t *t, int c, int r, char *fmt, ...);
-void table_set_cell_align (table_t *t, int c, int r,
-			   table_text_attr_align_t a);
-void table_set_cell_fg_color (table_t *t, int c, int r,
-			      table_text_attr_color_t v);
-void table_set_cell_bg_color (table_t *t, int c, int r,
-			      table_text_attr_color_t v);
-void table_free (table_t *t);
-void table_add_header_col (table_t *t, int n_strings, ...);
-void table_add_header_row (table_t *t, int n_strings, ...);
+__clib_export void table_format_title (table_t *t, char *fmt, ...);
+__clib_export void table_format_cell (table_t *t, int c, int r, char *fmt,
+				      ...);
+__clib_export void table_set_cell_align (table_t *t, int c, int r,
+					 table_text_attr_align_t a);
+__clib_export void table_set_cell_fg_color (table_t *t, int c, int r,
+					    table_text_attr_color_t v);
+__clib_export void table_set_cell_bg_color (table_t *t, int c, int r,
+					    table_text_attr_color_t v);
+__clib_export void table_free (table_t *t);
+__clib_export void table_add_header_col (table_t *t, int n_strings, ...);
+__clib_export void table_add_header_row (table_t *t, int n_strings, ...);
 
 #endif