You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/04/01 01:24:37 UTC

svn commit: r390540 - in /webservices/axis/trunk/c/src: cbindings/client/ wsdl/org/apache/axis/wsdl/wsdl2ws/c/ wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/

Author: nadiramra
Date: Fri Mar 31 15:24:30 2006
New Revision: 390540

URL: http://svn.apache.org/viewcvs?rev=390540&view=rev
Log:
C support fixes/enhancements.

Modified:
    webservices/axis/trunk/c/src/cbindings/client/CallC.cpp
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/BeanParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java

Modified: webservices/axis/trunk/c/src/cbindings/client/CallC.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/cbindings/client/CallC.cpp?rev=390540&r1=390539&r2=390540&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/cbindings/client/CallC.cpp (original)
+++ webservices/axis/trunk/c/src/cbindings/client/CallC.cpp Fri Mar 31 15:24:30 2006
@@ -1817,7 +1817,8 @@
 
 AXISC_STORAGE_CLASS_INFO 
 Axisc_Array* axiscGetCmplxArrayCall(AXISCHANDLE call, 
-                                    Axisc_Array* pArray, void * pDZFunct, 
+                                    Axisc_Array* pArray, 
+                                    void * pDZFunct, 
                                     void * pCreFunct, 
                                     void * pDelFunct, 
                                     void * pSizeFunct, 

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java?rev=390540&r1=390539&r2=390540&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/CFileWriter.java Fri Mar 31 15:24:30 2006
@@ -53,21 +53,16 @@
     {
         try
         {
-            this.writer =
-                new BufferedWriter(new FileWriter(getFilePath(), false));
+            this.writer = new BufferedWriter(new FileWriter(getFilePath(), false));
             writeClassComment();
             writePreprocessorStatements();
             writeGlobalCodes();
-            // this.writer.write("public class "+servicename+getExtendsPart()+"{\n");
             writeAttributes();
             writeMethods();
-            //this.writer.write("}\n");
-            //cleanup
             writer.flush();
             writer.close();
             if (WSDL2Ws.verbose)
-                System.out.println(
-                    getFilePath().getAbsolutePath() + " created.....");
+                System.out.println(getFilePath().getAbsolutePath() + " created.....");
         }
         catch (IOException e)
         {
@@ -96,37 +91,21 @@
      */
     protected File getFilePath(boolean useServiceName) throws WrapperFault
     {
-        String targetOutputLocation =
-            this.wscontext.getWrapInfo().getTargetOutputLocation();
+        String targetOutputLocation = this.wscontext.getWrapInfo().getTargetOutputLocation();
         if (targetOutputLocation.endsWith("/"))
-        {
-            targetOutputLocation =
-                targetOutputLocation.substring(
-                    0,
-                    targetOutputLocation.length() - 1);
-        }
-        new File(targetOutputLocation).mkdirs();
+            targetOutputLocation = targetOutputLocation.substring(0,targetOutputLocation.length() - 1);
 
-        String fileName =
-            targetOutputLocation + "/" + classname + CUtils.C_FILE_SUFFIX;
+        new File(targetOutputLocation).mkdirs();
+        String fileName = targetOutputLocation + "/" + classname + CUtils.C_FILE_SUFFIX;
 
         if (useServiceName)
         {
             String serviceName = this.wscontext.getSerInfo().getServicename();
-            fileName =
-                targetOutputLocation
-                    + "/"
-                    + serviceName
-                    + "_"
-                    + classname
-                    + CUtils.C_FILE_SUFFIX;
-            this.wscontext.addGeneratedFile(
-                serviceName + "_" + classname + CUtils.C_FILE_SUFFIX);
+            fileName = targetOutputLocation + "/" + serviceName + "_" + classname + CUtils.C_FILE_SUFFIX;
+            this.wscontext.addGeneratedFile(serviceName + "_" + classname + CUtils.C_FILE_SUFFIX);
         }
         else
-        {
             this.wscontext.addGeneratedFile(classname + CUtils.C_FILE_SUFFIX);
-        }
 
         return new File(fileName);
     }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/BeanParamWriter.java?rev=390540&r1=390539&r2=390540&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/BeanParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/BeanParamWriter.java Fri Mar 31 15:24:30 2006
@@ -56,54 +56,7 @@
     protected void writeGlobalCodes() throws WrapperFault
     {
         try
-        {
-            HashSet typeSet = new HashSet();
-            String typeName;
-            for (int i = 0; i < attribs.length; i++)
-                if (!(attribs[i].isSimpleType() || attribs[i].isAnyType()))
-                    typeSet.add(attribs[i].getTypeName());
-
-            Iterator itr = typeSet.iterator();
-            while (itr.hasNext())
-            {
-                /*
-                 * Needed for self referenced  array.
-                * <xsd:complexType name="Type1">
-                *    <xsd:sequence>
-                *        <xsd:element name="followings" maxOccurs="unbounded" minOccurs="0" type="tns:Type1" />
-                *        <xsd:element name="kind" type="xsd:string" />
-                *        <xsd:element name="index" type="xsd:int" />
-                *    </xsd:sequence>
-                *    <xsd:attribute name="att_kind" type="tns:Kind" />
-                * </xsd:complexType>
-                */
-                typeName = itr.next().toString();
-                if (!typeName.equals(type.getName().getLocalPart()))
-                {
-                    writer.write("extern int Axis_DeSerialize_" + typeName
-                            + "(" + typeName + "* param, AXISCHANDLE pDZ);\n");
-                    writer.write("extern void* Axis_Create_" + typeName
-                            + "(" + typeName + "* pObj, AxiscBool bArray, int nSize);\n");
-                    writer.write("extern void Axis_Delete_" + typeName
-                            + "(" + typeName + "* param, AxiscBool bArray, int nSize);\n");
-                    writer.write("extern int Axis_Serialize_" + typeName
-                            + "(" + typeName + "* param, AXISCHANDLE pSZ, AxiscBool bArray);\n");
-                    writer.write("extern int Axis_GetSize_" + typeName + "();\n\n");
-                }
-                else
-                {
-                    writer.write("int Axis_DeSerialize_" + typeName
-                            + "(" + typeName + "* param, AXISCHANDLE pDZ);\n");
-                    writer.write("void* Axis_Create_" + typeName
-                            + "(void* pObj, AxiscBool bArray, int nSize);\n");
-                    writer.write("void Axis_Delete_" + typeName 
-                            + "(" + typeName + "* param, AxiscBool bArray, int nSize);\n");
-                    writer.write("int Axis_Serialize_" + typeName 
-                            + "(" + typeName + "* param, AXISCHANDLE pSZ, AxiscBool bArray);\n");
-                    writer.write("int Axis_GetSize_" + typeName + "();\n\n");
-                }
-            }
-            
+        {           
             writeSerializeGlobalMethod();
             writeDeSerializeGlobalMethod();
             writeCreateGlobalMethod();
@@ -313,8 +266,9 @@
                 else
                 {
                     arrayType = attribs[i].getTypeName();
-                    writer.write("\tarray" + arrayCount + " = axiscGetCmplxArray(pDZ, (void*)Axis_DeSerialize_"
-                            + arrayType
+                    writer.write("\tarray" + arrayCount + " = axiscGetCmplxArrayCall(pDZ," 
+                            + "&array" + arrayCount + ","
+                            + "(void*)Axis_DeSerialize_"  + arrayType
                             + "\n\t\t, (void*)Axis_Create_" + arrayType
                             + ", (void*)Axis_Delete_" + arrayType
                             + "\n\t\t, (void*)Axis_GetSize_" + arrayType
@@ -588,7 +542,7 @@
                             "\t\t\tif (pTemp->"  + attribs[i].getParamName()
                                 + ".m_Array) Axis_Delete_" + attribs[i].getTypeName()
                                 + "(pTemp->" + attribs[i].getParamName()
-                                + ".m_Array, true, pTemp->" + attribs[i].getParamName()
+                                + ".m_Array, xsdc_boolean_true, pTemp->" + attribs[i].getParamName()
                                 + ".m_Size);\n");
                     }
                 }
@@ -659,7 +613,7 @@
                             + attribs[i].getParamName()
                             + ".m_Array) Axis_Delete_" + attribs[i].getTypeName()
                             + "(param->" + attribs[i].getParamName()
-                            + ".m_Array, true, param->" + attribs[i].getParamName()
+                            + ".m_Array, xsdc_boolean_true, param->" + attribs[i].getParamName()
                             + ".m_Size);\n");
                 }
             }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java?rev=390540&r1=390539&r2=390540&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java Fri Mar 31 15:24:30 2006
@@ -564,49 +564,7 @@
     /* (non-Javadoc)
      * @see org.apache.axis.wsdl.wsdl2ws.c.CFileWriter#writeGlobalCodes()
      */
-    protected void writeGlobalCodes() throws WrapperFault
+    protected void writeGlobalCodes() throws WrapperFault 
     {
-        Iterator types = wscontext.getTypemap().getTypes().iterator();
-        HashSet typeSet = new HashSet();
-        String typeName;
-        Type type;
-        try
-        {
-            while (types.hasNext())
-            {
-                type = (Type) types.next();
-                
-                if (type.isSimpleType())
-                    continue;
-                
-                if (type.isArray())
-                    continue;
-                
-                typeName = type.getLanguageSpecificName();
-                if (typeName.startsWith(">"))
-                    continue;
-                
-                typeSet.add(typeName);
-            }
-            
-            Iterator itr = typeSet.iterator();
-            while (itr.hasNext())
-            {
-                typeName = itr.next().toString();
-                writer.write("extern int Axis_DeSerialize_" + typeName
-                             + "(" + typeName + "* param, AXISCHANDLE pDZ);\n");
-                writer.write("extern void* Axis_Create_" + typeName
-                             + "(" + typeName + " *Obj, AxiscBool bArray, int nSize);\n");
-                writer.write("extern void Axis_Delete_" + typeName
-                             + "(" + typeName + "* param, AxiscBool bArray, int nSize);\n");
-                writer.write("extern int Axis_Serialize_" + typeName
-                             + "(" + typeName + "* param, AXISCHANDLE pSZ, AxiscBool bArray);\n");
-                writer.write("extern int Axis_GetSize_" + typeName + "();\n\n");
-            }
-        }
-        catch (IOException e)
-        {
-            throw new WrapperFault(e);
-        }
     }
 }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java?rev=390540&r1=390539&r2=390540&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java Fri Mar 31 15:24:30 2006
@@ -28,6 +28,7 @@
 import java.io.IOException;
 import java.util.Iterator;
 import java.util.Vector;
+import java.util.HashSet;
 
 import javax.xml.namespace.QName;
 
@@ -74,6 +75,7 @@
                 this.writer.write("typedef struct " + classname + "Tag {\n");
                 writeAttributes();
                 this.writer.write("} " + classname + ";\n\n");
+                writeFunctionPrototypes();
             }
             
             this.writer.write("#endif /* !defined(__" + classname.toUpperCase() + "_H__INCLUDED_)*/\n");
@@ -215,6 +217,53 @@
         }
     }
 
+    protected void writeFunctionPrototypes() throws WrapperFault
+    {
+        Iterator types = wscontext.getTypemap().getTypes().iterator();
+        HashSet typeSet = new HashSet();
+        String typeName;
+        Type type;
+        try
+        {
+            while (types.hasNext())
+            {
+                type = (Type) types.next();
+                
+                if (type.isSimpleType())
+                    continue;
+                
+                if (type.isArray())
+                    continue;
+                
+                typeName = type.getLanguageSpecificName();
+                if (typeName.startsWith(">") || !typeName.equals(classname))
+                    continue;
+                
+                typeSet.add(typeName);
+            }
+            
+            Iterator itr = typeSet.iterator();
+            while (itr.hasNext())
+            {
+                typeName = itr.next().toString();
+                this.writer.write("extern int Axis_DeSerialize_" + typeName
+                             + "(" + typeName + "* param, AXISCHANDLE pDZ);\n");
+                this.writer.write("extern void* Axis_Create_" + typeName
+                             + "(" + typeName + " *Obj, AxiscBool bArray, int nSize);\n");
+                this.writer.write("extern void Axis_Delete_" + typeName
+                             + "(" + typeName + "* param, AxiscBool bArray, int nSize);\n");
+                this.writer.write("extern int Axis_Serialize_" + typeName
+                             + "(" + typeName + "* param, AXISCHANDLE pSZ, AxiscBool bArray);\n");
+                this.writer.write("extern int Axis_GetSize_" + typeName + "();\n\n");
+            }
+        }
+        catch (IOException e)
+        {
+            throw new WrapperFault(e);
+        }
+    }
+    
+    
     /* (non-Javadoc)
      * @see org.apache.axis.wsdl.wsdl2ws.BasicFileWriter#writePreprocessorStatements()
      */
@@ -224,7 +273,8 @@
         {
             Type atype;
             Iterator types = this.wscontext.getTypemap().getTypes().iterator();
-            
+
+            writer.write("#include <axis/Axis.h>\n");
             writer.write("#include <axis/GDefine.h>\n");
             writer.write("#include <axis/AxisUserAPI.h>\n");