-void write_int8_array (const void *, int, int);
-void write_uint32_array (const void *, int, int);
-void write_uint32_2d_array(const void *, int, int);
-/** \} */ // end of printfuncs group
-
-struct tabledef {
- /** String that declares the array. Adding " = { ..." after it should
- * make a valid initializer, adding "extern" before and ";" if possible
- * should make a valid extern declaration. */
- const char *declaration;
- /** Function used to print the table data (i.e. the part in {}).
- * Should be one of the predefined write_*_array functions. */
- void (*printfunc)(const void *, int, int);
- /** Pointer passed to the printfunc, usually a pointer to the start
- * of the array to be printed. */
- const void *data;
- int size; ///< size of the first dimension of the array
- int size2; ///< size of the second dimension of the array if any
-};
-
-/** Initializes all the tables described in the tables array */
-void tableinit(void);
-/** Describes the tables that should be printed */
-extern const struct tabledef tables[];
+#if defined(_MSC_VER)
+#define FMT "Iu"
+#else
+#define FMT "zu"
+#endif
+
+#define WRITE_ARRAY(prefix, type, name) \
+ do { \
+ const size_t array_size = FF_ARRAY_ELEMS(name); \
+ printf(prefix" "#type" "#name"[%"FMT"] = {\n", \
+ array_size); \
+ write_##type##_array(name, array_size); \
+ printf("};\n"); \
+ } while(0)
+
+#define WRITE_2D_ARRAY(prefix, type, name) \
+ do { \
+ const size_t array_size1 = FF_ARRAY_ELEMS(name); \
+ const size_t array_size2 = FF_ARRAY_ELEMS(name[0]); \
+ printf(prefix" "#type" "#name"[%"FMT"][%"FMT"] = {\n", \
+ array_size1, array_size2 ); \
+ write_##type##_2d_array(name, array_size1, array_size2); \
+ printf("};\n"); \
+ } while(0)
+
+
+WRITE_1D_FUNC(int8_t, "%3"PRIi8, 15)
+WRITE_1D_FUNC(uint8_t, "0x%02"PRIx8, 15)
+WRITE_1D_FUNC(uint16_t, "0x%08"PRIx16, 7)
+WRITE_1D_FUNC(uint32_t, "0x%08"PRIx32, 7)
+WRITE_1D_FUNC(float, "%.18e", 3)
+
+WRITE_2D_FUNC(int8_t)
+WRITE_2D_FUNC(uint8_t)
+WRITE_2D_FUNC(uint32_t)
+WRITE_2D_FUNC(float)
+
+static inline void write_fileheader(void)
+{
+ printf("/* This file was automatically generated. */\n");
+ printf("#include <stdint.h>\n");
+}