Removed some bloat from repeated autodoc comments.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9769 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Gonzalo Garramuno 2007-05-04 00:37:08 +00:00
commit e90e28acfc

View file

@ -22,6 +22,7 @@ static int treduce = SWIG_cparse_template_reduce(0);
class RClass {
private:
String *temp;
public:
String *name; /* class name (renamed) */
String *cname; /* original C class/struct name */
@ -47,6 +48,7 @@ public:
String *prefix;
String *init;
int constructor_defined;
int destructor_defined;
@ -167,7 +169,7 @@ private:
bool multipleInheritance;
// Wrap modes
enum {
enum WrapperMode {
NO_CPP,
MEMBER_FUNC,
CONSTRUCTOR_ALLOCATE,
@ -192,6 +194,9 @@ private:
EXTEND_TYPES_AUTODOC = 3 // extended documentation and parameter types + names
};
autodoc_t last_mode;
String* last_autodoc;
autodoc_l autodoc_level(String *autodoc) {
@ -470,7 +475,30 @@ private:
full_name = NewString("");
Append(full_name, class_name);
String *symname = NULL;
String* symname = Getattr(n, "sym:name");
if ( Getattr( special_methods, symname ) )
symname = Getattr( special_methods, symname );
String* methodName = NewString(full_name);
Append(methodName, symname);
// Each overloaded function will try to get documented,
// so we keep the name of the last overloaded function and its type.
// Documenting just from functionWrapper() is not possible as
// sym:name has already been changed to include the class name
if ( last_mode == ad_type && Cmp(methodName, last_autodoc) == 0 ) {
Delete(full_name);
Delete(class_name);
Delete(super_names);
Delete(methodName);
return NewString("");
}
last_mode = ad_type;
last_autodoc = Copy(methodName);
String *doc = NewString("/*\n");
int counter = 0;
bool skipAuto = false;
@ -502,10 +530,6 @@ private:
break;
}
symname = Getattr(n, "sym:name");
if ( Getattr( special_methods, symname ) )
symname = Getattr( special_methods, symname );
SwigType *type = Getattr(n, "type");
if (type) {
@ -717,6 +741,7 @@ private:
Delete(full_name);
Delete(class_name);
Delete(super_names);
Delete(methodName);
return doc;
}
@ -734,6 +759,7 @@ public:
modvar = 0;
feature = 0;
prefix = 0;
last_autodoc = NewString("");
current = NO_CPP;
classes = 0;
klass = 0;
@ -1639,7 +1665,8 @@ public:
}
Printf(f->code, "{rb_raise(rb_eArgError, \"wrong # of arguments(%%d for %d)\",argc); SWIG_fail;}\n", numreq - start);
} else {
if ( !start )
if ( current == NO_CPP )
{
String* docs = docstring(n, AUTODOC_FUNC);
Printf(f_wrappers, "%s", docs);
@ -2694,10 +2721,16 @@ public:
* --------------------------------------------------------------------- */
virtual int staticmembervariableHandler(Node *n) {
String* docs = docstring(n, AUTODOC_STATICFUNC);
String* docs = docstring(n, AUTODOC_GETTER);
Printf(f_wrappers, "%s", docs);
Delete(docs);
if (is_assignable(n)) {
String* docs = docstring(n, AUTODOC_SETTER);
Printf(f_wrappers, "%s", docs);
Delete(docs);
}
current = STATIC_VAR;
Language::staticmembervariableHandler(n);
current = NO_CPP;