# HG changeset patch # User John W. Eaton # Date 1466927420 14400 # Node ID d04da18a407a31cb4c539d097253b0c69e6fe6f4 # Parent b9c14f756009fdb0221ae8718a2dcfb64dae096e use OCTAVE_USE_WINDOWS_API more consistently * octave-gui.cc, thread-manager.cc, welcome-wizard.cc, ft-text-renderer.cc, sighandlers.cc, sighandlers.h, sysdep.cc, sysdep.h, toplev.cc, ov-java.cc, lo-sysdep.cc, kpse.cc, oct-mutex.cc, oct-conf-post.in.h, main.in.cc, mkoctfile.in.cc, shared-fcns.h: Prefer OCTAVE_USE_WINDOWS_API where possible. diff -r b9c14f756009 -r d04da18a407a libgui/src/octave-gui.cc --- a/libgui/src/octave-gui.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libgui/src/octave-gui.cc Sun Jun 26 03:50:20 2016 -0400 @@ -157,7 +157,7 @@ // We provide specific terminal capabilities, so ensure that TERM is // always set appropriately -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) octave::sys::env::putenv ("TERM", "cygwin"); #else octave::sys::env::putenv ("TERM", "xterm"); diff -r b9c14f756009 -r d04da18a407a libgui/src/thread-manager.cc --- a/libgui/src/thread-manager.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libgui/src/thread-manager.cc Sun Jun 26 03:50:20 2016 -0400 @@ -24,7 +24,7 @@ # include "config.h" #endif -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) # include #else # include @@ -34,7 +34,7 @@ #include "thread-manager.h" -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) class windows_thread_manager : public octave_base_thread_manager { @@ -115,7 +115,7 @@ octave_base_thread_manager * octave_thread_manager::create_rep (void) { -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) return new windows_thread_manager (); #else return new pthread_thread_manager (); diff -r b9c14f756009 -r d04da18a407a libgui/src/welcome-wizard.cc --- a/libgui/src/welcome-wizard.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libgui/src/welcome-wizard.cc Sun Jun 26 03:50:20 2016 -0400 @@ -30,7 +30,7 @@ #include #include -#if defined (__WIN32__) +#if defined (OCTAVE_USE_WINDOWS_API) #define WIN32_LEAN_AND_MEAN #include #endif @@ -289,7 +289,7 @@ show_page (); -#if defined (__WIN32__) +#if defined (OCTAVE_USE_WINDOWS_API) // HACK to forceshow of dialog if started minimized ShowWindow((HWND)winId(), SW_SHOWNORMAL); #endif diff -r b9c14f756009 -r d04da18a407a libinterp/corefcn/ft-text-renderer.cc --- a/libinterp/corefcn/ft-text-renderer.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libinterp/corefcn/ft-text-renderer.cc Sun Jun 26 03:50:20 2016 -0400 @@ -261,7 +261,7 @@ if (file.empty ()) { -#if defined (__WIN32__) +#if defined (OCTAVE_USE_WINDOWS_API) file = "C:/WINDOWS/Fonts/verdana.ttf"; #else // FIXME: find a "standard" font for UNIX platforms diff -r b9c14f756009 -r d04da18a407a libinterp/corefcn/sighandlers.cc --- a/libinterp/corefcn/sighandlers.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libinterp/corefcn/sighandlers.cc Sun Jun 26 03:50:20 2016 -0400 @@ -75,7 +75,7 @@ // Forward declaration. static void user_abort (const char *sig_name, int sig_number); -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) #define WIN32_LEAN_AND_MEAN #include @@ -418,7 +418,7 @@ if (octave_interrupt_state == 0) octave_interrupt_state = 1; -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) w32_interrupt_manager::octave_jump_to_enclosing_context (); #else octave_jump_to_enclosing_context (); @@ -450,7 +450,7 @@ static void sigint_handler (int sig) { -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) w32_interrupt_manager::user_abort (octave_strsignal_wrapper (sig), sig); #else user_abort (octave_strsignal_wrapper (sig), sig); @@ -475,7 +475,7 @@ { octave_interrupt_handler retval; -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) w32_interrupt_manager::init (); #endif @@ -490,7 +490,7 @@ { octave_interrupt_handler retval; -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) w32_interrupt_manager::init (); #endif @@ -506,7 +506,7 @@ { octave_interrupt_handler retval; -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) w32_interrupt_manager::init (); #endif diff -r b9c14f756009 -r d04da18a407a libinterp/corefcn/sighandlers.h --- a/libinterp/corefcn/sighandlers.h Sat Jun 25 19:45:34 2016 -0400 +++ b/libinterp/corefcn/sighandlers.h Sun Jun 26 03:50:20 2016 -0400 @@ -75,7 +75,7 @@ octave_set_interrupt_handler (const volatile octave_interrupt_handler&, bool restart_syscalls = true); -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) extern OCTINTERP_API void w32_raise_sigint (void); #endif diff -r b9c14f756009 -r d04da18a407a libinterp/corefcn/sysdep.cc --- a/libinterp/corefcn/sysdep.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libinterp/corefcn/sysdep.cc Sun Jun 26 03:50:20 2016 -0400 @@ -106,7 +106,7 @@ } #endif -#if defined (__WIN32__) && ! defined (_POSIX_VERSION) +#if defined (OCTAVE_USE_WINDOWS_API) #define WIN32_LEAN_AND_MEAN #include @@ -203,7 +203,7 @@ octave_value retval; -#if defined (__WIN32__) && ! defined (_POSIX_VERSION) +#if defined (OCTAVE_USE_WINDOWS_API) HINSTANCE status = ShellExecute (0, 0, file.c_str (), 0, 0, SW_SHOWNORMAL); @@ -562,7 +562,7 @@ std::string get_P_tmpdir (void) { -#if defined (__WIN32__) && ! defined (_POSIX_VERSION) +#if defined (OCTAVE_USE_WINDOWS_API) std::string retval; diff -r b9c14f756009 -r d04da18a407a libinterp/corefcn/sysdep.h --- a/libinterp/corefcn/sysdep.h Sat Jun 25 19:45:34 2016 -0400 +++ b/libinterp/corefcn/sysdep.h Sun Jun 26 03:50:20 2016 -0400 @@ -47,7 +47,7 @@ extern void w32_set_quiet_shutdown (void); -#if defined (__WIN32__) && ! defined (_POSIX_VERSION) +#if defined (OCTAVE_USE_WINDOWS_API) extern void MINGW_signal_cleanup (void); # define MINGW_SIGNAL_CLEANUP() MINGW_signal_cleanup () #else diff -r b9c14f756009 -r d04da18a407a libinterp/corefcn/toplev.cc --- a/libinterp/corefcn/toplev.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libinterp/corefcn/toplev.cc Sun Jun 26 03:50:20 2016 -0400 @@ -35,7 +35,7 @@ #include #include -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) # define WIN32_LEAN_AND_MEAN 1 # include #endif @@ -1142,7 +1142,7 @@ std::string cmd_str = args(0).xstring_value ("system: first argument must be a string"); -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) // Work around weird double-quote handling on Windows systems. if (type == et_sync) cmd_str = "\"" + cmd_str + "\""; @@ -1166,7 +1166,7 @@ } else retval(0) = pid; -#elif defined (__WIN32__) +#elif defined (OCTAVE_USE_WINDOWS_API) STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory (&si, sizeof (si)); @@ -1629,7 +1629,7 @@ bool mac_system = false; bool windows_system = false; -#if defined (WIN32) +#if defined (__WIN32__) windows_system = true; #if ! defined (__CYGWIN__) unix_system = false; diff -r b9c14f756009 -r d04da18a407a libinterp/octave-value/ov-java.cc --- a/libinterp/octave-value/ov-java.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/libinterp/octave-value/ov-java.cc Sun Jun 26 03:50:20 2016 -0400 @@ -276,7 +276,7 @@ std::list java_opts; }; -#if defined (__WIN32__) +#if defined (OCTAVE_USE_WINDOWS_API) static std::string read_registry_string (const std::string& key, const std::string& value) @@ -515,7 +515,7 @@ const char *static_locale = setlocale (LC_ALL, 0); const std::string locale (static_locale); -#if defined (__WIN32__) +#if defined (OCTAVE_USE_WINDOWS_API) HMODULE hMod = GetModuleHandle ("jvm.dll"); std::string jvm_lib_path; @@ -595,7 +595,7 @@ error ("unable to load Java Runtime Environment from %s", jvm_lib_path.c_str ()); -#if defined (__WIN32__) +#if defined (OCTAVE_USE_WINDOWS_API) set_dll_directory (); diff -r b9c14f756009 -r d04da18a407a liboctave/system/lo-sysdep.cc --- a/liboctave/system/lo-sysdep.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/liboctave/system/lo-sysdep.cc Sun Jun 26 03:50:20 2016 -0400 @@ -60,7 +60,7 @@ { std::string path = octave::sys::file_ops::tilde_expand (path_arg); -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) if (path.length () == 2 && path[1] == ':') path += "\\"; #endif diff -r b9c14f756009 -r d04da18a407a liboctave/util/kpse.cc --- a/liboctave/util/kpse.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/liboctave/util/kpse.cc Sun Jun 26 03:50:20 2016 -0400 @@ -49,7 +49,7 @@ #include "pathsearch.h" #include "unistd-wrappers.h" -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) # define WIN32_LEAN_AND_MEAN 1 # include #endif @@ -166,7 +166,7 @@ regular file, as it is potentially useful to read fifo's or some kinds of devices. */ -#if defined (__WIN32__) +#if defined (OCTAVE_USE_WINDOWS_API) static inline bool READABLE (const std::string& fn) { diff -r b9c14f756009 -r d04da18a407a liboctave/util/oct-mutex.cc --- a/liboctave/util/oct-mutex.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/liboctave/util/oct-mutex.cc Sun Jun 26 03:50:20 2016 -0400 @@ -27,7 +27,7 @@ #include "oct-mutex.h" #include "lo-error.h" -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) # include #elif defined (HAVE_PTHREAD_H) # include @@ -53,7 +53,7 @@ return false; } -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) class octave_w32_mutex : public octave_base_mutex @@ -163,7 +163,7 @@ static octave_base_mutex * init_rep (void) { -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) return new octave_w32_mutex (); #elif defined (HAVE_PTHREAD_H) return new octave_pthread_mutex (); diff -r b9c14f756009 -r d04da18a407a oct-conf-post.in.h --- a/oct-conf-post.in.h Sat Jun 25 19:45:34 2016 -0400 +++ b/oct-conf-post.in.h Sun Jun 26 03:50:20 2016 -0400 @@ -80,7 +80,12 @@ # pragma warning (disable: 4661) #endif +/* Define to 1 if we expect to have , Sleep, etc. */ #if defined (__WIN32__) && ! defined (__CYGWIN__) +# define OCTAVE_USE_WINDOWS_API 1 +#endif + +#if defined (OCTAVE_USE_WINDOWS_API) # define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 #elif defined (__CYGWIN__) # define OCTAVE_HAVE_WINDOWS_FILESYSTEM 1 @@ -89,11 +94,6 @@ # define OCTAVE_HAVE_POSIX_FILESYSTEM 1 #endif -/* Define to 1 if we expect to have , Sleep, etc. */ -#if defined (__WIN32__) && ! defined (__CYGWIN__) -# define OCTAVE_USE_WINDOWS_API 1 -#endif - #if defined (__APPLE__) && defined (__MACH__) # define OCTAVE_USE_OS_X_API 1 #endif diff -r b9c14f756009 -r d04da18a407a src/main.in.cc --- a/src/main.in.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/src/main.in.cc Sun Jun 26 03:50:20 2016 -0400 @@ -64,8 +64,7 @@ #include "display-available.h" #include "shared-fcns.h" -#if (defined (HAVE_OCTAVE_QT_GUI) \ - && ! defined (__WIN32__) || defined (__CYGWIN__)) +#if defined (HAVE_OCTAVE_QT_GUI) && ! defined (OCTAVE_USE_WINDOWS_API) // Forward signals to the GUI process. @@ -318,14 +317,13 @@ } } -#if defined (__WIN32__) && ! defined (__CYGWIN__) +#if defined (OCTAVE_USE_WINDOWS_API) file += ".exe"; #endif new_argv[0] = strsave (file.c_str ()); -#if (defined (HAVE_OCTAVE_QT_GUI) \ - && ! defined (__WIN32__) || defined (__CYGWIN__)) +#if defined (HAVE_OCTAVE_QT_GUI) && ! defined (OCTAVE_USE_WINDOWS_API) if (gui_libs && start_gui && have_controlling_terminal ()) { diff -r b9c14f756009 -r d04da18a407a src/mkoctfile.in.cc --- a/src/mkoctfile.in.cc Sat Jun 25 19:45:34 2016 -0400 +++ b/src/mkoctfile.in.cc Sun Jun 26 03:50:20 2016 -0400 @@ -143,7 +143,7 @@ vars["LIBDIR"] = get_variable ("LIBDIR", DEFAULT_LIBDIR); vars["OCTLIBDIR"] = get_variable ("OCTLIBDIR", DEFAULT_OCTLIBDIR); -#if defined (__WIN32__) && ! defined (_POSIX_VERSION) +#if defined (OCTAVE_USE_WINDOWS_API) std::string DEFAULT_INCFLAGS = "-I" + quote_path (vars["OCTINCLUDEDIR"] + "\\..") + " -I" + quote_path (vars["OCTINCLUDEDIR"]); @@ -256,7 +256,7 @@ "\n" " -M, --depend Generate dependency files (.d) for C and C++\n" " source files.\n" -#if ! defined (__WIN32__) || defined (_POSIX_VERSION) +#if ! defined (OCTAVE_USE_WINDOWS_API) "\n" " -pthread Add -pthread to link command.\n" #endif @@ -498,7 +498,7 @@ { ldflags += (" " + arg); } -#if ! defined (__WIN32__) || defined (_POSIX_VERSION) +#if ! defined (OCTAVE_USE_WINDOWS_API) else if (arg == "-pthread") { ldflags += (" " + arg); diff -r b9c14f756009 -r d04da18a407a src/shared-fcns.h --- a/src/shared-fcns.h Sat Jun 25 19:45:34 2016 -0400 +++ b/src/shared-fcns.h Sun Jun 26 03:50:20 2016 -0400 @@ -23,7 +23,7 @@ #if ! defined (octave_shared_fcns_h) #define octave_shared_fcns_h 1 -#if defined (__WIN32__) && ! defined (_POSIX_VERSION) +#if defined (OCTAVE_USE_WINDOWS_API) #include #include @@ -111,7 +111,7 @@ { std::string oh = octave_getenv ("OCTAVE_HOME"); -#if defined (__WIN32__) && ! defined (_POSIX_VERSION) +#if defined (OCTAVE_USE_WINDOWS_API) if (oh.empty ()) oh = w32_get_octave_home (); #endif