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:
parent
86258412fb
commit
e90e28acfc
1 changed files with 41 additions and 8 deletions
|
|
@ -22,6 +22,7 @@ static int treduce = SWIG_cparse_template_reduce(0);
|
||||||
class RClass {
|
class RClass {
|
||||||
private:
|
private:
|
||||||
String *temp;
|
String *temp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
String *name; /* class name (renamed) */
|
String *name; /* class name (renamed) */
|
||||||
String *cname; /* original C class/struct name */
|
String *cname; /* original C class/struct name */
|
||||||
|
|
@ -47,6 +48,7 @@ public:
|
||||||
String *prefix;
|
String *prefix;
|
||||||
String *init;
|
String *init;
|
||||||
|
|
||||||
|
|
||||||
int constructor_defined;
|
int constructor_defined;
|
||||||
int destructor_defined;
|
int destructor_defined;
|
||||||
|
|
||||||
|
|
@ -167,7 +169,7 @@ private:
|
||||||
bool multipleInheritance;
|
bool multipleInheritance;
|
||||||
|
|
||||||
// Wrap modes
|
// Wrap modes
|
||||||
enum {
|
enum WrapperMode {
|
||||||
NO_CPP,
|
NO_CPP,
|
||||||
MEMBER_FUNC,
|
MEMBER_FUNC,
|
||||||
CONSTRUCTOR_ALLOCATE,
|
CONSTRUCTOR_ALLOCATE,
|
||||||
|
|
@ -192,6 +194,9 @@ private:
|
||||||
EXTEND_TYPES_AUTODOC = 3 // extended documentation and parameter types + names
|
EXTEND_TYPES_AUTODOC = 3 // extended documentation and parameter types + names
|
||||||
};
|
};
|
||||||
|
|
||||||
|
autodoc_t last_mode;
|
||||||
|
String* last_autodoc;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
autodoc_l autodoc_level(String *autodoc) {
|
autodoc_l autodoc_level(String *autodoc) {
|
||||||
|
|
@ -470,7 +475,30 @@ private:
|
||||||
full_name = NewString("");
|
full_name = NewString("");
|
||||||
Append(full_name, class_name);
|
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");
|
String *doc = NewString("/*\n");
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
bool skipAuto = false;
|
bool skipAuto = false;
|
||||||
|
|
@ -502,10 +530,6 @@ private:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
symname = Getattr(n, "sym:name");
|
|
||||||
if ( Getattr( special_methods, symname ) )
|
|
||||||
symname = Getattr( special_methods, symname );
|
|
||||||
|
|
||||||
SwigType *type = Getattr(n, "type");
|
SwigType *type = Getattr(n, "type");
|
||||||
|
|
||||||
if (type) {
|
if (type) {
|
||||||
|
|
@ -717,6 +741,7 @@ private:
|
||||||
Delete(full_name);
|
Delete(full_name);
|
||||||
Delete(class_name);
|
Delete(class_name);
|
||||||
Delete(super_names);
|
Delete(super_names);
|
||||||
|
Delete(methodName);
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
@ -734,6 +759,7 @@ public:
|
||||||
modvar = 0;
|
modvar = 0;
|
||||||
feature = 0;
|
feature = 0;
|
||||||
prefix = 0;
|
prefix = 0;
|
||||||
|
last_autodoc = NewString("");
|
||||||
current = NO_CPP;
|
current = NO_CPP;
|
||||||
classes = 0;
|
classes = 0;
|
||||||
klass = 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);
|
Printf(f->code, "{rb_raise(rb_eArgError, \"wrong # of arguments(%%d for %d)\",argc); SWIG_fail;}\n", numreq - start);
|
||||||
} else {
|
} else {
|
||||||
if ( !start )
|
|
||||||
|
if ( current == NO_CPP )
|
||||||
{
|
{
|
||||||
String* docs = docstring(n, AUTODOC_FUNC);
|
String* docs = docstring(n, AUTODOC_FUNC);
|
||||||
Printf(f_wrappers, "%s", docs);
|
Printf(f_wrappers, "%s", docs);
|
||||||
|
|
@ -2694,10 +2721,16 @@ public:
|
||||||
* --------------------------------------------------------------------- */
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int staticmembervariableHandler(Node *n) {
|
virtual int staticmembervariableHandler(Node *n) {
|
||||||
String* docs = docstring(n, AUTODOC_STATICFUNC);
|
String* docs = docstring(n, AUTODOC_GETTER);
|
||||||
Printf(f_wrappers, "%s", docs);
|
Printf(f_wrappers, "%s", docs);
|
||||||
Delete(docs);
|
Delete(docs);
|
||||||
|
|
||||||
|
if (is_assignable(n)) {
|
||||||
|
String* docs = docstring(n, AUTODOC_SETTER);
|
||||||
|
Printf(f_wrappers, "%s", docs);
|
||||||
|
Delete(docs);
|
||||||
|
}
|
||||||
|
|
||||||
current = STATIC_VAR;
|
current = STATIC_VAR;
|
||||||
Language::staticmembervariableHandler(n);
|
Language::staticmembervariableHandler(n);
|
||||||
current = NO_CPP;
|
current = NO_CPP;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue