changeset 17851:af685269e06c

avoid symbol conflicts in display.cc * sysdep.cc: Include display.h. (Fhave_window_system): Move here from display.cc. * display.cc: Don't undef Complex. Don't include defun.h.
author John W. Eaton <jwe@octave.org>
date Mon, 04 Nov 2013 23:06:48 -0500
parents 45e325002810
children 4de2eeb7d790
files libinterp/corefcn/display.cc libinterp/corefcn/sysdep.cc
diffstat 2 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/display.cc	Mon Nov 04 21:48:45 2013 +0000
+++ b/libinterp/corefcn/display.cc	Mon Nov 04 23:06:48 2013 -0500
@@ -34,15 +34,8 @@
 #include <X11/Xlib.h>
 #endif
 
-// X11/Xlib defines this and it conflicts with the Complex typedef in
-// oct-cmplx.h.
-#ifdef Complex
-#undef Complex
-#endif
-
 #include "singleton-cleanup.h"
 
-#include "defun.h"
 #include "display.h"
 #include "error.h"
 
@@ -193,13 +186,3 @@
 
   return retval;
 }
-
-DEFUN (have_window_system, , ,
-  "-*- texinfo -*-\n\
-@deftypefn {Built-in Function} {} have_window_system ()\n\
-Return true if Octave a window system is available (X11, Windows,\n\
-or Apple OS X) and false otherwise.\n\
-@end deftypefn")
-{
-  return octave_value (display_info::display_available ());
-}
--- a/libinterp/corefcn/sysdep.cc	Mon Nov 04 21:48:45 2013 +0000
+++ b/libinterp/corefcn/sysdep.cc	Mon Nov 04 23:06:48 2013 -0500
@@ -71,6 +71,7 @@
 #include "Cell.h"
 #include "builtins.h"
 #include "defun.h"
+#include "display.h"
 #include "error.h"
 #include "input.h"
 #include "oct-obj.h"
@@ -906,3 +907,17 @@
 %! assert (tilde_expand ("/foo/bar"), "/foo/bar");
 %! assert (tilde_expand ("foo/bar"), "foo/bar");
 */
+
+// This function really belongs in display.cc, but including defun.h in
+// that file results in conflicts with symbols from headers that are
+// needed for X11 and Carbon functions.
+
+DEFUN (have_window_system, , ,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {} have_window_system ()\n\
+Return true if Octave a window system is available (X11, Windows,\n\
+or Apple OS X) and false otherwise.\n\
+@end deftypefn")
+{
+  return octave_value (display_info::display_available ());
+}