| Libgretl Reference Manual |
|---|
interactinteract — |
#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);
typedef enum {
CMD_BATCH_MODE = 1 << 0,
CMD_STACKING = 1 << 1,
CMD_RECORDING = 1 << 2,
CMD_CLI = 1 << 3
} CmdEchoFlags;
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;
typedef enum {
CONSOLE_EXEC = 1 << 0,
SCRIPT_EXEC = 1 << 1,
SESSION_EXEC = 1 << 2,
INCLUDE_EXEC = 1 << 3,
FUNCTION_EXEC = 1 << 4
} ExecFlags;
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. |
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. |
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. |
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. |
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).
|
void echo_function_call (const char *line,
unsigned char flags,
PRN *prn);
line : |
|
flags : |
|
prn : |
void safe_print_line (const char *line,
int *plen,
PRN *prn);
line : |
|
plen : |
|
prn : |
int gretl_cmd_exec (ExecState *s, double ***pZ, DATAINFO **ppdinfo);
s : |
|
pZ : |
|
ppdinfo : |
|
| Returns : |
int call_pca_plugin (VMatrix *corrmat, double ***pZ, DATAINFO *pdinfo, gretlopt *pflag, PRN *prn);
corrmat : |
|
pZ : |
|
pdinfo : |
|
pflag : |
|
prn : |
|
| Returns : |
| << gretl_commands | objstack >> |