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/17 13:39:16 UTC
cvs commit: ws-axis/c/tools/org/apache/axis/tools/trace Tracer.java
whitlock 2005/01/17 04:39:16
Modified: c/src/common AxisTrace.cpp AxisTrace.h
c/tools/org/apache/axis/tools/cbindings
CBindingGenerator.java
c/tools/org/apache/axis/tools/common Parameter.java
Utils.java
c/tools/org/apache/axis/tools/trace Tracer.java
Log:
Trace methods with unnamed parameters
Revision Changes Path
1.53 +4 -0 ws-axis/c/src/common/AxisTrace.cpp
Index: AxisTrace.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- AxisTrace.cpp 13 Jan 2005 16:32:01 -0000 1.52
+++ AxisTrace.cpp 17 Jan 2005 12:39:16 -0000 1.53
@@ -449,6 +449,10 @@
}
break;
+ case TRACETYPE_ANONYMOUS:
+ line += "<ANONYMOUS>";
+ break;
+
default:
sprintf(prim,"%d",type);
line += "<UNKNOWNTYPE";
1.25 +1 -0 ws-axis/c/src/common/AxisTrace.h
Index: AxisTrace.h
===================================================================
RCS file: /home/cvs/ws-axis/c/src/common/AxisTrace.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- AxisTrace.h 13 Jan 2005 12:37:53 -0000 1.24
+++ AxisTrace.h 17 Jan 2005 12:39:16 -0000 1.25
@@ -76,6 +76,7 @@
#define TRACETYPE_DATA 13
#define TRACETYPE_STRING 14
#define TRACETYPE_STLSTRING 15
+#define TRACETYPE_ANONYMOUS 16
class AxisTraceEntrypoints {
public:
1.7 +3 -7 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CBindingGenerator.java 14 Jan 2005 17:29:52 -0000 1.6
+++ CBindingGenerator.java 17 Jan 2005 12:39:16 -0000 1.7
@@ -344,12 +344,6 @@
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.
@@ -380,7 +374,9 @@
type += "AxiscBool";
} else if (-1 != tok.toLowerCase().indexOf("axis")) {
type += changeAxisToAxisc(tok);
- } else if (!cpptypes.contains(tok) && !tok.startsWith("xsd")) {
+ } else if (!Utils.cTypeQualifiers.contains(tok) &&
+ !Utils.cPrimitives.contains(tok) &&
+ !tok.startsWith("xsd")) {
type += "AXISC_"+tok;
} else {
type += tok;
1.3 +18 -6 ws-axis/c/tools/org/apache/axis/tools/common/Parameter.java
Index: Parameter.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/common/Parameter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Parameter.java 6 Jan 2005 16:21:28 -0000 1.2
+++ Parameter.java 17 Jan 2005 12:39:16 -0000 1.3
@@ -60,6 +60,7 @@
// Some methods return have void on their signature and others
// have nothing. So to make them both the same, if a method
// doesn't return anything make type null.
+ // TODO: This assumption is wrong - methods that return nothing default to returning an int!
if (1 == type.size() && "void".equals(type.get(0)))
type = new ArrayList();
@@ -79,14 +80,25 @@
if (-1 != arrIdx)
nameIdx = arrIdx - 1;
- // Construct the type
- for (int i = 0; i < nameIdx; i++)
- type.add(parts.get(i));
-
+ // Even in real method declarations, parameters may not have a name
+ boolean noName = false;
name = (String) parts.get(nameIdx);
- if (-1 != arrIdx)
- for (int i = arrIdx; i < parts.size(); i++)
+ if (Utils.cPrimitives.contains(name) || Utils.cTypeQualifiers.contains(name))
+ noName = true;
+
+ if (noName) {
+ name = null;
+ for (int i = 0; i < parts.size(); i++)
type.add(parts.get(i));
+ } else {
+ // Construct the type
+ for (int i = 0; i < nameIdx; i++)
+ type.add(parts.get(i));
+
+ if (-1 != arrIdx)
+ for (int i = arrIdx; i < parts.size(); i++)
+ type.add(parts.get(i));
+ }
}
}
1.2 +13 -0 ws-axis/c/tools/org/apache/axis/tools/common/Utils.java
Index: Utils.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/common/Utils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Utils.java 17 Dec 2004 11:49:48 -0000 1.1
+++ Utils.java 17 Jan 2005 12:39:16 -0000 1.2
@@ -15,6 +15,8 @@
*/
package org.apache.axis.tools.common;
+import java.util.*;
+
/**
* Static utility methods. Some of these methods are similar to the methods on
* java.lang.String except they are aware of C/C++ comments and string literals.
@@ -22,6 +24,17 @@
* TODO: Many of these methods would perform better using StringBuffer not String
*/
public final class Utils {
+ // All the C primitive data types
+ public final static Set cPrimitives =
+ new HashSet( Arrays.asList( new Object[] {
+ "void", "byte", "char", "unsigned", "signed", "int", "short", "long","double","float" }));
+
+ // All the qualifiers that can affect C types
+ public final static Set cTypeQualifiers =
+ new HashSet(
+ Arrays.asList(
+ new Object[] { "(", ")", "*", ",", "&", "]", "[", "const" }));
+
public final static String whitespace = " \t\r\n";
/**
1.4 +9 -3 ws-axis/c/tools/org/apache/axis/tools/trace/Tracer.java
Index: Tracer.java
===================================================================
RCS file: /home/cvs/ws-axis/c/tools/org/apache/axis/tools/trace/Tracer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Tracer.java 13 Jan 2005 14:07:06 -0000 1.3
+++ Tracer.java 17 Jan 2005 12:39:16 -0000 1.4
@@ -253,7 +253,7 @@
+ signature.getMethodName()
+ "\", "
+ returnIndex
- + getTypeParms(signature.getReturnType())
+ + getTypeParms(signature.getReturnType(), true)
+ ");\t"
+ SIGNATURE
+ "\n";
@@ -318,15 +318,21 @@
// TODO cope with STL strings
// TODO cope with pointers to primitives
// TODO cope with references
- private String getTypeParms(Parameter p) {
+ private String getTypeParms(Parameter p) { return getTypeParms(p,false); }
+ private String getTypeParms(Parameter p, boolean isRetType) {
// copes with catch (...)
if ("...".equals(p.getType()))
return " ";
String parms = ",\n\t\t\t\t\tTRACETYPE_";
String name = p.getName();
- if (null == name)
+ if (isRetType)
name = "traceRet";
+ else if (null == name) {
+ // A parameter without a name can't be traced
+ parms += "ANONYMOUS, 0, NULL";
+ return parms;
+ }
name = "((void*)&" + name + ")";
String type = p.getTypeWithoutConst();