--- /dev/null
+#!/bin/bash
+#
+# Clear the SVN revision in the include file.
+# This should be run before checking in code to SVN.
+#
+revision_filename=src/common/pa_svnrevision.h
+
+# Update the include file with the current SVN revision.
+echo "#define PA_SVN_REVISION unknown" > ${revision_filename}
+
+echo ${revision_filename} now contains
+cat ${revision_filename}
printf( "ERROR: Pa_Initialize returned 0x%x\n", err );
goto error;
}
+
+ printf( "PortAudio version: 0x%08X\n", Pa_GetVersion());
+ printf( "Version text: '%s'\n", Pa_GetVersionInfo()->versionText );
- printf( "PortAudio version number = 0x%08X\nPortAudio version text = '%s'\n",
- Pa_GetVersion(), Pa_GetVersionText() );
-
-
numDevices = Pa_GetDeviceCount();
if( numDevices < 0 )
{
int Pa_GetVersion( void );
/** Retrieve a textual description of the current PortAudio build,
- * eg "PortAudio V19.5.0-devel (built Mar 3 2015 09:16:35)".
+ * eg "PortAudio V19.5.0-devel, revision 1952M".
* The format of the text may change so do not try to parse the returned string.
+ * @deprecated use PaVersionInfo() instead
*/
const char* Pa_GetVersionText( void );
* 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)) {}
+ * if (Pa_GetVersion() < paMakeVersionNumber(19,5,1)) {}
*/
#define paMakeVersionNumber(major, minor, subminor) \
(((major)&0xFF)<<16 | ((minor)&0xFF)<<8 | ((subminor)&0xFF))
+
+/**
+ * A structure containing the components of the version numbers.
+ */
+typedef struct PaVersionInfo {
+ int versionMajor;
+ int versionMinor;
+ int versionSubMinor;
+ /**
+ * This is currently the SVN revision but may change in the future.
+ * The versionControlRevision is updated by running a script before compiling code.
+ * If the update does not occur then this value may be less
+ * than the actual SVN revision number.
+ */
+ const char *versionControlRevision;
+ /** Version as a string, for example "PortAudio V19.5.0-devel, revision 1952M" */
+ const char *versionText;
+} PaVersionInfo;
+
+/**
+ * The structure that this points to is statically allocated.
+ * Do not attempt to free it or modify it.
+ */
+const PaVersionInfo* Pa_GetVersionInfo();
+
/** Error codes returned by PortAudio functions.
Note that with the exception of paNoError, all PaErrorCodes are negative.
*/
#include <stdio.h>
#include <memory.h>
#include <string.h>
+#include <stdlib.h> /* needed for strtol() */
#include <assert.h> /* needed by PA_VALIDATE_ENDIANNESS */
#include "portaudio.h"
#include "pa_trace.h" /* still usefull?*/
#include "pa_debugprint.h"
+#ifndef PA_SVN_REVISION
+#include "pa_svnrevision.h"
+#endif
+
/**
* This is incremented if we make incompatible API changes.
* This version scheme is based loosely on http://semver.org/
#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__ ")"
+#define PA_VERSION_STRING_ TOSTRING(paVersionMajor) "." TOSTRING(paVersionMinor) "." TOSTRING(paVersionSubMinor)
+#define PA_VERSION_TEXT_ "PortAudio V" PA_VERSION_STRING_ "-devel, revision " TOSTRING(PA_SVN_REVISION)
int Pa_GetVersion( void )
{
return PA_VERSION_TEXT_;
}
+static PaVersionInfo versionInfo_ = {
+ .versionMajor = paVersionMajor,
+ .versionMinor = paVersionMinor,
+ .versionSubMinor = paVersionSubMinor,
+ .versionControlRevision = TOSTRING(PA_SVN_REVISION),
+ .versionText = PA_VERSION_TEXT_
+};
+
+const PaVersionInfo* Pa_GetVersionInfo()
+{
+ return &versionInfo_;
+}
+
#define PA_LAST_HOST_ERROR_TEXT_LENGTH_ 1024
static char lastHostErrorText_[ PA_LAST_HOST_ERROR_TEXT_LENGTH_ + 1 ] = {0};
--- /dev/null
+#define PA_SVN_REVISION unknown
--- /dev/null
+#!/bin/bash
+#
+# Write the SVN revision to an include file.
+# This should be run before compiling code on Linux or Macintosh.
+#
+revision_filename=src/common/pa_svnrevision.h
+
+# Run svnversion first to make sure it is installed before corrupting the
+# include file.
+svnversion .
+
+# Update the include file with the current SVN revision.
+echo -n "#define PA_SVN_REVISION " > ${revision_filename}
+svnversion . >> ${revision_filename}
+
+echo ${revision_filename} now contains
+cat ${revision_filename}