devhelp r1064 - in trunk: . src
- From: rhult svn gnome org
- To: svn-commits-list gnome org
- Subject: devhelp r1064 - in trunk: . src
- Date: Wed, 1 Oct 2008 17:53:55 +0000 (UTC)
Author: rhult
Date: Wed Oct 1 17:53:54 2008
New Revision: 1064
URL: http://svn.gnome.org/viewvc/devhelp?rev=1064&view=rev
Log:
2008-10-01 Richard Hult <richard imendio com>
Add support for the keyword types added to gtk-doc output in
devhelp2 files:
* src/dh-link.c: (dh_link_new): Init ref count.
* src/dh-link.h: Add the types here.
* src/dh-keyword-model.c: (dh_keyword_model_set_words):
* src/dh-parser.c: (parser_start_node_cb): Parse them.
Modified:
trunk/ChangeLog
trunk/src/dh-keyword-model.c
trunk/src/dh-link.c
trunk/src/dh-link.h
trunk/src/dh-parser.c
Modified: trunk/src/dh-keyword-model.c
==============================================================================
--- trunk/src/dh-keyword-model.c (original)
+++ trunk/src/dh-keyword-model.c Wed Oct 1 17:53:54 2008
@@ -468,6 +468,11 @@
g_list_prepend (priv->page_list, link);
break;
case DH_LINK_TYPE_KEYWORD:
+ case DH_LINK_TYPE_FUNCTION:
+ case DH_LINK_TYPE_STRUCT:
+ case DH_LINK_TYPE_MACRO:
+ case DH_LINK_TYPE_ENUM:
+ case DH_LINK_TYPE_TYPEDEF:
priv->keys_list =
g_list_prepend (priv->keys_list, link);
break;
@@ -475,7 +480,6 @@
g_assert_not_reached();
}
}
-
}
DhLink *
Modified: trunk/src/dh-link.c
==============================================================================
--- trunk/src/dh-link.c (original)
+++ trunk/src/dh-link.c Wed Oct 1 17:53:54 2008
@@ -67,6 +67,8 @@
link->book = g_strdup (book);
link->page = g_strdup (page);
link->uri = g_strdup (uri);
+
+ link->ref_count = 1;
return link;
}
Modified: trunk/src/dh-link.h
==============================================================================
--- trunk/src/dh-link.h (original)
+++ trunk/src/dh-link.h Wed Oct 1 17:53:54 2008
@@ -32,7 +32,12 @@
typedef enum {
DH_LINK_TYPE_BOOK,
DH_LINK_TYPE_PAGE,
- DH_LINK_TYPE_KEYWORD
+ DH_LINK_TYPE_KEYWORD,
+ DH_LINK_TYPE_FUNCTION,
+ DH_LINK_TYPE_STRUCT,
+ DH_LINK_TYPE_MACRO,
+ DH_LINK_TYPE_ENUM,
+ DH_LINK_TYPE_TYPEDEF
} DhLinkType;
struct _DhLink {
@@ -70,5 +75,3 @@
gboolean is_deprecated);
#endif /* __DH_LINK_H__ */
-
-
Modified: trunk/src/dh-parser.c
==============================================================================
--- trunk/src/dh-parser.c (original)
+++ trunk/src/dh-parser.c Wed Oct 1 17:53:54 2008
@@ -237,9 +237,12 @@
}
else if (parser->parsing_functions) {
gboolean ok = FALSE;
+ const gchar *type = NULL;
const gchar *name = NULL;
const gchar *link = NULL;
const gchar *deprecated = NULL;
+ DhLinkType link_type;
+ gchar *tmp;
if (g_ascii_strcasecmp (node_name, "function") == 0) {
ok = TRUE;
@@ -275,7 +278,11 @@
for (i = 0; attribute_names[i]; ++i) {
if (g_ascii_strcasecmp (attribute_names[i],
- "name") == 0) {
+ "type") == 0) {
+ type = attribute_values[i];
+ }
+ else if (g_ascii_strcasecmp (attribute_names[i],
+ "name") == 0) {
name = attribute_values[i];
}
else if (g_ascii_strcasecmp (attribute_names[i],
@@ -295,7 +302,19 @@
DH_ERROR,
DH_ERROR_MALFORMED_BOOK,
_("name and link elements are required "
- "inside <function> on line %d, column %d"),
+ "inside <keyword> on line %d, column %d"),
+ line, col);
+ return;
+ }
+
+ if (parser->version == 2 && !type) {
+ /* Required */
+ g_markup_parse_context_get_position (context, &line, &col);
+ g_set_error (error,
+ DH_ERROR,
+ DH_ERROR_MALFORMED_BOOK,
+ _("type element is required "
+ "inside <keyword> on line %d, column %d"),
line, col);
return;
}
@@ -313,23 +332,49 @@
else if (g_str_has_prefix (name, "enum ")) {
name = name + 5;
}
-
+
full_link = g_strconcat (parser->base, "/", link, NULL);
page = extract_page_name (link);
- if (g_str_has_suffix (name, " ()")) {
- gchar *tmp;
+ if (parser->version == 2) {
+ if (strcmp (type, "function") == 0) {
+ link_type = DH_LINK_TYPE_FUNCTION;
+ }
+ else if (strcmp (type, "struct") == 0) {
+ link_type = DH_LINK_TYPE_STRUCT;
+ }
+ else if (strcmp (type, "macro") == 0) {
+ link_type = DH_LINK_TYPE_MACRO;
+ }
+ else if (strcmp (type, "enum") == 0) {
+ link_type = DH_LINK_TYPE_ENUM;
+ }
+ else if (strcmp (type, "typedef") == 0) {
+ link_type = DH_LINK_TYPE_TYPEDEF;
+ } else {
+ link_type = DH_LINK_TYPE_KEYWORD;
+ }
+ } else {
+ link_type = DH_LINK_TYPE_KEYWORD;
+ }
+
+ if (g_str_has_suffix (name, " ()")) {
tmp = g_strndup (name, strlen (name) - 3);
- dh_link = dh_link_new (DH_LINK_TYPE_KEYWORD, tmp,
- DH_LINK (parser->book_node->data)->book,
- page, full_link);
- g_free (tmp);
+
+ if (link_type == DH_LINK_TYPE_KEYWORD) {
+ link_type = DH_LINK_TYPE_FUNCTION;
+ }
+ name = tmp;
} else {
- dh_link = dh_link_new (DH_LINK_TYPE_KEYWORD, name,
- DH_LINK (parser->book_node->data)->book,
- page, full_link);
+ tmp = NULL;
}
+ dh_link = dh_link_new (link_type, name,
+ DH_LINK (parser->book_node->data)->book,
+ page, full_link);
+
+ g_free (tmp);
+
g_free (full_link);
g_free (page);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]