[beast/devel: 4/16] AIDA: use 'include' statements in IDL files instead of preprocessor directives



commit 05f01a465fe22864c3efd4c3daf6a83715cba920
Author: Tim Janik <timj gnu org>
Date:   Tue Dec 25 05:02:24 2012 +0100

    AIDA: use 'include' statements in IDL files instead of preprocessor directives
    
    * use 'include "file";' for including interfaces.
    * use 'include "file" as implementation;' for implementation include files.

 bse/bse.idl                          |   12 ++++++------
 bse/bsebusmodule.idl                 |    2 +-
 bse/bsecxxbase.idl                   |    2 +-
 bse/bsecxxmodule.idl                 |    2 +-
 bse/bseprobe.idl                     |    2 +-
 plugins/artscompressor.idl           |    2 +-
 plugins/bseamplifier.idl             |    2 +-
 plugins/bsebalance.idl               |    2 +-
 plugins/bsecontribsampleandhold.idl  |    2 +-
 plugins/bsenoise.idl                 |    2 +-
 plugins/bsequantizer.idl             |    2 +-
 plugins/bsesummation.idl             |    2 +-
 plugins/davbassfilter.idl            |    2 +-
 plugins/davchorus.idl                |    2 +-
 plugins/davorgan.idl                 |    2 +-
 plugins/evaluator/bseevaluator.idl   |    2 +-
 plugins/standardguspatchenvelope.idl |    2 +-
 plugins/standardsaturator.idl        |    2 +-
 sfi/sfidl-parser.cc                  |   30 ++++++++++++++++++++----------
 tests/bse/testplugin.idl             |    2 +-
 tests/latency/bselatencytest.idl     |    2 +-
 21 files changed, 45 insertions(+), 35 deletions(-)
---
diff --git a/bse/bse.idl b/bse/bse.idl
index 39bab74..57d971f 100644
--- a/bse/bse.idl
+++ b/bse/bse.idl
@@ -1,8 +1,8 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include-impl <bse/bsecore.idl>
-#include-impl <bse/bsecxxbase.idl>
-#include-impl <bse/bsecxxmodule.idl>
-#include-impl <bse/bseprobe.idl>
+
+include "bsecore.idl" as implementation;
+include "bsecxxbase.idl" as implementation;
+include "bsecxxmodule.idl" as implementation;
+include "bseprobe.idl" as implementation;
 // include non-C++ types
-#include-impl <bse/bsehack.idl>	// generated by bseprocidl
-/* vim:set ts=8 sts=2 sw=2 syntax=cpp: */
+include "bsehack.idl" as implementation;	// generated by bseprocidl
diff --git a/bse/bsebusmodule.idl b/bse/bsebusmodule.idl
index 0e8c0fa..481b8ed 100644
--- a/bse/bsebusmodule.idl
+++ b/bse/bsebusmodule.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecore.idl>
+include "bsecore.idl";
 namespace Bse { interface Effect; }; // FIXME: bad workaround
 namespace Bse {
 interface BusModule : Effect {
diff --git a/bse/bsecxxbase.idl b/bse/bsecxxbase.idl
index 2d7c53d..195efc8 100644
--- a/bse/bsecxxbase.idl
+++ b/bse/bsecxxbase.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecore.idl>
+include "bsecore.idl";
 namespace Bse { // FIXME: bad workarounds
 interface Source;
 }
diff --git a/bse/bsecxxmodule.idl b/bse/bsecxxmodule.idl
index 0891d7a..ca4d908 100644
--- a/bse/bsecxxmodule.idl
+++ b/bse/bsecxxmodule.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecxxbase.idl>
+include "bsecxxbase.idl";
 namespace Bse {
 interface Effect : CxxBase {
   // Implementation fully manual
diff --git a/bse/bseprobe.idl b/bse/bseprobe.idl
index eae5d53..c4d7c34 100644
--- a/bse/bseprobe.idl
+++ b/bse/bseprobe.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecxxmodule.idl>
+include "bsecxxmodule.idl";
 namespace Bse {
 record ProbeFeatures {
   Bool          probe_range;
diff --git a/plugins/artscompressor.idl b/plugins/artscompressor.idl
index 8d8ccc6..18ea6fd 100644
--- a/plugins/artscompressor.idl
+++ b/plugins/artscompressor.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse {
 namespace Arts {
 interface Compressor : Effect {
diff --git a/plugins/bseamplifier.idl b/plugins/bseamplifier.idl
index 60a825a..b05b515 100644
--- a/plugins/bseamplifier.idl
+++ b/plugins/bseamplifier.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecore.idl>
+include "bse/bsecore.idl";
 namespace Bse { // FIXME: bad workaround
 interface Effect;
 };
diff --git a/plugins/bsebalance.idl b/plugins/bsebalance.idl
index eb897b2..318a602 100644
--- a/plugins/bsebalance.idl
+++ b/plugins/bsebalance.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse {
 interface Balance : Effect {
   Info    icon      = "icons/balance.png";
diff --git a/plugins/bsecontribsampleandhold.idl b/plugins/bsecontribsampleandhold.idl
index 7826676..f8fd449 100644
--- a/plugins/bsecontribsampleandhold.idl
+++ b/plugins/bsecontribsampleandhold.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse { namespace Contrib {
 interface SampleAndHold: Effect {
   Info icon             = "icons/sample+hold.png";
diff --git a/plugins/bsenoise.idl b/plugins/bsenoise.idl
index 758246a..e80d970 100644
--- a/plugins/bsenoise.idl
+++ b/plugins/bsenoise.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecxxmodule.idl>
+include "bse/bsecxxmodule.idl";
 namespace Bse {
 interface Noise : Effect {
   Info    icon        = "icons/noise.png";
diff --git a/plugins/bsequantizer.idl b/plugins/bsequantizer.idl
index 71f1e95..1fa23d9 100644
--- a/plugins/bsequantizer.idl
+++ b/plugins/bsequantizer.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse { namespace Standard {
 interface Quantizer : Bse::Effect {
   Info    category   = "/Distortion/Quantizer";
diff --git a/plugins/bsesummation.idl b/plugins/bsesummation.idl
index 143eb7d..f290bf0 100644
--- a/plugins/bsesummation.idl
+++ b/plugins/bsesummation.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecxxmodule.idl>
+include "bse/bsecxxmodule.idl";
 namespace Bse {
 interface Summation : Effect {
   Info    icon        = "icons/summation.png";
diff --git a/plugins/davbassfilter.idl b/plugins/davbassfilter.idl
index 9c8390c..8cd7c04 100644
--- a/plugins/davbassfilter.idl
+++ b/plugins/davbassfilter.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse {
 namespace Dav {
 interface BassFilter : Effect {
diff --git a/plugins/davchorus.idl b/plugins/davchorus.idl
index fdf8eff..731b407 100644
--- a/plugins/davchorus.idl
+++ b/plugins/davchorus.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse {
 namespace Dav {
 interface Chorus : Effect {
diff --git a/plugins/davorgan.idl b/plugins/davorgan.idl
index 89f1fb9..6f772c0 100644
--- a/plugins/davorgan.idl
+++ b/plugins/davorgan.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse {
 namespace Dav {
 interface Organ : Effect {
diff --git a/plugins/evaluator/bseevaluator.idl b/plugins/evaluator/bseevaluator.idl
index dd71da0..164ca22 100644
--- a/plugins/evaluator/bseevaluator.idl
+++ b/plugins/evaluator/bseevaluator.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse {
 interface Evaluator : Bse::Effect {
   /*Info    icon      = "icons/bseevaluator.png";*/
diff --git a/plugins/standardguspatchenvelope.idl b/plugins/standardguspatchenvelope.idl
index 51adbe2..f8cf224 100644
--- a/plugins/standardguspatchenvelope.idl
+++ b/plugins/standardguspatchenvelope.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecxxmodule.idl>
+include "bse/bsecxxmodule.idl";
 namespace Bse {
 interface Wave;
 namespace Standard {
diff --git a/plugins/standardsaturator.idl b/plugins/standardsaturator.idl
index e2b2393..eb0b6bd 100644
--- a/plugins/standardsaturator.idl
+++ b/plugins/standardsaturator.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Bse { namespace Standard {
 enum SaturationType {
   SATURATE_TANH      = Enum (_("TANH"),      _("Saturation via hyperbolic tangent function which is mostly linear for "
diff --git a/sfi/sfidl-parser.cc b/sfi/sfidl-parser.cc
index b9a4943..e5e4c1f 100644
--- a/sfi/sfidl-parser.cc
+++ b/sfi/sfidl-parser.cc
@@ -473,7 +473,7 @@ void Parser::preprocessContents (const String& input_filename)
 			break;
 	    case '<':	state = filenameIn2;
 			break;
-	    default:	g_printerr ("bad char after #include statement");
+	    default:	g_printerr ("bad char after include statement");
 			g_assert_not_reached (); // error handling!
 	    }
 	}
@@ -481,7 +481,7 @@ void Parser::preprocessContents (const String& input_filename)
 	   || (state == filenameIn2 && *i == '>'))
 	{
 	  String location;
-	  // #include "/usr/include/foo.idl" (absolute path includes)
+	  // include "/usr/include/foo.idl" (absolute path includes)
 	  if (g_path_is_absolute (filename.c_str()))
 	    {
 	      if (fileExists (filename))
@@ -489,15 +489,17 @@ void Parser::preprocessContents (const String& input_filename)
 	    }
 	  else
 	    {
-	      // #include "foo.idl" => search in local directory (relative to input_file)
+	      // include "foo.idl" => search in local directory (relative to input_file)
 	      if (state == filenameIn1)
 		{
-		  gchar *dir = g_path_get_dirname (input_filename.c_str());
-		  if (fileExists (dir + String(G_DIR_SEPARATOR_S) + filename))
-		    location = filename;
+		  char *dir = g_path_get_dirname (input_filename.c_str());
+                  String candidate = dir + String(G_DIR_SEPARATOR_S) + filename;
+		  const bool candidate_exists = fileExists (candidate);
+		  if (candidate_exists)
+		    location = candidate;
 		  g_free (dir);
 		}
-	      // all #include directives => search includepath with standard include dirs
+	      // all include directives => search includepath with standard include dirs
 	      if (location == "")
 		{
 		  vector<String>::const_iterator oi;
@@ -518,9 +520,17 @@ void Parser::preprocessContents (const String& input_filename)
 	      fprintf (stderr, "include file '%s' not found\n", filename.c_str());
 	      exit(1);
 	    }
+	  i++; // eat closing quote
+          if (match (i, " as implementation"))
+            {
+              i += 18;
+              includeImpl = true;
+            }
+          if (*i != ';')
+            g_error ("expected ';' after include statement");
+          i++; // eat semicolpon after include
 	  preprocess (location, includeImpl);
 	  state = idlCode;
-	  i++;
 	}
       else if(state == filenameIn1 || state == filenameIn2)
 	{
@@ -533,14 +543,14 @@ void Parser::preprocessContents (const String& input_filename)
 	}
       else if(state == lineStart) // check if we're on lineStart
 	{
-	  if(match(i,"#include-impl"))
+	  if (0 && match(i,"#include-impl")) // old syntax disabled
 	    {
 	      i += 13;
 	      state = filenameFind;
 	      filename = "";
 	      includeImpl = true;
 	    }
-	  else if(match(i,"#include"))
+	  else if(match(i,"include"))
 	    {
 	      i += 8;
 	      state = filenameFind;
diff --git a/tests/bse/testplugin.idl b/tests/bse/testplugin.idl
index 786683f..e58e972 100644
--- a/tests/bse/testplugin.idl
+++ b/tests/bse/testplugin.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bse.idl>
+include "bse/bse.idl";
 namespace Namespace {
 using namespace Sfi;
 // test enum
diff --git a/tests/latency/bselatencytest.idl b/tests/latency/bselatencytest.idl
index 73e9e06..7035e28 100644
--- a/tests/latency/bselatencytest.idl
+++ b/tests/latency/bselatencytest.idl
@@ -1,5 +1,5 @@
 // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include <bse/bsecxxmodule.idl>
+include "bse/bsecxxmodule.idl";
 namespace Bse {
 interface LatencyTest : Effect {
   Info    authors     = "Stefan Westerfeld";



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