From d3d2bb26c51ef361fc67620ac37e1ba65f863b23 Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Thu, 26 Jul 2007 19:04:35 +0300 Subject: [PATCH] New macro LIST_OF for better Doxygen support. --- src/bookmarks/backend/xbel.c | 2 +- src/bookmarks/bookmarks.h | 2 +- src/cache/cache.h | 2 +- src/config/kbdbind.c | 2 +- src/config/options.h | 2 +- src/document/css/stylesheet.h | 6 +++--- src/document/document.h | 10 +++++----- src/document/forms.h | 2 +- src/dom/Doxyfile | 6 +++--- src/ecmascript/ecmascript.h | 2 +- src/mime/backend/mailcap.c | 4 ++-- src/protocol/bittorrent/common.h | 10 +++++----- src/protocol/bittorrent/dialogs.c | 2 +- src/protocol/bittorrent/piececache.h | 4 ++-- src/session/history.h | 2 +- src/session/session.h | 8 ++++---- src/terminal/terminal.h | 4 ++-- src/util/lists.h | 7 ++++++- src/viewer/text/vs.h | 2 +- 19 files changed, 42 insertions(+), 37 deletions(-) diff --git a/src/bookmarks/backend/xbel.c b/src/bookmarks/backend/xbel.c index a7639290..f0fc4055 100644 --- a/src/bookmarks/backend/xbel.c +++ b/src/bookmarks/backend/xbel.c @@ -67,7 +67,7 @@ static void write_bookmarks_xbel(struct secure_save_info *ssi, struct tree_node { unsigned char *name; /* Name of the element */ unsigned char *text; /* Text inside the element */ - struct list_head attrs; /* {struct attributes} */ + LIST_OF(struct attributes) attrs; struct tree_node *parent; struct tree_node *children; diff --git a/src/bookmarks/bookmarks.h b/src/bookmarks/bookmarks.h index 4c576aa7..b2e639ee 100644 --- a/src/bookmarks/bookmarks.h +++ b/src/bookmarks/bookmarks.h @@ -25,7 +25,7 @@ struct bookmark { /* Bookmark lists */ -extern struct list_head bookmarks; /* struct bookmark */ +extern LIST_OF(struct bookmark) bookmarks; /* The bookmarks module */ diff --git a/src/cache/cache.h b/src/cache/cache.h index 78180bce..8ee0ad6c 100644 --- a/src/cache/cache.h +++ b/src/cache/cache.h @@ -29,7 +29,7 @@ struct cache_entry { /* Items in this list are ALLOCATED IN A NON-STANDARD WAY! Thus if you * are gonna mess with them (you shouldn't), you need to use the * mmap suite. */ - struct list_head frag; /* -> struct fragment */ + LIST_OF(struct fragment) frag; struct uri *uri; /* Identifier for the cached data */ struct uri *proxy_uri; /* Proxy identifier or same as @uri */ diff --git a/src/config/kbdbind.c b/src/config/kbdbind.c index 6a58773e..77ddd32a 100644 --- a/src/config/kbdbind.c +++ b/src/config/kbdbind.c @@ -27,7 +27,7 @@ static struct action_list action_table[KEYMAP_MAX]; static struct keymap keymap_table[KEYMAP_MAX]; -static struct list_head keymaps[KEYMAP_MAX]; /* struct keybinding */ +static LIST_OF(struct keybinding) keymaps[KEYMAP_MAX]; static void add_default_keybindings(void); diff --git a/src/config/options.h b/src/config/options.h index 77e2a157..54cea42f 100644 --- a/src/config/options.h +++ b/src/config/options.h @@ -84,7 +84,7 @@ struct session; /* session/session.h */ union option_value { /* XXX: Keep first to make @options_root initialization possible. */ /* The OPT_TREE list_head is allocated. */ - struct list_head *tree; + LIST_OF(struct option) *tree; /* Used by OPT_BOOL, OPT_INT, OPT_CODEPAGE and OPT_LANGUAGE */ int number; diff --git a/src/document/css/stylesheet.h b/src/document/css/stylesheet.h index 25432a69..98d8eac1 100644 --- a/src/document/css/stylesheet.h +++ b/src/document/css/stylesheet.h @@ -49,7 +49,7 @@ struct css_selector { CSR_ANCESTOR, /* Ancestor, i.e. the "p" in "p a". */ CSR_PARENT, /* Direct parent, i.e. the "div" in "div>img". */ } relation; - struct list_head leaves; /* -> struct css_selector */ + LIST_OF(struct css_selector) leaves; enum css_selector_type { CST_ELEMENT, @@ -60,7 +60,7 @@ struct css_selector { } type; unsigned char *name; - struct list_head properties; /* -> struct css_property */ + LIST_OF(struct css_property) properties; }; @@ -81,7 +81,7 @@ struct css_stylesheet { /* The list of basic element selectors (which can then somehow * tree up on inside). */ - struct list_head selectors; /* -> struct css_selector */ + LIST_OF(struct css_selector) selectors; /* How deeply nested are we. Limited by MAX_REDIRECTS. */ int import_level; diff --git a/src/document/document.h b/src/document/document.h index 4ea7781b..22237cc9 100644 --- a/src/document/document.h +++ b/src/document/document.h @@ -97,7 +97,7 @@ struct link { /* XXX: They don't neccessary need to be link-specific, but we just * don't support them for any other elements for now. Well, we don't * even have a good place where to store them in that case. */ - struct list_head *event_hooks; /* -> struct script_event_hook */ + LIST_OF(struct script_event_hook) *event_hooks; union { unsigned char *name; @@ -138,9 +138,9 @@ struct document { struct document_options options; - struct list_head forms; /* -> struct form */ - struct list_head tags; /* -> struct tag */ - struct list_head nodes; /* -> struct node */ + LIST_OF(struct form) forms; + LIST_OF(struct tag) tags; + LIST_OF(struct node) nodes; #ifdef CONFIG_ECMASCRIPT /* ECMAScript snippets to be executed during loading the document into @@ -149,7 +149,7 @@ struct document { * by an external reference - you must wait with processing other items * until it gets resolved and loaded. New items are guaranteed to * always appear at the list end. */ - struct list_head onload_snippets; /* -> struct string_list_item */ + LIST_OF(struct string_list_item) onload_snippets; /* FIXME: We should externally maybe using cache_entry store the * dependencies between the various entries so nothing gets removed * unneeded. */ diff --git a/src/document/forms.h b/src/document/forms.h index 0762fa5c..832bc41b 100644 --- a/src/document/forms.h +++ b/src/document/forms.h @@ -36,7 +36,7 @@ struct form { unsigned char *target; enum form_method method; - struct list_head items; /* -> struct form_control */ + LIST_OF(struct form_control) items; }; diff --git a/src/dom/Doxyfile b/src/dom/Doxyfile index e7c5022f..892cf7e7 100644 --- a/src/dom/Doxyfile +++ b/src/dom/Doxyfile @@ -188,12 +188,12 @@ PERLMOD_MAKEVAR_PREFIX = # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO +MACRO_EXPANSION = YES +EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = -PREDEFINED = +PREDEFINED = LIST_OF(element_T)="element_T list" EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- diff --git a/src/ecmascript/ecmascript.h b/src/ecmascript/ecmascript.h index 394c442e..ceac6eab 100644 --- a/src/ecmascript/ecmascript.h +++ b/src/ecmascript/ecmascript.h @@ -39,7 +39,7 @@ struct ecmascript_interpreter { * any new snippets in document.onload_snippets). Instead, as we * go through the list we maintain a pointer to the last processed * entry. */ - struct list_head onload_snippets; /* -> struct string_list_item */ + LIST_OF(struct string_list_item) onload_snippets; struct string_list_item *current_onload_snippet; /* ID of the {struct document} where those onload_snippets belong to. diff --git a/src/mime/backend/mailcap.c b/src/mime/backend/mailcap.c index aaa17b3f..1ca637a6 100644 --- a/src/mime/backend/mailcap.c +++ b/src/mime/backend/mailcap.c @@ -42,7 +42,7 @@ struct mailcap_hash_item { /* The entries associated with the type */ - struct list_head entries; /* -> struct mailcap_entry */ + LIST_OF(struct mailcap_entry) entries; /* The content type of all @entries. Must be last! */ unsigned char type[1]; @@ -683,7 +683,7 @@ int default_mime_backend, install_signal_handler, mimetypes_mime_backend, program; -struct list_head terminals; +LIST_OF(struct terminal) terminals; void die(const char *msg, ...) { diff --git a/src/protocol/bittorrent/common.h b/src/protocol/bittorrent/common.h index 87915c6c..90f1e1b6 100644 --- a/src/protocol/bittorrent/common.h +++ b/src/protocol/bittorrent/common.h @@ -117,7 +117,7 @@ struct bittorrent_peer_request { struct bittorrent_peer_status { /* FIFO-like recording of requests. */ - struct list_head requests; /* -> struct bittorrent_peer_request */ + LIST_OF(struct bittorrent_peer_request) requests; /* Flags for scheduling updating of the peer state. */ unsigned int choked:1; /* The peer was choked. */ @@ -170,7 +170,7 @@ struct bittorrent_peer_connection { /* Outgoing message queue. Note piece messages are maintained entirely * in the request list in the bittorrent_peer_status struct. */ - struct list_head queue; /* -> struct bittorrent_peer_request */ + LIST_OF(struct bittorrent_peer_request) queue; /* A bitfield of the available pieces from the peer. */ /* The size depends on the number of pieces. */ @@ -270,7 +270,7 @@ struct bittorrent_meta { /* A list with information about files in the torrent. */ /* The list is a singleton for single-file torrents. */ - struct list_head files; /* -> struct bittorrent_file */ + LIST_OF(struct bittorrent_file) files; }; enum bittorrent_connection_mode { @@ -304,11 +304,11 @@ struct bittorrent_connection { /* Active peer list */ /* The size is controlled by the protocol.bittorrent.max_active_peers * option. */ - struct list_head peers; /* -> struct bittorrent_peer_connection */ + LIST_OF(struct bittorrent_peer_connection) peers; /* List of information about potential peers. */ /* TODO: Use hash. */ - struct list_head peer_pool; /* -> struct bittorrent_peer */ + LIST_OF(struct bittorrent_peer) peer_pool; /* The peer ID of the client. */ bittorrent_id_T peer_id; diff --git a/src/protocol/bittorrent/dialogs.c b/src/protocol/bittorrent/dialogs.c index 365c5666..eec92c2a 100644 --- a/src/protocol/bittorrent/dialogs.c +++ b/src/protocol/bittorrent/dialogs.c @@ -26,7 +26,7 @@ struct bittorrent_download_info { - struct list_head labels; /* -> struct string_list_item */ + LIST_OF(struct string_list_item) labels; unsigned char *name; int *selection; size_t size; diff --git a/src/protocol/bittorrent/piececache.h b/src/protocol/bittorrent/piececache.h index c9291548..1c2a5d9e 100644 --- a/src/protocol/bittorrent/piececache.h +++ b/src/protocol/bittorrent/piececache.h @@ -60,7 +60,7 @@ struct bittorrent_piece_cache { /* A list of completed and saved entries which has been loaded into * memory. The allocated memory for all these entries is disposable. The * entries are sorted in a LRU-manner. */ - struct list_head queue; /* -> struct bittorrent_piece_cache_entry */ + LIST_OF(struct bittorrent_piece_cache_entry) queue; /* Remaining pieces are tracked using the remaining_blocks member of the * piece cache entry and a free list of piece blocks to be requested. @@ -84,7 +84,7 @@ struct bittorrent_piece_cache { * cloned flag. The flag is set when piece block requests are cloned. If * the cloned flag is set when receiving a block then the peer-list is * searched and requests for the same piece is canceled. */ - struct list_head free_list; /* -> struct bittorrent_piece_request */ + LIST_OF(struct bittorrent_piece_request) free_list; struct bittorrent_piece_cache_entry entries[1]; }; diff --git a/src/session/history.h b/src/session/history.h index 0d60d8c2..ba5959f4 100644 --- a/src/session/history.h +++ b/src/session/history.h @@ -8,7 +8,7 @@ struct ses_history { /* The first list item is the first visited location. The last list * item is the last location in the unhistory. The @current location is * included in this list. */ - struct list_head history; /* -> struct location */ + LIST_OF(struct location) history; /* The current location. This is moveable pivot pointing somewhere at * the middle of @history. */ diff --git a/src/session/session.h b/src/session/session.h index 55d37d9f..d9e33dba 100644 --- a/src/session/session.h +++ b/src/session/session.h @@ -145,7 +145,7 @@ struct session { /* The current document */ - struct list_head more_files; /* -> struct file_to_load */ + LIST_OF(struct file_to_load) more_files; struct download loading; struct uri *loading_uri; @@ -154,7 +154,7 @@ struct session { int redirect_cnt; struct document_view *doc_view; - struct list_head scrn_frames; /* -> struct document_view */ + LIST_OF(struct document_view) scrn_frames; struct uri *download_uri; @@ -192,13 +192,13 @@ struct session { /* The possibly running type queries (what-to-do-with-that-file?) */ - struct list_head type_queries; /* -> struct type_query */ + LIST_OF(struct type_query) type_queries; /* The info for status displaying */ struct session_status status; }; -extern struct list_head sessions; /* -> struct session */ +extern LIST_OF(struct session) sessions; extern enum remote_session_flags remote_session_flags; /* This returns a pointer to the current location inside of the given session. diff --git a/src/terminal/terminal.h b/src/terminal/terminal.h index f661e02a..7a14f324 100644 --- a/src/terminal/terminal.h +++ b/src/terminal/terminal.h @@ -90,7 +90,7 @@ struct terminal { * tab numbers explicitly, rather than computing them from the * stack order as is done now. Also, what should be done with the * inactive main menu? --KON */ - struct list_head windows; /* {struct window} */ + LIST_OF(struct window) windows; /* The specification of terminal in terms of terminal options. */ struct option *spec; @@ -159,7 +159,7 @@ struct terminal { memset(&(term)->prev_mouse_event, 0, sizeof((term)->prev_mouse_event)) /* We keep track about all the terminals in this list. */ -extern struct list_head terminals; +extern LIST_OF(struct terminal) terminals; extern const unsigned char frame_dumb[]; diff --git a/src/util/lists.h b/src/util/lists.h index 9cfaddcd..806e5cc5 100644 --- a/src/util/lists.h +++ b/src/util/lists.h @@ -56,7 +56,6 @@ struct xlist_head { #define LIST_HEAD(x) x *next; x *prev #define LIST_SET_MAGIC(x) list_magic_set(*(x)) - #else /* LISTDEBUG */ #define LISTMAGIC1 ((void *) 0xdadababa) @@ -118,6 +117,12 @@ struct xlist_head { #define INIT_LIST_HEAD(x) struct list_head x = { D_LIST_HEAD(x) } +/** A list intended to contain elements of a specific type. The + * parameter currently serves as documentation only. Doxyfile defines + * this macro differently in order to get better collaboration + * diagrams. */ +#define LIST_OF(element_T) struct list_head + #ifdef HAVE_TYPEOF #define list_typeof(x) typeof(x) #else diff --git a/src/viewer/text/vs.h b/src/viewer/text/vs.h index 84336bd1..6b79ec43 100644 --- a/src/viewer/text/vs.h +++ b/src/viewer/text/vs.h @@ -14,7 +14,7 @@ struct view_state { struct document_view *doc_view; struct uri *uri; - struct list_head forms; /* -> struct form_view */ + LIST_OF(struct form_view) forms; struct form_state *form_info; int form_info_len;