Group key config symbols together
[neverball] / share / binary.h
index 7122d12..fc0c0d5 100644 (file)
@@ -3,21 +3,30 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+
+#include "fs.h"
 
 /*---------------------------------------------------------------------------*/
 
-void put_float(FILE *, const float *);
-void put_index(FILE *, const int   *);
-void put_short(FILE *, const short *);
-void put_array(FILE *, const float *, size_t);
+#define FLOAT_BYTES     4
+#define INDEX_BYTES     4
+#define SHORT_BYTES     2
+#define ARRAY_BYTES(n)  (FLOAT_BYTES * (n))
+#define STRING_BYTES(s) (strlen(s) + 1)
+
+void put_float(fs_file, const float *);
+void put_index(fs_file, const int   *);
+void put_short(fs_file, const short *);
+void put_array(fs_file, const float *, size_t);
 
-void get_float(FILE *, float *);
-void get_index(FILE *, int   *);
-void get_short(FILE *, short *);
-void get_array(FILE *, float *, size_t);
+void get_float(fs_file, float *);
+void get_index(fs_file, int   *);
+void get_short(fs_file, short *);
+void get_array(fs_file, float *, size_t);
 
-void put_string(FILE *fout, const char *);
-void get_string(FILE *fin, char *, int );
+void put_string(fs_file fout, const char *);
+void get_string(fs_file fin, char *, int );
 
 /*---------------------------------------------------------------------------*/