[beast: 9/39] SFI: provide bse_installpath() and bse_version()



commit 6b95b92f3faed8ae1342abcf42973e289ca09241
Author: Tim Janik <timj gnu org>
Date:   Fri Sep 11 23:56:57 2015 +0200

    SFI: provide bse_installpath() and bse_version()

 sfi/glib-extra.cc |   35 +++++++++++++++++++++++++++++++++++
 sfi/glib-extra.hh |   27 +++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/sfi/glib-extra.cc b/sfi/glib-extra.cc
index dd242b8..cf4625e 100644
--- a/sfi/glib-extra.cc
+++ b/sfi/glib-extra.cc
@@ -1037,3 +1037,38 @@ g_scanner_new64 (const GScannerConfig *config_templ)
     g_error ("%s(): attempt to create 64bit scanner with store_int64==FALSE", G_STRFUNC);
   return g_scanner_new (config_templ);
 }
+
+// == BSE_INSTALLPATH ==
+#include "../configure.h"
+std::string
+bse_installpath (BseInstallpathType installpath_type)
+{
+  switch (installpath_type)
+    {
+    case BSE_INSTALLPATH_INCLUDES:                      return INSTALLPATH_INCLUDES;
+    case BSE_INSTALLPATH_BINDIR:                        return INSTALLPATH_BINDIR;
+    case BSE_INSTALLPATH_LOCALEBASE:                    return INSTALLPATH_LOCALEBASE;
+    case BSE_INSTALLPATH_LADSPA:                        return INSTALLPATH_LADSPA;
+    case BSE_INSTALLPATH_PKGDOCDIR:                     return INSTALLPATH_PKGDOCDIR;
+    case BSE_INSTALLPATH_USER_DATA:                     return INSTALLPATH_USER_DATA;
+    case BSE_INSTALLPATH_PKGLIBDIR:                     return INSTALLPATH_PKGLIBDIR;
+    case BSE_INSTALLPATH_PKGLIBDIR_PLUGINS:             return bse_installpath (BSE_INSTALLPATH_PKGLIBDIR) + 
"/plugins";
+    case BSE_INSTALLPATH_PKGLIBDIR_DRIVERS:             return bse_installpath (BSE_INSTALLPATH_PKGLIBDIR) + 
"/drivers";
+    case BSE_INSTALLPATH_PKGDATADIR:                    return INSTALLPATH_PKGDATADIR;
+    case BSE_INSTALLPATH_PKGDATADIR_DEMO:               return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/demo";
+    case BSE_INSTALLPATH_PKGDATADIR_SAMPLES:            return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/samples";
+    case BSE_INSTALLPATH_PKGDATADIR_EFFECTS:            return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/effects";
+    case BSE_INSTALLPATH_PKGDATADIR_INSTRUMENTS:        return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/instruments";
+    case BSE_INSTALLPATH_PKGDATADIR_SCRIPTS:            return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/scripts";
+    case BSE_INSTALLPATH_PKGDATADIR_IMAGES:             return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/images";
+    case BSE_INSTALLPATH_PKGDATADIR_KEYS:               return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/keys";
+    case BSE_INSTALLPATH_PKGDATADIR_SKINS:              return bse_installpath (BSE_INSTALLPATH_PKGDATADIR) 
+ "/skins";
+    }
+  return "";
+}
+
+std::string
+bse_version ()
+{
+  return PACKAGE_VERSION;
+}
diff --git a/sfi/glib-extra.hh b/sfi/glib-extra.hh
index c5dceeb..3bf8383 100644
--- a/sfi/glib-extra.hh
+++ b/sfi/glib-extra.hh
@@ -299,6 +299,33 @@ GScanner*  g_scanner_new64                 (const GScannerConfig *config_templ);
 #define g_scanner_thaw_symbol_table(scanner) ((void)0)
 #endif /* G_DISABLE_DEPRECATED */
 
+// == BSE_INSTALLPATH ==
+// See also configure.ac, this function is here because all of sfi, bse and beast include this file.
+enum BseInstallpathType {
+  BSE_INSTALLPATH_INCLUDES = 1,
+  BSE_INSTALLPATH_BINDIR,
+  BSE_INSTALLPATH_LOCALEBASE,
+  BSE_INSTALLPATH_LADSPA,
+  BSE_INSTALLPATH_PKGDOCDIR,
+  BSE_INSTALLPATH_USER_DATA,
+  BSE_INSTALLPATH_PKGLIBDIR,
+  BSE_INSTALLPATH_PKGLIBDIR_PLUGINS,
+  BSE_INSTALLPATH_PKGLIBDIR_DRIVERS,
+  BSE_INSTALLPATH_PKGDATADIR,
+  BSE_INSTALLPATH_PKGDATADIR_DEMO,
+  BSE_INSTALLPATH_PKGDATADIR_SAMPLES,
+  BSE_INSTALLPATH_PKGDATADIR_EFFECTS,
+  BSE_INSTALLPATH_PKGDATADIR_INSTRUMENTS,
+  BSE_INSTALLPATH_PKGDATADIR_SCRIPTS,
+  BSE_INSTALLPATH_PKGDATADIR_IMAGES,
+  BSE_INSTALLPATH_PKGDATADIR_KEYS,
+  BSE_INSTALLPATH_PKGDATADIR_SKINS,
+};
+/// Provide installation directories and searchpaths for various types of data.
+std::string bse_installpath  (BseInstallpathType installpath_type);
+
+/// Provide a string containing the BSE library version number.
+std::string bse_version ();
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]