Code formatting fixes in doxygen code
This commit is contained in:
parent
0483caaed5
commit
73c585b994
4 changed files with 109 additions and 111 deletions
|
|
@ -53,50 +53,52 @@ static int rename_active = 0;
|
|||
/* Doxygen comments scanning */
|
||||
int scan_doxygen_comments = 0;
|
||||
|
||||
int isStructuralDoxygen(String *s){
|
||||
static const char* const structuralTags[] = {
|
||||
"addtogroup",
|
||||
"callgraph",
|
||||
"callergraph",
|
||||
"category",
|
||||
"def",
|
||||
"defgroup",
|
||||
"dir",
|
||||
"example",
|
||||
"file",
|
||||
"headerfile",
|
||||
"internal",
|
||||
"mainpage",
|
||||
"name",
|
||||
"nosubgrouping",
|
||||
"overload",
|
||||
"package",
|
||||
"page",
|
||||
"protocol",
|
||||
"relates",
|
||||
"relatesalso",
|
||||
"showinitializer",
|
||||
"weakgroup",
|
||||
};
|
||||
int isStructuralDoxygen(String *s) {
|
||||
static const char* const structuralTags[] = {
|
||||
"addtogroup",
|
||||
"callgraph",
|
||||
"callergraph",
|
||||
"category",
|
||||
"def",
|
||||
"defgroup",
|
||||
"dir",
|
||||
"example",
|
||||
"file",
|
||||
"headerfile",
|
||||
"internal",
|
||||
"mainpage",
|
||||
"name",
|
||||
"nosubgrouping",
|
||||
"overload",
|
||||
"package",
|
||||
"page",
|
||||
"protocol",
|
||||
"relates",
|
||||
"relatesalso",
|
||||
"showinitializer",
|
||||
"weakgroup",
|
||||
};
|
||||
|
||||
unsigned n;
|
||||
char *slashPointer = Strchr(s, '\\');
|
||||
char *atPointer = Strchr(s,'@');
|
||||
if (slashPointer == NULL && atPointer == NULL) return 0;
|
||||
else if( slashPointer == NULL) slashPointer = atPointer;
|
||||
unsigned n;
|
||||
char *slashPointer = Strchr(s, '\\');
|
||||
char *atPointer = Strchr(s,'@');
|
||||
if (slashPointer == NULL && atPointer == NULL)
|
||||
return 0;
|
||||
else if(slashPointer == NULL)
|
||||
slashPointer = atPointer;
|
||||
|
||||
slashPointer++; /* skip backslash or at sign */
|
||||
slashPointer++; /* skip backslash or at sign */
|
||||
|
||||
for (n = 0; n < sizeof(structuralTags)/sizeof(structuralTags[0]); n++) {
|
||||
const size_t len = strlen(structuralTags[n]);
|
||||
if (strncmp(slashPointer, structuralTags[n], len) == 0) {
|
||||
/* Take care to avoid false positives with prefixes of other tags. */
|
||||
if (slashPointer[len] == '\0' || isspace(slashPointer[len]))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
for (n = 0; n < sizeof(structuralTags)/sizeof(structuralTags[0]); n++) {
|
||||
const size_t len = strlen(structuralTags[n]);
|
||||
if (strncmp(slashPointer, structuralTags[n], len) == 0) {
|
||||
/* Take care to avoid false positives with prefixes of other tags. */
|
||||
if (slashPointer[len] == '\0' || isspace(slashPointer[len]))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -427,7 +429,7 @@ static int yylook(void) {
|
|||
do {
|
||||
String *cmt = Scanner_text(scan);
|
||||
char *loc = Char(cmt);
|
||||
if ((strncmp(loc,"/*@SWIG",7) == 0) && (loc[Len(cmt)-3] == '@')) {
|
||||
if ((strncmp(loc, "/*@SWIG", 7) == 0) && (loc[Len(cmt)-3] == '@')) {
|
||||
Scanner_locator(scan, cmt);
|
||||
}
|
||||
if (scan_doxygen_comments) { /* else just skip this node, to avoid crashes in parser module*/
|
||||
|
|
@ -437,9 +439,7 @@ static int yylook(void) {
|
|||
if (Len(cmt) > 3 && loc[0] == '/' &&
|
||||
((loc[1] == '/' && ((loc[2] == '/' && loc[3] != '/') || loc[2] == '!')) ||
|
||||
(loc[1] == '*' && ((loc[2] == '*' && loc[3] != '*') || loc[2] == '!')))) {
|
||||
comment_kind_t this_comment = loc[3] == '<' ? DOX_COMMENT_POST
|
||||
: DOX_COMMENT_PRE;
|
||||
|
||||
comment_kind_t this_comment = loc[3] == '<' ? DOX_COMMENT_POST : DOX_COMMENT_PRE;
|
||||
if (existing_comment != DOX_COMMENT_NONE && this_comment != existing_comment) {
|
||||
/* We can't concatenate together Doxygen pre- and post-comments. */
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1723,8 +1723,8 @@ program : interface {
|
|||
interface : interface declaration {
|
||||
/* add declaration to end of linked list (the declaration isn't always a single declaration, sometimes it is a linked list itself) */
|
||||
if (currentDeclComment != NULL) {
|
||||
set_comment($2, currentDeclComment);
|
||||
currentDeclComment = NULL;
|
||||
set_comment($2, currentDeclComment);
|
||||
currentDeclComment = NULL;
|
||||
}
|
||||
appendChild($1,$2);
|
||||
$$ = $1;
|
||||
|
|
@ -1736,7 +1736,7 @@ interface : interface declaration {
|
|||
| interface DOXYGENPOSTSTRING {
|
||||
Node *node = lastChild($1);
|
||||
if (node) {
|
||||
set_comment(node, $2);
|
||||
set_comment(node, $2);
|
||||
}
|
||||
$$ = $1;
|
||||
}
|
||||
|
|
@ -5048,7 +5048,11 @@ rawparms : parm ptail {
|
|||
set_nextSibling($1,$2);
|
||||
$$ = $1;
|
||||
}
|
||||
| empty { $$ = 0; previousNode = currentNode; currentNode=0; }
|
||||
| empty {
|
||||
$$ = 0;
|
||||
previousNode = currentNode;
|
||||
currentNode=0;
|
||||
}
|
||||
;
|
||||
|
||||
ptail : COMMA parm ptail {
|
||||
|
|
@ -5057,7 +5061,7 @@ ptail : COMMA parm ptail {
|
|||
}
|
||||
| COMMA DOXYGENPOSTSTRING parm ptail {
|
||||
set_comment(previousNode, $2);
|
||||
set_nextSibling($3,$4);
|
||||
set_nextSibling($3, $4);
|
||||
$$ = $3;
|
||||
}
|
||||
| empty { $$ = 0; }
|
||||
|
|
|
|||
|
|
@ -590,10 +590,10 @@ public:
|
|||
|
||||
if (module_imports)
|
||||
Printf(f_module, "%s\n", module_imports);
|
||||
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(f_module, "/* This was generated from top() */");
|
||||
Printv(f_module, Char(doxygen_comments), NIL);
|
||||
Delete(doxygen_comments);
|
||||
|
|
@ -1019,7 +1019,7 @@ public:
|
|||
Delete(c_param_type);
|
||||
Delete(arg);
|
||||
}
|
||||
|
||||
|
||||
Printv(f->code, nondir_args, NIL);
|
||||
Delete(nondir_args);
|
||||
|
||||
|
|
@ -1274,16 +1274,15 @@ public:
|
|||
EnumFeature enum_feature = decodeEnumFeature(n);
|
||||
String *typemap_lookup_type = Getattr(n, "name");
|
||||
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter) {
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter) {
|
||||
Printf(enum_code, "/* This was generated from enumDeclaration() */");
|
||||
}
|
||||
Printv(enum_code, Char(doxygen_comments), NIL);
|
||||
Delete(doxygen_comments);
|
||||
}
|
||||
|
||||
|
||||
if ((enum_feature != SimpleEnum) && symname && typemap_lookup_type) {
|
||||
// Wrap (non-anonymous) C/C++ enum within a typesafe, typeunsafe or proper Java enum
|
||||
|
||||
|
|
@ -1306,18 +1305,16 @@ public:
|
|||
Replaceall(enum_code, "$static ", "");
|
||||
Delete(scope);
|
||||
} else {
|
||||
//translate and write javadoc comment for the enum itself if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
// Translate and write javadoc comment for the enum itself if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(constants_code, "/* This was generated from enumDeclaration() */");
|
||||
Printf(constants_code, "/* Comment for enum %s */\n",
|
||||
Getattr(n, "unnamedinstance") ? "" : symname);
|
||||
Printf(constants_code, "/* Comment for enum %s */\n", Getattr(n, "unnamedinstance") ? "" : symname);
|
||||
Printf(constants_code, Char(doxygen_comments));
|
||||
Printf(constants_code, "\n");
|
||||
Delete(doxygen_comments);
|
||||
}
|
||||
else if (symname && !Getattr(n, "unnamedinstance"))
|
||||
} else if (symname && !Getattr(n, "unnamedinstance"))
|
||||
Printf(constants_code, " // %s \n", symname);
|
||||
}
|
||||
|
||||
|
|
@ -1430,7 +1427,7 @@ public:
|
|||
tmpValue = NewString(name);
|
||||
// Note that this is used in enumValue() amongst other places
|
||||
Setattr(n, "value", tmpValue);
|
||||
|
||||
|
||||
// Deal with enum values that are not int
|
||||
int swigtype = SwigType_type(Getattr(n, "type"));
|
||||
if (swigtype == T_BOOL) {
|
||||
|
|
@ -1472,10 +1469,10 @@ public:
|
|||
if (!addSymbol(symname, n, scope))
|
||||
return SWIG_ERROR;
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
// Translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(enum_code, "/* This was generated from enumvalueDeclaration() */");
|
||||
Printv(enum_code, Char(doxygen_comments), NIL);
|
||||
Delete(doxygen_comments);
|
||||
|
|
@ -1557,13 +1554,12 @@ public:
|
|||
String *tm;
|
||||
String *return_type = NewString("");
|
||||
String *constants_code = NewString("");
|
||||
|
||||
Swig_save("constantWrapper", n, "value", NIL);
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
// Translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(constants_code, "/* This was generated from constantWrapper() */");
|
||||
Printv(constants_code, Char(doxygen_comments), NIL);
|
||||
Delete(doxygen_comments);
|
||||
|
|
@ -2008,11 +2004,11 @@ public:
|
|||
|
||||
// Pure Java interfaces
|
||||
const String *pure_interfaces = typemapLookup(n, "javainterfaces", typemap_lookup_type, WARN_NONE);
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
|
||||
// Translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(proxy_class_def, "/* This was generated from emitProxyClassDefAndCPPCasts() */");
|
||||
Printv(proxy_class_def, Char(doxygen_comments), NIL);
|
||||
Delete(doxygen_comments);
|
||||
|
|
@ -2021,7 +2017,6 @@ public:
|
|||
if (*Char(interface_list) && *Char(pure_interfaces))
|
||||
Append(interface_list, ", ");
|
||||
Append(interface_list, pure_interfaces);
|
||||
|
||||
// Start writing the proxy class
|
||||
if (!has_outerclass) // Import statements
|
||||
Printv(proxy_class_def, typemapLookup(n, "javaimports", typemap_lookup_type, WARN_NONE),"\n", NIL);
|
||||
|
|
@ -2506,11 +2501,11 @@ public:
|
|||
// For wrapping member variables (Javabean setter)
|
||||
setter_flag = (Cmp(Getattr(n, "sym:name"), Swig_name_set(getNSpace(), Swig_name_member(0, getClassPrefix(), variable_name))) == 0);
|
||||
}
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
|
||||
// Translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(function_code, "/* This was generated from proxyclassfunctionhandler() */");
|
||||
Printv(function_code, Char(doxygen_comments), NIL);
|
||||
Delete(doxygen_comments);
|
||||
|
|
@ -2750,16 +2745,16 @@ public:
|
|||
|
||||
tm = Getattr(n, "tmap:jtype"); // typemaps were attached earlier to the node
|
||||
Printf(im_return_type, "%s", tm);
|
||||
|
||||
//translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
|
||||
// Translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(function_code, "/* This was generated from constructionhandler() */");
|
||||
Printv(function_code, Char(doxygen_comments), NIL);
|
||||
Delete(doxygen_comments);
|
||||
}
|
||||
|
||||
|
||||
Printf(function_code, " %s %s(", methodmods, proxy_class_name);
|
||||
Printf(helper_code, " static private %s SwigConstruct%s(", im_return_type, proxy_class_name);
|
||||
|
||||
|
|
@ -3024,11 +3019,11 @@ public:
|
|||
bool setter_flag = false;
|
||||
String *pre_code = NewString("");
|
||||
String *post_code = NewString("");
|
||||
|
||||
// translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)){
|
||||
String *doxygen_comments=doxygenTranslator->getDocumentation(n);
|
||||
if(comment_creation_chatter)
|
||||
|
||||
// Translate and write javadoc comment if flagged
|
||||
if (doxygen && doxygenTranslator->hasDocumentation(n)) {
|
||||
String *doxygen_comments = doxygenTranslator->getDocumentation(n);
|
||||
if (comment_creation_chatter)
|
||||
Printf(function_code, "/* This was generated from moduleClassFunctionHandler() */");
|
||||
Printv(function_code, doxygen_comments, NIL);
|
||||
Delete(doxygen_comments);
|
||||
|
|
@ -3514,7 +3509,6 @@ public:
|
|||
const String *pure_baseclass = typemapLookup(n, "javabase", type, WARN_NONE);
|
||||
const String *pure_interfaces = typemapLookup(n, "javainterfaces", type, WARN_NONE);
|
||||
|
||||
|
||||
// Emit the class
|
||||
Printv(swigtype, typemapLookup(n, "javaimports", type, WARN_NONE), // Import statements
|
||||
"\n", typemapLookup(n, "javaclassmodifiers", type, WARN_JAVA_TYPEMAP_CLASSMOD_UNDEF), // Class modifiers
|
||||
|
|
@ -4993,4 +4987,3 @@ Java Options (available with -java)\n\
|
|||
-oldvarnames - Old intermediary method names for variable wrappers\n\
|
||||
-package <name> - Set name of the Java package to <name>\n\
|
||||
\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -1688,14 +1688,16 @@ public:
|
|||
|
||||
/* ------------------------------------------------------------
|
||||
* build_combined_docstring()
|
||||
* Build the full docstring which may be a combination of the
|
||||
* explicit docstring and autodoc string or, if none of them
|
||||
* is specified, obtained by translating Doxygen comment to
|
||||
* Python.
|
||||
*
|
||||
* Return new string to be deleted by caller (never NIL but
|
||||
* may be empty if there is no docstring).
|
||||
* Build the full docstring which may be a combination of the
|
||||
* explicit docstring and autodoc string or, if none of them
|
||||
* is specified, obtained by translating Doxygen comment to
|
||||
* Python.
|
||||
*
|
||||
* Return new string to be deleted by caller (never NIL but
|
||||
* may be empty if there is no docstring).
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
String *build_combined_docstring(Node *n, autodoc_t ad_type, const String *indent = "") {
|
||||
String *docstr = Getattr(n, "feature:docstring");
|
||||
if (docstr && Len(docstr)) {
|
||||
|
|
@ -1708,14 +1710,14 @@ public:
|
|||
}
|
||||
|
||||
if (Getattr(n, "feature:autodoc") && !GetFlag(n, "feature:noautodoc")) {
|
||||
String* autodoc = make_autodoc(n, ad_type);
|
||||
String *autodoc = make_autodoc(n, ad_type);
|
||||
if (autodoc && Len(autodoc) > 0) {
|
||||
if (docstr && Len(docstr)) {
|
||||
Append(autodoc, "\n");
|
||||
Append(autodoc, docstr);
|
||||
}
|
||||
|
||||
String* tmp = autodoc;
|
||||
String *tmp = autodoc;
|
||||
autodoc = docstr;
|
||||
docstr = tmp;
|
||||
}
|
||||
|
|
@ -1751,8 +1753,7 @@ public:
|
|||
// """
|
||||
//
|
||||
// otherwise, put it all on a single line
|
||||
if (Strchr(docstr, '\n'))
|
||||
{
|
||||
if (Strchr(docstr, '\n')) {
|
||||
String *tmp = NewString("");
|
||||
Append(tmp, "\n");
|
||||
Append(tmp, indent_docstring(docstr, indent));
|
||||
|
|
@ -3728,7 +3729,7 @@ public:
|
|||
}
|
||||
|
||||
if (f_s) {
|
||||
if(needs_swigconstant(n)) {
|
||||
if (needs_swigconstant(n)) {
|
||||
Printv(f_s, "\n",NIL);
|
||||
Printv(f_s, module, ".", iname, "_swigconstant(",module,")\n", NIL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue