1 /*****************************************************************************
2 * intf_cmd.h: interface commands parsing and executions functions
3 * This file implements the interface commands execution functions. It is used
4 * by command-line oriented interfaces and scripts. The commands themselves are
5 * implemented in intf_ctrl.
6 *****************************************************************************
7 * Copyright (C) 1999, 2000 VideoLAN
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public
22 * License along with this program; if not, write to the
23 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
25 *****************************************************************************/
27 /*****************************************************************************
30 *****************************************************************************/
32 /*****************************************************************************
33 * intf_arg_t: control fonction argument descriptor
34 *****************************************************************************
35 * This structure is used to control an argument type and to transmit
36 * arguments to control functions. It is also used to parse format string and
37 * build an easier to use array of arguments.
38 *****************************************************************************/
42 int i_flags; /* argument type and flags */
43 int i_index; /* index of mask in format string */
45 /* Converted arguments value */
46 char * psz_str; /* string value */
47 char * ps_name; /* name, can be '\0' or '=' terminated */
48 long i_num; /* integer value */
49 float f_num; /* float value */
53 #define INTF_STR_ARG 1 /* string argument */
54 #define INTF_INT_ARG 2 /* integer argument */
55 #define INTF_FLOAT_ARG 4 /* float argument */
56 #define INTF_NAMED_ARG 16 /* named argument */
57 #define INTF_OPT_ARG 256 /* optionnal argument */
58 #define INTF_REP_ARG 512 /* argument can be repeated */
59 #define INTF_PRESENT_ARG 1024 /* argument has been encountered */
61 /*****************************************************************************
62 * intf_command_t: control command descriptor
63 *****************************************************************************
64 * This structure describes a control commands. It stores informations needed
65 * for argument type checking, command execution but also a short inline help.
66 * See control.c for more informations about fields.
67 *****************************************************************************/
70 /* Function control */
71 char * psz_name; /* command name */
72 int (* function)( int i_argc, intf_arg_t *p_argv ); /* function */
73 char * psz_format; /* arguments format */
75 /* Function informations */
76 char * psz_summary; /* info text */
77 char * psz_usage; /* usage text */
78 char * psz_help; /* help text */
81 /*****************************************************************************
83 *****************************************************************************
84 * These errors should be used as return values for control functions (see
85 * control.c). The intf_ExecCommand function as different behaviour depending
86 * of the error it received. Other errors numbers can be used, but their valued
87 * should be positive to avoid conflict with future error codes.
88 *****************************************************************************/
90 #define INTF_NO_ERROR 0 /* success */
91 #define INTF_FATAL_ERROR -1 /* fatal error: the program will end */
92 #define INTF_CRITICAL_ERROR -2 /* critical error: the program will exit */
93 #define INTF_USAGE_ERROR -3 /* usage error: command usage will be displayed */
94 #define INTF_OTHER_ERROR -4/* other error: command prints its own message */
96 /*****************************************************************************
98 *****************************************************************************/
99 int intf_ExecCommand ( char *psz_cmd );
100 int intf_ExecScript ( char *psz_filename );