pivot-table: Add more tests for category and dimension borders.
[pspp] / src / data / value.h
index 8e624a8464b73163e9638c88c26dff5fa6a444cd..7f4399ced497e4a37b7a4a592ee35f7736e540bf 100644 (file)
@@ -23,7 +23,9 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
-#include "xalloc.h"
+#include "libpspp/cast.h"
+#include "libpspp/str.h"
+#include "gl/xalloc.h"
 \f
 /* A numeric or string value.  The client is responsible for keeping track of
    the value's width. */
@@ -56,6 +58,8 @@ bool value_is_resizable (const union value *, int old_width, int new_width);
 bool value_needs_resize (int old_width, int new_width);
 void value_resize (union value *, int old_width, int new_width);
 
+static inline struct substring value_ss (const union value *, int width);
+
 bool value_is_spaces (const union value *, int width);
 
 static inline void value_swap (union value *, union value *);
@@ -149,4 +153,13 @@ value_swap (union value *a, union value *b)
   *b = tmp;
 }
 
+static inline struct substring
+value_ss (const union value *v, int width)
+{
+  return (struct substring) {
+    .string = CHAR_CAST (char *, v->s),
+    .length = width
+  };
+}
+
 #endif /* data/value.h */