+
+/** Used to avoid a shortcoming in vim's syntax highlighting. */
+#define EMBRACE(...) { __VA_ARGS__}
+
+/** A nice cup of STFU for Mr gcc. */
+#define do_nothing do {/* nothing */} while (0)
+
+/**
+ * The sample formats supported by paraslash.
+ *
+ * It may be determined by one of the following sources:
+ *
+ * 1. The decoding filter (para_audiod only). In this case, it is always
+ * \p SF_S16_LE which is the canonical format used within decoders.
+ *
+ * 2. The wav header (para_write only).
+ *
+ * 3. The --sample-format option of para_write.
+ */
+#define SAMPLE_FORMATS \
+ SAMPLE_FORMAT(SF_S8, "8 bit signed"), \
+ SAMPLE_FORMAT(SF_U8, "8 bit unsigned"), \
+ SAMPLE_FORMAT(SF_S16_LE, "16 bit signed, little endian"), \
+ SAMPLE_FORMAT(SF_S16_BE, "16 bit signed, big endian"), \
+ SAMPLE_FORMAT(SF_U16_LE, "16 bit unsigned, little endian"), \
+ SAMPLE_FORMAT(SF_U16_BE, "16 bit unsigned, big endian"), \
+
+/** \cond sample_format */
+#define SAMPLE_FORMAT(a, b) a
+enum sample_format {SAMPLE_FORMATS};
+#undef SAMPLE_FORMAT
+#define SAMPLE_FORMAT(a, b) b
+/** \endcond sample_format */
+
+/** Debug, Info, etc. */
+enum loglevels {LOGLEVELS, NUM_LOGLEVELS};
+
+#define PARA_DEBUG_LOG(f,...) para_log(LL_DEBUG, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+#define PARA_INFO_LOG(f,...) para_log(LL_INFO, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+#define PARA_NOTICE_LOG(f,...) para_log(LL_NOTICE, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+#define PARA_WARNING_LOG(f,...) para_log(LL_WARNING, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+#define PARA_ERROR_LOG(f,...) para_log(LL_ERROR, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+#define PARA_CRIT_LOG(f,...) para_log(LL_CRIT, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+#define PARA_EMERG_LOG(f,...) para_log(LL_EMERG, "%s: " f, __FUNCTION__, ## __VA_ARGS__)
+
+#define STATUS_ITEMS \
+ STATUS_ITEM(basename) \
+ STATUS_ITEM(status) \
+ STATUS_ITEM(num_played) \
+ STATUS_ITEM(mtime) \
+ STATUS_ITEM(bitrate) \
+ STATUS_ITEM(frequency) \
+ STATUS_ITEM(file_size) \
+ STATUS_ITEM(status_flags) \
+ STATUS_ITEM(format) \
+ STATUS_ITEM(score) \
+ STATUS_ITEM(techinfo) \
+ STATUS_ITEM(afs_mode) \
+ STATUS_ITEM(attributes_txt) \
+ STATUS_ITEM(decoder_flags) \
+ STATUS_ITEM(audiod_status) \
+ STATUS_ITEM(play_time) \
+ STATUS_ITEM(attributes_bitmap) \
+ STATUS_ITEM(offset) \
+ STATUS_ITEM(seconds_total) \
+ STATUS_ITEM(stream_start) \
+ STATUS_ITEM(current_time) \
+ STATUS_ITEM(audiod_uptime) \
+ STATUS_ITEM(image_id) \
+ STATUS_ITEM(lyrics_id) \
+ STATUS_ITEM(duration) \
+ STATUS_ITEM(directory) \
+ STATUS_ITEM(lyrics_name) \
+ STATUS_ITEM(image_name) \
+ STATUS_ITEM(path) \
+ STATUS_ITEM(hash) \
+ STATUS_ITEM(channels) \
+ STATUS_ITEM(last_played) \
+ STATUS_ITEM(num_chunks) \
+ STATUS_ITEM(chunk_time) \
+ STATUS_ITEM(amplification) \
+ STATUS_ITEM(artist) \
+ STATUS_ITEM(title) \
+ STATUS_ITEM(year) \
+ STATUS_ITEM(album) \
+ STATUS_ITEM(comment) \
+ STATUS_ITEM(max_chunk_size) \
+
+#define STATUS_ITEM(_name) SI_ ##_name,
+enum status_items {STATUS_ITEMS NUM_STAT_ITEMS};
+#undef STATUS_ITEM
+#define STATUS_ITEM(_name) #_name,
+
+extern const char *status_item_list[];
+/** Loop over each status item. */
+#define FOR_EACH_STATUS_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++)
+int for_each_stat_item(char *item_buf, size_t num_bytes,
+ int (*item_handler)(int, char *));