[PATCH 1/4] doc: use markdown tildes for code blocks

Bill Spitzak spitzak at gmail.com
Tue Dec 2 18:29:33 PST 2014


This requires doxygen 1.8 or newer.
I could not figure out how to make configure.ac test the doxygen
version number. It appears to be really complex. So it will run with
any version of doxygen and the doc output is somewhat mangled.
---
 src/wayland-client.c |   14 +++++++-------
 src/wayland-server.h |   16 ++++++++--------
 src/wayland-util.h   |   24 +++++++++++++-----------
 3 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 36380fe..9dddb29 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -1326,12 +1326,12 @@ wl_display_prepare_read_queue(struct wl_display *display,
  * it will assume the file descriptor is readable and read events from
  * the fd by calling wl_display_dispatch().  Simplified, we have:
  *
- * \code
+ * ~~~
  * wl_display_dispatch_pending(display);
  * wl_display_flush(display);
  * poll(fds, nfds, -1);
  * wl_display_dispatch(display);
- * \endcode
+ * ~~~
  *
  * There are two races here: first, before blocking in poll(), the fd
  * could become readable and another thread reads the events.  Some of
@@ -1346,14 +1346,15 @@ wl_display_prepare_read_queue(struct wl_display *display,
  * fds in the event loop.
  *
  * A correct sequence would be:
- * \code
+ *
+ * ~~~
  * while (wl_display_prepare_read(display) != 0)
  *         wl_display_dispatch_pending(display);
  * wl_display_flush(display);
  * poll(fds, nfds, -1);
  * wl_display_read_events(display);
  * wl_display_dispatch_pending(display);
- * \endcode
+ * ~~~
  *
  * Here we call wl_display_prepare_read(), which ensures that between
  * returning from that call and eventually calling
@@ -1602,7 +1603,7 @@ wl_display_get_error(struct wl_display *display)
  *                   still valid; the client must know if it deleted the object.
  * \return           The error code as defined in the interface specification.
  *
- * \code
+ * ~~~
  * int err = wl_display_get_error(display);
  *
  * if (err == EPROTO) {
@@ -1611,8 +1612,7 @@ wl_display_get_error(struct wl_display *display)
  * }
  *
  * ...
- *
- *  \endcode
+ * ~~~
  */
 WL_EXPORT uint32_t
 wl_display_get_protocol_error(struct wl_display *display,
diff --git a/src/wayland-server.h b/src/wayland-server.h
index af2f03d..22185e8 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -144,36 +144,36 @@ wl_client_post_no_memory(struct wl_client *client);
  * listener should be done through provided accessor methods. A listener can
  * only listen to one signal at a time.
  *
- * \code
+ * ~~~
  * struct wl_listener your_listener;
  *
  * your_listener.notify = your_callback_method;
  *
- * // Direct access
+ * \comment{Direct access}
  * wl_signal_add(&some_object->destroy_signal, &your_listener);
  *
- * // Accessor access
+ * \comment{Accessor access}
  * wl_event_loop *loop = ...;
  * wl_event_loop_add_destroy_listener(loop, &your_listener);
- * \endcode
+ * ~~~
  *
  * If the listener is part of a larger struct, #wl_container_of can be used
  * to retrieve a pointer to it:
  *
- * \code
+ * ~~~
  * void your_listener(struct wl_listener *listener, void *data)
  * {
  * 	struct your_data *data;
  *
  * 	your_data = wl_container_of(listener, data, your_member_name);
  * }
- * \endcode
+ * ~~~
  *
  * If you need to remove a listener from a signal, use wl_list_remove().
  *
- * \code
+ * ~~~
  * wl_list_remove(&your_listener.link);
- * \endcode
+ * ~~~
  *
  * \sa wl_signal
  */
diff --git a/src/wayland-util.h b/src/wayland-util.h
index a4b22b5..d61ce0a 100644
--- a/src/wayland-util.h
+++ b/src/wayland-util.h
@@ -88,7 +88,8 @@ struct wl_interface {
  * "item_t", and the item member as "struct wl_list link".
  *
  * The following code will initialize a list:
- * \code
+ *
+ * ~~~
  * struct wl_list foo_list;
  *
  * struct item_t {
@@ -98,20 +99,21 @@ struct wl_interface {
  * struct item_t item1, item2, item3;
  *
  * wl_list_init(&foo_list);
- * wl_list_insert(&foo_list, &item1.link);	// Pushes item1 at the head
- * wl_list_insert(&foo_list, &item2.link);	// Pushes item2 at the head
- * wl_list_insert(&item2.link, &item3.link);	// Pushes item3 after item2
- * \endcode
+ * wl_list_insert(&foo_list, &item1.link); \comment{Pushes item1 at the head}
+ * wl_list_insert(&foo_list, &item2.link); \comment{Pushes item2 at the head}
+ * wl_list_insert(&item2.link, &item3.link); \comment{Pushes item3 after item2}
+ * ~~~
  *
  * The list now looks like [item2, item3, item1]
  *
  * Iterate the list in ascending order:
- * \code
+ *
+ * ~~~
  * item_t *item;
  * wl_list_for_each(item, foo_list, link) {
  * 	Do_something_with_item(item);
  * }
- * \endcode
+ * ~~~
  */
 struct wl_list {
 	struct wl_list *prev;
@@ -136,10 +138,10 @@ void wl_list_insert_list(struct wl_list *list, struct wl_list *other);
  * To demonstrate, the following example retrieves a pointer to
  * `example_container` given only its `destroy_listener` member:
  *
- * \code
+ * ~~~
  * struct example_container {
  *     struct wl_listener destroy_listener;
- *     // other members...
+ *     \comment{other members...}
  * };
  *
  * void example_container_destroy(struct wl_listener *listener, void *data)
@@ -147,9 +149,9 @@ void wl_list_insert_list(struct wl_list *list, struct wl_list *other);
  *     struct example_container *ctr;
  *
  *     ctr = wl_container_of(listener, ctr, destroy_listener);
- *     // destroy ctr...
+ *     \comment{destroy ctr...}
  * }
- * \endcode
+ * ~~~
  *
  * \param ptr A valid pointer to the contained item.
  *
-- 
1.7.9.5



More information about the wayland-devel mailing list