]> Repos - portaudio/commitdiff
Add version numbering with major.minor.subminor format.
authorphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 3 Mar 2015 17:28:15 +0000 (17:28 +0000)
committerphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Tue, 3 Mar 2015 17:28:15 +0000 (17:28 +0000)
Bump version to 19.5.0

examples/pa_devs.c
include/portaudio.h
src/common/pa_front.c

index 42f8f9f9d6772864ea8727e05ffb050510b63bfb..4d6324c35a30ba442899ee51fd6d19b4e9b151d2 100644 (file)
@@ -114,7 +114,7 @@ int main(void)
         goto error;
     }
 
-    printf( "PortAudio version number = %d\nPortAudio version text = '%s'\n",
+    printf( "PortAudio version number = 0x%08X\nPortAudio version text = '%s'\n",
             Pa_GetVersion(), Pa_GetVersionText() );
 
             
index 1d2323349cfc02213c8031ab7c4dd4cfc0a7b03e..64859587c655af658119876d1491494504bc6927 100644 (file)
@@ -50,18 +50,26 @@ extern "C"
 {
 #endif /* __cplusplus */
 
-/** Retrieve the release number of the currently running PortAudio build,
- eg 1900.
-*/
+/** Retrieve the release number of the currently running PortAudio build.
+ * For example, for version "19.5.1" this will return 0x00130501.
+ */
 int Pa_GetVersion( void );
 
-
 /** Retrieve a textual description of the current PortAudio build,
- eg "PortAudio V19-devel 13 October 2002".
-*/
+ * eg "PortAudio V19.5.0-devel (built Mar  3 2015 09:16:35)".
+ * The format of the text may change so do not try to parse the returned string.
+ */
 const char* Pa_GetVersionText( void );
 
+/**
+ * Generate a packed integer version number in the same format used
+ * by Pa_GetVersion(). Use this to compare a specified version number with 
+ * the currently running version. For example:
+ *
+ * if (Pa_GetVersion() < paMakeVersionNumber(19.5.1)) {}
+ */
+#define paMakeVersionNumber(major, minor, subminor) \
+    (((major)&0xFF)<<16 | ((minor)&0xFF)<<8 | ((subminor)&0xFF))
 
 /** Error codes returned by PortAudio functions.
  Note that with the exception of paNoError, all PaErrorCodes are negative.
index 4e4bb6831b7e25615190b0d1c534c197cbe7f971..197516d814d6f70c4a85d48790b1c9137315c193 100644 (file)
 #include "pa_trace.h" /* still usefull?*/
 #include "pa_debugprint.h"
 
+/**
+ * This is incremented if we make incompatible API changes.
+ * This version scheme is based loosely on http://semver.org/
+ */
+#define paVersionMajor     19
+
+/**
+ * This is incremented when we add functionality in a backwards-compatible manner.
+ * Or it is set to zero when paVersionMajor is incremented.
+ */
+#define paVersionMinor      5
 
-#define PA_VERSION_  1899
-#define PA_VERSION_TEXT_ "PortAudio V19-devel (built " __DATE__  " " __TIME__ ")"
+/**
+ * This is incremented when we make backwards-compatible bug fixes.
+ * Or it is set to zero when paVersionMinor changes.
+ */
+#define paVersionSubMinor   0
 
+/**
+ * This is a combination of paVersionMajor, paVersionMinor and paVersionSubMinor.
+ * It will always increase so that version numbers can be compared as integers to 
+ * see which is later.
+ */
+#define paVersion  paMakeVersionNumber(paVersionMajor, paVersionMinor, paVersionSubMinor)
 
+#define STRINGIFY(x) #x
+#define TOSTRING(x) STRINGIFY(x)
 
+#define PA_VERSION_STRING_  TOSTRING(paVersionMajor) "." TOSTRING(paVersionMinor) "." TOSTRING(paVersionSubMinor)
+#define PA_VERSION_TEXT_    "PortAudio V" PA_VERSION_STRING_ "-devel (built " __DATE__  " " __TIME__ ")"
 
 int Pa_GetVersion( void )
 {
-    return PA_VERSION_;
+    return paVersion;
 }
 
-
 const char* Pa_GetVersionText( void )
 {
     return PA_VERSION_TEXT_;
 }
 
-
-
 #define PA_LAST_HOST_ERROR_TEXT_LENGTH_  1024
 
 static char lastHostErrorText_[ PA_LAST_HOST_ERROR_TEXT_LENGTH_ + 1 ] = {0};