+#define UPKG_HDR_OFFSET_VERSION 4
+#define UPKG_HDR_OFFSET_LICENSE 6
+#define UPKG_HDR_OFFSET_FLAGS 8
+#define UPKG_HDR_OFFSET_NAME_COUNT 12
+#define UPKG_HDR_OFFSET_NAME_OFFSET 16
+#define UPKG_HDR_OFFSET_EXPORT_COUNT 20
+#define UPKG_HDR_OFFSET_EXPORT_OFFSET 24
+#define UPKG_HDR_OFFSET_IMPORT_COUNT 28
+#define UPKG_HDR_OFFSET_IMPORT_OFFSET 32
+
+/*
+ * Print a message and execute some statement(s) if the expression evaluates
+ * to zero. Intended to help verify that assumed constraints on the file
+ * format actually are not violated.
+ */
+#define format_assert(expr, body) do { \
+ if (!(expr)) { \
+ fprintf(stderr, "%s: %d: %s: format assertion failed: %s\n", \
+ __FILE__, __LINE__, __func__, #expr); \
+ body; \
+ } \
+} while (0)
+