Root/jzboot/include/shell_internal.h

1/*
2 * JzBoot: an USB bootloader for JZ series of Ingenic(R) microprocessors.
3 * Copyright (C) 2010 Sergey Gridassov <grindars@gmail.com>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __SHELL_INTERNAL__H__
20#define __SHELL_INTERNAL__H__
21
22#define SHELL_INTERNALS
23#define STATE_WANTSTR 0
24#define STATE_WANTSPACE 1
25
26#define TOK_SEPARATOR 1
27#define TOK_STRING 2
28#define TOK_SPACE 3
29#define TOK_COMMENT 4
30
31typedef struct {
32    void *device;
33    char linebuf[512];
34    char *strval;
35    char *line;
36    const struct shell_command *set_cmds;
37    int shell_exit;
38    int prev_progress;
39} shell_context_t;
40
41
42typedef struct {
43    int argc;
44    char **argv;
45} shell_run_data_t;
46
47int shell_pull(shell_context_t *ctx, char *buf, int maxlen);
48
49#ifndef FLEX_SCANNER
50typedef void *yyscan_t;
51int yylex_init(yyscan_t *ptr_yy_globals);
52int yylex_init_extra(shell_context_t *user_defined, yyscan_t *ptr_yy_globals);
53int yylex(yyscan_t yyscanner) ;
54int yylex_destroy (yyscan_t yyscanner) ;
55#else
56#define YY_EXTRA_TYPE shell_context_t *
57#define YY_INPUT(buf, result, max_size) result = shell_pull(yyextra, buf, max_size);
58#endif
59
60#include "shell.h"
61
62#endif
63
64

Archive Download this file



interactive