work on docs
[pspp] / src / libpspp / misc.h
index f3afb1fb91a88b8d91fd7835a1ab754d95fa06c4..1698297dc4cc51a2694f55d831c740d4eb601694 100644 (file)
@@ -17,6 +17,7 @@
 #if !libpspp_misc_h
 #define libpspp_misc_h 1
 
+#include <stddef.h>
 #include <float.h>
 #include <math.h>
 
@@ -35,8 +36,6 @@
 /* Rounds X down to the previous multiple of Y. */
 #define ROUND_DOWN(X, Y) ((X) / (Y) * (Y))
 
-#define SQR(X) ((X) * (X))
-
 int intlog10 (unsigned);
 
 /* Returns the square of X. */
@@ -79,4 +78,25 @@ maximize (double *dest, double src)
     *dest = src;
 }
 
+
+/* Set *DEST to the lower of *DEST and SRC */
+static inline void
+minimize_int (int *dest, int src)
+{
+  if (src < *dest)
+    *dest = src;
+}
+
+
+/* Set *DEST to the greater of *DEST and SRC */
+static inline void
+maximize_int (int *dest, int src)
+{
+  if (src > *dest)
+    *dest = src;
+}
+
+int c_dtoastr (char *buf, size_t bufsize, int flags, int width, double x);
+
+
 #endif /* libpspp/misc.h */