private void generateFunctionPrototype(
FilePart fp,
BufferedWriter outputFile)
throws Exception {
Signature sign = null;
if (FilePart.PROTOTYPE == fp.getType()) {
PrototypePart pp = (PrototypePart) fp;
sign = pp.getSignature();
} else {
MethodPart mp = (MethodPart) fp;
sign = mp.getSignature();
}
// Ignore private methods.
if (!sign.getScope().equals("public") &&
!sign.getScope().equals("protected"))
return;
String classname = sign.getClassName();
if (null != classname && classname.endsWith("::"))
classname = classname.substring(0, classname.length() - 2);
String method = sign.getMethodName();
if (Configuration.methodExcluded(classname, method))
return;
Parameter[] parms = sign.getParameters();
String text = new String();
// Look to see if this method is overloaded by another method
// in the same class or a different class. If methods in two
// different classes happen to have the same name, then change
// their names. If methods are overloaded in the same class then
// convert the longest method prototype to C. We should really
// superset the parameters in the two prototypes instead of
// picking the longest one.
List overloads = headers.getMethods(method);
boolean sameClass = true;
if (overloads.size() > 1) {
Iterator it = overloads.iterator();
while (it.hasNext()) {
Signature s = (Signature) it.next();
if (!s.getTrimClassName().equals(classname))
sameClass = false;
else {
int n1 = 0;
int n2 = 0;
if (null != s.getParameters())
n1 = s.getParameters().length;
if (null != sign.getParameters())
n2 = sign.getParameters().length;
if (n1 > n2)
return;
}