diff options
author | William Speirs <bill.speirs@gmail.com> | 2014-10-16 12:06:54 -0400 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-10-17 11:41:36 +0200 |
commit | 31267a1ae8d670c4b8749fc55b07c01d9285a488 (patch) | |
tree | 678fb6b416aef122cbb9b9affd5f9c702dc2ce03 /kernel | |
parent | fda52f05f277720e12aadb4716415ec9bff616a5 (diff) | |
download | yosys-31267a1ae8d670c4b8749fc55b07c01d9285a488.tar.gz yosys-31267a1ae8d670c4b8749fc55b07c01d9285a488.tar.bz2 yosys-31267a1ae8d670c4b8749fc55b07c01d9285a488.zip |
Header changes so it will compile on VS
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/driver.cc | 7 | ||||
-rw-r--r-- | kernel/yosys.cc | 10 | ||||
-rw-r--r-- | kernel/yosys.h | 29 |
3 files changed, 40 insertions, 6 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index 8117a61c5..7f2cdb325 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -27,11 +27,14 @@ #include <stdio.h> #include <string.h> -#include <unistd.h> -#include <libgen.h> #include <limits.h> #include <errno.h> +#ifndef _WIN32 +# include <unistd.h> +#endif + + USING_YOSYS_NAMESPACE int main(int argc, char **argv) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 1ce7b5207..9c1cb58f3 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -33,17 +33,21 @@ #elif defined(__APPLE__) # include <mach-o/dyld.h> #else +# include <unistd.h> +# include <dirent.h> # include <sys/types.h> # include <sys/stat.h> #endif -#include <unistd.h> #include <limits.h> -#include <dirent.h> #include <errno.h> YOSYS_NAMESPACE_BEGIN +#ifdef _WIN32 +const char *yosys_version_str = "Windows"; +#endif + int autoidx = 1; RTLIL::Design *yosys_design = NULL; @@ -325,10 +329,10 @@ void yosys_shutdown() #ifdef YOSYS_ENABLE_PLUGINS for (auto &it : loaded_plugins) dlclose(it.second); -#endif loaded_plugins.clear(); loaded_plugin_aliases.clear(); +#endif } RTLIL::IdString new_id(std::string file, int line, std::string func) diff --git a/kernel/yosys.h b/kernel/yosys.h index 239146d77..e4465edf7 100644 --- a/kernel/yosys.h +++ b/kernel/yosys.h @@ -68,6 +68,30 @@ # include <tcl.h> #endif +// a few platform specific things +#ifdef _WIN32 +# define NOMINMAX +# include <Windows.h> +# include <stdint.h> // takes care of a number of typedefs +# include <io.h> +# include <direct.h> + +// these are always a bit dangerous :-) +# define strtok_r strtok_s +# define strdup _strdup +# define snprintf _snprintf +# define access _access +# define getcwd _getcwd +# define mkdir _mkdir +# define popen _popen +# define pclose _pclose + +# define PATH_MAX MAX_PATH +# define F_OK 00 +# define X_OK 00 // note this is NOT correct as there is no execute flag in Windows +#endif + + #define PRIVATE_NAMESPACE_BEGIN namespace { #define PRIVATE_NAMESPACE_END } #define YOSYS_NAMESPACE_BEGIN namespace Yosys { @@ -85,6 +109,9 @@ #if !defined(__GNUC__) && !defined(__clang__) # define __attribute__(...) +# define _NORETURN_ __declspec(noreturn) +#else +# define _NORETURN_ #endif YOSYS_NAMESPACE_BEGIN @@ -96,7 +123,7 @@ namespace RTLIL { struct Cell; } -std::string stringf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +std::string stringf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); std::string vstringf(const char *fmt, va_list ap); std::string next_token(std::string &text, const char *sep); bool patmatch(const char *pattern, const char *string); |