You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by wh...@apache.org on 2005/01/13 18:35:36 UTC
cvs commit: ws-axis/c/tools/org/apache/axis/tools/cbindings CBindingGenerator.java
whitlock 2005/01/13 09:35:36
Modified: c/tools/org/apache/axis/tools/cbindings
CBindingGenerator.java
Log:
Change bool to AxiscBool in typedefs
Revision Changes Path
1.4 +22 -24 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CBindingGenerator.java 13 Jan 2005 12:37:53 -0000 1.3
+++ CBindingGenerator.java 13 Jan 2005 17:35:36 -0000 1.4
@@ -141,7 +141,9 @@
case FilePart.TYPEDEF :
prevPart = fp.getType();
// TODO: make sure all typedefs are prefixed with AXISC_
- outputFile.write(changeAxisToAxisc(fp.toString().trim()));
+ text = changeAxisToAxisc(fp.toString().trim());
+ text = replaceInString(text,"bool","AxiscBool",null);
+ outputFile.write(text);
outputFile.newLine();
break;
@@ -384,32 +386,28 @@
* Does not convert Axisc, axisc or AXISC_
*/
private static String changeAxisToAxisc(String text) throws Exception {
- String[] from = { "axis", "Axis", "AXIS" };
- String[] to = { "axisc", "Axisc", "AXISC_" };
- String[] postfix = { "c", "c", "C" };
+ text = replaceInString(text,"axis","axisc",null);
+ text = replaceInString(text,"Axis","Axisc","Axisc");
+ text = replaceInString(text,"AXIS","AXISC","AXISC_");
+ return text;
+ }
+ /**
+ * Replaces from with to in text, excluding strings that start with exclude.
+ */
+ private static String replaceInString(String text, String from, String to, String exclude) throws Exception {
int idx = 0;
- while (idx < text.length()
- && -1 != text.toLowerCase().indexOf("axis", idx)) {
- int newidx = text.length();
- String c = "c";
- for (int arridx = 0; arridx < from.length; arridx++) {
- int axis = text.indexOf(from[arridx], idx);
- if (-1 != axis && axis < newidx) {
- newidx = axis;
- if (text.indexOf(to[arridx], idx) == axis)
- c = "";
- else
- c = postfix[arridx];
- }
- }
-
- if (text.length() != newidx && c.length() > 0)
+ while (-1 != text.indexOf(from, idx)) {
+ int start = text.indexOf(from, idx);
+ if (null == exclude || text.indexOf(exclude, idx) != start) {
text =
- text.substring(0, newidx + 4)
- + c
- + text.substring(newidx + 4);
- idx = newidx + 4 + c.length();
+ text.substring(0, start)
+ + to
+ + text.substring(start + from.length());
+ idx = start + to.length();
+ } else {
+ idx = start + exclude.length();
+ }
}
return text;
}