options

options —

Synopsis

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);

Description

Details

get_gretl_options ()

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.

opt_from_flag ()

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.

print_flags ()

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.

get_opts_for_command ()

const char **       get_opts_for_command                (int ci,
                                                         int *nopt);

ci :
nopt :
Returns :

check_for_loop_only_options ()

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.

get_all_option_strings ()

char **             get_all_option_strings              (int *pn);

pn :
Returns :

transcribe_option_flags ()

gretlopt            transcribe_option_flags             (gretlopt *targ,
                                                         gretlopt src,
                                                         gretlopt test);

targ :
src :
test :
Returns :

delete_option_flags ()

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.

incompatible_options ()

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.

option_prereq_missing ()

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.

inapplicable_option_error ()

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.

get_optval_double ()

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.

set_optval_double ()

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.

get_optval_string ()

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.

clear_option_params ()

void                clear_option_params                 (void);

Clears any ancillary parameter values currently associated with gretl command/option pairs.


option_flags_cleanup ()

void                option_flags_cleanup                (void);