case YY_STATE_EOF(S_surfxml_AS_4):
case YY_STATE_EOF(S_surfxml_AS_6):
case YY_STATE_EOF(S_surfxml_AS_8):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</AS>' expected.");
+FAIL("Premature EOF: `</AS>' expected.");
YY_BREAK
case 47:
if (!AX_surfxml_ASroute_src) FAIL("Required attribute `src' not set for `ASroute' element.");
LEAVE; STag_surfxml_ASroute(); surfxml_pcdata_ix = 0; ETag_surfxml_ASroute(); popbuffer(); /* attribute */
switch (YY_START) {
- case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
- case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
- case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
- case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+ case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+ case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+ case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+ case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
}
}
YY_BREAK
ETag_surfxml_ASroute();
popbuffer(); /* attribute */
switch (YY_START) {
- case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
- case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
- case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
- case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+ case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+ case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+ case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+ case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
}
}
YY_BREAK
case YY_STATE_EOF(E_surfxml_ASroute):
case YY_STATE_EOF(S_surfxml_ASroute):
case YY_STATE_EOF(S_surfxml_ASroute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</ASroute>' expected.");
+FAIL("Premature EOF: `</ASroute>' expected.");
YY_BREAK
case 68:
case YY_STATE_EOF(E_surfxml_actor):
case YY_STATE_EOF(S_surfxml_actor):
case YY_STATE_EOF(S_surfxml_actor_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</actor>' expected.");
+FAIL("Premature EOF: `</actor>' expected.");
YY_BREAK
case 89:
FAIL("Unexpected character `%c': `</argument>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_argument):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</argument>' expected.");
+FAIL("Premature EOF: `</argument>' expected.");
YY_BREAK
case 100:
FAIL("Unexpected character `%c': `</backbone>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_backbone):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</backbone>' expected.");
+FAIL("Premature EOF: `</backbone>' expected.");
YY_BREAK
case 115:
case YY_STATE_EOF(E_surfxml_bypassASroute):
case YY_STATE_EOF(S_surfxml_bypassASroute):
case YY_STATE_EOF(S_surfxml_bypassASroute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</bypassASroute>' expected.");
+FAIL("Premature EOF: `</bypassASroute>' expected.");
YY_BREAK
case 132:
case YY_STATE_EOF(E_surfxml_bypassRoute):
case YY_STATE_EOF(S_surfxml_bypassRoute):
case YY_STATE_EOF(S_surfxml_bypassRoute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</bypassRoute>' expected.");
+FAIL("Premature EOF: `</bypassRoute>' expected.");
YY_BREAK
case 145:
case YY_STATE_EOF(E_surfxml_bypassZoneRoute):
case YY_STATE_EOF(S_surfxml_bypassZoneRoute):
case YY_STATE_EOF(S_surfxml_bypassZoneRoute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</bypassZoneRoute>' expected.");
+FAIL("Premature EOF: `</bypassZoneRoute>' expected.");
YY_BREAK
case 162:
FAIL("Unexpected character `%c': `</cabinet>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_cabinet):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</cabinet>' expected.");
+FAIL("Premature EOF: `</cabinet>' expected.");
YY_BREAK
case 185:
case YY_STATE_EOF(E_surfxml_cluster):
case YY_STATE_EOF(S_surfxml_cluster):
case YY_STATE_EOF(S_surfxml_cluster_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</cluster>' expected.");
+FAIL("Premature EOF: `</cluster>' expected.");
YY_BREAK
case 242:
case YY_STATE_EOF(E_surfxml_config):
case YY_STATE_EOF(S_surfxml_config):
case YY_STATE_EOF(S_surfxml_config_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</config>' expected.");
+FAIL("Premature EOF: `</config>' expected.");
YY_BREAK
case 253:
case YY_STATE_EOF(E_surfxml_host):
case YY_STATE_EOF(S_surfxml_host):
case YY_STATE_EOF(S_surfxml_host_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</host>' expected.");
+FAIL("Premature EOF: `</host>' expected.");
YY_BREAK
case 276:
FAIL("Unexpected character `%c': `</host_link>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_host___link):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</host_link>' expected.");
+FAIL("Premature EOF: `</host_link>' expected.");
YY_BREAK
/* <!-- tag include is deprecated. Not documented, and soon removed --> */
case YY_STATE_EOF(E_surfxml_include):
case YY_STATE_EOF(S_surfxml_include):
case YY_STATE_EOF(S_surfxml_include_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</include>' expected.");
+FAIL("Premature EOF: `</include>' expected.");
YY_BREAK
case 302:
case YY_STATE_EOF(E_surfxml_link):
case YY_STATE_EOF(S_surfxml_link):
case YY_STATE_EOF(S_surfxml_link_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</link>' expected.");
+FAIL("Premature EOF: `</link>' expected.");
YY_BREAK
case 329:
FAIL("Unexpected character `%c': `</link_ctn>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_link___ctn):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</link_ctn>' expected.");
+FAIL("Premature EOF: `</link_ctn>' expected.");
YY_BREAK
/* <!-- <!ATTLIST model_prop key CDATA #REQUIRED> -->
FAIL("Unexpected character `%c': `</model_prop>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_model___prop):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</model_prop>' expected.");
+FAIL("Premature EOF: `</model_prop>' expected.");
YY_BREAK
case 359:
FAIL("Unexpected character `%c': `</mount>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_mount):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</mount>' expected.");
+FAIL("Premature EOF: `</mount>' expected.");
YY_BREAK
case 372:
FAIL("Unexpected character `%c': `</peer>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_peer):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</peer>' expected.");
+FAIL("Premature EOF: `</peer>' expected.");
YY_BREAK
/* <!--
case YY_STATE_EOF(S_surfxml_platform_4):
case YY_STATE_EOF(S_surfxml_platform_6):
case YY_STATE_EOF(S_surfxml_platform_8):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</platform>' expected.");
+FAIL("Premature EOF: `</platform>' expected.");
YY_BREAK
case 408:
case YY_STATE_EOF(E_surfxml_process):
case YY_STATE_EOF(S_surfxml_process):
case YY_STATE_EOF(S_surfxml_process_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</process>' expected.");
+FAIL("Premature EOF: `</process>' expected.");
YY_BREAK
/* <!-- <!ATTLIST prop key CDATA #REQUIRED> -->
FAIL("Unexpected character `%c': `</prop>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_prop):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</prop>' expected.");
+FAIL("Premature EOF: `</prop>' expected.");
YY_BREAK
case 442:
FAIL("Unexpected character `%c': `</random>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_random):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</random>' expected.");
+FAIL("Premature EOF: `</random>' expected.");
YY_BREAK
case 473:
case YY_STATE_EOF(E_surfxml_route):
case YY_STATE_EOF(S_surfxml_route):
case YY_STATE_EOF(S_surfxml_route_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</route>' expected.");
+FAIL("Premature EOF: `</route>' expected.");
YY_BREAK
case 490:
FAIL("Unexpected character `%c': `</router>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_router):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</router>' expected.");
+FAIL("Premature EOF: `</router>' expected.");
YY_BREAK
case 503:
case YY_STATE_EOF(E_surfxml_storage):
case YY_STATE_EOF(S_surfxml_storage):
case YY_STATE_EOF(S_surfxml_storage_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</storage>' expected.");
+FAIL("Premature EOF: `</storage>' expected.");
YY_BREAK
case 520:
case YY_STATE_EOF(E_surfxml_storage___type):
case YY_STATE_EOF(S_surfxml_storage___type):
case YY_STATE_EOF(S_surfxml_storage___type_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</storage_type>' expected.");
+FAIL("Premature EOF: `</storage_type>' expected.");
YY_BREAK
case 537:
FAIL("Unexpected end-tag `%s': `</trace>' expected.",surf_parse_text);
YY_BREAK
case YY_STATE_EOF(IN_trace):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</trace>' expected.");
+FAIL("Premature EOF: `</trace>' expected.");
YY_BREAK
case 551:
FAIL("Unexpected character `%c': `</trace_connect>' expected.",surf_parse_text[0]);
YY_BREAK
case YY_STATE_EOF(E_surfxml_trace___connect):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</trace_connect>' expected.");
+FAIL("Premature EOF: `</trace_connect>' expected.");
YY_BREAK
case 574:
case YY_STATE_EOF(S_surfxml_zone_4):
case YY_STATE_EOF(S_surfxml_zone_6):
case YY_STATE_EOF(S_surfxml_zone_8):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</zone>' expected.");
+FAIL("Premature EOF: `</zone>' expected.");
YY_BREAK
case 605:
if (!AX_surfxml_zoneRoute_src) FAIL("Required attribute `src' not set for `zoneRoute' element.");
LEAVE; STag_surfxml_zoneRoute(); surfxml_pcdata_ix = 0; ETag_surfxml_zoneRoute(); popbuffer(); /* attribute */
switch (YY_START) {
- case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
- case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
- case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
- case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+ case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+ case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+ case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+ case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
}
}
YY_BREAK
ETag_surfxml_zoneRoute();
popbuffer(); /* attribute */
switch (YY_START) {
- case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
- case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
- case S_surfxml_zone_1: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
- case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
+ case S_surfxml_AS_5: case S_surfxml_AS_6: SET(S_surfxml_AS_6); break;
+ case S_surfxml_AS: case S_surfxml_AS_1: case S_surfxml_AS_3: case S_surfxml_AS_4: case S_surfxml_AS_7: case S_surfxml_AS_8: SET(S_surfxml_AS_8); break;
+ case S_surfxml_zone: case S_surfxml_zone_3: case S_surfxml_zone_5: case S_surfxml_zone_6: SET(S_surfxml_zone_6); break;
+ case S_surfxml_zone_1: case S_surfxml_zone_4: case S_surfxml_zone_7: case S_surfxml_zone_8: SET(S_surfxml_zone_8); break;
}
}
YY_BREAK
case YY_STATE_EOF(E_surfxml_zoneRoute):
case YY_STATE_EOF(S_surfxml_zoneRoute):
case YY_STATE_EOF(S_surfxml_zoneRoute_2):
-if(!ETag_surfxml_include_state()) FAIL("Premature EOF: `</zoneRoute>' expected.");
+FAIL("Premature EOF: `</zoneRoute>' expected.");
YY_BREAK
/* EPILOG: after the root element. */
extern "C" {
-int ETag_surfxml_include_state();
-
#include "simgrid_dtd.c"
-/*
- * Stuff relative to the <include> tag
- */
-static std::vector<YY_BUFFER_STATE> surf_input_buffer_stack;
-static std::vector<FILE*> surf_file_to_parse_stack;
-static std::vector<std::string> surf_parsed_filename_stack;
-
-static inline const char* surf_parsed_filename() // to locate parse error messages
-{
- return surf_parsed_filename_stack.empty() ? nullptr : surf_parsed_filename_stack.back().c_str();
-}
-
+static const char* surf_parsed_filename; // Currently parsed file (for the error messages)
std::vector<simgrid::surf::LinkImpl*> parsed_link_list; /* temporary store of current list link of a route */
/*
if (not cond) {
int lineno = surf_parse_lineno;
cleanup();
- XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename(), lineno, msg.c_str());
+ XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename, lineno, msg.c_str());
surf_exit();
xbt_die("Exiting now");
}
{
int lineno = surf_parse_lineno;
cleanup();
- XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename(), lineno, msg.c_str());
+ XBT_ERROR("Parse error at %s:%d: %s", surf_parsed_filename, lineno, msg.c_str());
surf_exit();
xbt_die("Exiting now");
}
void surf_parse_warn(std::string msg)
{
- XBT_WARN("%s:%d: %s", surf_parsed_filename(), surf_parse_lineno, msg.c_str());
+ XBT_WARN("%s:%d: %s", surf_parsed_filename, surf_parse_lineno, msg.c_str());
}
double surf_parse_get_double(std::string s)
std::map<std::string, std::string>* current_model_property_set = nullptr;
int ZONE_TAG = 0; // Whether we just opened a zone tag (to see what to do with the properties)
-YY_BUFFER_STATE surf_input_buffer;
FILE *surf_file_to_parse = nullptr;
/* Stuff relative to storage */
void STag_surfxml_include()
{
- XBT_ERROR("<include> tag is deprecated, and will be removed in SimGrid v3.18. Please stop using it now (or tell us why you need it).");
- parse_after_config();
- XBT_DEBUG("STag_surfxml_include '%s'",A_surfxml_include_file);
- surf_parsed_filename_stack.emplace_back(A_surfxml_include_file); // save file name
-
- surf_file_to_parse_stack.push_back(surf_file_to_parse); // save old file descriptor
-
- surf_file_to_parse = surf_fopen(A_surfxml_include_file, "r"); // read new file descriptor
- xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n", A_surfxml_include_file);
-
- surf_input_buffer_stack.push_back(surf_input_buffer);
- surf_input_buffer = surf_parse__create_buffer(surf_file_to_parse, YY_BUF_SIZE);
- surf_parse_push_buffer_state(surf_input_buffer);
-
- fflush(nullptr);
-}
-
-void ETag_surfxml_include() {
-/* Nothing to do when done with reading the include tag.
- * Instead, the handling should be deferred until the EOF of current buffer -- see below */
+ xbt_die("<include> tag was removed in SimGrid v3.18. Please stop using it now.");
}
-/** @brief When reaching EOF, check whether we are in an include tag, and behave accordingly if yes
- *
- * This function is called automatically by sedding the parser in tools/cmake/MaintainerMode.cmake
- * Every FAIL on "Premature EOF" is preceded by a call to this function, which role is to restore the
- * previous buffer if we reached the EOF /of an include file/. Its return code is used to avoid the
- * error message in that case.
- *
- * Yeah, that's terribly hackish, but it works. A better solution should be dealed with in flexml
- * directly: a command line flag could instruct it to do the correct thing when the include directive is encountered
- * on a line. One day maybe, if the maya allow it.
- */
-int ETag_surfxml_include_state()
+void ETag_surfxml_include()
{
- fflush(nullptr);
- XBT_DEBUG("ETag_surfxml_include_state '%s'",A_surfxml_include_file);
-
- if (surf_input_buffer_stack.empty()) // nope, that's a true premature EOF. Let the parser die verbosely.
- return 0;
-
- // Yeah, we were in an <include> Restore state and proceed.
- fclose(surf_file_to_parse);
- surf_file_to_parse_stack.pop_back();
- surf_parse_pop_buffer_state();
- surf_input_buffer_stack.pop_back();
-
- // Restore the filename for error messages
- surf_parsed_filename_stack.pop_back();
-
- return 1;
+ /* Won't happen since <include> is now removed since v3.18. */
}
/* Stag and Etag parse functions */
-
void STag_surfxml_platform() {
XBT_ATTRIB_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
"Use simgrid_update_xml to update your file automatically. "
"This program is installed automatically with SimGrid, or "
"available in the tools/ directory of the source archive.",
- surf_parsed_filename(), version);
+ surf_parsed_filename, version);
if (version < 4.1) {
XBT_INFO("You're using a v%.1f XML file (%s) while the current standard is v4.1 "
"That's fine, the new version is backward compatible. \n\n"
"Use simgrid_update_xml to update your file automatically. "
"This program is installed automatically with SimGrid, or "
"available in the tools/ directory of the source archive.",
- version, surf_parsed_filename());
+ version, surf_parsed_filename);
}
xbt_assert(version <= 4.1, "******* FILE %s COMES FROM THE FUTURE (v:%.1f) *********\n "
"The most recent formalism that this version of SimGrid understands is v4.1.\n"
"Please update your code, or use another, more adapted, file.",
- surf_parsed_filename(), version);
+ surf_parsed_filename, version);
sg_platf_begin();
}
void ETag_surfxml_model___prop(){/* Nothing to do */}
/* Open and Close parse file */
+YY_BUFFER_STATE surf_input_buffer;
+
void surf_parse_open(const char *file)
{
xbt_assert(file, "Cannot parse the nullptr file. Bypassing the parser is strongly deprecated nowadays.");
- surf_parsed_filename_stack.emplace_back(file);
+ surf_parsed_filename = file;
std::string dir = simgrid::xbt::Path(file).getDirname();
surf_path.push_back(dir);
void surf_parse_close()
{
- if (surf_parsed_filename()) {
- surf_path.pop_back();
- }
-
- surf_parsed_filename_stack.pop_back();
+ surf_path.pop_back(); // remove the dirname of the opened file, that was added in surf_parse_open()
if (surf_file_to_parse) {
surf_parse__delete_buffer(surf_input_buffer);