#include <stdio.h>
#ifndef _YOSYS_
-# error It looks like you are trying to build Yosys with the config defines set. \
+# error It looks like you are trying to build Yosys without the config defines set. \
When building Yosys with a custom make system, make sure you set all the \
- defines the Yosys Makefile would set for your build configuration.
+ defines the Yosys Makefile would set for your build configuration.
#endif
#ifdef YOSYS_ENABLE_TCL
# define NOMINMAX 1
# undef YY_NO_UNISTD_H
# define YY_NO_UNISTD_H 1
-# undef _CRT_SECURE_NO_WARNINGS
-# define _CRT_SECURE_NO_WARNINGS 1
# include <windows.h>
# include <io.h>
# define popen _popen
# define pclose _pclose
# define PATH_MAX MAX_PATH
+
+# ifndef __MINGW32__
+# define isatty _isatty
+# define fileno _fileno
+# endif
#endif
#define PRIVATE_NAMESPACE_BEGIN namespace {
#define USING_YOSYS_NAMESPACE using namespace Yosys;
#if __cplusplus >= 201103L
-# define OVERRIDE override
-# define FINAL final
+# define YS_OVERRIDE override
+# define YS_FINAL final
#else
-# define OVERRIDE
-# define FINAL
+# define YS_OVERRIDE
+# define YS_FINAL
#endif
-#if !defined(__GNUC__) && !defined(__clang__)
-# define __attribute__(...)
-# define _NORETURN_ __declspec(noreturn)
+#if defined(__GNUC__) || defined(__clang__)
+# define YS_ATTRIBUTE(...) __attribute__((__VA_ARGS__))
+# define YS_NORETURN
+#elif defined(_MSC_VER)
+# define YS_ATTRIBUTE(...)
+# define YS_NORETURN __declspec(noreturn)
#else
-# define _NORETURN_
+# define YS_ATTRIBUTE(...)
+# define YS_NORETURN
#endif
YOSYS_NAMESPACE_BEGIN
struct Cell;
}
-std::string stringf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
+std::string stringf(const char *fmt, ...) YS_ATTRIBUTE(format(printf, 1, 2));
std::string vstringf(const char *fmt, va_list ap);
+int readsome(std::istream &f, char *s, int n);
std::string next_token(std::string &text, const char *sep);
bool patmatch(const char *pattern, const char *string);
int run_command(const std::string &command, std::function<void(const std::string&)> process_line = std::function<void(const std::string&)>());