summaryrefslogtreecommitdiff
path: root/src/lib/ecore/ecore_getopt.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-07-26 09:19:30 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-07-26 12:30:12 +0900
commit164ea41b3e9a8a9e518c4469631488d0d284c462 (patch)
treec64e5a69fdfa8191118850012948f01be089d4fe /src/lib/ecore/ecore_getopt.c
parent8f654b8f244c9eac2049d7b591b8e1e3c106ccbf (diff)
move ecore documentation not in headers to .h files for consistency
Diffstat (limited to 'src/lib/ecore/ecore_getopt.c')
-rw-r--r--src/lib/ecore/ecore_getopt.c172
1 files changed, 0 insertions, 172 deletions
diff --git a/src/lib/ecore/ecore_getopt.c b/src/lib/ecore/ecore_getopt.c
index 6fc0c64d83..79e09cce75 100644
--- a/src/lib/ecore/ecore_getopt.c
+++ b/src/lib/ecore/ecore_getopt.c
@@ -814,14 +814,6 @@ _ecore_getopt_help_prepare(const Ecore_Getopt *parser)
814 return EINA_TRUE; 814 return EINA_TRUE;
815} 815}
816 816
817/**
818 * Show nicely formatted help message for the given parser.
819 *
820 * @param fp The file the message will be printed on.
821 * @param parser The parser to be used.
822 *
823 * @see ecore_getopt_help_category()
824 */
825EAPI void 817EAPI void
826ecore_getopt_help(FILE *fp, 818ecore_getopt_help(FILE *fp,
827 const Ecore_Getopt *parser) 819 const Ecore_Getopt *parser)
@@ -834,17 +826,6 @@ ecore_getopt_help(FILE *fp,
834 _ecore_getopt_help_options(fp, parser); 826 _ecore_getopt_help_options(fp, parser);
835} 827}
836 828
837/**
838 * Show help for a single category (along with program usage and description).
839 *
840 * @param fp The file the message will be printed on.
841 * @param parser The parser to be used.
842 * @param category The category to print.
843 *
844 * @return @c EINA_TRUE when the category exists, @c EINA_FALSE otherwise.
845 *
846 * @see ecore_getopt_help()
847 */
848EAPI Eina_Bool 829EAPI Eina_Bool
849ecore_getopt_help_category(FILE *fp, 830ecore_getopt_help_category(FILE *fp,
850 const Ecore_Getopt *parser, 831 const Ecore_Getopt *parser,
@@ -1980,12 +1961,6 @@ _ecore_getopt_parse_find_long_other(const Ecore_Getopt *parser,
1980 return NULL; 1961 return NULL;
1981} 1962}
1982 1963
1983/**
1984 * Check parser for duplicate entries, print them out.
1985 *
1986 * @return @c EINA_TRUE if there are duplicates, @c EINA_FALSE otherwise.
1987 * @param parser The parser to be checked.
1988 */
1989EAPI Eina_Bool 1964EAPI Eina_Bool
1990ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser) 1965ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser)
1991{ 1966{
@@ -2037,68 +2012,6 @@ _ecore_getopt_find_help(const Ecore_Getopt *parser)
2037 return NULL; 2012 return NULL;
2038} 2013}
2039 2014
2040/**
2041 * Parse command line parameters.
2042 *
2043 * Walks the command line parameters and parse them based on @a parser
2044 * description, doing actions based on @c parser->descs->action, like
2045 * showing help text, license, copyright, storing values in values and
2046 * so on.
2047 *
2048 * It is expected that values is of the same size than @c parser->descs,
2049 * options that do not need a value it will be left untouched.
2050 *
2051 * All values are expected to be initialized before use. Options with
2052 * action @c ECORE_GETOPT_ACTION_STORE and non required arguments
2053 * (others than @c ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES), are expected
2054 * to provide a value in @c def to be used.
2055 *
2056 * The following actions will store @c 1 on value as a boolean
2057 * (@c value->boolp) if it's not @c NULL to indicate these actions were
2058 * executed:
2059 * - @c ECORE_GETOPT_ACTION_HELP
2060 * - @c ECORE_GETOPT_ACTION_VERSION
2061 * - @c ECORE_GETOPT_ACTION_COPYRIGHT
2062 * - @c ECORE_GETOPT_ACTION_LICENSE
2063 *
2064 * Just @c ECORE_GETOPT_ACTION_APPEND will allocate memory and thus
2065 * need to be freed. For consistency between all of appended subtypes,
2066 * @c eina_list->data will contain an allocated memory with the value,
2067 * that is, for @c ECORE_GETOPT_TYPE_STR it will contain a copy of the
2068 * argument, @c ECORE_GETOPT_TYPE_INT a pointer to an allocated
2069 * integer and so on.
2070 *
2071 * If parser is in strict mode (see @c Ecore_Getopt->strict), then any
2072 * error will abort parsing and @c -1 is returned. Otherwise it will try
2073 * to continue as far as possible.
2074 *
2075 * This function may reorder @a argv elements.
2076 *
2077 * Translation of help strings (description), metavar, usage, license
2078 * and copyright may be translated, standard/global gettext() call
2079 * will be applied on them if ecore was compiled with such support.
2080 *
2081 * This function will @b not parse positional arguments! If these are
2082 * declared (metavar is defined with both shortname and longname being
2083 * empty), then you must call ecore_getopt_parse_positional() with the
2084 * last argument (@c start) being the result of this function. This is
2085 * done so you can have "quit options", those that once called you
2086 * want to exit without doing further parsing, as is the case with
2087 * help, license, copyright, version and eventually others you may
2088 * define.
2089 *
2090 * @param parser description of how to work.
2091 * @param values where to store values, it is assumed that this is a vector
2092 * of the same size as @c parser->descs. Values should be previously
2093 * initialized.
2094 * @param argc how many elements in @a argv. If not provided it will be
2095 * retrieved with ecore_app_args_get().
2096 * @param argv command line parameters.
2097 *
2098 * @return index of first non-option parameter or -1 on error.
2099 *
2100 * @see ecore_getopt_parse_positional()
2101 */
2102EAPI int 2015EAPI int
2103ecore_getopt_parse(const Ecore_Getopt *parser, 2016ecore_getopt_parse(const Ecore_Getopt *parser,
2104 Ecore_Getopt_Value *values, 2017 Ecore_Getopt_Value *values,
@@ -2163,57 +2076,6 @@ error:
2163 return -1; 2076 return -1;
2164} 2077}
2165 2078
2166/**
2167 * Parse command line positional parameters.
2168 *
2169 * Walks the command line positional parameters (those that do not
2170 * start with "-" or "--") and parse them based on @a parser
2171 * description, doing actions based on @c parser->descs->action, like
2172 * storing values of some type.
2173 *
2174 * It is expected that @a values is of the same size than @c
2175 * parser->descs, same as with ecore_getopt_parse().
2176 *
2177 * All values are expected to be initialized before use.
2178 *
2179 * Unlike the ecore_getopt_parse(), only the following options are
2180 * supported:
2181 * - @c ECORE_GETOPT_ACTION_STORE
2182 * - @c ECORE_GETOPT_ACTION_CHOICE
2183 * - @c ECORE_GETOPT_ACTION_APPEND
2184 * - @c ECORE_GETOPT_ACTION_CALLBACK
2185 *
2186 * There is a special case for @c ECORE_GETOPT_ACTION_APPEND as it
2187 * will consume all remaining elements. It is also special in the
2188 * sense that it will allocate memory and thus need to be freed. For
2189 * consistency between all of appended subtypes, @c eina_list->data
2190 * will contain an allocated memory with the value, that is, for @c
2191 * ECORE_GETOPT_TYPE_STR it will contain a copy of the argument, @c
2192 * ECORE_GETOPT_TYPE_INT a pointer to an allocated integer and so on.
2193 *
2194 * If parser is in strict mode (see @c Ecore_Getopt->strict), then any
2195 * error will abort parsing and @c -1 is returned. Otherwise it will try
2196 * to continue as far as possible.
2197 *
2198 * Translation of help strings (description) and metavar may be done,
2199 * standard/global gettext() call will be applied on them if ecore was
2200 * compiled with such support.
2201 *
2202 * @param parser description of how to work.
2203 * @param values where to store values, it is assumed that this is a vector
2204 * of the same size as @c parser->descs. Values should be previously
2205 * initialized.
2206 * @param argc how many elements in @a argv. If not provided it will be
2207 * retrieved with ecore_app_args_get().
2208 * @param argv command line parameters.
2209 * @param start the initial position argument to look at, usually the
2210 * return of ecore_getopt_parse(). If less than 1, will try to
2211 * find it automatically.
2212 *
2213 * @return index of first non-option parameter or -1 on error. If the
2214 * last positional argument is of action @c
2215 * ECORE_GETOPT_ACTION_APPEND then it will be the same as @a argc.
2216 */
2217EAPI int 2079EAPI int
2218ecore_getopt_parse_positional(const Ecore_Getopt *parser, 2080ecore_getopt_parse_positional(const Ecore_Getopt *parser,
2219 Ecore_Getopt_Value *values, 2081 Ecore_Getopt_Value *values,
@@ -2280,12 +2142,6 @@ error:
2280 return -1; 2142 return -1;
2281} 2143}
2282 2144
2283/**
2284 * Utility to free list and nodes allocated by @a ECORE_GETOPT_ACTION_APPEND.
2285 *
2286 * @param list pointer to list to be freed.
2287 * @return always @c NULL, so you can easily make your list head @c NULL.
2288 */
2289EAPI Eina_List * 2145EAPI Eina_List *
2290ecore_getopt_list_free(Eina_List *list) 2146ecore_getopt_list_free(Eina_List *list)
2291{ 2147{
@@ -2296,19 +2152,6 @@ ecore_getopt_list_free(Eina_List *list)
2296 return NULL; 2152 return NULL;
2297} 2153}
2298 2154
2299/**
2300 * Helper ecore_getopt callback to parse geometry (x:y:w:h).
2301 *
2302 * @param parser This parameter isn't in use.
2303 * @param desc This parameter isn't in use.
2304 * @param str Geometry value
2305 * @param data This parameter isn't in use.
2306 * @param storage must be a pointer to @c Eina_Rectangle and will be used to
2307 * store the four values passed in the given string.
2308 * @return @c EINA_TRUE on success, @c EINA_FALSE on incorrect geometry value.
2309 *
2310 * @c callback_data value is ignored, you can safely use @c NULL.
2311 */
2312EAPI Eina_Bool 2155EAPI Eina_Bool
2313ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser EINA_UNUSED, 2156ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser EINA_UNUSED,
2314 const Ecore_Getopt_Desc *desc EINA_UNUSED, 2157 const Ecore_Getopt_Desc *desc EINA_UNUSED,
@@ -2327,20 +2170,6 @@ ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser EINA_UNUSED
2327 return EINA_TRUE; 2170 return EINA_TRUE;
2328} 2171}
2329 2172
2330/**
2331 * Helper ecore_getopt callback to parse geometry size (WxH).
2332 *
2333 * @param parser This parameter isn't in use.
2334 * @param desc This parameter isn't in use.
2335 * @param str size value
2336 * @param data This parameter isn't in use.
2337 * @param storage must be a pointer to @c Eina_Rectangle and will be used to
2338 * store the two values passed in the given string and @c 0 in the x and y
2339 * fields.
2340 * @return @c EINA_TRUE on success, @c EINA_FALSE on incorrect size value.
2341 *
2342 * @c callback_data value is ignored, you can safely use @c NULL.
2343 */
2344EAPI Eina_Bool 2173EAPI Eina_Bool
2345ecore_getopt_callback_size_parse(const Ecore_Getopt *parser EINA_UNUSED, 2174ecore_getopt_callback_size_parse(const Ecore_Getopt *parser EINA_UNUSED,
2346 const Ecore_Getopt_Desc *desc EINA_UNUSED, 2175 const Ecore_Getopt_Desc *desc EINA_UNUSED,
@@ -2360,4 +2189,3 @@ ecore_getopt_callback_size_parse(const Ecore_Getopt *parser EINA_UNUSED,
2360 2189
2361 return EINA_TRUE; 2190 return EINA_TRUE;
2362} 2191}
2363