cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1060345 - in /cxf/trunk/tools/corba/src: main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java test/resources/idlpreprocessor/C-resolved.idl test/resources/idlpreprocessor/C.idl
Date Tue, 18 Jan 2011 12:08:01 GMT
Author: ffang
Date: Tue Jan 18 12:08:00 2011
New Revision: 1060345

URL: http://svn.apache.org/viewvc?rev=1060345&view=rev
Log:
[CXF-3254]idl2wsdl should be able to honor #if preprocessor

Modified:
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
    cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C-resolved.idl
    cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C.idl

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java?rev=1060345&r1=1060344&r2=1060345&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/idlpreprocessor/IdlPreprocessorReader.java
Tue Jan 18 12:08:00 2011
@@ -176,6 +176,8 @@ public final class IdlPreprocessorReader
                 handleIfndef(line);
             } else if (line.startsWith("#ifdef")) {
                 handleIfdef(line);
+            } else if (line.startsWith("#if")) {
+                handleIf(line);
             } else if (line.startsWith("#endif")) {
                 handleEndif(lineNo, ise);
             } else if (line.startsWith("#else")) {
@@ -254,6 +256,21 @@ public final class IdlPreprocessorReader
         registerIf(!isDefined);
         buf.append(LF);
     }
+    
+    private void handleIf(String line) {
+        String symbol = line.substring("#if".length()).trim();
+        boolean notSkip = true;
+        try {
+            int value = Integer.valueOf(symbol);
+            if (value == 0) {
+                notSkip = false;
+            }
+        } catch (NumberFormatException e) {
+            //do nothig
+        }
+        registerIf(!notSkip);
+        buf.append(LF);
+    }
 
     private void handleIfndef(String line) {
         String symbol = line.substring("#ifndef".length()).trim();

Modified: cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C-resolved.idl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C-resolved.idl?rev=1060345&r1=1060344&r2=1060345&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C-resolved.idl (original)
+++ cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C-resolved.idl Tue Jan 18 12:08:00
2011
@@ -21,6 +21,16 @@ module c
 
 
 // endif _c
+
+
+
+
+
+    const char e = 'e';
+
+
+    const char f = 'f';
+
   };
 };
 

Modified: cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C.idl
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C.idl?rev=1060345&r1=1060344&r2=1060345&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C.idl (original)
+++ cxf/trunk/tools/corba/src/test/resources/idlpreprocessor/C.idl Tue Jan 18 12:08:00 2011
@@ -20,6 +20,16 @@ module c
 #else
     const boolean c = TRUE;
 #endif  // endif _c
+
+#if 0
+    const char d = 'd';
+#endif 
+#if 1
+    const char e = 'e';
+#endif
+#if true
+    const char f = 'f';
+#endif
   };
 };
 



Mime
View raw message