ice40: split out cells_map.v into ff_map.v
[yosys.git] / kernel / register.cc
index af8c1b8e83c90620c27a10aaee129c80a56faf83..02974e5349f92c0090b141cbbc6dc4d39294c830 100644 (file)
@@ -238,6 +238,7 @@ void Pass::call(RTLIL::Design *design, std::string command)
                return;
 
        if (tok[0] == '!') {
+#if !defined(YOSYS_DISABLE_SPAWN)
                cmd_buf = command.substr(command.find('!') + 1);
                while (!cmd_buf.empty() && (cmd_buf.back() == ' ' || cmd_buf.back() == '\t' ||
                                cmd_buf.back() == '\r' || cmd_buf.back() == '\n'))
@@ -247,6 +248,9 @@ void Pass::call(RTLIL::Design *design, std::string command)
                if (retCode != 0)
                        log_cmd_error("Shell command returned error code %d.\n", retCode);
                return;
+#else
+               log_cmd_error("Shell is not available.\n");
+#endif
        }
 
        while (!tok.empty()) {
@@ -485,20 +489,21 @@ void Frontend::extra_args(std::istream *&f, std::string &filename, std::vector<s
                        cmd_error(args, argidx, "Extra filename argument in direct file mode.");
 
                filename = arg;
+               //Accommodate heredocs with EOT marker spaced out from "<<", e.g. "<< EOT" vs. "<<EOT"
                if (filename == "<<" && argidx+1 < args.size())
                        filename += args[++argidx];
                if (filename.compare(0, 2, "<<") == 0) {
-                       if (Frontend::current_script_file == NULL)
-                               log_error("Unexpected here document '%s' outside of script!\n", filename.c_str());
                        if (filename.size() <= 2)
                                log_error("Missing EOT marker in here document!\n");
                        std::string eot_marker = filename.substr(2);
+                       if (Frontend::current_script_file == nullptr)
+                               filename = "<stdin>";
                        last_here_document.clear();
                        while (1) {
                                std::string buffer;
                                char block[4096];
                                while (1) {
-                                       if (fgets(block, 4096, Frontend::current_script_file) == NULL)
+                                       if (fgets(block, 4096, Frontend::current_script_file == nullptr? stdin : Frontend::current_script_file) == nullptr)
                                                log_error("Unexpected end of file in here document '%s'!\n", filename.c_str());
                                        buffer += block;
                                        if (buffer.size() > 0 && (buffer[buffer.size() - 1] == '\n' || buffer[buffer.size() - 1] == '\r'))