doxygen: add some missing docstrings.
authorRichard Kettlewell <rjk@terraraq.org.uk>
Sun, 7 Aug 2011 13:50:50 +0000 (14:50 +0100)
committerRichard Kettlewell <rjk@terraraq.org.uk>
Sun, 7 Aug 2011 13:50:50 +0000 (14:50 +0100)
14 files changed:
cgi/options.c
clients/disorder.c
clients/disorderfm.c
disobedience/misc.c
lib/configuration.h
lib/eventdist.c
lib/eventlog.c
lib/eventlog.h
lib/hash.c
lib/queue.c
lib/snprintf.c
lib/strptime.c
plugins/tracklength-flac.c
server/server.c

index fca5801..5517c76 100644 (file)
@@ -58,9 +58,15 @@ static void option__columns(int nvec,
   hash_add(columns, vec[0], &c, HASH_INSERT_OR_REPLACE);
 }
 
+/** @brief Definition of an option command */
 static struct option {
+  /** @brief Command name */
   const char *name;
-  int minargs, maxargs;
+  /** @brief Minimum number of arguments */
+  int minargs;
+  /** @brief Maximum number of arguments */
+  int maxargs;
+  /** @brief Command handler */
   void (*handler)(int nvec, char **vec);
 } options[] = {
   { "columns", 1, INT_MAX, option__columns },
index 53fce74..6d0a29d 100644 (file)
@@ -672,12 +672,28 @@ static void cf_playlist_set(char **argv) {
     exit(EXIT_FAILURE);
 }
 
-static const struct command {
+/** @brief Command-line client's definition of a command */
+static const struct client_command {
+  /** @brief Command name */
   const char *name;
-  int min, max;
+
+  /** @brief Minimum number of argument */
+  int min;
+
+  /** @brief Maximum number of argument */
+  int max;
+
+  /** @brief Pointer to function implementing command */
   void (*fn)(char **);
+
+  /** @brief Function to recognize a valid argument, or NULL */
   int (*isarg)(const char *);
-  const char *argstr, *desc;
+
+  /** @brief Summary of arguments */
+  const char *argstr;
+
+  /** @brief Description */
+  const char *desc;
 } commands[] = {
   { "adduser",        2, 3, cf_adduser, isarg_rights, "USERNAME PASSWORD [RIGHTS]",
                       "Create a new user" },
index ed31dd0..14092da 100644 (file)
@@ -73,7 +73,7 @@ static const char *nativeencoding;
 /* Count of errors */
 static long errors;
 
-/* Included/excluded filename patterns */
+/** @brief Included/excluded filename pattern */
 static struct pattern {
   struct pattern *next;
   const char *pattern;
index a1fdf4d..3878824 100644 (file)
 #include "disobedience.h"
 #include "table.h"
 
+/** @brief Embedded image */
 struct image {
+  /** @brief Image name */
   const char *name;
+  /** @brief Image data in GDK pixbuf inline format */
   const guint8 *data;
 };
 
index 6e3a9a9..63c82c8 100644 (file)
@@ -68,6 +68,7 @@ struct collectionlist {
   struct collection *s;
 };
 
+/** @brief A track name part */
 struct namepart {
   char *part;                          /* part */
   pcre *re;                            /* compiled regexp */
@@ -77,11 +78,13 @@ struct namepart {
   unsigned reflags;                    /* regexp flags */
 };
 
+/** @brief A list of track name parts */
 struct namepartlist {
   int n;
   struct namepart *s;
 };
 
+/** @brief A track name transform */
 struct transform {
   char *type;                          /* track or dir */
   char *context;                       /* sort or choose */
@@ -90,6 +93,7 @@ struct transform {
   unsigned flags;                      /* regexp flags */
 };
 
+/** @brief A list of track name transforms */
 struct transformlist {
   int n;
   struct transform *t;
index 37893b6..e0fb0fa 100644 (file)
 #include "eventdist.h"
 #include "hash.h"
 
+/** @brief Event data
+ *
+ * @c event_data structures form linked lists; one list per event and one node
+ * per handler.
+ */
 struct event_data {
+  /** @brief Next handler */
   struct event_data *next;
+
+  /** @brief Name of event */
   const char *event;
+
+  /** @brief Handler callback */
   event_handler *callback;
+
+  /** @brief Passed to @ref callback */
   void *callbackdata;
 };
 
index a56884b..9ca2292 100644 (file)
@@ -28,6 +28,7 @@
 #include "eventlog.h"
 #include "split.h"
 
+/** @brief Linked list of event logs */
 static struct eventlog_output *outputs;
 
 void eventlog_add(struct eventlog_output *lo) {
@@ -44,6 +45,11 @@ void eventlog_remove(struct eventlog_output *lo) {
     *pp = lo->next;
 }
 
+/** @brief Write to the event log
+ * @param keyword Distinguishing keyword for event
+ * @param raw Unformatted data
+ * @param ap Extra data, terminated by (char *)0
+ */
 static void veventlog(const char *keyword, const char *raw, va_list ap) {
   struct eventlog_output *p, *pnext;
   struct dynstr d;
index 87eea51..e29fcfc 100644 (file)
 #ifndef EVENTLOG_H
 #define EVENTLOG_H
 
-/* definition of an event log output.  The caller must allocate these
- * (since log.c isn't allowed to perform memory allocation). */
+/** @brief An output for the event log
+ *
+ * The caller must allocate these (since log.c isn't allowed to perform memory
+ * allocation).  They form a linked list, using eventlog_add() and
+ * eventlog_remove().
+ */
 struct eventlog_output {
+  /** @brief Next output */
   struct eventlog_output *next;
+
+  /** @brief Handler for this output */
   void (*fn)(const char *msg, void *user);
+
+  /** @brief Passed to @ref fn */
   void *user;
 };
 
+/** @brief Add an event log output
+ * @param lo Pointer to output to add
+ */
 void eventlog_add(struct eventlog_output *lo);
-/* add a log output */
 
+/** @brief Remove an event log output
+ * @param lo Pointer to output to remove
+ */
 void eventlog_remove(struct eventlog_output *lo);
-/* remove a log output */
 
+/** @brief Send a message to the event log
+ * @param keyword Distinguishing keyword for event
+ * @param ... Extra data, terminated by (char *)0
+ */
 void eventlog(const char *keyword, ...);
+
+/** @brief Send a message to the event log
+ * @param keyword Distinguishing keyword for event
+ * @param raw Unformatted data
+ * @param ... Extra data, terminated by (char *)0
+ */
 void eventlog_raw(const char *keyword, const char *raw, ...);
-/* send a message to the event log */
 
 #endif /* EVENTLOG_H */
 
index 573b50a..9dc3469 100644 (file)
@@ -25,6 +25,7 @@
 #include "log.h"
 #include "kvp.h"
 
+/** @brief One entry in a hash table */
 struct entry {
   struct entry *next;                   /* next entry same key */
   size_t h;                             /* hash of KEY */
@@ -32,6 +33,7 @@ struct entry {
   void *value;                          /* value of this entry */
 };
 
+/** @brief A hash table */
 struct hash {
   size_t nslots;                        /* number of slots */
   size_t nitems;                        /* total number of entries */
index 0f39b23..e39ca5f 100644 (file)
@@ -194,13 +194,23 @@ static const char *marshall_origin(const struct queue_entry *q, size_t offset) {
 
 #define F(n, h) { #n, offsetof(struct queue_entry, n), marshall_##h, unmarshall_##h, free_##h }
 
-static const struct field {
+/** @brief A field in a @ref queue_entry */
+static const struct queue_field {
+  /** @brief Field name */
   const char *name;
+
+  /** @brief Offset of value in @ref queue_entry structure */
   size_t offset;
+
+  /** @brief Marshaling function */
   const char *(*marshall)(const struct queue_entry *q, size_t offset);
+
+  /** @brief Unmarshaling function */
   int (*unmarshall)(char *data, struct queue_entry *q, size_t offset,
                    void (*error_handler)(const char *, void *),
                    void *u);
+
+  /** @brief Destructor */
   void (*free)(struct queue_entry *q, size_t offset);
 } fields[] = {
   /* Keep this table sorted. */
index e62e3c9..f272dc7 100644 (file)
 #include "printf.h"
 #include "sink.h"
 
+/** @brief A @ref sink that stores to a fixed buffer
+ *
+ * If there is too much output, it is truncated.
+ */
 struct fixedstr_sink {
+  /** @brief Base */
   struct sink s;
+
+  /** @brief Output buffer */
   char *buffer;
+
+  /** @brief Bytes written so far */
   int nbytes;
+
+  /** @brief Size of buffer */
   size_t size;
 };
 
index 83d010d..91d57d5 100644 (file)
 #include <langinfo.h>
 #include "strptime.h"
 
+/** @brief Lookup table entry for locale-specific strings */
 struct locale_item_match {
+  /** @brief Locale key to try */
   nl_item key;
+
+  /** @brief Value to return if value of @ref key matches subject string */
   int value;
 };
 
index a838966..31a7e9d 100644 (file)
 
 /* libFLAC's "simplified" interface is rather heavyweight... */
 
+/** @brief State used when computing FLAC file length */
 struct flac_state {
+  /** @brief Duration or -1 */
   long duration;
+
+  /** @brief File being analyzed */
   const char *path;
 };
 
index 29efbbe..1169e2f 100644 (file)
@@ -1845,7 +1845,8 @@ static int c_playlist_unlock(struct conn *c,
   return 1;
 }
 
-static const struct command {
+/** @brief Server's definition of a command */
+static const struct server_command {
   /** @brief Command name */
   const char *name;