GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / include / ui_command.h
blob252f19a86991789a33fc40e79777bc1e7f4b5b0e
1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * Command interpreter defs File: ui_command.h
5 *
6 * This file contains structures related to the
7 * command interpreter.
8 *
9 * Author: Mitch Lichtenberg (mpl@broadcom.com)
11 *********************************************************************
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
16 * This software is furnished under license and may be used and
17 * copied only in accordance with the following terms and
18 * conditions. Subject to these conditions, you may download,
19 * copy, install, use, modify and distribute modified or unmodified
20 * copies of this software in source and/or binary form. No title
21 * or ownership is transferred hereby.
23 * 1) Any source code used, modified or distributed must reproduce
24 * and retain this copyright notice and list of conditions
25 * as they appear in the source file.
27 * 2) No right is granted to use any trade name, trademark, or
28 * logo of Broadcom Corporation. The "Broadcom Corporation"
29 * name may not be used to endorse or promote products derived
30 * from this software without the prior written permission of
31 * Broadcom Corporation.
33 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
34 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
37 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
38 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
41 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
43 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
45 * THE POSSIBILITY OF SUCH DAMAGE.
46 ********************************************************************* */
48 #ifndef _LIB_QUEUE_H
49 #include "lib_queue.h"
50 #endif
52 typedef struct ui_cmdsw_s {
53 int swidx;
54 char *swname;
55 char *swvalue;
56 } ui_cmdsw_t;
58 #define MAX_TOKENS 64
59 #define MAX_SWITCHES 16
60 #define MAX_TOKEN_SIZE 1000
61 typedef struct ui_cmdline_s {
62 int argc;
63 char *argv[MAX_TOKENS];
64 int swc;
65 ui_cmdsw_t swv[MAX_SWITCHES];
66 int (*func)(struct ui_cmdline_s *,int argc,char *argv[]);
67 int argidx;
68 char *ref;
69 char *usage;
70 char *switches;
71 } ui_cmdline_t;
73 typedef struct ui_command_s {
74 queue_t list;
75 int term;
76 char *ptr;
77 queue_t head;
78 } ui_command_t;
80 typedef struct ui_token_s {
81 queue_t qb;
82 char token;
83 } ui_token_t;
85 #define CMD_TERM_EOL 0
86 #define CMD_TERM_SEMI 1
87 #define CMD_TERM_AND 2
88 #define CMD_TERM_OR 3
90 int cmd_sw_value(ui_cmdline_t *cmd,char *swname,char **swvalue);
91 int cmd_sw_posn(ui_cmdline_t *cmd,char *swname);
92 char *cmd_sw_name(ui_cmdline_t *cmd,int swidx);
93 int cmd_sw_isset(ui_cmdline_t *cmd,char *swname);
94 char *cmd_getarg(ui_cmdline_t *cmd,int argnum);
95 void cmd_free(ui_cmdline_t *cmd);
96 int cmd_sw_validate(ui_cmdline_t *cmd,char *validstr);
97 void cmd_parse(ui_cmdline_t *cmd,char *line);
98 int cmd_addcmd(char *command,
99 int (*func)(ui_cmdline_t *,int argc,char *argv[]),
100 void *ref,
101 char *help,
102 char *usage,
103 char *switches);
104 int cmd_lookup(queue_t *head,ui_cmdline_t *cmd);
105 void cmd_init(void);
106 int cmd_getcommand(ui_cmdline_t *cmd);
107 void cmd_showusage(ui_cmdline_t *cmd);
111 #define CMD_ERR_INVALID -1
112 #define CMD_ERR_AMBIGUOUS -2
113 #define CMD_ERR_BLANK -3
116 /* *********************************************************************
117 * Prototypes (public routines)
118 ********************************************************************* */
120 const char *ui_errstring(int errcode);
121 int ui_showerror(int errcode,char *tmplt,...);
122 int ui_showusage(ui_cmdline_t *cmd);
123 int ui_docommands(char *str);
124 #define ui_docommand(str) ui_docommands(str)
125 void ui_restart(int);
126 int ui_init_cmddisp(void);
129 /* *********************************************************************
130 * Prototypes (internal routines)
131 ********************************************************************* */
133 ui_command_t *cmd_readcommand(queue_t *head);
134 void cmd_build_list(queue_t *qb,char *buf);
135 void cmd_walk_and_expand(queue_t *qb);
136 ui_command_t *cmd_readcommand(queue_t *head);
137 void cmd_free_tokens(queue_t *list);
138 void cmd_build_cmdline(queue_t *head, ui_cmdline_t *cmd);