Better autodocs.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9760 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f8ee6e65fe
commit
7d570676f5
4 changed files with 62 additions and 30 deletions
|
|
@ -4,9 +4,8 @@ Version 1.3.32 (in progress)
|
||||||
05/03/2007: gga
|
05/03/2007: gga
|
||||||
[Ruby]
|
[Ruby]
|
||||||
Fixed Ruby documentation to use the proper css styles for
|
Fixed Ruby documentation to use the proper css styles for
|
||||||
each section.
|
each section. Added autodoc section to Ruby's docs to
|
||||||
Added autodoc section to document the features supported by
|
document the features supported by Ruby in documenting its modules.
|
||||||
Ruby in documenting its modules.
|
|
||||||
|
|
||||||
05/03/2007: gga
|
05/03/2007: gga
|
||||||
[Ruby]
|
[Ruby]
|
||||||
|
|
@ -18,6 +17,7 @@ Version 1.3.32 (in progress)
|
||||||
Improved autodoc generation.
|
Improved autodoc generation.
|
||||||
Added autodoc .swg files to Ruby library for easily adding
|
Added autodoc .swg files to Ruby library for easily adding
|
||||||
documentation to common Ruby methods and STL methods.
|
documentation to common Ruby methods and STL methods.
|
||||||
|
Fixed autodoc documenting of getters and setters and module.
|
||||||
Made test suite always generate autodocs.
|
Made test suite always generate autodocs.
|
||||||
|
|
||||||
05/03/2007: gga
|
05/03/2007: gga
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,6 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#if 0
|
|
||||||
} /* cc-mode */
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -398,8 +395,5 @@ SWIG_Ruby_SetModule(swig_module_info *pointer)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if 0
|
|
||||||
{ /* cc-mode */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,4 @@ AUTODOC(push_front, "Add an element at the beginning of the $class");
|
||||||
AUTODOC(push_back, "Add an element at the end of the $class");
|
AUTODOC(push_back, "Add an element at the end of the $class");
|
||||||
AUTODOC(pop_front, "Remove and return element at the beginning of the $class");
|
AUTODOC(pop_front, "Remove and return element at the beginning of the $class");
|
||||||
AUTODOC(pop_back, "Remove and return an element at the end of the $class");
|
AUTODOC(pop_back, "Remove and return an element at the end of the $class");
|
||||||
|
AUTODOC(clear, "Clear $class contents");
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,9 @@ enum autodoc_t {
|
||||||
AUTODOC_DTOR,
|
AUTODOC_DTOR,
|
||||||
AUTODOC_STATICFUNC,
|
AUTODOC_STATICFUNC,
|
||||||
AUTODOC_FUNC,
|
AUTODOC_FUNC,
|
||||||
AUTODOC_METHOD
|
AUTODOC_METHOD,
|
||||||
|
AUTODOC_GETTER,
|
||||||
|
AUTODOC_SETTER
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *usage = "\
|
static const char *usage = "\
|
||||||
|
|
@ -542,8 +544,12 @@ private:
|
||||||
|
|
||||||
case AUTODOC_FUNC:
|
case AUTODOC_FUNC:
|
||||||
case AUTODOC_METHOD:
|
case AUTODOC_METHOD:
|
||||||
|
case AUTODOC_GETTER:
|
||||||
Printf(doc, " Document-method: %s\n\n", symname);
|
Printf(doc, " Document-method: %s\n\n", symname);
|
||||||
break;
|
break;
|
||||||
|
case AUTODOC_SETTER:
|
||||||
|
Printf(doc, " Document-method: %s=\n\n", symname);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -555,6 +561,7 @@ private:
|
||||||
case AUTODOC_STATICFUNC:
|
case AUTODOC_STATICFUNC:
|
||||||
case AUTODOC_FUNC:
|
case AUTODOC_FUNC:
|
||||||
case AUTODOC_METHOD:
|
case AUTODOC_METHOD:
|
||||||
|
case AUTODOC_GETTER:
|
||||||
{
|
{
|
||||||
String *paramList = make_autodocParmList(n, showTypes);
|
String *paramList = make_autodocParmList(n, showTypes);
|
||||||
if (Len(paramList))
|
if (Len(paramList))
|
||||||
|
|
@ -565,6 +572,12 @@ private:
|
||||||
Printf(doc, " -> %s", type);
|
Printf(doc, " -> %s", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AUTODOC_SETTER:
|
||||||
|
{
|
||||||
|
Printf(doc, " %s=(x)", symname);
|
||||||
|
if (type) Printf(doc, " -> %s", type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -605,6 +618,8 @@ private:
|
||||||
case AUTODOC_STATICFUNC:
|
case AUTODOC_STATICFUNC:
|
||||||
case AUTODOC_FUNC:
|
case AUTODOC_FUNC:
|
||||||
case AUTODOC_METHOD:
|
case AUTODOC_METHOD:
|
||||||
|
case AUTODOC_GETTER:
|
||||||
|
{
|
||||||
if (counter == 0) Printf(doc, " call-seq:\n");
|
if (counter == 0) Printf(doc, " call-seq:\n");
|
||||||
String *paramList = make_autodocParmList(n, showTypes);
|
String *paramList = make_autodocParmList(n, showTypes);
|
||||||
if (Len(paramList))
|
if (Len(paramList))
|
||||||
|
|
@ -615,6 +630,14 @@ private:
|
||||||
Printf(doc, " -> %s", type);
|
Printf(doc, " -> %s", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AUTODOC_SETTER:
|
||||||
|
{
|
||||||
|
Printf(doc, " call-seq:\n");
|
||||||
|
Printf(doc, " %s=(x)", symname);
|
||||||
|
if (type) Printf(doc, " -> %s", type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's overloaded then get the next decl and loop around again
|
// if it's overloaded then get the next decl and loop around again
|
||||||
|
|
@ -627,24 +650,25 @@ private:
|
||||||
if (!skipAuto) {
|
if (!skipAuto) {
|
||||||
switch (ad_type) {
|
switch (ad_type) {
|
||||||
case AUTODOC_CLASS:
|
case AUTODOC_CLASS:
|
||||||
|
case AUTODOC_DTOR:
|
||||||
break;
|
break;
|
||||||
case AUTODOC_CTOR:
|
case AUTODOC_CTOR:
|
||||||
Printf(doc, "Class constructor.\n");
|
Printf(doc, "Class constructor.\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUTODOC_DTOR:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case AUTODOC_STATICFUNC:
|
case AUTODOC_STATICFUNC:
|
||||||
Printf(doc, "A static function.\n");
|
Printf(doc, "A class method.\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUTODOC_FUNC:
|
case AUTODOC_FUNC:
|
||||||
Printf(doc, "A function.\n");
|
Printf(doc, "A module function.\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AUTODOC_METHOD:
|
case AUTODOC_METHOD:
|
||||||
Printf(doc, "A method.\n");
|
Printf(doc, "An instance method.\n");
|
||||||
|
break;
|
||||||
|
case AUTODOC_GETTER:
|
||||||
|
Printf(doc, "Get value of attribute.\n");
|
||||||
|
break;
|
||||||
|
case AUTODOC_SETTER:
|
||||||
|
Printf(doc, "Set new value for attribute.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1012,6 +1036,8 @@ public:
|
||||||
Printf(f_header, "static VALUE %s;\n", modvar);
|
Printf(f_header, "static VALUE %s;\n", modvar);
|
||||||
|
|
||||||
/* Start generating the initialization function */
|
/* Start generating the initialization function */
|
||||||
|
String* docs = docstring(n, AUTODOC_CLASS);
|
||||||
|
Printf(f_init, "/*\n%s\n*/", docs );
|
||||||
Printv(f_init, "\n", "#ifdef __cplusplus\n", "extern \"C\"\n", "#endif\n", "SWIGEXPORT void Init_", feature, "(void) {\n", "size_t i;\n", "\n", NIL);
|
Printv(f_init, "\n", "#ifdef __cplusplus\n", "extern \"C\"\n", "#endif\n", "SWIGEXPORT void Init_", feature, "(void) {\n", "size_t i;\n", "\n", NIL);
|
||||||
|
|
||||||
Printv(f_init, tab4, "VALUE parent = Qnil;\n", NIL);
|
Printv(f_init, tab4, "VALUE parent = Qnil;\n", NIL);
|
||||||
|
|
@ -1955,10 +1981,11 @@ public:
|
||||||
* --------------------------------------------------------------------- */
|
* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int variableWrapper(Node *n) {
|
virtual int variableWrapper(Node *n) {
|
||||||
String* docs = docstring(n, AUTODOC_METHOD);
|
String* docs = docstring(n, AUTODOC_GETTER);
|
||||||
Printf(f_wrappers, "%s", docs);
|
Printf(f_wrappers, "%s", docs);
|
||||||
Delete(docs);
|
Delete(docs);
|
||||||
|
|
||||||
|
|
||||||
char *name = GetChar(n, "name");
|
char *name = GetChar(n, "name");
|
||||||
char *iname = GetChar(n, "sym:name");
|
char *iname = GetChar(n, "sym:name");
|
||||||
SwigType *t = Getattr(n, "type");
|
SwigType *t = Getattr(n, "type");
|
||||||
|
|
@ -2001,6 +2028,10 @@ public:
|
||||||
setfname = NewString("NULL");
|
setfname = NewString("NULL");
|
||||||
} else {
|
} else {
|
||||||
/* create setter */
|
/* create setter */
|
||||||
|
String* docs = docstring(n, AUTODOC_SETTER);
|
||||||
|
Printf(f_wrappers, "%s", docs);
|
||||||
|
Delete(docs);
|
||||||
|
|
||||||
String *setname = Swig_name_set(iname);
|
String *setname = Swig_name_set(iname);
|
||||||
setfname = Swig_name_wrapper(setname);
|
setfname = Swig_name_wrapper(setname);
|
||||||
Printv(setf->def, "SWIGINTERN VALUE\n", setfname, "(VALUE self, ", NIL);
|
Printv(setf->def, "SWIGINTERN VALUE\n", setfname, "(VALUE self, ", NIL);
|
||||||
|
|
@ -2563,10 +2594,16 @@ public:
|
||||||
* -------------------------------------------------------------------- */
|
* -------------------------------------------------------------------- */
|
||||||
|
|
||||||
virtual int membervariableHandler(Node *n) {
|
virtual int membervariableHandler(Node *n) {
|
||||||
String* docs = docstring(n, AUTODOC_METHOD);
|
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 = MEMBER_VAR;
|
current = MEMBER_VAR;
|
||||||
Language::membervariableHandler(n);
|
Language::membervariableHandler(n);
|
||||||
current = NO_CPP;
|
current = NO_CPP;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue