# HG changeset patch
# User Michael Godfrey <michaeldgodfrey@gmail.com>
# Date 1401383765 -3600
#      Thu May 29 18:16:05 2014 +0100
# Node ID b75616333fe600e56aa75bb1475c7925028cea8d
# Parent  ff613b6a7b6f780b7197f2e2bbe5dbae81c409f9
Edit Manual Sect. 1.3.3

diff -r ff613b6a7b6f -r b75616333fe6 configure.ac
--- a/configure.ac	Fri May 23 16:28:37 2014 +0200
+++ b/configure.ac	Thu May 29 18:16:05 2014 +0100
@@ -857,9 +857,13 @@
       warn_llvm="Missing LLVM file TargetData.h.  JIT compiler is disabled."
     fi
 
+    AC_CHECK_HEADERS([llvm/IR/Verifier.h])
+
     OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API
     OCTAVE_LLVM_FUNCTION_ADDFNATTR_API
     OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API
+    OCTAVE_LLVM_RAW_FD_OSTREAM_API
+    OCTAVE_LLVM_LEGACY_PASSMANAGER_API
     AC_LANG_POP(C++)
     CPPFLAGS="$save_CPPFLAGS"
     CXXFLAGS="$save_CXXFLAGS"
diff -r ff613b6a7b6f -r b75616333fe6 doc/interpreter/plot.txi
--- a/doc/interpreter/plot.txi	Fri May 23 16:28:37 2014 +0200
+++ b/doc/interpreter/plot.txi	Thu May 29 18:16:05 2014 +0100
@@ -1311,9 +1311,37 @@
 * Surface Properties::
 @end menu
 
-In this Section the object properties are discussed in detail, starting
+In this Section the graphics object properties are discussed in detail, starting
 with the root figure properties and continuing through the graphics object
-hierarchy.
+hierarchy. For each graphics object its properties, with the allowed values
+(with the default value indicated by a following *), can
+be displayed using:
+
+@table @code
+@item Figure
+--- @code{set(gcf())} or @code{set(0)}
+
+@item Axes
+--- @code{set(gca())} or @code{set(axes)}
+
+@item Line
+--- @code{set(line)}
+
+@item Text
+--- @code{set(text)}
+
+@item Image
+--- @code{set(image)}
+
+@item Patch
+--- @code{set(patch)}
+
+@item Surface
+--- @code{set(surface)}
+@end table
+
+NOTE: It is appropriate to use these @code{set} functions as a check on the information shown below as
+your copy of Octave may not match the version described here.
 
 @node Root Figure Properties
 @subsubsection Root Figure Properties
@@ -1323,23 +1351,18 @@
 
 @table @code
 @item __modified__
---- Values: @qcode{"on"}, @qcode{"off"}
-
-@item __myhandle__
+--- Values: @code{[ off | on * ]}
 
 @item beingdeleted
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item busyaction
+--- Values: @code{[ cancel | queue * ]}
 
 @item buttondownfcn
 
-@item callbackobject
-
-@item children
-
 @item clipping
- --- Values: @qcode{"on"}, @qcode{"off"}
+ --- Values: @code{[ off | on * ]}
 
 @item createfcn
 
@@ -1347,45 +1370,60 @@
 
 @item deletefcn
 
+@item diary
+--- Values:  @code{[ off | on * ]}
+
+@item diaryfile
+
+@item echo
+--- Values:  @code{[ off | on * ]}
+
+@item fixedwidthfontname
+
+@item format
+--- Values:  @code{[ + | bank | bit | hex | long | longe | longeng | longg | native-bit | native-hex | none | rat | short * | shorte | shorteng | shortg ]}
+
+@item formatspacing
+--- Values: @code{[ compact | loose * ]}
+
 @item handlevisibility
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ callback | off | on * ]}
 
 @item hittest
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item interruptible
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
+
+@item language
+
+@item monitorpositions
 
 @item parent
 
-@item screendepth
-
-@item screenpixelsperinch
-
-@item screensize
+@item pointerlocation
+
+@item recursionlimit
 
 @item selected
+--- Values: @code{[ off | on * ]}
 
 @item selectionhighlight
-
-@item screendepth
-
-@item screenpixelsperinch
+--- Values: @code{[ off | on * ]}
 
 @item showhiddenhandles
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item tag
 
-@item type
-
 @item uicontextmenu
 
 @item units
-
+--- Values: @code{[ centimeters | inches | normalized | pixels * | points ]}
 @item userdata
 
 @item visible
+--- Values: @code{[ off | on * ]}
 @end table
 
 @node Figure Properties
@@ -1398,28 +1436,21 @@
 @item __graphics_toolkit__
 --- The graphics toolkit currently in use.
 
-@item __enhanced__
-
 @item __modified__
-
-@item __myhandle__
-
-@item __plot_stream__
+--- Values: @code{[ off | on * ]}
 
 @item alphamap
 
 @item beingdeleted
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item busyaction
+--- Values: @code{[ cancel | queue * ]}
 
 @item buttondownfcn
 
-@item children
-Handle to children.
-
 @item clipping
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item closerequestfcn
 --- Handle of function to call on close.
@@ -1429,44 +1460,35 @@
 @item colormap
 An N-by-3 matrix containing the color map for the current axes.
 
-@item paperorientation
-
 @item createfcn
 
 @item currentaxes
 Handle to graphics object of current axes.
 
-@item currentcharacter
-
-@item currentobject
-
-@item currentpoint
-Holds the coordinates of the point over which the mouse pointer was when
-the mouse button was pressed.  If a mouse callback function is defined,
-@qcode{"currentpoint"} holds the coordinates of the point over which the
-mouse pointer is when the function gets called.
-
 @item deletefcn
 
 @item dockcontrols
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item doublebuffer
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item filename
 
 @item handlevisibility
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ callback | off | on * ]}
 
 @item hittest
+--- Values: @code{[ off | on * ]}
 
 @item integerhandle
+--- Values: @code{[ off | on * ]}
 
 @item interruptible
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item inverthardcopy
+--- Values: @code{[ off | on * ]}
 
 @item keypressfcn
 see @qcode{"keypressfcn"}
@@ -1492,41 +1514,39 @@
 @end table
 
 @item menubar
-
+--- Values: @code{[ figure * | none ]}
 @item mincolormap
 
 @item name
 
 @item nextplot
-May be one of
-
-@table @asis
-@item @qcode{"new"}
-
-@item @qcode{"add"}
-
-@item @qcode{"replace"}
-
-@item @qcode{"replacechildren"}
-@end table
+--- Values: @code{[ add * | new | replace | replacechildren ]}
 
 @item numbertitle
+--- Values: @code{[ off | on * ]}
+
+@item outerposition
 
 @item paperorientation
-Indicates the orientation for printing.  Either @qcode{"landscape"} or
-@qcode{"portrait"}.
+--- Values: @code{[ landscape | portrait * | rotated ]}
 
 @item paperposition
 
 @item paperpositionmode
+--- Values: @code{[ auto | manual * ]}
 
 @item papersize
 
 @item papertype
+--- Values: @code{[ <custom> | a | a0 | a1 | a2 | a3 | a4 | a5 | arch-a | arch-b | arch-c | arch-d | arch-e | b | b0 | b1 | b2 | b3 | b4 | b5 | c | d | e | tabloid | uslegal | usletter * ]}
 
 @item paperunits
+--- Values: @code{[ centimeters | inches * | normalized | points ]}
+
+@item parent
 
 @item pointer
+--- Values: @code{[ arrow * | botl | botr | bottom | circle | cross | crosshair | custom | fleur | fullcrosshair | hand | ibeam | left | right | top | topl | topr | watch ]}
 
 @item pointershapecdata
 
@@ -1535,32 +1555,39 @@
 @item position
 
 @item renderer
+--- Values: @code{[ none | opengl | painters * | zbuffer ]}
 
 @item renderermode
+--- Values: @code{[ auto * | manual ]}
 
 @item resize
+--- Values: @code{[ off | on * ]}
 
 @item resizefcn
 
 @item selected
+--- Values: @code{[ off | on * ]}
 
 @item selectionhighlight
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item selectiontype
+--- Values: @code{[ alt | extend | normal * | open ]}
 
 @item tag
 
 @item toolbar
-
-@item type
+--- Values: @code{[ auto * | figure | none ]}
+
+@item uicontextmenu
 
 @item units
+--- Values: @code{[ centimeters | characters | inches | normalized | pixels * | points ]}
 
 @item userdata
 
 @item visible
-Either @qcode{"on"} or @qcode{"off"} to toggle display of the figure.
+--- Values: @code{[ off | on * ]}
 
 @item windowbuttondownfcn
 See @qcode{"windowbuttonupfcn"}
@@ -1575,19 +1602,27 @@
 these callback functions are called, the @qcode{"currentpoint"} property
 holds the current coordinates of the cursor.
 
+@item windowkeypressfcn
+
+@item windowkeyreleasefcn
+
 @item windowscrollwheelfcn
 
 @item windowstyle
+--- Values: @code{[ docked | modal | normal * ]}
 
 @item wvisual
 
 @item wvisualmode
+--- Values: @code{[ auto * | manual ]}
 
 @item xdisplay
 
 @item xvisual
 
 @item xvisualmode
+--- Values: @code{[ auto * | manual ]}
+
 @end table
 
 @node Axes Properties
@@ -1598,42 +1633,48 @@
 
 @table @code
 @item __modified__
-
-@item __myhandle__
+--- Values: @code{[ off | on * ]}
 
 @item activepositionproperty
+--- Values: @code{[ outerposition * | position ]}
 
 @item alim
 
 @item alimmode
+--- Values: @code{[ auto * | manual ]}
 
 @item ambientlightcolor
 
 @item beingdeleted
+--- Values: @code{[ off | on * ]}
 
 @item box
-Box surrounding axes.
---- Values: @qcode{"on"}, @qcode{"off"}
+--- Values: @code{[ off | on * ]}
 
 @item busyaction
+--- Values: @code{[ cancel | queue * ]}
 
 @item buttondownfcn
 
 @item cameraposition
 
 @item camerapositionmode
+--- Values: @code{[ auto * | manual ]}
 
 @item cameratarget
 
 @item cameratargetmode
+--- Values: @code{[ auto * | manual ]}
 
 @item cameraupvector
 
 @item cameraupvectormode
+--- Values: @code{[ auto * | manual ]}
 
 @item cameraviewangle
 
 @item cameraviewanglemode
+--- Values: @code{[ auto * | manual ]}
 
 @item children
 
diff -r ff613b6a7b6f -r b75616333fe6 libinterp/corefcn/graphics.cc
--- a/libinterp/corefcn/graphics.cc	Fri May 23 16:28:37 2014 +0200
+++ b/libinterp/corefcn/graphics.cc	Thu May 29 18:16:05 2014 +0100
@@ -4000,43 +4000,82 @@
 
 /*
 %!test
-%! hf = figure ("visible", "off");
+%! hf = figure ("visible", "off", "paperpositionmode", "auto");
+%! in_pos = [0 0 4 5];
+%! tol = 20 * eps ();
 %! unwind_protect
 %!   ## paperpositionmode "auto" converts figure size to paper units 
 %!   set (hf, "units", "inches");
-%!   set (hf, "position", [0 0 4 5]);
+%!   set (hf, "position", in_pos);
 %!   set (hf, "paperunits", "centimeters");
 %!   psz = get (hf, "papersize");
-%!   fsz = [10.16 12.7];
+%!   fsz = in_pos(3:4) * 2.54;
 %!   pos = [(psz/2 .- fsz/2) fsz];  
 %!   set (hf, "paperpositionmode", "auto");
-%!   assert (get (hf, "paperposition"), pos)
-%!   
+%!   assert (get (hf, "paperposition"), pos, tol)
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off", "paperpositionmode", "auto");
+%! in_pos = [0 0 4 5];
+%! tol = 20 * eps ();
+%! unwind_protect
 %!   ## likewise with normalized units 
+%!   set (hf, "units", "inches");
+%!   set (hf, "position", in_pos);
+%!   psz = get (hf, "papersize");
 %!   set (hf, "paperunits", "normalized");
-%!   fsz = [10.16 12.7]./psz;
+%!   fsz = in_pos(3:4) ./ psz;
 %!   pos = [([0.5 0.5] .- fsz/2) fsz];  
-%!   assert (get (hf, "paperposition"), pos)
-%!   
+%!   assert (get (hf, "paperposition"), pos, tol)
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off", "paperpositionmode", "auto");
+%! in_pos = [0 0 4 5];
+%! tol = 20 * eps ();
+%! unwind_protect
 %!   ## changing papertype updates paperposition 
-%!   set (hf, "paperunits", "centimeters");
+%!   set (hf, "units", "inches");
+%!   set (hf, "position", in_pos);
 %!   set  (hf, "papertype", "a4");
 %!   psz = get (hf, "papersize");
-%!   fsz = [10.16 12.7];
+%!   fsz = in_pos(3:4);
 %!   pos = [(psz/2 .- fsz/2) fsz];  
-%!   assert (get (hf, "paperposition"), pos)
-%!
+%!   assert (get (hf, "paperposition"), pos, tol)
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off", "paperpositionmode", "auto");
+%! in_pos = [0 0 4 5];
+%! tol = 20 * eps ();
+%! unwind_protect
 %!   ## lanscape updates paperposition
+%!   set (hf, "units", "inches");
+%!   set (hf, "position", in_pos);
 %!   set (hf, "paperorientation", "landscape");
 %!   psz = get (hf, "papersize");
-%!   fsz = [10.16 12.7];
+%!   fsz = in_pos(3:4);
 %!   pos = [(psz/2 .- fsz/2) fsz];  
-%!   assert (get (hf, "paperposition"), pos)
-%!   
+%!   assert (get (hf, "paperposition"), pos, tol)
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off", "paperpositionmode", "auto");
+%! in_pos = [0 0 4 5];
+%! unwind_protect
 %!   ## back to manual mode
-%!   set (hf, "paperposition", pos+eps)
+%!   set (hf, "paperposition", in_pos * 1.1)
 %!   assert (get (hf, "paperpositionmode"), "manual")
-%!   assert (get (hf, "paperposition"), pos + eps)
+%!   assert (get (hf, "paperposition"), in_pos * 1.1)
 %! unwind_protect_cleanup
 %!   close (hf);
 %! end_unwind_protect
diff -r ff613b6a7b6f -r b75616333fe6 libinterp/corefcn/jit-typeinfo.cc
--- a/libinterp/corefcn/jit-typeinfo.cc	Fri May 23 16:28:37 2014 +0200
+++ b/libinterp/corefcn/jit-typeinfo.cc	Thu May 29 18:16:05 2014 +0100
@@ -34,7 +34,12 @@
 
 #include "jit-typeinfo.h"
 
+#ifdef HAVE_LLVM_IR_VERIFIER_H
+#include <llvm/IR/Verifier.h>
+#else
 #include <llvm/Analysis/Verifier.h>
+#endif
+
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 
 #ifdef HAVE_LLVM_IR_FUNCTION_H
diff -r ff613b6a7b6f -r b75616333fe6 libinterp/corefcn/jit-util.h
--- a/libinterp/corefcn/jit-util.h	Fri May 23 16:28:37 2014 +0200
+++ b/libinterp/corefcn/jit-util.h	Thu May 29 18:16:05 2014 +0100
@@ -42,8 +42,15 @@
 {
   class Value;
   class Module;
+#ifdef LEGACY_PASSMANAGER
+  namespace legacy {
+    class FunctionPassManager;
+    class PassManager;
+  }
+#else
   class FunctionPassManager;
   class PassManager;
+#endif
   class ExecutionEngine;
   class Function;
   class BasicBlock;
diff -r ff613b6a7b6f -r b75616333fe6 libinterp/corefcn/pt-jit.cc
--- a/libinterp/corefcn/pt-jit.cc	Fri May 23 16:28:37 2014 +0200
+++ b/libinterp/corefcn/pt-jit.cc	Thu May 29 18:16:05 2014 +0100
@@ -50,11 +50,22 @@
 
 #include <llvm/Analysis/CallGraph.h>
 #include <llvm/Analysis/Passes.h>
+
+#ifdef HAVE_LLVM_IR_VERIFIER_H
+#include <llvm/IR/Verifier.h>
+#else
 #include <llvm/Analysis/Verifier.h>
+#endif
+
 #include <llvm/Bitcode/ReaderWriter.h>
 #include <llvm/ExecutionEngine/ExecutionEngine.h>
 #include <llvm/ExecutionEngine/JIT.h>
+
+#ifdef LEGACY_PASSMANAGER
+#include <llvm/IR/LegacyPassManager.h>
+#else
 #include <llvm/PassManager.h>
+#endif
 
 #ifdef HAVE_LLVM_IR_FUNCTION_H
 #include <llvm/IR/LLVMContext.h>
@@ -2053,10 +2064,15 @@
   if (! engine)
     return false;
 
+#ifdef LEGACY_PASSMANAGER
+  module_pass_manager = new llvm::legacy::PassManager ();
+  pass_manager = new llvm::legacy::FunctionPassManager (module); 
+#else
   module_pass_manager = new llvm::PassManager ();
+  pass_manager = new llvm::FunctionPassManager (module);
+#endif
   module_pass_manager->add (llvm::createAlwaysInlinerPass ());
 
-  pass_manager = new llvm::FunctionPassManager (module);
 #ifdef HAVE_LLVM_DATALAYOUT
   pass_manager->add (new llvm::DataLayout (*engine->getDataLayout ()));
 #else
@@ -2171,8 +2187,13 @@
   if (Vdebug_jit)
     {
       std::string error;
+#ifdef RAW_FD_OSTREAM_ARG_IS_LLVM_SYS_FS
+      llvm::raw_fd_ostream fout ("test.bc", error,
+                                 llvm::sys::fs::F_Binary);
+#else
       llvm::raw_fd_ostream fout ("test.bc", error,
                                  llvm::raw_fd_ostream::F_Binary);
+#endif
       llvm::WriteBitcodeToFile (module, fout);
     }
 }
diff -r ff613b6a7b6f -r b75616333fe6 libinterp/corefcn/pt-jit.h
--- a/libinterp/corefcn/pt-jit.h	Fri May 23 16:28:37 2014 +0200
+++ b/libinterp/corefcn/pt-jit.h	Thu May 29 18:16:05 2014 +0100
@@ -386,8 +386,13 @@
   size_t trip_count (const octave_value& bounds) const;
 
   llvm::Module *module;
+#ifdef LEGACY_PASSMANAGER
+  llvm::legacy::PassManager *module_pass_manager;
+  llvm::legacy::FunctionPassManager *pass_manager;
+#else
   llvm::PassManager *module_pass_manager;
   llvm::FunctionPassManager *pass_manager;
+#endif
   llvm::ExecutionEngine *engine;
 };
 
diff -r ff613b6a7b6f -r b75616333fe6 m4/acinclude.m4
--- a/m4/acinclude.m4	Fri May 23 16:28:37 2014 +0200
+++ b/m4/acinclude.m4	Thu May 29 18:16:05 2014 +0100
@@ -1744,6 +1744,58 @@
   fi
 ])
 dnl
+dnl Check for raw_fd_ostream API
+dnl
+AC_DEFUN([OCTAVE_LLVM_RAW_FD_OSTREAM_API], [
+  AC_CACHE_CHECK([check LLVM::raw_fd_ostream arg type is llvm::sys:fs],
+    [octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs],
+    [AC_LANG_PUSH(C++)
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[
+          #include <llvm/Support/raw_os_ostream.h>
+          ]], [[
+          std::string str;
+          llvm::raw_fd_ostream fout ("", str, llvm::sys::fs::F_Binary);
+        ]])],
+        octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=yes,
+        octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs=no)
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_raw_fd_ostream_arg_is_llvm_sys_fs = yes; then
+    AC_DEFINE(RAW_FD_OSTREAM_ARG_IS_LLVM_SYS_FS, 1,
+      [Define to 1 if LLVM::raw_fd_ostream arg type is llvm::sys:fs.])
+  fi
+])
+dnl
+dnl Check for legacy::PassManager API
+dnl
+AC_DEFUN([OCTAVE_LLVM_LEGACY_PASSMANAGER_API], [
+  AC_CACHE_CHECK([check for LLVM::legacy::PassManager],
+    [octave_cv_legacy_passmanager],
+    [AC_LANG_PUSH(C++)
+      save_LIBS="$LIBS"
+      LIBS="$LLVM_LIBS $LIBS"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([[
+          #include <llvm/IR/LegacyPassManager.h>
+          ]], [[
+          llvm::Module *module;
+          llvm::legacy::PassManager *module_pass_manager;
+          llvm::legacy::FunctionPassManager *pass_manager;      
+          module_pass_manager = new llvm::legacy::PassManager ();
+          pass_manager = new llvm::legacy::FunctionPassManager (module);
+        ]])],
+        octave_cv_legacy_passmanager=yes,
+        octave_cv_legacy_passmanager=no)
+      LIBS="$save_LIBS"
+    AC_LANG_POP(C++)
+  ])
+  if test $octave_cv_legacy_passmanager = yes; then
+    AC_DEFINE(LEGACY_PASSMANAGER, 1,
+      [Define to 1 if LLVM::legacy::PassManager exists.])
+  fi
+])
+dnl
 dnl Check for ar.
 dnl
 AC_DEFUN([OCTAVE_PROG_AR], [
