42 : mtasklist(tasklist),
43 ws(tasklist.workspace()),
44 mcfile(std::move(controlfile)),
46 verbosity(rverbosity) {
75 <<
"Mixing positional and named arguments is not allowed.";
85 named_args.push_back(current_argument);
96 Index bracket_level = 0;
97 bool inside_quotes =
false;
102 while ((bracket_level || inside_quotes) ||
111 if (bracket_level < 0)
118 if (prev_char !=
'\\') inside_quotes = !inside_quotes;
127 }
catch (
const Eot& x) {
130 "Unexpectedly reached end of file.\nProbably a runaway argument.",
140 }
catch (
const Eot& x) {
162 os <<
"Expected ',' or ')' but found '" <<
msource.
Current() <<
"' after "
176 for (arg_index = 0; arg_index < (
Index)named_args.size(); arg_index++) {
177 if (named_args[(
size_t)arg_index].name == name)
return;
207 out3 <<
"\nParsing control text:\n";
221 if (
"Arts" != md_data[
id].Name() &&
"Arts2" != md_data[
id].Name()) {
223 os <<
"The outermost agenda must be Arts2!\n"
224 <<
"(But it seems to be " << md_data[id].Name() <<
".)\n";
234 }
catch (
const Eot&) {
239 os <<
"Unexpected character(s) at the end of the control file\n";
240 os <<
"after the main agenda was already closed.\n";
241 os <<
"File: " << x.
file() <<
'\n';
242 os <<
"Line: " << x.
line() <<
'\n';
243 os <<
"Column: " << x.
column() <<
'\n';
244 throw runtime_error(os.str());
246 }
catch (
const Eot& x) {
249 os <<
"Unexpected end of control script.\n";
250 os <<
"File: " << x.
file() <<
'\n';
251 os <<
"Line: " << x.
line() <<
'\n';
252 throw runtime_error(os.str());
256 os <<
"Unexpected character:\n";
257 os << x.what() <<
'\n';
258 os <<
"File: " << x.
file() <<
'\n';
259 os <<
"Line: " << x.
line() <<
'\n';
260 os <<
"Column: " << x.
column() <<
'\n';
261 throw runtime_error(os.str());
265 os <<
"Illegal Line break:\n";
266 os << x.what() <<
'\n';
267 os <<
"File: " << x.
file() <<
'\n';
268 os <<
"Line: " << x.
line() <<
'\n';
269 throw runtime_error(os.str());
275 os <<
"Unknown Method:\n";
276 os << x.what() <<
'\n';
277 os <<
"File: " << x.
file() <<
'\n';
278 os <<
"Line: " << x.
line() <<
'\n';
279 os <<
"Column: " << x.
column() <<
'\n';
280 throw runtime_error(os.str());
286 os <<
"Unknown workspace variable:\n";
287 os << x.what() <<
'\n';
288 os <<
"File: " << x.
file() <<
'\n';
289 os <<
"Line: " << x.
line() <<
'\n';
290 os <<
"Column: " << x.
column() <<
'\n';
291 throw runtime_error(os.str());
295 os <<
"Attempt to create a workspace variable that already exists:\n";
296 os << x.what() <<
'\n';
297 os <<
"File: " << x.
file() <<
'\n';
298 os <<
"Line: " << x.
line() <<
'\n';
299 os <<
"Column: " << x.
column() <<
'\n';
300 throw runtime_error(os.str());
306 os <<
"Workspace variable belongs to the wrong group:\n";
307 os << x.what() <<
'\n';
308 os <<
"File: " << x.
file() <<
'\n';
309 os <<
"Line: " << x.
line() <<
'\n';
310 os <<
"Column: " << x.
column() <<
'\n';
311 throw runtime_error(os.str());
315 os <<
"Parse error:\n";
316 os << x.what() <<
'\n';
317 os <<
"File: " << x.
file() <<
'\n';
318 os <<
"Line: " << x.
line() <<
'\n';
319 os <<
"Column: " << x.
column() <<
'\n';
320 throw runtime_error(os.str());
361 id, output, input, tasks, auto_vars, auto_vars_values, include_file);
371 if (includedir.nelem()) {
372 if (current_includepath.
nelem() && current_includepath[0] != includedir)
373 current_includepath.insert(current_includepath.begin(), includedir);
379 find_file(matching_files, include_file, current_includepath);
380 find_file(matching_files, include_file +
".arts", current_includepath);
382 if (!matching_files.
nelem()) {
384 os <<
"Cannot find include file " << include_file <<
".\n";
386 os <<
"Search path was: " << current_includepath <<
"\n";
391 include_file = matching_files[0];
392 out2 <<
"- Including control file " << include_file <<
"\n";
397 for (
auto& method: tasks.Methods())
401 if (md_data[
id].SetMethod()) {
404 MRecord(
id, output, input, auto_vars_values[0], tasks));
416 const String& mname = md_data[id].Name();
418 if (mname.length() > 6 && mname.find(
"Create") == mname.length() - 6 &&
420 if (agenda_name !=
"Arts2") {
422 os << mname <<
" cannot be called inside an agenda.\n"
423 <<
"All workspace variables are global and must be created at the top level.";
431 wsv_groups[(*
ws->wsv_data_ptr)[output[0]].Group()].name;
432 map<String, Index>::const_iterator mdit;
433 mdit = MdMap.find(method_name);
445 out3 <<
"- " << md_data[id].Name() <<
"\n";
449 md_data[
id].GOutType().nelem() + md_data[
id].GInType().nelem()) {
452 out3 << (*
ws->wsv_data_ptr)[output[j]].Name() <<
" ";
458 out3 << (*
ws->wsv_data_ptr)[input[j]].Name() <<
" ";
516 bool found_curly_brace =
false;
524 auto_vars_values.resize(0);
530 if (methodname ==
"INCLUDE") {
539 if (methodname ==
"Arts2") {
541 }
else if (methodname ==
"Arts") {
543 "Arts version 1 controlfiles are no longer supported.");
549 mdd,
id, methodname, output, input, auto_vars, auto_vars_values);
557 found_curly_brace =
true;
564 out3 <<
"- " << mdd->
Name() <<
"\n";
573 os <<
"Expected method name , but got `" <<
msource.
Current() <<
"'.";
582 if (found_curly_brace) {
585 }
catch (
const Eot& x) {
587 if (!no_eot)
throw Eot(x);
614 ostringstream os_default_error;
616 <<
"\nParse error in default value for generic input variable.\n"
617 <<
"This is not a user error but a bug in methods.cc.\n"
618 <<
"Please contact the ARTS developers.";
628 istringstream is(mdd->
GInDefault()[gin_index]);
631 if (is.bad() || is.fail()) failed =
true;
634 istringstream is(mdd->
GInDefault()[gin_index]);
637 if (is.bad() || is.fail()) failed =
true;
647 os << p.what() << os_default_error.str();
660 os << p.what() << os_default_error.str();
673 os << p.what() << os_default_error.str();
683 }
catch (std::exception& e) {
684 std::ostringstream os;
685 os << e.what() << os_default_error.str();
693 os <<
"Default values for generic inputs with type "
694 << wsv_groups[mdd->
GInType()[gin_index]]
695 <<
" are not supported.\n"
696 <<
"Either remove the default value for generic input '"
697 << mdd->
GIn()[gin_index] <<
"' in workspace method\n"
698 <<
"*" << mdd->
Name() <<
"* in methods.cc or discuss this "
699 <<
"issue on the arts-dev mailing list.\n";
710 name =
"auto_" + mdd->
Name() +
"_" +
"gin" + os.str() +
"_" +
711 mdd->
GIn()[gin_index];
714 auto wsvit =
ws->WsvMap_ptr->find(name);
715 if (wsvit ==
ws->WsvMap_ptr->end()) {
717 "Automatically allocated variable.",
720 wsvid = wsvit->second;
723 auto_vars.push_back(wsvid);
724 auto_vars_values.push_back(tv);
728 os <<
"Failed to assign default value for generic '"
729 << mdd->
GIn()[gin_index] <<
"'.\n"
730 <<
"Check the documentation of workspace method *" << mdd->
Name()
737 os <<
"Generic input '" << mdd->
GIn()[gin_index]
738 <<
"' omitted but no default value found.\n"
739 <<
"Check the documentation of workspace method *" << mdd->
Name()
771 bool still_supergeneric =
true;
776 const auto md_raw_id = MdRawMap.find(methodname);
777 if (md_raw_id == MdRawMap.end())
781 id = md_raw_id->second;
786 mdd = &md_data_raw[id];
792 const auto i2 = MdMap.find(methodname);
798 still_supergeneric =
false;
803 Index supergeneric_index = -1;
805 Index this_method_end_line = -1;
806 Index this_method_end_column = -1;
807 bool call_by_name =
false;
838 bool is_first_arg =
true;
843 still_supergeneric, supergeneric_args,
844 supergeneric_index, named_arguments, call_by_name);
847 is_first_arg, named_arguments, call_by_name);
850 auto_vars_values, is_first_arg, still_supergeneric,
851 supergeneric_args, supergeneric_index,
852 named_arguments, call_by_name);
862 if (call_by_name && named_arguments.size()) {
865 os <<
"Error in arguments passed to " << mdd->
Name() <<
":\n";
866 for (
auto &argument_name : named_arguments) {
867 if (std::find(mdd->
GIn().begin(), mdd->
GIn().end(),
868 argument_name.name) == mdd->
GIn().end() &&
869 std::find(mdd->
GOut().begin(), mdd->
GOut().end(),
870 argument_name.name) == mdd->
GOut().end())
871 os <<
" Unkown argument: ";
873 os <<
" Duplicate argument: ";
874 os << argument_name.name << std::endl;
913 os <<
"This method has generic output. "
914 <<
"You have to pass a variable!";
922 for (
auto outs = vo.begin(); outs < vo.end(); ++outs) {
923 output.push_back(*outs);
927 for (
auto ins = vi.begin(); ins < vi.end(); ++ins) {
928 input.push_back(*ins);
934 bool all_gin_have_defaults =
true;
935 for (
Index gin = 0; all_gin_have_defaults && gin < mdd->
GIn().nelem();
941 all_gin_have_defaults =
false;
947 const auto wsvit =
ws->WsvMap_ptr->find(wsvname);
948 if (wsvit ==
ws->WsvMap_ptr->end()) {
953 wsvid = wsvit->second;
955 input.push_back(wsvid);
959 if (!all_gin_have_defaults) {
961 os <<
"Not all generic inputs of the method *" << methodname
962 <<
"* have default values, you have to specify them!";
992 bool& still_supergeneric,
993 String& supergeneric_args,
1005 Index this_arg_index = 0;
1010 if (this_arg_index != -1) {
1012 named_args[this_arg_index].
column);
1013 named_args.erase(named_args.begin() + this_arg_index);
1027 if ((call_by_name && this_arg_index == -1) ||
msource.
Current() ==
',' ||
1036 "generic" + os.str(),
1042 "Unexpected '=' sign encountered.\n"
1043 "Mixing positional and named arguments is not allowed.",
1049 "Only constants can be passed to Set methods.\n"
1050 "You might want to use the *Copy* here.",
1061 ws->WsvMap_ptr->find(wsvname);
1062 if (wsvit ==
ws->WsvMap_ptr->end()) {
1067 wsvid = wsvit->second;
1073 if (still_supergeneric) {
1075 if (wsv_groups[mdd->
GInType()[j]] ==
"Any")
1076 supergeneric_args +=
1077 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name;
1078 os << mdd->
Name() <<
"_sg_" << supergeneric_args;
1079 methodname = os.str();
1082 const auto mdit = MdMap.find(methodname);
1083 if (mdit != MdMap.end()) {
1088 still_supergeneric =
false;
1099 if (supergeneric_index == -1) {
1100 bool wrong_group_id =
true;
1103 if ((*
ws->wsv_data_ptr)[wsvid].Group() == mdd->
GInSpecType()[j][i]) {
1104 wrong_group_id =
false;
1105 supergeneric_index = i;
1109 if (wrong_group_id) {
1111 bool firsttype =
true;
1121 "*" + mdd->
Name() +
"* is not defined for " +
1122 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name +
1123 " input. Check the online docs.",
1129 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1132 wsvname +
" is not " +
1133 wsv_groups[mdd->
GInSpecType()[j][supergeneric_index]].name +
1135 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1141 }
else if ((*
ws->wsv_data_ptr)[wsvid].Group() != mdd->
GInType()[j]) {
1143 wsvname +
" is not " + wsv_groups[mdd->
GInType()[j]].name +
1144 ", it is " + wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1151 input.push_back(wsvid);
1176 bool& still_supergeneric,
1177 String& supergeneric_args,
1178 Index& supergeneric_index,
1180 bool call_by_name) {
1188 for (
Index j = 0; j < mdd->
GOut().nelem(); ++j) {
1190 Index this_arg_index;
1194 if (this_arg_index == -1) {
1196 os <<
"This method has generic output. "
1197 <<
"You have to pass a variable!";
1203 named_args[this_arg_index].
column);
1204 named_args.erase(named_args.begin() + this_arg_index);
1220 auto wsvit =
ws->WsvMap_ptr->find(wsvname);
1221 if (wsvit ==
ws->WsvMap_ptr->end()) {
1222 if (still_supergeneric) {
1224 os <<
"This might be either a typo or you have to create "
1225 <<
"the variable\nby calling TYPECreate(" << wsvname
1226 <<
") first. Replace TYPE with the\n"
1227 <<
"WSV group your variable should belong to.";
1233 if (mdd->
Name().length() <= 6 ||
1234 mdd->
Name().substr(mdd->
Name().length() - 6) !=
"Create") {
1236 os <<
"This might be either a typo or you have to create "
1237 <<
"the variable\nby calling "
1238 << wsv_groups[mdd->
GOutType()[j]] <<
"Create( " << wsvname
1247 "Automatically allocated variable.",
1252 if (mdd->
Name().length() > 6 &&
1253 mdd->
Name().find(
"Create") == mdd->
Name().length() - 6) {
1255 wsv_groups[(*
ws->wsv_data_ptr)[wsvit->second].Group()].name;
1256 if (mdd->
Name().find(gn) not_eq 0) {
1260 " already exists of group ",
1262 ". A variable cannot be redefined as a different group.\n"),
1268 wsvid = wsvit->second;
1276 if (still_supergeneric) {
1278 if (wsv_groups[mdd->
GOutType()[j]] ==
"Any")
1279 supergeneric_args +=
1280 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name;
1281 os << mdd->
Name() <<
"_sg_" << supergeneric_args;
1282 methodname = os.str();
1285 const auto mdit = MdMap.find(methodname);
1286 if (mdit != MdMap.end()) {
1291 still_supergeneric =
false;
1302 if (supergeneric_index == -1) {
1303 bool wrong_group_id =
true;
1306 if ((*
ws->wsv_data_ptr)[wsvid].Group() == mdd->
GOutSpecType()[j][i]) {
1307 wrong_group_id =
false;
1308 supergeneric_index = i;
1312 if (wrong_group_id) {
1314 bool firsttype =
true;
1324 "*" + mdd->
Name() +
"* is not defined for " +
1325 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name +
1326 " output. Check the online docs.",
1332 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1335 wsvname +
" is not " +
1336 wsv_groups[mdd->
GOutSpecType()[j][supergeneric_index]].name +
1338 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1344 }
else if ((*
ws->wsv_data_ptr)[wsvid].Group() != mdd->
GOutType()[j]) {
1346 wsvname +
" is not " + wsv_groups[mdd->
GOutType()[j]].name +
1347 ", it is " + wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1354 output.push_back(wsvid);
1378 bool call_by_name) {
1388 for (
auto ins = vi.begin(); ins < vi.end(); ++ins) {
1392 Index this_arg_index;
1394 wsvname = (*
ws->wsv_data_ptr)[*ins].Name();
1398 if (this_arg_index != -1) {
1400 named_args[this_arg_index].
column);
1401 named_args.erase(named_args.begin() + this_arg_index);
1406 (*
ws->wsv_data_ptr)[*ins].Name(),
1408 (*
ws->wsv_data_ptr)[*ins].Group());
1419 os <<
"Expected input WSV *" << (*
ws->wsv_data_ptr)[*ins].Name()
1428 (*
ws->wsv_data_ptr)[*ins].Name(),
1430 (*
ws->wsv_data_ptr)[*ins].Group());
1436 ws->WsvMap_ptr->find(wsvname);
1437 if (wsvit ==
ws->WsvMap_ptr->end())
1441 wsvid = wsvit->second;
1445 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1446 (*
ws->wsv_data_ptr)[*ins].Group()) {
1448 wsvname +
" is not " +
1449 wsv_groups[(*
ws->wsv_data_ptr)[*ins].Group()].name +
", it is " +
1450 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1456 input.push_back(wsvid);
1476 bool call_by_name) {
1484 for (
auto outs = vo.begin(); outs < vo.end();
1489 Index this_arg_index = 0;
1491 wsvname = (*
ws->wsv_data_ptr)[*outs].Name();
1495 if (this_arg_index != -1) {
1497 named_args[this_arg_index].
column);
1498 named_args.erase(named_args.begin() + this_arg_index);
1511 os <<
"Expected output WSV *" << (*
ws->wsv_data_ptr)[*outs].Name()
1526 ws->WsvMap_ptr->find(wsvname);
1527 if (wsvit ==
ws->WsvMap_ptr->end()) {
1528 if (mdd->
Name().length() > 6 &&
1529 mdd->
Name().substr(mdd->
Name().length() - 6) !=
"Create") {
1531 os <<
"This might be either a typo or you have to create "
1532 <<
"the variable\nby calling "
1533 << wsv_groups[(*
ws->wsv_data_ptr)[*outs].Group()]
1534 <<
"Create( " << wsvname <<
" ) first.\n";
1541 "Automatically allocated variable.",
1542 (*
ws->wsv_data_ptr)[*outs].Group()));
1545 if (wsvid == -1) wsvid = wsvit->second;
1549 if ((*
ws->wsv_data_ptr)[wsvid].Group() !=
1550 (*
ws->wsv_data_ptr)[*outs].Group()) {
1552 wsvname +
" is not " +
1553 wsv_groups[(*
ws->wsv_data_ptr)[*outs].Group()].name +
", it is " +
1554 wsv_groups[(*
ws->wsv_data_ptr)[wsvid].Group()].name,
1560 output.push_back(wsvid);
1582 const Index method_type,
1587 for (
Index i = 0; i < auto_vars.
nelem(); i++) {
1588 map<String, Index>::const_iterator mdit;
1590 TokVal auto_keyword_value;
1595 const Index auto_group = (*
ws->wsv_data_ptr)[auto_vars[i]].Group();
1606 << wsv_groups[(*
ws->wsv_data_ptr)[auto_vars[i]].Group()]
1607 <<
" constant to a WSM is not supported!";
1613 switch (method_type) {
1615 auto_keyword_value = auto_vars_values[i];
1616 auto_output_var.push_back(auto_vars[i]);
1618 wsv_groups[(*
ws->wsv_data_ptr)[auto_vars[i]].Group()].name +
"Set";
1621 auto_input_var.push_back(auto_vars[i]);
1624 wsv_groups[(*
ws->wsv_data_ptr)[auto_vars[i]].Group()].name;
1633 mdit = MdMap.find(method_name);
1635 init_mdid = mdit->second;
1693 os <<
"Expected whitespace, but got `" << dummy <<
"'.";
1708 while (pos < str.length() &&
is_whitespace(str[pos])) pos++;
1728 os <<
"Workspace variable names must start with a letter!";
1736 if (isalnum(dummy) ||
'_' == dummy) {
1770 const String& default_name,
1772 const Index group) {
1782 os <<
"Passing constants as supergeneric arguments is not supported.";
1793 name =
"auto_" + mdd->
Name() +
"_" + default_name;
1794 auto wsvit =
ws->WsvMap_ptr->find(name);
1795 if (wsvit ==
ws->WsvMap_ptr->end()) {
1797 name.c_str(),
"Automatically allocated variable.", group));
1799 wsvid = wsvit->second;
1802 auto_vars.push_back(wsvid);
1809 auto_vars_values.push_back(dummy);
1813 auto_vars_values.push_back(n);
1817 auto_vars_values.push_back(n);
1821 auto_vars_values.push_back(dummy);
1825 auto_vars_values.push_back(dummy);
1830 if (dummy.
nelem()) {
1833 auto_vars_values.push_back(aost);
1837 auto_vars_values.push_back(dummy);
1841 auto_vars_values.push_back(dummy);
1845 os <<
"Unsupported argument type: " << wsv_groups[group];
1862 os <<
"Expected '" <<
c <<
"', but got '" <<
msource.
Current() <<
"'.";
1929 if (
'+' == dummy ||
'-' == dummy) {
1941 os <<
"Expected digit or variable name, but got `" <<
msource.
Current()
1949 if (isdigit(chtmp)) {
1981 bool found_digit =
false;
1985 if (
'+' == dummy ||
'-' == dummy) {
1999 if (isdigit(chtmp)) {
2029 if (isdigit(chtmp)) {
2043 throw ParseError(
"Expected at least one digit.",
2050 if (
'e' == dummy ||
'E' == dummy) {
2075 istringstream is(res);
2086 istringstream is(res);
2127 res.push_back(dummy);
2168 res.push_back(dummy);
2213 tres.push_back(dummy);
2219 for (
int i = 0; i < tres.
nelem(); i++) {
2253 Index cur_ncols = 0;
2266 if (ncols != -1 && cur_ncols > ncols) {
2269 <<
"'. Check Matrix dimensions.";
2279 }
else if (ncols != cur_ncols) {
2282 <<
"'. Check Matrix dimensions.";
2291 if (ncols > cur_ncols)
c =
',';
2294 <<
"'. Check Matrix dimensions.";
2301 tres.push_back(dummy);
2305 if (ncols == -1) ncols = cur_ncols;
2306 if (ncols != cur_ncols) {
2307 throw ParseError(
"Missing element(s) in last row of matrix",
2314 res.
resize(nrows, ncols);
2315 for (
Index i = 0; i < nrows; i++)
2316 for (
Index j = 0; j < ncols; j++) res(i, j) = tres[i * ncols + j];
2339 if (str[pos] !=
'[') {
2340 throw ParseError(
"No opening bracket found while parsing ArrayOfIndex.",
2352 while (pos < str.length() && str[pos] !=
']') {
2356 if (str[pos] !=
',') {
2364 istringstream is(str.substr(pos));
2366 if (is.bad() || is.fail())
return false;
2367 tres.push_back(dummy);
2368 while (pos < str.length() &&
2369 (isdigit(str[pos]) || str[pos] ==
'-' || str[pos] ==
'e'))
2375 res.resize(tres.
nelem());
2376 for (
int i = 0; i < tres.
nelem(); i++) {
2401 if (str[pos] !=
'[') {
2402 throw ParseError(
"No opening bracket found while parsing Vector.",
2414 while (pos < str.length() && str[pos] !=
']') {
2418 if (str[pos] !=
',') {
2426 istringstream is(str.substr(pos));
2428 if (is.bad() || is.fail())
return false;
2429 tres.push_back(dummy);
2430 if (str[pos] ==
'N' && str.find(
"NaN", pos) == pos) {
2433 while (pos < str.length() && (isdigit(str[pos]) || str[pos] ==
'-' ||
2434 str[pos] ==
'.' || str[pos] ==
'e'))
2442 for (
int i = 0; i < tres.
nelem(); i++) {
2469 if (str[pos] !=
'[') {
2470 throw ParseError(
"No opening bracket found while parsing ArrayOfString.",
2482 while (pos < str.length() && str[pos] !=
']') {
2486 if (str[pos] !=
',') {
2493 if (str[pos] !=
'"') {
2494 throw ParseError(
"Expected quotes while parsing ArrayOfString.",
2503 while (pos < str.length() && str[pos] !=
'"') {
2508 if (pos == str.length() || str[pos] !=
'"')
return false;
2510 tres.push_back(dummy);
2516 res.resize(tres.
nelem());
2517 for (
int i = 0; i < tres.
nelem(); i++) {
The global header file for ARTS.
void push_back(const MRecord &n)
Append a new method to end of list.
void resize(Index n)
Resize the method list.
Index nelem() const ARTS_NOEXCEPT
bool parse_stringarray_from_string(ArrayOfString &res, String &str)
Read an Array of Strings from a String.
void parse_specific_output(const MdRecord *mdd, ArrayOfIndex &output, bool &first, NamedArguments &named_args, bool call_by_name)
Parse the output WSVs for current method from the controlfile.
const Verbosity & verbosity
void parse_numeric(Numeric &n)
Use a String stream to parse a floating point number.
vector< NamedArgument > NamedArguments
void parse_tasklist()
Public interface to the main function of the parser.
void read_name(String &name)
Reads name of method, keyword, or workspace variable.
void tasklist_insert_set_delete(const ArrayOfIndex &auto_vars, const Array< TokVal > &auto_vars_values, const Index method_type, Agenda &tasklist)
Insert Set and Delete methods for automatically allocated output WSVs.
void parse_generic_input(const MdRecord *&mdd, Index &id, String &methodname, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, bool &first, bool &still_supergeneric, String &supergeneric_args, Index &supergeneric_index, NamedArguments &named_args, bool call_by_name)
Parse the generic input WSVs for current method from the controlfile.
void parse_Stringvector(ArrayOfString &res)
Read a vector of Strings.
void parse_integer(Index &n)
Use a String stream to parse an integer number.
void skip_to_next_argument()
Skips forward to the next argument.
void assertain_character(char c)
Make sure that the current character is equal to c and go to the next character.
void parse_specific_input(const MdRecord *mdd, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, bool &first, NamedArguments &named_args, bool call_by_name)
Parse the specific input WSVs for current method from the controlfile.
std::shared_ptr< Workspace > ws
{ String name NamedArgument
Index read_name_or_value(String &name, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, const String &default_name, const MdRecord *mdd, const Index group)
Reads name of a workspace variable or a value.
void find_named_arguments(vector< NamedArgument > &named_args)
Find named arguments.
bool parse_intvector_from_string(ArrayOfIndex &res, String &str)
Read an array of integers from a String.
ArtsParser(Agenda &tasklist, String controlfile, const Verbosity &verbosity)
Constructs a new parser.
bool parse_numvector_from_string(Vector &res, String &str)
Read a vector of Numerics from a String.
void use_default_method_args(const MdRecord *mdd, String &methodname, ArrayOfIndex &output, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values)
Set defaults if method is called without any arguments.
bool is_whitespace(const char c)
Returns true if this character is considered whitespace.
void parse_method(Index &id, ArrayOfIndex &output, ArrayOfIndex &input, Agenda &tasks, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, String &include_file, bool no_eot=false)
Parse the Contents of text as ARTS control input.
void eat_whitespace_from_string(String &str, size_t &pos)
Eats whitespace from a String.
String set_gin_to_default(const MdRecord *mdd, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values, Index keyword_index)
Set generic input to default value.
void parse_agenda(Agenda &tasklist, const String &agenda_name)
Parse the Contents of text as ARTS control input.
void eat_whitespace()
Eats whitespace.
void parse_main()
The main function of the parser.
void parse_String(String &res)
Reads a String, complete with quotation marks.
void read_numeric(String &res)
Reads a floating point number.
void parse_method_args(const MdRecord *&mdd, Index &id, String &methodname, ArrayOfIndex &output, ArrayOfIndex &input, ArrayOfIndex &auto_vars, Array< TokVal > &auto_vars_values)
Parse method's argument list.
void parse_generic_output(const MdRecord *&mdd, Index &id, String &methodname, ArrayOfIndex &output, bool &first, bool &still_supergeneric, String &supergeneric_args, Index &supergeneric_index, NamedArguments &named_args, bool call_by_name)
Parse the generic output WSVs for current method from the controlfile.
void parse_numvector(Vector &res)
Read a vector of Numerics.
void read_integer(String &res)
Reads an integer.
void parse_intvector(ArrayOfIndex &res)
Read a vector of integers.
void parse_matrix(Matrix &res)
Read a Matrix.
void at_end_of_argument(const String &argname)
Check if current position in controlfile is at the end of an argument.
void get_argument_index_by_name(Index &arg_index, NamedArguments &named_args, const String &name)
Return the index of the argument with the given name.
void resize(Index r, Index c)
Resize function.
All information for one workspace method.
const String & Name() const
const ArrayOfIndex & InOnly() const
const ArrayOfIndex & GOutType() const
const Array< String > & GInDefault() const
const ArrayOfArrayOfIndex & GInSpecType() const
const ArrayOfString & GOut() const
bool AgendaMethod() const
bool Supergeneric() const
const ArrayOfArrayOfIndex & GOutSpecType() const
const ArrayOfIndex & Out() const
const ArrayOfIndex & GInType() const
const ArrayOfString & GIn() const
Structure to hold all command line Parameters.
ArrayOfString includepath
List of paths to search for include files.
ArrayOfString datapath
List of paths to search for data files.
Index MarkedLine()
Return the marked line number, but for the file that is associated with the current position.
void AdvanceChar()
Advance position pointer by one character.
void AdvanceLine()
Advances position pointer by one line.
Index Line()
Return the line number, but for the file that is associated with the current position.
const String & File()
Return the filename associated with the current position.
void SetMark()
Mark current position.
void AppendFile(const String &name)
Appends contents of file to the source text.
char Current()
Return the current character.
bool & LineBreak()
Read the line break flag.
Index MarkedColumn()
Return the current marked column.
bool reachedEot()
Check if the current position reached the end.
Index Column()
Return the current column.
void Init()
This sets the pointer to the first existing character in the text.
Index LineRaw()
Return the line index.
Index ColumnRaw()
Return the column index.
void SetPosition(Index line, Index column)
Set current position.
void resize(Index n)
Resize function.
This class contains all static information for one workspace variable.
Input manipulator class for doubles to enable nan and inf parsing.
#define ARTS_ASSERT(condition,...)
std::string var_string(Args &&... args)
The declarations of all the exception classes.
bool find_file(ArrayOfString &matches, const std::string_view filename, const ArrayOfString &paths, const ArrayOfString &extensions)
Searches through paths for a file with a matching name.
String get_dirname(const std::string_view path)
Return the parent directory of a path.
This file contains basic functions to handle ASCII files.
Index get_wsv_group_id(const String &name)
Returns the id of the given group.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Declaration of the class MdRecord.
const ArrayOfGroupRecord wsv_groups
The names associated with Wsv groups as Strings.
const Array< MdRecord > md_data_raw
Lookup information for workspace methods.
const Array< MdRecord > md_data
Lookup information for workspace methods.
const map< String, Index > MdMap
The map associated with md_data.
const map< String, Index > MdRawMap
The map associated with md_data_raw.
Parameters parameters
Holds the command line parameters.
This file contains header information for the dealing with command line parameters.
This file contains the Workspace class.
Auxiliary header stuff related to workspace variable groups.