interact

interact —

Synopsis




#define     MAXSAVENAME
#define     CMD_NULL
#define     CMD_COMMENT
typedef     CMD;
typedef     ExecState;
enum        CmdEchoFlags;
enum        ProgramOptions;
enum        ForcedLangs;
enum        ExecFlags;
#define     HIDDEN_COMMAND                  (c)
int         gretl_cmd_init                  (CMD *cmd);
void        gretl_cmd_free                  (CMD *cmd);
CMD*        gretl_cmd_new                   (void);
void        gretl_cmd_destroy               (CMD *cmd);
void        gretl_cmd_set_context           (CMD *cmd,
                                             int ci);
void        gretl_cmd_destroy_context       (CMD *cmd);
char*       gretl_cmd_get_savename          (char *sname);
gretlopt    gretl_cmd_get_opt               (const CMD *cmd);
void        gretl_cmd_set_opt               (CMD *cmd,
                                             gretlopt opt);
int         parse_command_line              (char *line,
                                             CMD *cmd,
                                             double ***pZ,
                                             DATAINFO *pdinfo);
int         get_command_index               (char *line,
                                             CMD *cmd,
                                             const DATAINFO *pdinfo);
int         command_number                  (const char *cmd);
int         cli_help                        (const char *cmdword,
                                             const char *helpfile,
                                             int locale,
                                             PRN *prn);
int         parseopt                        (const char **argv,
                                             int argc,
                                             char *fname,
                                             int *force_lang);
int         gretl_shell                     (const char *arg);
void        echo_cmd                        (const CMD *cmd,
                                             const DATAINFO *pdinfo,
                                             const char *line,
                                             unsigned char flags,
                                             PRN *prn);
void        echo_function_call              (const char *line,
                                             unsigned char flags,
                                             PRN *prn);
void        safe_print_line                 (const char *line,
                                             int *plen,
                                             PRN *prn);
int         gretl_cmd_exec                  (ExecState *s,
                                             double ***pZ,
                                             DATAINFO **ppdinfo);
int         call_pca_plugin                 (VMatrix *corrmat,
                                             double ***pZ,
                                             DATAINFO *pdinfo,
                                             gretlopt *pflag,
                                             PRN *prn);
int         ready_for_command               (const char *line);

Description

Details

MAXSAVENAME

#define MAXSAVENAME 32


CMD_NULL

#define CMD_NULL    -1


CMD_COMMENT

#define CMD_COMMENT -2


CMD

typedef struct CMD_ CMD;


ExecState

typedef struct ExecState_ ExecState;


enum CmdEchoFlags

typedef enum {
    CMD_BATCH_MODE     = 1 << 0,
    CMD_STACKING       = 1 << 1,
    CMD_RECORDING      = 1 << 2,
    CMD_CLI            = 1 << 3
} CmdEchoFlags;


enum ProgramOptions

typedef enum {
    OPT_BATCH   = 1 << 0,
    OPT_HELP    = 1 << 1,
    OPT_VERSION = 1 << 2,
    OPT_RUNIT   = 1 << 3,
    OPT_DBOPEN  = 1 << 4,
    OPT_WEBDB   = 1 << 5,
    OPT_DUMP    = 1 << 6,
    OPT_DEBUG   = 1 << 7
} ProgramOptions;


enum ForcedLangs

typedef enum {
    ENGLISH = 1,
    BASQUE
} ForcedLangs;


enum ExecFlags

typedef enum {
    CONSOLE_EXEC      = 1 << 0,
    SCRIPT_EXEC       = 1 << 1,
    SESSION_EXEC      = 1 << 2,
    INCLUDE_EXEC      = 1 << 3,
    FUNCTION_EXEC     = 1 << 4
} ExecFlags;


HIDDEN_COMMAND()

#define     HIDDEN_COMMAND(c)

c :

gretl_cmd_init ()

int         gretl_cmd_init                  (CMD *cmd);

cmd :
Returns :

gretl_cmd_free ()

void        gretl_cmd_free                  (CMD *cmd);

cmd :

gretl_cmd_new ()

CMD*        gretl_cmd_new                   (void);

Returns :

gretl_cmd_destroy ()

void        gretl_cmd_destroy               (CMD *cmd);

cmd :

gretl_cmd_set_context ()

void        gretl_cmd_set_context           (CMD *cmd,
                                             int ci);

cmd :
ci :

gretl_cmd_destroy_context ()

void        gretl_cmd_destroy_context       (CMD *cmd);

cmd :

gretl_cmd_get_savename ()

char*       gretl_cmd_get_savename          (char *sname);

sname :
Returns :

gretl_cmd_get_opt ()

gretlopt    gretl_cmd_get_opt               (const CMD *cmd);

cmd :
Returns :

gretl_cmd_set_opt ()

void        gretl_cmd_set_opt               (CMD *cmd,
                                             gretlopt opt);

cmd :
opt :

parse_command_line ()

int         parse_command_line              (char *line,
                                             CMD *cmd,
                                             double ***pZ,
                                             DATAINFO *pdinfo);

Parses line and fills out cmd accordingly.

line : the command line.
cmd : pointer to command struct.
pZ : pointer to data matrix.
pdinfo : pointer to data information struct.
Returns : 0 on success, non-zero error code on error.

get_command_index ()

int         get_command_index               (char *line,
                                             CMD *cmd,
                                             const DATAINFO *pdinfo);

Parse line and assign to the ci field of cmd the index number of the command embedded in line. Note: this is a "lite" version of parse_command_line(). It is used when commands are being stacked for execution within a loop. Note that command options are not parsed out of line.

line : command line.
cmd : pointer to gretl command struct.
pdinfo : dataset information.
Returns : 1 on error, otherwise 0.

command_number ()

int         command_number                  (const char *cmd);

cmd :
Returns :

cli_help ()

int         cli_help                        (const char *cmdword,
                                             const char *helpfile,
                                             int locale,
                                             PRN *prn);

Searches in helpfile for help on cmdword and, if help is found, prints it to prn. If cmdword is NULL, lists the valid commands.

cmdword : the command on which help is wanted.
helpfile : path to the gretl help file.
locale : if non-zero, check to see if we need to recode into the local character set.
prn : pointer to gretl printing struct.
Returns : 0 on success, 1 if the helpfile was not found or the requested topic was not found.

parseopt ()

int         parseopt                        (const char **argv,
                                             int argc,
                                             char *fname,
                                             int *force_lang);

argv : command-line argument array.
argc : argument count.
fname : optional filename argument.
force_lang : pointer to store result of "force language" option.
Returns : the gretl option code corresponding to the first "real" option flag, or 0 if the option flag is not recognized.

gretl_shell ()

int         gretl_shell                     (const char *arg);

arg :
Returns :

echo_cmd ()

void        echo_cmd                        (const CMD *cmd,
                                             const DATAINFO *pdinfo,
                                             const char *line,
                                             unsigned char flags,
                                             PRN *prn);

Echoes the user command represented by cmd and line, to stdout (if prn is NULL) or prn. This is used for two distinct purposes: to give visual feedback on the command supplied, and (in some contexts) to record a command that was executed interactively.

cmd : pointer to CMD struct.
pdinfo : pointer to data information struct.
line : "raw" command line associated with cmd.
flags : bitwise OR of elements from CmdEchoFlags.
prn : pointer to gretl printing struct (or NULL).

echo_function_call ()

void        echo_function_call              (const char *line,
                                             unsigned char flags,
                                             PRN *prn);

line :
flags :
prn :

safe_print_line ()

void        safe_print_line                 (const char *line,
                                             int *plen,
                                             PRN *prn);

line :
plen :
prn :

gretl_cmd_exec ()

int         gretl_cmd_exec                  (ExecState *s,
                                             double ***pZ,
                                             DATAINFO **ppdinfo);

s :
pZ :
ppdinfo :
Returns :

call_pca_plugin ()

int         call_pca_plugin                 (VMatrix *corrmat,
                                             double ***pZ,
                                             DATAINFO *pdinfo,
                                             gretlopt *pflag,
                                             PRN *prn);

corrmat :
pZ :
pdinfo :
pflag :
prn :
Returns :

ready_for_command ()

int         ready_for_command               (const char *line);

line :
Returns :