1 | /* Copyright JS Foundation and other contributors, http://js.foundation |
2 | * |
3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
4 | * you may not use this file except in compliance with the License. |
5 | * You may obtain a copy of the License at |
6 | * |
7 | * http://www.apache.org/licenses/LICENSE-2.0 |
8 | * |
9 | * Unless required by applicable law or agreed to in writing, software |
10 | * distributed under the License is distributed on an "AS IS" BASIS |
11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | * See the License for the specific language governing permissions and |
13 | * limitations under the License. |
14 | */ |
15 | |
16 | #ifndef MAIN_OPTIONS_H |
17 | #define MAIN_OPTIONS_H |
18 | |
19 | #include <stdint.h> |
20 | |
21 | /** |
22 | * Argument option flags. |
23 | */ |
24 | typedef enum |
25 | { |
26 | OPT_FLAG_EMPTY = 0, |
27 | OPT_FLAG_PARSE_ONLY = (1 << 0), |
28 | OPT_FLAG_DEBUG_SERVER = (1 << 1), |
29 | OPT_FLAG_WAIT_SOURCE = (1 << 2), |
30 | OPT_FLAG_NO_PROMPT = (1 << 3), |
31 | OPT_FLAG_USE_STDIN = (1 << 4), |
32 | OPT_FLAG_TEST262_OBJECT = (1u << 5), |
33 | } main_option_flags_t; |
34 | |
35 | /** |
36 | * Source types |
37 | */ |
38 | typedef enum |
39 | { |
40 | SOURCE_SNAPSHOT, |
41 | SOURCE_MODULE, |
42 | SOURCE_SCRIPT, |
43 | } main_source_type_t; |
44 | |
45 | /** |
46 | * Input source file. |
47 | */ |
48 | typedef struct |
49 | { |
50 | uint32_t path_index; |
51 | uint16_t snapshot_index; |
52 | uint16_t type; |
53 | } main_source_t; |
54 | |
55 | /** |
56 | * Arguments struct to store parsed command line arguments. |
57 | */ |
58 | typedef struct |
59 | { |
60 | main_source_t *sources_p; |
61 | uint32_t source_count; |
62 | |
63 | const char *debug_channel; |
64 | const char *debug_protocol; |
65 | const char *debug_serial_config; |
66 | uint16_t debug_port; |
67 | |
68 | const char *exit_cb_name_p; |
69 | |
70 | uint16_t option_flags; |
71 | uint16_t init_flags; |
72 | } main_args_t; |
73 | |
74 | void |
75 | main_parse_args (int argc, char **argv, main_args_t *arguments_p); |
76 | |
77 | #endif /* !MAIN_OPTIONS_H */ |
78 | |