X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=blobdiff_plain;f=interpreters%2Fbocfel%2Fiff.h;fp=interpreters%2Fbocfel%2Fiff.h;h=fd63d265827300c412e794d9bd10d213c658b940;hp=0000000000000000000000000000000000000000;hb=aa30979369091c96bca34499c28cb01bc16efb1d;hpb=61180dab8f5c29f5a29b83fcb7d62942f7a741d1 diff --git a/interpreters/bocfel/iff.h b/interpreters/bocfel/iff.h new file mode 100644 index 0000000..fd63d26 --- /dev/null +++ b/interpreters/bocfel/iff.h @@ -0,0 +1,31 @@ +#ifndef ZTERP_IFF_H +#define ZTERP_IFF_H + +#include + +#include "io.h" + +typedef struct zterp_iff zterp_iff; + +/* Translate an IFF tag into the corresponding 32-bit integer. */ +#define STRID(s) ( \ + (((uint32_t)(s)[0]) << 24) | \ + (((uint32_t)(s)[1]) << 16) | \ + (((uint32_t)(s)[2]) << 8) | \ + (((uint32_t)(s)[3]) << 0) \ + ) + +/* Reverse of above. */ +#define IDSTR(n) ((char[5]){ \ + ((uint32_t)n >> 24) & 0xff, \ + ((uint32_t)n >> 16) & 0xff, \ + ((uint32_t)n >> 8) & 0xff, \ + ((uint32_t)n >> 0) & 0xff, \ + }) + + +void zterp_iff_free(zterp_iff *); +zterp_iff *zterp_iff_parse(zterp_io *, const char [4]); +int zterp_iff_find(zterp_iff *, const char [4], uint32_t *); + +#endif