![]() |
Oyranos
git-devel
Oyranos is a full featured Color Management System
|
|
Macros | |
| #define | OYJL_QUIET 0x100000 |
| be silent on error More... | |
| #define | OYJL_SOURCE_CODE_C 0x01 |
| C programming language source code. More... | |
| #define | OYJL_WITH_OYJL_ARGS_C 0x02 |
| Include oyjl_args.c . Skip libOyjlCore code. More... | |
| #define | OYJL_NO_DEFAULT_OPTIONS 0x04 |
| omit automatic options generation for –help, –X export or –verbose More... | |
| #define | OYJL_SUGGEST_VARIABLE_NAMES 0x08 |
| automatic suggestion of variable names for missing oyjlOption_s::o and oyjlOption_s::option members More... | |
| #define | OYJL_WITH_OYJL_ARGS_BASE_API 0x10 |
| Restrict to oyjl_args_base.h API's. More... | |
| #define | OYJL_COMPLETION_BASH 0x100 |
| bash completion source code More... | |
| #define | OYJL_OPTION_FLAG_EDITABLE 0x001 |
| The oyjlOption_s choices are merely a hint. Let users fill other strings too: "prog --opt=arg|...". More... | |
| #define | OYJL_OPTION_FLAG_ACCEPT_NO_ARG 0x002 |
| Accept as well no arg: "prog --opt[=arg]". More... | |
| #define | OYJL_OPTION_FLAG_NO_DASH 0x004 |
| No double dash '–' acceptance; single dash can be omitted by not specifying oyjlOption_s::o : "prog opt". More... | |
| #define | OYJL_OPTION_FLAG_REPETITION 0x008 |
| Accept more than one occurence: "prog --opt=arg ...". More... | |
| #define | OYJL_OPTION_FLAG_MAINTENANCE 0x100 |
| Maintenance option; can be invisible. More... | |
| #define | OYJL_OPTION_FLAG_IMMEDIATE 0x200 |
| Apply instantly in UI; opposite to OYJL_GROUP_FLAG_EXPLICITE. More... | |
| #define | OYJL_GROUP_FLAG_SUBCOMMAND 0x080 |
| This oyjlOptionGroup_s flag requires one single mandatory option with oyjlOPTIONTYPE_NONE. More... | |
| #define | OYJL_GROUP_FLAG_EXPLICITE 0x100 |
| Apply explicitely in UI. More... | |
| #define | OYJL_GROUP_FLAG_GENERAL_OPTS 0x200 |
| Hint for MAN page section. More... | |
Typedefs | |
| typedef enum oyjlOPTIONTYPE_e | oyjlOPTIONTYPE_e |
| Type of option. More... | |
| typedef enum oyjlVARIABLETYPE_e | oyjlVARIABLE_e |
| Types for oyjlVariable_u. More... | |
| typedef struct oyjlOptionChoice_s | oyjlOptionChoice_s |
| Choice item. More... | |
| typedef union oyjlVariable_u | oyjlVariable_u |
| abstract value More... | |
| typedef union oyjlOption_u | oyjlOption_u |
| abstract option More... | |
| typedef struct oyjlOptionGroup_s | oyjlOptionGroup_s |
| Info to compile a Syntax line and check missing arguments. More... | |
| typedef struct oyjlUiHeaderSection_s | oyjlUiHeaderSection_s |
| Header section. More... | |
| typedef struct oyjlUi_s | oyjlUi_s |
| Info for graphic UI's containing options, additional info sections and other bells and whistles. More... | |
Functions | |
| oyjl_val | oyjlOptionStringToJson (const char *opts) |
| Convert separated string to result JSON. More... | |
| void | oyjlUiJsonSetDefaults (oyjl_val root, oyjl_val defaults) |
| Change Defaults. More... | |
| int | oyjlArgsRender (int argc, const char **argv, const char *json, const char *commands, const char *output, int debug, oyjlUi_s *ui, int(*callback)(int argc, const char **argv)) |
| Load renderer for graphical rendering options. More... | |
| oyjl_val | oyjlUi_s::oyjlUiJsonSetOption (oyjl_val root, oyjl_val results, const char *key, const char *value, int current_group_id, int flags OYJL_UNUSED) |
| Set interactive option and format cli args (libOyjlExtra) More... | |
| char * | oyjlUi_s::oyjlUiExportToCode (oyjl_val root, int flags) |
| Return a source code from a parsed source tree (libOyjlExtra) More... | |
| void | oyjlOptionChoice_s::oyjlOptionChoice_Release (oyjlOptionChoice_s **choices) |
| Release dynamic structure. More... | |
| int | oyjlOptionChoice_s::oyjlOptionChoice_Count (oyjlOptionChoice_s *list) |
| Return number of array elements. More... | |
| int | oyjlOptions_s::oyjlOptions_Count (oyjlOptions_s *opts) |
| Return number of "oiwi" array elements. More... | |
| int | oyjlOptions_s::oyjlOptions_CountGroups (oyjlOptions_s *opts) |
| Return number of "oiwi" groups elements. More... | |
| oyjlOption_s * | oyjlOptions_s::oyjlOptions_GetOption (oyjlOptions_s *opts, const char *ol) |
| Obtain the specified option from one letter member::o. More... | |
| oyjlOption_s * | oyjlOptions_s::oyjlOptions_GetOptionL (oyjlOptions_s *opts, const char *ostring, int flags) |
| Obtain the specified option from option string. More... | |
| oyjlOPTIONSTATE_e | oyjlOptions_s::oyjlOptions_Parse (oyjlOptions_s *opts) |
| Parse the options into a private data structure. More... | |
| oyjlOPTIONSTATE_e | oyjlOptions_s::oyjlOptions_GetResult (oyjlOptions_s *opts, const char *opt, const char **result_string, double *result_dbl, int *result_int) |
| Obtain the parsed result. More... | |
| char ** | oyjlOptions_s::oyjlOptions_ResultsToList (oyjlOptions_s *opts, const char *oc, int *count) |
| Convert the parsed content to a text list. More... | |
| char * | oyjlOptions_s::oyjlOptions_ResultsToText (oyjlOptions_s *opts) |
| Convert the parsed content to simple text. More... | |
| char * | oyjlOption_s::oyjlOption_PropertiesGetValue (oyjlOption_s *o, const char *key) |
| access the oyjlOption_s::properties by key More... | |
| oyjlOptions_s * | oyjlOptions_s::oyjlOptions_New (int argc, const char **argv) |
| Allocate a new options structure. More... | |
| oyjlUi_s * | oyjlUi_s::oyjlUi_New (int argc, const char **argv) |
| Allocate a new ui structure. More... | |
| oyjlUi_s * | oyjlUi_s::oyjlUi_Copy (oyjlUi_s *src) |
| Copy structure. More... | |
| oyjlUi_s * | oyjlUi_s::oyjlUi_FromOptions (const char *nick, const char *name, const char *description, const char *logo, oyjlUiHeaderSection_s *info, oyjlOptions_s *opts, int *status) |
| Create a new UI structure from options. More... | |
| oyjlUi_s * | oyjlUi_s::oyjlUi_Create (int argc, const char **argv, const char *nick, const char *name, const char *description, const char *logo, oyjlUiHeaderSection_s *info, oyjlOption_s *options, oyjlOptionGroup_s *groups, int *status) |
| Create a new UI structure. More... | |
| void | oyjlUi_s::oyjlUi_ReleaseArgs (oyjlUi_s **ui OYJL_UNUSED) |
| Release "oiui". More... | |
| int | oyjlUiHeaderSection_s::oyjlUiHeaderSection_Count (oyjlUiHeaderSection_s *sections) |
| Return the number of sections of type "oihs". More... | |
| oyjlUiHeaderSection_s * | oyjlUiHeaderSection_s::oyjlUiHeaderSection_Append (oyjlUiHeaderSection_s *sections, const char *nick, const char *label, const char *name, const char *description) |
| Add new header section at end. More... | |
| oyjlUiHeaderSection_s * | oyjlUi_s::oyjlUi_GetHeaderSection (oyjlUi_s *ui, const char *nick) |
| Return the section which was specified by its nick name. More... | |
| char * | oyjlUi_s::oyjlUi_ToMan (oyjlUi_s *ui, int flags OYJL_UNUSED) |
| Return a MAN page from options. More... | |
| char * | oyjlOptions_s::oyjlOptions_PrintHelp (oyjlOptions_s *opts, oyjlUi_s *ui, int verbose, FILE **out_file, const char *motto_format,...) |
| Print help text to stderr. More... | |
| char * | oyjlUi_s::oyjlUi_ToMarkdown (oyjlUi_s *ui, int flags) |
| Return markdown formated text from options. More... | |
| #define OYJL_COMPLETION_BASH 0x100 |
bash completion source code
| #define OYJL_GROUP_FLAG_EXPLICITE 0x100 |
Apply explicitely in UI.
For per option exception see OYJL_OPTION_FLAG_IMMEDIATE . The flag is intended for e.g. costly processing.
| #define OYJL_GROUP_FLAG_GENERAL_OPTS 0x200 |
Hint for MAN page section.
Recommend to set a special section name "GENERAL OPTIONS". Usualy it follows the "OPTIONS" section.
| #define OYJL_GROUP_FLAG_SUBCOMMAND 0x080 |
This oyjlOptionGroup_s flag requires one single mandatory option with oyjlOPTIONTYPE_NONE.
For a related flag see OYJL_OPTION_FLAG_NO_DASH
| #define OYJL_NO_DEFAULT_OPTIONS 0x04 |
omit automatic options generation for –help, –X export or –verbose
| #define OYJL_OPTION_FLAG_ACCEPT_NO_ARG 0x002 |
Accept as well no arg: "prog --opt[=arg]".
| #define OYJL_OPTION_FLAG_EDITABLE 0x001 |
The oyjlOption_s choices are merely a hint. Let users fill other strings too: "prog --opt=arg|...".
| #define OYJL_OPTION_FLAG_IMMEDIATE 0x200 |
Apply instantly in UI; opposite to OYJL_GROUP_FLAG_EXPLICITE.
| #define OYJL_OPTION_FLAG_MAINTENANCE 0x100 |
Maintenance option; can be invisible.
| #define OYJL_OPTION_FLAG_NO_DASH 0x004 |
No double dash '–' acceptance; single dash can be omitted by not specifying oyjlOption_s::o : "prog opt".
| #define OYJL_OPTION_FLAG_REPETITION 0x008 |
Accept more than one occurence: "prog --opt=arg ...".
| #define OYJL_QUIET 0x100000 |
be silent on error
| #define OYJL_SOURCE_CODE_C 0x01 |
C programming language source code.
Referenced by oyjlUi_s::oyjlUiExportToCode().
| #define OYJL_SUGGEST_VARIABLE_NAMES 0x08 |
automatic suggestion of variable names for missing oyjlOption_s::o and oyjlOption_s::option members
| #define OYJL_WITH_OYJL_ARGS_BASE_API 0x10 |
Restrict to oyjl_args_base.h API's.
| #define OYJL_WITH_OYJL_ARGS_C 0x02 |
Include oyjl_args.c . Skip libOyjlCore code.
| typedef union oyjlOption_u oyjlOption_u |
abstract option
The type is declared inside the oyjlOPTIONTYPE_e enum range.
| typedef struct oyjlOptionChoice_s oyjlOptionChoice_s |
Choice item.
| typedef struct oyjlOptionGroup_s oyjlOptionGroup_s |
Info to compile a Syntax line and check missing arguments.
Options listed in mandatory, optional and detail are comma(,) separated.
| typedef enum oyjlOPTIONTYPE_e oyjlOPTIONTYPE_e |
Type of option.
| typedef struct oyjlUi_s oyjlUi_s |
Info for graphic UI's containing options, additional info sections and other bells and whistles.
| typedef struct oyjlUiHeaderSection_s oyjlUiHeaderSection_s |
Header section.
| typedef enum oyjlVARIABLETYPE_e oyjlVARIABLE_e |
Types for oyjlVariable_u.
type of result
| typedef union oyjlVariable_u oyjlVariable_u |
abstract value
The type is declared inside the oyjlVARIABLE_e enum range.
| anonymous enum |
| enum oyjlARGS_EXPORT_e |
| enum oyjlARGS_EXPORT_e |
| enum oyjlOBJECT_e |
| enum oyjlOPTIONSTATE_e |
option state
| enum oyjlOPTIONTYPE_e |
| enum oyjlVARIABLETYPE_e |
Types for oyjlVariable_u.
| Enumerator | |
|---|---|
| oyjlNONE | no variable given, will be asked later with oyjlOptions_GetResult() |
| oyjlSTRING | pointer to a array of char |
| oyjlDOUBLE | IEEE floating point number with double precission |
| oyjlINT | integer number declared as int |
| int oyjlArgsRender | ( | int | argc, |
| const char ** | argv, | ||
| const char * | json, | ||
| const char * | commands, | ||
| const char * | output, | ||
| int | debug, | ||
| oyjlUi_s * | ui, | ||
| int(*)(int argc, const char **argv) | callback | ||
| ) |
Load renderer for graphical rendering options.
link with libOyjlArgsWeb and use microhttps WWW renderer as library
link with libOyjlArgsQml and use Qt's QML to render in a GUI
The function version in libOyjlCore dynamicaly dlopen() s libOyjlArgsQml. The function version in liboyjl-core-static needs as well liboyjl-args-qml-static to work. You should check wich library is linked and possibly guard the according code in case no QML library is available:
| [in] | argc | number of arguments from main() |
| [in] | argv | arguments from main() |
| [in] | json | JSON UI text; optional, can be generated from ui |
| [in] | commands | JSON commands/config text; optional, can be generated from ui or passed in as –render="XXX" option |
| [in] | output | write ui interaction results; optional |
| [in] | debug | set debug level |
| [in] | ui | user interface structure |
| [in,out] | callback | the function resembling main() to call into; It will be used to parse args, show help texts, all options handling and data processing |
| char * oyjlOption_PropertiesGetValue | ( | oyjlOption_s * | o, |
| const char * | key | ||
| ) |
access the oyjlOption_s::properties by key
References oyjlStringCopy(), oyjlStringListRelease(), and oyjlStringSplit2().
| int oyjlOptionChoice_Count | ( | oyjlOptionChoice_s * | list | ) |
Return number of array elements.
| void oyjlOptionChoice_Release | ( | oyjlOptionChoice_s ** | choices | ) |
Release dynamic structure.
| int oyjlOptions_Count | ( | oyjlOptions_s * | opts | ) |
Return number of "oiwi" array elements.
References oyjlOBJECT_OPTION.
| int oyjlOptions_CountGroups | ( | oyjlOptions_s * | opts | ) |
Return number of "oiwi" groups elements.
References oyjlOBJECT_OPTION_GROUP.
| oyjlOption_s * oyjlOptions_GetOption | ( | oyjlOptions_s * | opts, |
| const char * | ol | ||
| ) |
Obtain the specified option from one letter member::o.
| oyjlOption_s * oyjlOptions_GetOptionL | ( | oyjlOptions_s * | opts, |
| const char * | ostring, | ||
| int | flags | ||
| ) |
Obtain the specified option from option string.
Interprete "-o".
Interprete "--option"
Interprete "--option=arg" with arg
Interprete "--option.attr" with attribute
| oyjlOPTIONSTATE_e oyjlOptions_GetResult | ( | oyjlOptions_s * | opts, |
| const char * | opt, | ||
| const char ** | result_string, | ||
| double * | result_dbl, | ||
| int * | result_int | ||
| ) |
Obtain the parsed result.
This function is only useful, if the results shall be obtained independently from oyjlOption_s::variable after oyjlOptions_Parse().
If the option was not specified the state oyjlOPTION_NONE will be returned and otherwise oyjlOPTION_USER_CHANGED. With result_int and a option type of oyjlOPTIONTYPE_NONE, the number of occurences is obtained, e.g. -vvv will give result_int = 3. A option type oyjlOPTIONTYPE_DOUBLE can ask for the floating point result with a result_dbl argument.
References oyjlOPTION_NONE.
| oyjlOptions_s * oyjlOptions_New | ( | int | argc, |
| const char ** | argv | ||
| ) |
Allocate a new options structure.
| oyjlOPTIONSTATE_e oyjlOptions_Parse | ( | oyjlOptions_s * | opts | ) |
Parse the options into a private data structure.
The returned status can be used to detect usage errors and hint them on the command line. In the usual case where the variable fields are set, the results will be set too.
Put the count of found anonymous arguments into '@' options variable.i of variable_type oyjlINT.
References oyjlOPTION_NONE.
| char * oyjlOptions_PrintHelp | ( | oyjlOptions_s * | opts, |
| oyjlUi_s * | ui, | ||
| int | verbose, | ||
| FILE ** | out_file, | ||
| const char * | motto_format, | ||
| ... | |||
| ) |
Print help text to stderr.
| opts | options to print |
| ui | more info for e.g. from the documentation section for the description block; optional |
| verbose | gives debug output
|
| out_file | recommended output file |
| motto_format | prints a customised intoduction line |
| char ** oyjlOptions_ResultsToList | ( | oyjlOptions_s * | opts, |
| const char * | oc, | ||
| int * | count | ||
| ) |
Convert the parsed content to a text list.
This function is part of libOyjlArgsBase.
| [in] | opts | the argument object |
| [in] | oc | a filter; use NULL to get all results; e.g. use "@" for all anonymous results |
| [out] | count | the number of matched results |
Keep the -@=XXX unbound option around in order to simplify interpreting the options. Thus sub commands like "prog opt" can be easily separated from "prog unbound.txt" . For a correct command line the "-@=" must be omitted.
| char * oyjlOptions_ResultsToText | ( | oyjlOptions_s * | opts | ) |
Convert the parsed content to simple text.
| oyjl_val oyjlOptionStringToJson | ( | const char * | opts | ) |
Convert separated string to result JSON.
| opts | separate by colon ':' and omit leading dash '-' or '–' |
References OYJL_CREATE_NEW, oyjlStringCopy(), oyjlStringListRelease(), oyjlStringSplit(), oyjlTreeGetValueF(), oyjlTreeNew(), oyjlValueCount(), and oyjlValueSetString().
Copy structure.
The oyjlUi_s string members are mostly references.
References oyjlOBJECT_UI, and oyjlStringAppendN().
| oyjlUi_s * oyjlUi_Create | ( | int | argc, |
| const char ** | argv, | ||
| const char * | nick, | ||
| const char * | name, | ||
| const char * | description, | ||
| const char * | logo, | ||
| oyjlUiHeaderSection_s * | info, | ||
| oyjlOption_s * | options, | ||
| oyjlOptionGroup_s * | groups, | ||
| int * | status | ||
| ) |
Create a new UI structure.
This is a high level convinience function. The returned oyjlUi_s is a comlete description of the UI and can be used instantly. The options are parsed, errors are printed, help text is printed for the boolean -h/–help option. Boolean -v/–verbose is handled too. The results are set to the declared variables. The app_type defaults to "tool", but it can be replaced if needed.
| [in] | argc | number of command line arguments |
| [in] | argv | command line args from C/C++ main() |
| [in] | nick | four byte string; e.g. "myCl" |
| [in] | name | short name of the tool; i18n; e.g. _("My Command") |
| [in] | description | compact sentence starting with full name; i18n; e.g. _("My Command line tool from Me") |
| [in] | logo | icon name; This variable must contain the file name only, without ending. The icon needs to be installed in typical icon search path and will be detected there. e.g. "my_logo" points to "my_logo.{png|svg}" |
| [in] | info | general information for rich UI's and for help text |
| [in,out] | options | the main option declaration, with syntax declaration and variable passing for setting results |
| [in] | groups | the option grouping declares dependencies of options and provides a UI layout |
| [in,out] | status | inform about processing
|
| oyjlUi_s * oyjlUi_FromOptions | ( | const char * | nick, |
| const char * | name, | ||
| const char * | description, | ||
| const char * | logo, | ||
| oyjlUiHeaderSection_s * | info, | ||
| oyjlOptions_s * | opts, | ||
| int * | status | ||
| ) |
Create a new UI structure from options.
This function is part of libOyjlArgsBase.
This is a high level convinience function. The returned oyjlUi_s is a comlete description of the UI and can be used instantly. The options are parsed, errors are printed, help text is printed for the boolean -h/–help option. Boolean -v/–verbose is handled too. The results are set to the declared variables. The app_type defaults to "tool", but it can be replaced if needed.
| [in] | nick | four byte string; e.g. "myCl" |
| [in] | name | short name of the tool; i18n; e.g. _("My Command") |
| [in] | description | compact sentence starting with full name; i18n; e.g. _("My Command line tool from Me") |
| [in] | logo | icon name; This variable must contain the file name only, without ending. The icon needs to be installed in typical icon search path and will be detected there. e.g. "my_logo" points to "my_logo.{png|svg}" |
| [in] | info | general information for rich UI's and for help text |
| [in,out] | opts | The main option declaration, with syntax declaration and variable passing for setting results. The option grouping declares dependencies of options and provides a UI layout. |
| [in,out] | status | inform about processing
|
| oyjlUiHeaderSection_s * oyjlUi_GetHeaderSection | ( | oyjlUi_s * | ui, |
| const char * | nick | ||
| ) |
Return the section which was specified by its nick name.
| oyjlUi_s * oyjlUi_New | ( | int | argc, |
| const char ** | argv | ||
| ) |
Allocate a new ui structure.
The oyjlUi_s contains already options in the opts member.
| void oyjlUi_ReleaseArgs | ( | oyjlUi_s **ui | OYJL_UNUSED | ) |
Release "oiui".
Release oyjlUi_s::opts, oyjlUi_s::private_data and oyjlUi_s.
References oyjlOBJECT_UI.
| char * oyjlUi_ToMan | ( | oyjlUi_s * | ui, |
| int flags | OYJL_UNUSED | ||
| ) |
Return a MAN page from options.
Some manual pages (MAN pages) might contain some additional sections. They are supported as options. To generate a custom MAN page section, add a blind option to your options list and set the oyjlOption_s::o char to something non interupting like, dot '.' or similar. The oyjlOption_s::option string contains "man-section_head", with "section_head" being adapted to your needs. The "man-" identifier part will be cut off and "section_head" will become uppercase and underline '_' become empty space, e.g.: "SECTION HEAD". Use oyjlOption_s::value_type=oyjlOPTIONTYPE_CHOICE and place your string list into oyjlOptionChoice_s by filling it's members. Each choice is shown as own subsection. oyjlOptionChoice_s::nick is handled as a subsection headline and oyjlOptionChoice_s::name is shown as link or normal text. A "man-see_also" section oyjlOptionChoice_s::nick is scanned for MAN page cross references, e.g: "oyjl(1) oyjl(args(1)" and links are created appropriately. Translated section heads are "EXAMPLES, "SEE AS WELL", "HISTORY", "ENVIRONMENT VARIABLES", "EXIT-STATE" and "FILES".
| char * oyjlUi_ToMarkdown | ( | oyjlUi_s * | ui, |
| int | flags | ||
| ) |
Return markdown formated text from options.
This function supports extra sections in MAN page style.
| char * oyjlUiExportToCode | ( | oyjl_val | root, |
| int | flags | ||
| ) |
Return a source code from a parsed source tree (libOyjlExtra)
The input format is the JSON data from oyjlUi_ExportToJson().
| [in] | root | the parsed JSON tree to convert |
| [in] | flags | support; |
References OYJL_SOURCE_CODE_C, oyjlStr_New(), and oyjlTreeGetValue().
| oyjlUiHeaderSection_s * oyjlUiHeaderSection_Append | ( | oyjlUiHeaderSection_s * | sections, |
| const char * | nick, | ||
| const char * | label, | ||
| const char * | name, | ||
| const char * | description | ||
| ) |
Add new header section at end.
| int oyjlUiHeaderSection_Count | ( | oyjlUiHeaderSection_s * | sections | ) |
Return the number of sections of type "oihs".
References oyjlOBJECT_UI_HEADER_SECTION.
Change Defaults.
| root | –export=json output |
| defaults | parsed oyjlOptionStringToJson() JSON |
References OYJL_KEY, oyjlTreeGetValue(), oyjlTreeToPaths(), and oyjlValueCount().
| oyjl_val oyjlUiJsonSetOption | ( | oyjl_val | root, |
| oyjl_val | results, | ||
| const char * | key, | ||
| const char * | value, | ||
| int | current_group_id, | ||
| int flags | OYJL_UNUSED | ||
| ) |
Set interactive option and format cli args (libOyjlExtra)
The input format is the JSON data from oyjlUi_ToJson().
| [in] | root | the parsed JSON tree to convert |
| [in,out] | results | the changed option and state |
| [in] | key | the option key to change |
| [in] | value | the option value to change |
| [in] | current_group_id | the group which was modified |
| [in] | flags | nothing |
1.8.13