ref: f8eca2daeee2dcd559eafecf6290d86afcdf2b90
parent: e1e358ec2c84ac0e6cecf5b1a91e583d9a1b0860
author: cbagwell <cbagwell>
date: Wed Jan 17 18:34:23 EST 2007
cleanup libst's namespace some
--- a/src/adpcms.c
+++ b/src/adpcms.c
@@ -17,7 +17,7 @@
/* ADPCM CODECs: IMA, OKI. (c) 2007 robs@users.sourceforge.net */
#include "adpcms.h"
-#include "st.h"
+#include "st_i.h"
#define range_limit(x,min,max)((x)<(min)?(min):(x)>(max)?(max):(x))
--- a/src/st.h
+++ b/src/st.h
@@ -26,23 +26,6 @@
/* Boolean type, compatible with C++ */
typedef enum {false, true} bool;
-/* Compile-time ("static") assertion */
-/* e.g. assert_static(sizeof(int) >= 4, int_type_too_small) */
-#define assert_static(e,f) enum {assert_static__##f = 1/(e)}
-
-#ifdef min
-#undef min
-#endif
-#define min(a, b) ((a) <= (b) ? (a) : (b))
-
-#ifdef max
-#undef max
-#endif
-#define max(a, b) ((a) >= (b) ? (a) : (b))
-
-/* Array-length operator */
-#define array_length(a) (sizeof(a)/sizeof(a[0]))
-
typedef int32_t int24_t; /* But beware of the extra byte. */
typedef uint32_t uint24_t; /* ditto */
@@ -430,12 +413,5 @@
#define ST_ENOTSUP 2005 /* Operation not supported */
#define ST_EINVAL 2006 /* Invalid argument */
#define ST_EFFMT 2007 /* Unsupported file format */
-
-/* Define fseeko and ftello for platforms lacking them */
-#ifndef HAVE_FSEEKO
-#define fseeko fseek
-#define ftello ftell
-#define off_t long
-#endif
#endif
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -31,6 +31,25 @@
#define NORET
#endif
+/* C language enhancements: */
+
+/* Compile-time ("static") assertion */
+/* e.g. assert_static(sizeof(int) >= 4, int_type_too_small) */
+#define assert_static(e,f) enum {assert_static__##f = 1/(e)}
+
+#ifdef min
+#undef min
+#endif
+#define min(a, b) ((a) <= (b) ? (a) : (b))
+
+#ifdef max
+#undef max
+#endif
+#define max(a, b) ((a) >= (b) ? (a) : (b))
+
+/* Array-length operator */
+#define array_length(a) (sizeof(a)/sizeof(a[0]))
+
/* declared in misc.c */
typedef struct {char const *text; int value;} enum_item;
#define ENUM_ITEM(prefix, item) {#item, prefix##item},
@@ -40,6 +59,13 @@
typedef enum {ST_SHORT, ST_INT, ST_FLOAT, ST_DOUBLE} st_data_t;
typedef enum {ST_WAVE_SINE, ST_WAVE_TRIANGLE} st_wave_t;
extern enum_item const st_wave_enum[];
+
+/* Define fseeko and ftello for platforms lacking them */
+#ifndef HAVE_FSEEKO
+#define fseeko fseek
+#define ftello ftell
+#define off_t long
+#endif
/* Digitise one cycle of a wave and store it as
* a table of samples of a specified data-type.