SF.net SVN: geany-plugins:[1330] trunk/geanygendoc/src/ggd.c

colombanw at users.sourceforge.net colombanw at xxxxx
Sat May 1 18:12:33 UTC 2010


Revision: 1330
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1330&view=rev
Author:   colombanw
Date:     2010-05-01 18:12:33 +0000 (Sat, 01 May 2010)

Log Message:
-----------
GeanyGenDoc: Don't use a hard-coded list of what can have arguments

Always generate arguments list if the tag have one.
In the same spirit, always generate the "returns" symbol too even
when it doesn't make sense; simply let the template use it or not.

Modified Paths:
--------------
    trunk/geanygendoc/src/ggd.c

Modified: trunk/geanygendoc/src/ggd.c
===================================================================
--- trunk/geanygendoc/src/ggd.c	2010-05-01 17:49:41 UTC (rev 1329)
+++ trunk/geanygendoc/src/ggd.c	2010-05-01 18:12:33 UTC (rev 1330)
@@ -146,19 +146,16 @@
                  GeanyDocument *doc,
                  const TMTag   *tag)
 {
-  CtplEnviron *env;
-  GList       *children = NULL;
-  GPtrArray   *tag_array = doc->tm_file->tags_array;
+  CtplEnviron  *env;
+  GList        *children = NULL;
+  GPtrArray    *tag_array = doc->tm_file->tags_array;
+  gboolean      returns;
   
   env = ctpl_environ_new ();
   ctpl_environ_push_string (env, "cursor", GGD_CURSOR_IDENTIFIER);
   ctpl_environ_push_string (env, "symbol", tag->name);
-  /* get arguments & return type if appropriate */
-  if (tag->type & (tm_tag_function_t |
-                   tm_tag_macro_with_arg_t |
-                   tm_tag_prototype_t |
-                   tm_tag_method_t)) {
-    gboolean    returns;
+  /* get argument list it it exists */
+  if (tag->atts.entry.arglist) {
     CtplValue  *v;
     
     v = get_arg_list_from_string (ft, tag->atts.entry.arglist);
@@ -166,11 +163,13 @@
       ctpl_environ_push (env, "argument_list", v);
       ctpl_value_free (v);
     }
-    returns = ! (tag->atts.entry.var_type != NULL &&
-                 /* C-style none return type hack */
-                 strcmp ("void", tag->atts.entry.var_type) == 0);
-    ctpl_environ_push_int (env, "returns", returns);
   }
+  /* get return type -- no matter if the return concept is pointless for that
+   * particular tag, it's up to the rule to use it when it makes sense */
+  returns = ! (tag->atts.entry.var_type != NULL &&
+               /* C-style none return type hack */
+               strcmp ("void", tag->atts.entry.var_type) == 0);
+  ctpl_environ_push_int (env, "returns", returns);
   /* get direct children tags */
   children = ggd_tag_find_children (tag_array, tag,
                                     FILETYPE_ID (doc->file_type), 0);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list