MCPcopy Create free account
hub / github.com/covscript/covscript / covscript_args

Function covscript_args

sources/interpreter.cpp:90–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88bool show_version_info = false;
89
90int covscript_args(int args_size, char *args[])
91{
92 int expect_csym = 0;
93 int expect_log_path = 0;
94 int expect_import_path = 0;
95 int expect_stack_resize = 0;
96 int index = 1;
97 for (; index < args_size; ++index) {
98 if (expect_csym == 1) {
99 csym_path = cs::process_path(args[index]);
100 expect_csym = 2;
101 }
102 else if (expect_log_path == 1) {
103 log_path = cs::process_path(args[index]);
104 expect_log_path = 2;
105 }
106 else if (expect_import_path == 1) {
107 cs::current_process->import_path += cs::path_delimiter + cs::process_path(args[index]);
108 expect_import_path = 2;
109 }
110 else if (expect_stack_resize == 1) {
111 cs::current_process->resize_stack(std::stoul(args[index]));
112 expect_stack_resize = 2;
113 }
114 else if (args[index][0] == '-') {
115 if (std::strcmp(args[index], "--args") == 0 || std::strcmp(args[index], "-a") == 0) {
116 repl = true;
117 return ++index;
118 }
119 else if ((std::strcmp(args[index], "--silent") == 0 || std::strcmp(args[index], "-s") == 0) && !silent)
120 silent = true;
121 else if ((std::strcmp(args[index], "--dump-ast") == 0 || std::strcmp(args[index], "-d") == 0) && !dump_ast)
122 dump_ast = true;
123 else if ((std::strcmp(args[index], "--dependency") == 0 || std::strcmp(args[index], "-r") == 0) &&
124 !dump_dependency)
125 dump_dependency = true;
126 else if ((std::strcmp(args[index], "--no-optimize") == 0 || std::strcmp(args[index], "-o") == 0) &&
127 !no_optimize)
128 no_optimize = true;
129 else if ((std::strcmp(args[index], "--compile-only") == 0 || std::strcmp(args[index], "-c") == 0) &&
130 !compile_only)
131 compile_only = true;
132 else if ((std::strcmp(args[index], "--help") == 0 || std::strcmp(args[index], "-h") == 0) &&
133 !show_help_info)
134 show_help_info = true;
135 else if ((std::strcmp(args[index], "--wait-before-exit") == 0 || std::strcmp(args[index], "-w") == 0) &&
136 !wait_before_exit)
137 wait_before_exit = true;
138 else if ((std::strcmp(args[index], "--version") == 0 || std::strcmp(args[index], "-v") == 0) &&
139 !show_version_info)
140 show_version_info = true;
141 else if ((std::strcmp(args[index], "--csym") == 0 || std::strcmp(args[index], "-g") == 0) &&
142 expect_csym == 0)
143 expect_csym = 1;
144 else if ((std::strcmp(args[index], "--log-path") == 0 || std::strcmp(args[index], "-l") == 0) &&
145 expect_log_path == 0)
146 expect_log_path = 1;
147 else if ((std::strcmp(args[index], "--import-path") == 0 || std::strcmp(args[index], "-i") == 0) &&

Callers 1

covscript_mainFunction · 0.70

Calls 3

process_pathFunction · 0.85
fatal_errorClass · 0.85
resize_stackMethod · 0.80

Tested by

no test coverage detected