From 6dcef0e0d26f6dbe7d75df3bd716bede44c92d76 Mon Sep 17 00:00:00 2001
From: twinaphex <libretro@gmail.com>
Date: Fri, 9 Jan 2015 16:45:58 +0100
Subject: [PATCH] More documentation for settings_data.c

---
 settings_data.c | 174 ++++++++++++++++++++++++++++++++++++++++++++----
 settings_data.h | 165 +++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 321 insertions(+), 18 deletions(-)

diff --git a/settings_data.c b/settings_data.c
index 79bc62ed9c..da242a3c71 100644
--- a/settings_data.c
+++ b/settings_data.c
@@ -1377,6 +1377,17 @@ static void menu_common_setting_set_label_perf(char *type_str,
  ******* LIST BUILDING HELPER FUNCTIONS *******
 **/
 
+/**
+ * setting_data_action_setting:
+ * @name               : Name of setting.
+ * @short_description  : Short description of setting.
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ *
+ * Initializes a setting of type ST_ACTION.
+ *
+ * Returns: setting of type ST_ACTION.
+ **/
 rarch_setting_t setting_data_action_setting(const char* name,
       const char* short_description,
       const char *group, const char *subgroup)
@@ -1403,6 +1414,15 @@ rarch_setting_t setting_data_action_setting(const char* name,
    return result;
 }
 
+/**
+ * setting_data_group_setting:
+ * @type               : type of settting.
+ * @name               : name of setting.
+ *
+ * Initializes a setting of type ST_GROUP.
+ *
+ * Returns: setting of type ST_GROUP.
+ **/
 rarch_setting_t setting_data_group_setting(enum setting_type type, const char* name)
 {
    rarch_setting_t result;
@@ -1416,8 +1436,18 @@ rarch_setting_t setting_data_group_setting(enum setting_type type, const char* n
    return result;
 }
 
-rarch_setting_t setting_data_subgroup_setting(enum setting_type type, const char* name,
-      const char *parent_name)
+/**
+ * setting_data_subgroup_setting:
+ * @type               : type of settting.
+ * @name               : name of setting.
+ * @parent_name        : group that the subgroup setting belongs to.
+ *
+ * Initializes a setting of type ST_SUBGROUP.
+ *
+ * Returns: setting of type ST_SUBGROUP.
+ **/
+rarch_setting_t setting_data_subgroup_setting(enum setting_type type,
+      const char* name, const char *parent_name)
 {
    rarch_setting_t result;
 
@@ -1432,10 +1462,26 @@ rarch_setting_t setting_data_subgroup_setting(enum setting_type type, const char
    return result;
 }
 
+/**
+ * setting_data_float_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of float setting.
+ * @default_value      : Default value (in float).
+ * @rounding           : Rounding (for float-to-string representation).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_FLOAT.
+ *
+ * Returns: setting of type ST_FLOAT.
+ **/
 rarch_setting_t setting_data_float_setting(const char* name,
       const char* short_description, float* target, float default_value,
-      const char *rounding, const char *group, const char *subgroup, change_handler_t change_handler,
-      change_handler_t read_handler)
+      const char *rounding, const char *group, const char *subgroup,
+      change_handler_t change_handler, change_handler_t read_handler)
 {
    rarch_setting_t result;
 
@@ -1462,11 +1508,28 @@ rarch_setting_t setting_data_float_setting(const char* name,
    return result;
 }
 
+/**
+ * setting_data_bool_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of bool setting.
+ * @default_value      : Default value (in bool format).
+ * @off                : String value for "Off" label.
+ * @on                 : String value for "On"  label.
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_BOOL.
+ *
+ * Returns: setting of type ST_BOOL.
+ **/
 rarch_setting_t setting_data_bool_setting(const char* name,
       const char* short_description, bool* target, bool default_value,
       const char *off, const char *on,
-      const char *group, const char *subgroup, change_handler_t change_handler,
-      change_handler_t read_handler)
+      const char *group, const char *subgroup,
+      change_handler_t change_handler, change_handler_t read_handler)
 {
    rarch_setting_t result;
 
@@ -1494,6 +1557,21 @@ rarch_setting_t setting_data_bool_setting(const char* name,
    return result;
 }
 
+/**
+ * setting_data_int_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of signed integer setting.
+ * @default_value      : Default value (in signed integer format).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_INT. 
+ *
+ * Returns: setting of type ST_INT.
+ **/
 rarch_setting_t setting_data_int_setting(const char* name,
       const char* short_description, int* target, int default_value,
       const char *group, const char *subgroup, change_handler_t change_handler,
@@ -1519,6 +1597,21 @@ rarch_setting_t setting_data_int_setting(const char* name,
    return result;
 }
 
+/**
+ * setting_data_uint_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of unsigned integer setting.
+ * @default_value      : Default value (in unsigned integer format).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_UINT. 
+ *
+ * Returns: setting of type ST_UINT.
+ **/
 rarch_setting_t setting_data_uint_setting(const char* name,
       const char* short_description, unsigned int* target,
       unsigned int default_value, const char *group, const char *subgroup,
@@ -1548,6 +1641,21 @@ rarch_setting_t setting_data_uint_setting(const char* name,
    return result;
 }
 
+/**
+ * setting_data_bind_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of bind setting.
+ * @idx                : Index of bind setting.
+ * @idx_offset         : Index offset of bind setting.
+ * @default_value      : Default value (in bind format).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ *
+ * Initializes a setting of type ST_BIND. 
+ *
+ * Returns: setting of type ST_BIND.
+ **/
 rarch_setting_t setting_data_bind_setting(const char* name,
       const char* short_description, struct retro_keybind* target,
       uint32_t idx, uint32_t idx_offset,
@@ -1576,6 +1684,24 @@ rarch_setting_t setting_data_bind_setting(const char* name,
    return result;
 }
 
+/**
+ * setting_data_string_setting:
+ * @type               : type of setting.
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of string setting.
+ * @size               : Size of string setting.
+ * @default_value      : Default value (in string format).
+ * @empty              : TODO/FIXME: ???
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a string setting (of type @type). 
+ *
+ * Returns: String setting of type @type.
+ **/
 rarch_setting_t setting_data_string_setting(enum setting_type type,
       const char* name, const char* short_description, char* target,
       unsigned size, const char* default_value, const char *empty,
@@ -1615,12 +1741,12 @@ rarch_setting_t setting_data_string_setting(enum setting_type type,
    return result;
 }
 
-rarch_setting_t setting_data_string_setting_options
-(enum setting_type type,
+rarch_setting_t setting_data_string_setting_options(enum setting_type type,
  const char* name, const char* short_description, char* target,
- unsigned size, const char* default_value, const char *empty, const char *values,
- const char *group, const char *subgroup, change_handler_t change_handler,
- change_handler_t read_handler)
+ unsigned size, const char* default_value,
+ const char *empty, const char *values,
+ const char *group, const char *subgroup,
+ change_handler_t change_handler, change_handler_t read_handler)
 {
   rarch_setting_t result = setting_data_string_setting(type, name,
         short_description, target, size, default_value, empty, group,
@@ -1630,9 +1756,6 @@ rarch_setting_t setting_data_string_setting_options
   return result;
 }
 
-
-
-
 /**
  * setting_data_get_description:
  * @label              : identifier label of setting
@@ -2674,6 +2797,20 @@ static void get_string_representation_savestate(void * data, char *type_str,
       strlcat(type_str, " (Auto)", type_str_size);
 }
 
+/**
+ * setting_data_get_label:
+ * @type_str           : String for the type to be represented on-screen as
+ *                       a label.
+ * @type_str_size      : Size of @type_str
+ * @w                  : Width of the string (for text label representation
+ *                       purposes in the menu display driver).
+ * @type               : Identifier of setting.
+ * @menu_label         : Menu Label identifier of setting.
+ * @label              : Label identifier of setting.
+ * @idx                : Index identifier of setting.
+ *
+ * Get associated label of a setting.
+ **/
 void setting_data_get_label(char *type_str,
       size_t type_str_size, unsigned *w, unsigned type, 
       const char *menu_label, const char *label, unsigned idx)
@@ -5817,6 +5954,15 @@ static bool setting_data_append_list_privacy_options(
 }
 
 
+/**
+ * setting_data_new:
+ * @mask               : Bitmask of settings to include.
+ *
+ * Request a list of settings based on @mask.
+ *
+ * Returns: settings list composed of all requested
+ * settings on success, otherwise NULL.
+ **/
 rarch_setting_t *setting_data_new(unsigned mask)
 {
    rarch_setting_t terminator = { ST_NONE };
diff --git a/settings_data.h b/settings_data.h
index b5737d0f3f..719e1b501e 100644
--- a/settings_data.h
+++ b/settings_data.h
@@ -44,9 +44,6 @@ void setting_data_reset_setting(rarch_setting_t* setting);
  **/
 void setting_data_reset(rarch_setting_t* settings);
 
-bool setting_data_load_config_path(rarch_setting_t* settings,
-      const char* path);
-
 /**
  * setting_data_reset:
  * @settings           : pointer to settings
@@ -81,46 +78,171 @@ void setting_data_set_with_string_representation(
 void setting_data_get_string_representation(rarch_setting_t* setting,
       char* buf, size_t sizeof_buf);
 
-/* List building helper functions. */
+/**
+ * setting_data_action_setting:
+ * @name               : name of setting.
+ * @short_description  : short description of setting.
+ * @group              : group that the setting belongs to.
+ * @subgroup           : subgroup that the setting belongs to.
+ *
+ * Initializes a setting of type ST_ACTION.
+ *
+ * Returns: setting of type ST_ACTION.
+ **/
 rarch_setting_t setting_data_action_setting(const char *name,
       const char *short_description,
       const char *group,
       const char *subgroup);
 
+/**
+ * setting_data_group_setting:
+ * @type               : type of settting.
+ * @name               : name of setting.
+ *
+ * Initializes a setting of type ST_GROUP.
+ *
+ * Returns: setting of type ST_GROUP.
+ **/
 rarch_setting_t setting_data_group_setting(enum setting_type type,
       const char* name);
 
+/**
+ * setting_data_subgroup_setting:
+ * @type               : type of settting.
+ * @name               : name of setting.
+ * @parent_name        : group that the subgroup setting belongs to.
+ *
+ * Initializes a setting of type ST_SUBGROUP.
+ *
+ * Returns: setting of type ST_SUBGROUP.
+ **/
 rarch_setting_t setting_data_subgroup_setting(enum setting_type type,
       const char* name, const char *parent_name);
 
+/**
+ * setting_data_bool_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of bool setting.
+ * @default_value      : Default value (in bool format).
+ * @off                : String value for "Off" label.
+ * @on                 : String value for "On"  label.
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_BOOL.
+ *
+ * Returns: setting of type ST_BOOL.
+ **/
 rarch_setting_t setting_data_bool_setting(const char* name,
       const char* description, bool* target, bool default_value,
       const char *off, const char *on, const char * group,
       const char *subgroup, change_handler_t change_handler,
       change_handler_t read_handler);
 
+/**
+ * setting_data_int_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of signed integer setting.
+ * @default_value      : Default value (in signed integer format).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_INT. 
+ *
+ * Returns: setting of type ST_INT.
+ **/
 rarch_setting_t setting_data_int_setting(const char* name,
       const char* description, int* target, int default_value,
       const char *group, const char *subgroup,
       change_handler_t change_handler, change_handler_t read_handler);
 
+/**
+ * setting_data_uint_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of unsigned integer setting.
+ * @default_value      : Default value (in unsigned integer format).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_UINT. 
+ *
+ * Returns: setting of type ST_UINT.
+ **/
 rarch_setting_t setting_data_uint_setting(const char* name,
       const char* description, unsigned int* target,
       unsigned int default_value, const char *group,
       const char *subgroup, change_handler_t change_handler,
       change_handler_t read_handler);
 
+/**
+ * setting_data_float_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of float setting.
+ * @default_value      : Default value (in float).
+ * @rounding           : Rounding (for float-to-string representation).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a setting of type ST_FLOAT.
+ *
+ * Returns: setting of type ST_FLOAT.
+ **/
 rarch_setting_t setting_data_float_setting(const char* name,
       const char* description, float* target, float default_value,
       const char *rounding, const char *group, const char *subgroup,
       change_handler_t change_handler, change_handler_t read_handler);
 
+/**
+ * setting_data_string_setting:
+ * @type               : type of setting.
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of string setting.
+ * @size               : Size of string setting.
+ * @default_value      : Default value (in string format).
+ * @empty              : TODO/FIXME: ???
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ * @change_handler     : Function callback for change handler function pointer.
+ * @read_handler       : Function callback for read handler function pointer.
+ *
+ * Initializes a string setting (of type @type). 
+ *
+ * Returns: String setting of type @type.
+ **/
 rarch_setting_t setting_data_string_setting(enum setting_type type,
       const char* name, const char* description, char* target,
       unsigned size, const char* default_value, const char *empty,
       const char *group, const char *subgroup,
       change_handler_t change_handler, change_handler_t read_handler);
 
+/**
+ * setting_data_bind_setting:
+ * @name               : name of setting.
+ * @short_description  : Short description of setting.
+ * @target             : Target of bind setting.
+ * @idx                : Index of bind setting.
+ * @idx_offset         : Index offset of bind setting.
+ * @default_value      : Default value (in bind format).
+ * @group              : Group that the setting belongs to.
+ * @subgroup           : Subgroup that the setting belongs to.
+ *
+ * Initializes a setting of type ST_BIND. 
+ *
+ * Returns: setting of type ST_BIND.
+ **/
 rarch_setting_t setting_data_bind_setting(const char* name,
       const char* description, struct retro_keybind* target, uint32_t idx,
       uint32_t idx_offset,
@@ -133,6 +255,18 @@ rarch_setting_t setting_data_string_setting_options(enum setting_type type,
      const char *group, const char *subgroup, change_handler_t change_handler,
      change_handler_t read_handler);
 
+/**
+ * setting_data_get_description:
+ * @label              : identifier label of setting
+ * @msg                : output message 
+ * @sizeof_msg         : size of @msg
+ *
+ * Writes a 'Help' description message to @msg if there is
+ * one available based on the identifier label of the setting
+ * (@label).
+ *
+ * Returns: 0 (always for now). TODO: make it handle -1 as well.
+ **/
 int setting_data_get_description(const char *label, char *msg,
       size_t msg_sizeof);
 
@@ -152,11 +286,34 @@ void core_list_change_handler(void *data);
 void load_content_change_handler(void *data);
 
 #ifdef HAVE_MENU
+/**
+ * setting_data_get_label:
+ * @type_str           : String for the type to be represented on-screen as
+ *                       a label.
+ * @type_str_size      : Size of @type_str
+ * @w                  : Width of the string (for text label representation
+ *                       purposes in the menu display driver).
+ * @type               : Identifier of setting.
+ * @menu_label         : Menu Label identifier of setting.
+ * @label              : Label identifier of setting.
+ * @idx                : Index identifier of setting.
+ *
+ * Get associated label of a setting.
+ **/
 void setting_data_get_label(char *type_str,
       size_t type_str_size, unsigned *w, unsigned type, 
       const char *menu_label, const char *label, unsigned idx);
 #endif
 
+/**
+ * setting_data_new:
+ * @mask               : Bitmask of settings to include.
+ *
+ * Request a list of settings based on @mask.
+ *
+ * Returns: settings list composed of all requested
+ * settings on success, otherwise NULL.
+ **/
 rarch_setting_t* setting_data_new(unsigned mask);
 
 #ifdef __cplusplus