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 wh...@apache.org on 2005/01/14 18:29:53 UTC
cvs commit: ws-axis/c/src/cbindings AxisExceptionC.cpp BasicNodeC.cpp
whitlock 2005/01/14 09:29:53
Modified: c/src/engine Axis.cpp
c/tools/org/apache/axis/tools/cbindings
CBindingGenerator.java cbindinggenerator.conf
c/tools/org/apache/axis/tools/common MethodPart.java
c/tools/org/apache/axis/tools/trace TraceInstrumentor.java
tracetool.conf
Added: c/src/cbindings AxisExceptionC.cpp BasicNodeC.cpp
Log:
C bindings for AxisException and BasicNode
Initialise trace before initialising the XML parser library
Revision Changes Path
1.89 +3 -3 ws-axis/c/src/engine/Axis.cpp
Index: Axis.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/Axis.cpp,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- Axis.cpp 11 Jan 2005 17:01:47 -0000 1.88
+++ Axis.cpp 14 Jan 2005 17:29:52 -0000 1.89
@@ -351,7 +351,6 @@
*/
if (status == AXIS_SUCCESS)
{
- XMLParserFactory::initialize();
#if defined(ENABLE_AXISTRACE)
status = AxisTrace::openFileByClient ();
/* //Samisa: 01/09/2004
@@ -363,9 +362,10 @@
}
*/
#endif
+ XMLParserFactory::initialize();
SOAPTransportFactory::initialize();
- char *pClientWsddPath =
- g_pConfig->getAxisConfProperty(AXCONF_CLIENTWSDDFILEPATH);
+ char *pClientWsddPath =
+ g_pConfig->getAxisConfProperty(AXCONF_CLIENTWSDDFILEPATH);
/* May be there is no client side handlers configured. So may not
* have CLIENTWSDDFILEPATH entry in axiscpp.conf
1.6 +50 -23 ws-axis/c/tools/org/apache/axis/tools/cbindings/CBindingGenerator.java
Index: CBindingGenerator.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/cbindings/CBindingGenerator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CBindingGenerator.java 14 Jan 2005 13:55:30 -0000 1.5
+++ CBindingGenerator.java 14 Jan 2005 17:29:52 -0000 1.6
@@ -24,6 +24,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
+import java.util.*;
import org.apache.axis.tools.common.CParsingTool;
import org.apache.axis.tools.common.Configuration;
@@ -140,11 +141,7 @@
case FilePart.TYPEDEF :
prevPart = fp.getType();
- // TODO: make sure all typedefs are prefixed with AXISC_
- text = changeAxisToAxisc(fp.toString().trim());
- text = replaceInString(text,"bool","AxiscBool",null);
- outputFile.write(text);
- outputFile.newLine();
+ generateTypedef(fp, outputFile);
break;
case FilePart.METHOD :
@@ -184,16 +181,15 @@
//TODO: replace axis with axisc, etc
String text = fp.toString().trim();
if (-1 != text.indexOf("include")) {
- StringBuffer sb = new StringBuffer(text);
- int ext = sb.indexOf(".hpp");
- int dot = sb.indexOf(".");
- if (-1 != ext) {
- // change .hpp ext to .h
- sb.delete(ext + 2, ext + 4);
- text = sb.toString();
- } else if (-1 == dot) {
+ if (-1 == text.indexOf(".")) {
// remove C++ includes with no ext
text = new String();
+ } else {
+ // Putting #includes of GDefine and AxisUserAPI in <> not "" is needed for the
+ // ant build because those 2 headers aren't generated.
+ text = replaceInString(text,"\"GDefine.hpp\"","<axis/GDefine.hpp>",null);
+ text = replaceInString(text,"\"AxisUserAPI.hpp\"","<axis/AxisUserAPI.hpp>",null);
+ text = replaceInString(text,".hpp",".h",null);
}
outputFile.write(text);
outputFile.newLine();
@@ -211,6 +207,24 @@
}
}
+ private void generateTypedef(
+ FilePart fp,
+ BufferedWriter outputFile)
+ throws Exception {
+
+ String text = changeAxisToAxisc(fp.toString().trim());
+ text = replaceInString(text,"bool","AxiscBool",null);
+
+ // Put AXISC_ on to the front of the typedef name which is always at the end.
+ StringTokenizer st = new StringTokenizer(text);
+ String tok = null;
+ while (st.hasMoreTokens()) tok = st.nextToken();
+ text = replaceInString(text,tok,"AXISC_"+tok,null);
+
+ outputFile.write(text);
+ outputFile.newLine();
+ }
+
private void generateFunctionPrototype(
FilePart fp,
BufferedWriter outputFile)
@@ -268,9 +282,9 @@
}
if (sign.isConstructor()) {
- text += "AXISCHANDLE AXISC_STORAGE_CLASS_INFO axiscCreate" + classname + "(";
+ text += "AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscCreate" + classname + "(";
} else if (sign.isDestructor()) {
- text += "void AXISC_STORAGE_CLASS_INFO axiscDestroy" + classname + "(AXISCHANDLE ";
+ text += "AXISC_STORAGE_CLASS_INFO void axiscDestroy" + classname + "(AXISCHANDLE ";
String prettyClass = classNamePretty(classname);
text += Character.toLowerCase(prettyClass.charAt(0));
text += prettyClass.substring(1);
@@ -278,7 +292,7 @@
text += ", ";
} else {
String retType = toCType(sign.getReturnType());
- text += retType + " AXISC_STORAGE_CLASS_INFO ";
+ text += "AXISC_STORAGE_CLASS_INFO " + retType + " ";
text += "axisc";
text += Character.toUpperCase(method.charAt(0));
text += method.substring(1);
@@ -330,6 +344,12 @@
return className;
}
+ private final static Set cpptypes =
+ new HashSet(
+ Arrays.asList(
+ new Object[] { "(", ")", "*", ",", "&", "]", "[", "const", "void",
+ "byte", "char", "unsigned", "signed", "int", "short", "long","double","float" }));
+
/**
* Converts a C++ datatype to a C-style datatype.
* References are converted to pointers.
@@ -358,8 +378,12 @@
type += "AxiscAnyType";
} else if ("bool".equals(tok)) {
type += "AxiscBool";
- } else {
+ } else if (-1 != tok.toLowerCase().indexOf("axis")) {
type += changeAxisToAxisc(tok);
+ } else if (!cpptypes.contains(tok) && !tok.startsWith("xsd")) {
+ type += "AXISC_"+tok;
+ } else {
+ type += tok;
}
if (it.hasNext())
type += " ";
@@ -413,6 +437,7 @@
}
public static void main(String[] args) {
+ boolean failed = false;
try {
CBindingGenerator gen = new CBindingGenerator(args);
File source = gen.checkFile("-source");
@@ -424,15 +449,17 @@
gen,
new HashSet(Arrays.asList(new Object[] { "hpp" })));
tree.walkTree(source, target, 0);
- if (gen.failed) {
- Utils.outputDebugString("Finished! (but encountered problems)");
- System.exit(-2);
- }
+ failed = gen.failed;
} catch (Exception exception) {
exception.printStackTrace();
- } finally {
- Utils.outputDebugString("Finished!");
+ failed = true;
}
+
+ if (failed) {
+ Utils.outputDebugString("Finished! (but encountered problems)");
+ System.exit(-2);
+ }
+ Utils.outputDebugString("Finished!");
}
protected void printUsage() {
1.4 +4 -0 ws-axis/c/tools/org/apache/axis/tools/cbindings/cbindinggenerator.conf
Index: cbindinggenerator.conf
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/cbindings/cbindinggenerator.conf,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cbindinggenerator.conf 7 Jan 2005 16:35:20 -0000 1.3
+++ cbindinggenerator.conf 14 Jan 2005 17:29:52 -0000 1.4
@@ -28,11 +28,15 @@
excludefile=GDefine.hpp
excludefile=AxisUserAPI.hpp
excludefile=Handler.hpp
+excludefile=BasicHandler.hpp
+excludefile=IHandlerSoapSerializer.hpp
+excludefile=IHandlerSoapDeSerializer.hpp
#
excludemethod=BasicNode::serialize
excludemethod=Call::getTransport
excludemethod=Call::getSOAPSerializer
excludemethod=IMessageData::setService
excludemethod=IMessageData::getService
+excludemethod=BasicNode::BasicNode
1.3 +8 -1 ws-axis/c/tools/org/apache/axis/tools/common/MethodPart.java
Index: MethodPart.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/common/MethodPart.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MethodPart.java 6 Jan 2005 16:21:28 -0000 1.2
+++ MethodPart.java 14 Jan 2005 17:29:52 -0000 1.3
@@ -57,14 +57,19 @@
if (-1 == idxC || (-1 != idxR && idxR < idxC)) {
String frag = b.substring(0, idxR);
String rest = b.substring(idxR + "return".length());
- String retVal = rest.substring(0, Utils.indexOf(rest, ';'));
+
+ int semicolon = Utils.indexOf(rest, ';');
+ if (-1==semicolon) Utils.rude("Missing semicolon in "+signature);
+ String retVal = rest.substring(0, semicolon);
BodyPart bp = new BodyPart(frag, retVal);
al.add(bp);
b = b.substring(idxR + "return".length() + retVal.length() + 1);
} else {
String frag = b.substring(0, idxC);
String rest = b.substring(idxC);
+
int brace = Utils.indexOf(rest, "{");
+ if (-1==brace) Utils.rude("Missing open brace in "+signature);
Signature signature = new Signature(rest.substring(0,brace));
frag = frag + rest.substring(0,brace+1);
BodyPart bp = new BodyPart(frag, signature.getParameters()[0]);
@@ -94,7 +99,9 @@
// exit is added before the last brace. This could be tricky to fix.
if ((0 == al.size() || -1 != Utils.indexOf(b, ';'))
&& null == signature.getReturnType().getType()) {
+
int last = b.lastIndexOf('}');
+ if (-1==last) Utils.rude("Missing end brace in "+signature);
String b2 = b.substring(0, last);
al.add(new BodyPart(b2));
b = b.substring(last);
1.4 +9 -6 ws-axis/c/tools/org/apache/axis/tools/trace/TraceInstrumentor.java
Index: TraceInstrumentor.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/trace/TraceInstrumentor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TraceInstrumentor.java 13 Jan 2005 14:07:06 -0000 1.3
+++ TraceInstrumentor.java 14 Jan 2005 17:29:52 -0000 1.4
@@ -161,6 +161,7 @@
}
public static void main(String[] args) {
+ boolean failed = false;
try {
TraceInstrumentor ti = new TraceInstrumentor(args);
File source = ti.checkFile("-source");
@@ -169,15 +170,17 @@
DirectoryTree tree = new DirectoryTree(ti, null);
tree.walkTree(source, target, 0);
- if (ti.failed) {
- Utils.outputDebugString("Finished! (but encountered problems)");
- System.exit(-2);
- }
+ failed = ti.failed;
} catch (Exception exception) {
exception.printStackTrace();
- } finally {
- Utils.outputDebugString("Finished!");
+ failed = true;
}
+
+ if (failed) {
+ Utils.outputDebugString("Finished! (but encountered problems)");
+ System.exit(-2);
+ }
+ Utils.outputDebugString("Finished!");
}
protected void printUsage() {
1.7 +2 -0 ws-axis/c/tools/org/apache/axis/tools/trace/tracetool.conf
Index: tracetool.conf
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/trace/tracetool.conf,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- tracetool.conf 13 Jan 2005 14:07:06 -0000 1.6
+++ tracetool.conf 14 Jan 2005 17:29:52 -0000 1.7
@@ -65,6 +65,8 @@
#
attribute=AXISCALL
attribute=STORAGE_CLASS_INFO
+attribute=AXISCCALL
+attribute=AXISC_STORAGE_CLASS_INFO
#
ifdef=ENABLE_AXISTRACE
namespace=axiscpp
1.1 ws-axis/c/src/cbindings/AxisExceptionC.cpp
Index: AxisExceptionC.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <axis/AxisException.hpp>
AXIS_CPP_NAMESPACE_USE
extern "C" {
#include <axis/AxisException.h>
AXISC_STORAGE_CLASS_INFO void axiscDestroyAxisException(AXISCHANDLE axisException) {
AxisException *ae = (AxisException*)axisException;
delete ae;
}
AXISC_STORAGE_CLASS_INFO const char * axiscWhat(AXISCHANDLE axisException) {
AxisException *ae = (AxisException*)axisException;
return ae->what();
}
AXISC_STORAGE_CLASS_INFO const int axiscGetExceptionCode(AXISCHANDLE axisException) {
AxisException *ae = (AxisException*)axisException;
return ae->getExceptionCode();
}
}
1.1 ws-axis/c/src/cbindings/BasicNodeC.cpp
Index: BasicNodeC.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <axis/BasicNode.hpp>
AXIS_CPP_NAMESPACE_USE
extern "C" {
#include <axis/BasicNode.h>
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetAttribute(AXISCHANDLE basicNode, AxiscChar * pachPrefix,
AxiscChar * pachURI, AxiscChar * pachLocalname) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getAttribute(pachPrefix,pachURI,pachLocalname);
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetFirstAttribute(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getFirstAttribute();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetLastAttribute(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getLastAttribute();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetNextAttribute(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getNextAttribute();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetCurrentAttribute(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getCurrentAttribute();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscCreateAttributeBasicNode(AXISCHANDLE basicNode, const AxiscChar * localname,
const AxiscChar * prefix, const AxiscChar * uri, const AxiscChar * value) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->createAttribute(localname,prefix,uri,value);
}
AXISC_STORAGE_CLASS_INFO const AxiscChar * axiscGetLocalNameBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getLocalName();
}
AXISC_STORAGE_CLASS_INFO int axiscGetNoOfChildrenBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getNoOfChildren();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetFirstChildBasicNodeBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getFirstChild();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetLastChildBasicNodeBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getLastChild();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscGetChildBasicNodeBasicNode(AXISCHANDLE basicNode, int iChildPosition) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getChild(iChildPosition);
}
AXISC_STORAGE_CLASS_INFO int axiscAddChildBasicNode(AXISCHANDLE basicNode, AXISCHANDLE pBasicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->addChild((BasicNode*)pBasicNode);
}
AXISC_STORAGE_CLASS_INFO AXISC_NODE_TYPE axiscGetNodeType(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return (AXISC_NODE_TYPE)bn->getNodeType();
}
AXISC_STORAGE_CLASS_INFO const AxiscChar * axiscGetValueBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getValue();
}
AXISC_STORAGE_CLASS_INFO int axiscSetValueBasicNode(AXISCHANDLE basicNode, const AxiscChar * pachValue) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->setValue(pachValue);
}
AXISC_STORAGE_CLASS_INFO int axiscSetURIBasicNode(AXISCHANDLE basicNode, const AxiscChar * sURI) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->setURI(sURI);
}
AXISC_STORAGE_CLASS_INFO int axiscSetLocalNameBasicNode(AXISCHANDLE basicNode, const AxiscChar * sLocalName) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->setLocalName(sLocalName);
}
AXISC_STORAGE_CLASS_INFO int axiscSetPrefixBasicNode(AXISCHANDLE basicNode, const AxiscChar * sPrefix) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->setPrefix(sPrefix);
}
AXISC_STORAGE_CLASS_INFO const AxiscChar * axiscGetURIBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getURI();
}
AXISC_STORAGE_CLASS_INFO const AxiscChar * axiscGetPrefixBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->getPrefix();
}
AXISC_STORAGE_CLASS_INFO AXISCHANDLE axiscCloneBasicNodeBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
return bn->clone();
}
AXISC_STORAGE_CLASS_INFO void axiscDestroyBasicNode(AXISCHANDLE basicNode) {
BasicNode *bn = (BasicNode*)basicNode;
delete bn;
}
}