| Libgretl Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
gretlopt get_gretl_options (char *line, int *err); gretlopt opt_from_flag (unsigned char c); const char * print_flags (gretlopt oflags, int ci); const char ** get_opts_for_command (int ci, int *nopt); int check_for_loop_only_options (int ci, gretlopt opt, PRN *prn); char ** get_all_option_strings (int *pn); gretlopt transcribe_option_flags (gretlopt *targ, gretlopt src, gretlopt test); gretlopt delete_option_flags (gretlopt *targ, gretlopt test); int incompatible_options (gretlopt opt, gretlopt test); int option_prereq_missing (gretlopt opt, gretlopt test, gretlopt prereq); int inapplicable_option_error (int ci, gretlopt opt); double get_optval_double (int ci, gretlopt opt); void set_optval_double (int ci, gretlopt opt, double x); const char * get_optval_string (int ci, gretlopt opt); void clear_option_params (void); void option_flags_cleanup (void);
gretlopt get_gretl_options (char *line, int *err);
Check for option flags in line: if found, chop them out and set
the return value accordingly.
line : |
command line to parse. |
err : |
location for error code, which is set to 1 in case any invalid options are found, else set to 0. |
| Returns : | the options found in the line. |
gretlopt opt_from_flag (unsigned char c);
c : |
|
| Returns : | the gretl option value associated with a given single-character flag. Gives 0 if there is no associated option. |
const char * print_flags (gretlopt oflags, int ci);
oflags : |
options. |
ci : |
command index, for context. |
| Returns : | a string representation of the options in oflags,
or an empty string if no options are found. The returned
value should not be modified in any way.
|
const char ** get_opts_for_command (int ci,
int *nopt);
ci : |
|
nopt : |
|
| Returns : |
int check_for_loop_only_options (int ci,
gretlopt opt,
PRN *prn);
ci : |
gretl command index. |
opt : |
option flag to be tested. |
prn : |
gretl printing struct. |
| Returns : | 1 if option opt is applicable for command ci only
in the context of a command loop (in which case a warning is
printed to prn), otherwise 0.
|
gretlopt transcribe_option_flags (gretlopt *targ, gretlopt src, gretlopt test);
targ : |
|
src : |
|
test : |
|
| Returns : |
gretlopt delete_option_flags (gretlopt *targ, gretlopt test);
If the intersection of the flags in targ and test is non-
empty, unset the corresponding flags in targ.
targ : |
pointer to target option flags. |
test : |
bitwise OR of flags that to be deleted. |
| Returns : | the (possibly modified) targ.
|
int incompatible_options (gretlopt opt, gretlopt test);
opt : |
option flags to be tested. |
test : |
bitwise OR of flags that are incompatible in context. |
| Returns : | E_BADOPT if opt contains more than one of the flags
in test, otherwise 0.
|
int option_prereq_missing (gretlopt opt, gretlopt test, gretlopt prereq);
opt : |
option flags to be tested. |
test : |
bitwise OR of flags that have a deinite prequisite. |
prereq : |
bitwise OR of prequisite flags. |
| Returns : | E_BADOPT if opt contains at least one element of
test but no elements of prereq, otherwise 0.
|
int inapplicable_option_error (int ci,
gretlopt opt);
Flags an error: to be used when opt is not applicable in the
context of command ci, in context.
ci : |
command index. |
opt : |
bad option flag. |
| Returns : | E_BADOPT.
|
double get_optval_double (int ci,
gretlopt opt);
ci : |
gretl command index. |
opt : |
gretl option value. |
| Returns : | the double-precision ancillary value currently
associated with option opt for command ci, if any,
otherwise NADBL.
|
void set_optval_double (int ci,
gretlopt opt,
double x);
Sets a double-precision ancillary value to be associated
with option opt for command ci.
ci : |
gretl command index. |
opt : |
gretl option value. |
x : |
value to set. |
const char * get_optval_string (int ci,
gretlopt opt);
ci : |
gretl command index. |
opt : |
gretl option value. |
| Returns : | the ancillary string value currently
associated with option opt for command ci, if any,
otherwise NULL.
|
void clear_option_params (void);
Clears any ancillary parameter values currently associated with gretl command/option pairs.