changeset 23218:95a9d6ffaecc

maint: Periodic merge of stable to default.
author Rik <rik@octave.org>
date Tue, 21 Feb 2017 16:56:38 -0800
parents 3a298e07002c (current diff) 893d99338cc8 (diff)
children 092078913d54
files doc/interpreter/container.txi doc/interpreter/external.txi doc/interpreter/numbers.txi doc/interpreter/octave.texi doc/interpreter/plot.txi libgui/graphics/GLCanvas.cc libinterp/dldfcn/__init_fltk__.cc libinterp/parse-tree/lex.ll scripts/general/chop.m
diffstat 9 files changed, 482 insertions(+), 279 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/container.txi	Sun Feb 19 12:37:59 2017 +0100
+++ b/doc/interpreter/container.txi	Tue Feb 21 16:56:38 2017 -0800
@@ -1033,21 +1033,27 @@
 
 @example
 @group
-in@{1@} = [10, 20, 30, 40, 50, 60, 70, 80, 90];
+in@{1@} = [10, 20, 30];
 in@{2@} = inf;
 in@{3@} = "last";
 in@{4@} = "first";
 out = cell (4, 1);
-[out@{1:3@}] = find (in@{1 : 3@});
-[out@{4:6@}] = find (in@{[1, 2, 4]@})
+[out@{1:3@}] = in@{1 : 3@};
+[out@{4:6@}] = in@{[1, 2, 4]@})
      @result{} out =
         @{
-          [1,1] = 1
-          [2,1] = 9
-          [3,1] = 90
-          [4,1] = 1
-          [3,1] = 1
-          [4,1] = 10
+           [1,1] =
+         
+              10   20   30
+         
+           [2,1] = Inf
+           [3,1] = last
+           [4,1] =
+         
+              10   20   30
+         
+           [5,1] = Inf
+           [6,1] = first
         @}
 @end group
 @end example
--- a/doc/interpreter/external.txi	Sun Feb 19 12:37:59 2017 +0100
+++ b/doc/interpreter/external.txi	Tue Feb 21 16:56:38 2017 -0800
@@ -1804,12 +1804,368 @@
 or @code{joPas} (@url{http://jopas.sourceforge.net/}).
 
 @menu
+* Making Java Classes Available::
+* How to use Java from within Octave::
+* Passing parameters to the JVM::
 * Java Interface Functions::
-* Making Java Classes Available::
-* Creating an Instance of a Java Class::
-* Handling Java Memory Limitations::
 @end menu
 
+
+@node Making Java Classes Available
+@subsection Making Java Classes Available
+
+@c - index -
+@cindex classpath, setting
+@cindex classpath, difference between static and dynamic
+@cindex static classpath
+@cindex dynamic classpath
+@cindex @file{javaclasspath.txt}
+@cindex @file{classpath.txt}
+@cindex classes, making available to Octave
+@c - index -
+
+Java finds classes by searching a @var{classpath} which is a list of Java
+archive files and/or directories containing class files.  In Octave the
+@var{classpath} is composed of two parts:
+
+@itemize
+@item the @var{static classpath} is initialized once at startup of the JVM, and
+
+@item the @var{dynamic classpath} which can be modified at runtime.
+@end itemize
+
+Octave searches the @var{static classpath} first, and then the
+@var{dynamic classpath}.  Classes appearing in the @var{static classpath}, as
+well as in the @var{dynamic classpath}, will therefore be found in the
+@var{static classpath} and loaded from this location.  Classes which will be
+used frequently, or must be available to all users, should be added to the
+@var{static classpath}.  The @var{static classpath} is populated once from the
+contents of a plain text file named @file{javaclasspath.txt} (or
+@file{classpath.txt} historically) when the Java Virtual Machine starts.  This
+file contains one line for each individual classpath to be added to the
+@var{static classpath}.  These lines can identify directories containing class
+files, or Java archives with complete class file hierarchies.  Comment lines
+starting with a @samp{#} or a @samp{%} character are ignored.
+
+The search rules for the file @file{javaclasspath.txt} (or
+@file{classpath.txt}) are:
+
+@itemize
+@item
+First, Octave tries to locate it in the current directory (where Octave was
+started from).  If such a file is found, it is read and defines the initial
+@var{static classpath}.  Thus, it is possible to define a static classpath on a
+'per Octave invocation' basis.
+
+@item
+Next, Octave searches in the user's home directory.  If a file
+@file{javaclasspath.txt} exists here, its contents are appended to the static
+classpath (if any).  Thus, it is possible to build an initial static classpath
+on a @nospell{'per user'} basis.
+
+@item
+Finally, Octave looks for a @file{javaclasspath.txt} in the m-file directory
+where Octave Java functions live.  This is where the function
+@file{javaclasspath.m} resides, usually something like
+@file{@w{@env{OCTAVE_HOME}}/share/octave/@w{@env{OCTAVE_VERSION}}/m/java/}.
+You can find this directory by executing the command
+
+@example
+which javaclasspath
+@end example
+
+If this file exists here, its contents are also appended to the
+@var{static classpath}.  Note that the archives and class directories defined
+in this last step will affect all users.
+@end itemize
+
+Classes which are used only by a specific script should be placed in the
+@var{dynamic classpath}.  This portion of the classpath can be modified at
+runtime using the @code{javaaddpath} and @code{javarmpath} functions.
+
+Example:
+
+@example
+octave> base_path = "C:/Octave/java_files";
+
+octave> # add two JAR archives to the dynamic classpath
+octave> javaaddpath ([base_path, "/someclasses.jar"]);
+octave> javaaddpath ([base_path, "/moreclasses.jar"]);
+
+octave> # check the dynamic classpath
+octave> p = javaclasspath;
+octave> disp (p@{1@});
+C:/Octave/java_files/someclasses.jar
+octave> disp (p@{2@});
+C:/Octave/java_files/moreclasses.jar
+
+octave> # remove the first element from the classpath
+octave> javarmpath ([base_path, "/someclasses.jar"]);
+octave> p = javaclasspath;
+octave> disp (p@{1@});
+C:/Octave/java_files/moreclasses.jar
+
+octave> # provoke an error
+octave> disp (p@{2@});
+error: A(I): Index exceeds matrix dimension.
+@end example
+
+Another way to add files to the @var{dynamic classpath} exclusively for your
+user account is to use the file @file{.octaverc} which is stored in your home
+directory.  All Octave commands in this file are executed each time you start a
+new instance of Octave.  The following example adds the directory @file{octave}
+to Octave's search path and the archive @file{myclasses.jar} in this directory
+to the Java search path.
+
+@example
+@group
+# contents of .octaverc:
+addpath ("~/octave");
+javaaddpath ("~/octave/myclasses.jar");
+@end group
+@end example
+
+@c ------------------------------------------------------------------------
+@node How to use Java from within Octave
+@subsection How to use Java from within Octave
+
+The function @ref{XREFjavaObject,javaObject,javaObject} creates Java objects.
+In fact it invokes the public constructor of the class with the given name
+and with the given parameters.
+
+The following example shows how to invoke the constructors
+@code{BigDecimal(double)} and @code{BigDecimal(String)} of the builtin Java
+class @code{java.math.BigDecimal}.
+
+@example
+@group
+javaObject ("java.math.BigDecimal",  1.001 );
+javaObject ("java.math.BigDecimal", "1.001");
+@end group
+@end example
+
+Note that parameters of the Octave type @code{double} are implicitly converted
+into the Java type @code{double} and the Octave type (array of) @code{char} is
+converted into the java type @code{String}.  A Java object created by
+@ref{XREFjavaObject,javaObject,javaObject} is never automatically converted
+into an Octave type but remains a Java object.  It can be assigned to an
+Octave variable.
+
+@example
+@group
+a = 1.001;
+b = javaObject ("java.math.BigDecimal", a);
+@end group
+@end example
+
+Using @ref{XREFisjava,isjava,isjava}, it is possible to check whether a
+variable is a Java object and its class can be determined as well.  In
+addition to the previous example:
+
+@example
+@group
+isjava (a)
+@result{} ans = 0
+class (a)
+@result{} ans = double
+isjava (b)
+@result{} ans = 1
+class (b)
+@result{} ans = java.math.BigDecimal
+@end group
+@end example
+
+The example above can be carried out using only Java objects:
+
+@example
+a = javaObject ("java.lang.Double", 1.001);
+b = javaObject ("java.math.BigDecimal", a);
+
+isjava (a)
+@result{} ans = 1
+class (a)
+@result{} ans = java.lang.Double
+isjava (b)
+@result{} ans = 1
+class (b)
+@result{} ans = java.math.BigDecimal
+@end example
+
+One can see, that even a @code{java.lang.Double} is not converted to an Octave
+@code{double}, when created by @ref{XREFjavaObject,javaObject,javaObject}.
+But ambiguities might arise, if the Java classes @code{java.lang.Double} or
+@code{double} are parameters of a method (or a constructor).  In this case
+they can be converted into one another, depending on the context.
+
+
+Via @ref{XREFjavaObject,javaObject,javaObject} one may create all kinds of
+Java objects but arrays.  The latter are created through
+@ref{XREFjavaArray,javaArray,javaArray}.
+
+It is possible to invoke public member methods on Java objects in Java syntax:
+
+@example
+@group
+a.toString
+@result{} ans = 1.001
+b.toString
+@result{} ans = 1.000999999999999889865...
+@end group
+@end example
+
+The second result may be surprising, but simply comes from the fact, that
+@code{1.001} cannot exactly be represented as @code{double}, due to rounding.
+Note that unlike in Java, in Octave methods without arguments can be invoked
+with and without parentheses @code{()}.
+
+Currently it is not possible to invoke static methods with a Java like syntax
+from within Octave.  Instead, one has to use the function
+@ref{XREFjavaMethod,javaMethod,javaMethod} as in the following example:
+
+@example
+@group
+java.math.BigDecimal.valueOf(1.001);                    # does not work
+javaMethod ("valueOf", "java.math.BigDecimal", 1.001);  # workaround
+@end group
+@end example
+
+As mentioned before, method and constructor parameters are converted
+automatically between Octave and Java types, if appropriate.  For functions
+this is also true with return values, whereas for constructors this is not.
+
+It is also possible to access public fields of Java objects from within Octave
+using Java syntax, with the limitation of static fields:
+
+@example
+@group
+java.math.BigDecimal.ONE;                  # does not work
+java_get ("java.math.BigDecimal", "ONE");  # workaround
+@end group
+@end example
+
+Accordingly, with @ref{XREFjava_set,java_set,java_set} the value of a field
+can be set.  Note that only public Java fields are accessible from within
+Octave.
+
+The following example indicates that in Octave empty brackets @code{[]}
+represent Java's @code{null} value and how Java exceptions are represented.
+
+@example
+@group
+javaObject ("java.math.BigDecimal", []);
+@result{} error: [java] java.lang.NullPointerException
+@end group
+@end example
+
+It is not recommended to represent Java's @code{null} value by empty brackets
+@code{[]}, because @code{null} has no type whereas @code{[]} has type
+@code{double}.
+
+In Octave it is possible to provide limited Java reflection by listing the
+public fields and methods of a Java object, both static or not.
+
+@example
+@group
+fieldnames (<Java object>)
+methods (<Java object>)
+@end group
+@end example
+
+Finally, an examples is shown how to access the stack trace from within
+Octave, where the function @ref{XREFdebug_java,debug_java,debug_java} is used
+to set and to get the current debug state.  In debug mode, the Java error and
+the stack trace are displayed.
+
+@example
+@group
+debug_java (true)  # use "false" to omit display of stack trace
+debug_java ()
+@result{} ans = 1
+javaObject ("java.math.BigDecimal", "1") ...
+  .divide (javaObject ("java.math.BigDecimal", "0"))
+@end group
+@end example
+
+
+
+@node Passing parameters to the JVM
+@subsection Passing parameters to the JVM
+@cindex memory, limitations on JVM
+
+In order to execute Java code Octave creates a Java Virtual Machine (JVM).
+Such a JVM allocates a fixed amount of initial memory and may expand this pool
+up to a fixed maximum memory limit.  The default values depend on the Java
+version (@pxref{XREFjavamem,,javamem}).  The memory pool is shared by all Java
+objects running in the JVM@.  This strict memory limit is intended mainly to
+avoid runaway applications inside web browsers or in enterprise servers which
+can consume all memory and crash the system.  When the maximum memory limit is
+hit, Java code will throw exceptions so that applications will fail or behave
+unexpectedly.
+
+You can specify options for the creation of the JVM inside a file named
+@file{java.opts}.  This is a text file where enter you enter lines containing
+@option{-X} and @option{-D} options that are then passed to the JVM during
+initialization.
+
+The directory where the Java options file is located is specified by the
+environment variable @w{@env{OCTAVE_JAVA_DIR}}.  If unset the directory where
+@file{javaclasspath.m} resides is used instead (typically
+@file{@w{@env{OCTAVE_HOME}}/share/octave/@w{@env{OCTAVE_VERSION}}/m/java/}).
+You can find this directory by executing
+
+@example
+which javaclasspath
+@end example
+
+The @option{-X} options allow you to increase the maximum amount of memory
+available to the JVM@.  The following example allows up to 256 Megabytes to be
+used by adding the following line to the @file{java.opts} file:
+
+@example
+-Xmx256m
+@end example
+
+The maximum possible amount of memory depends on your system.  On a Windows
+system with 2 Gigabytes main memory you should be able to set this maximum to
+about 1 Gigabyte.
+
+If your application requires a large amount of memory from the beginning, you
+can also specify the initial amount of memory allocated to the JVM@.  Adding
+the following line to the @file{java.opts} file starts the JVM with 64
+Megabytes of initial memory:
+
+@example
+-Xms64m
+@end example
+
+For more details on the available @option{-X} options of your Java Virtual
+Machine issue the command @samp{java -X} at the operating system command prompt
+and consult the Java documentation.
+
+The @option{-D} options can be used to define system properties which can then
+be used by Java classes inside Octave.  System properties can be retrieved by
+using the @code{getProperty()} methods of the @code{java.lang.System} class.
+The following example line defines the property @var{MyProperty} and assigns it
+the string @code{12.34}.
+
+@example
+-DMyProperty=12.34
+@end example
+
+The value of this property can then be retrieved as a string by a Java object
+or in Octave:
+
+@example
+@group
+octave> javaMethod ("getProperty", "java.lang.System", "MyProperty");
+ans = 12.34
+@end group
+@end example
+
+@seealso{javamem}
+
+
+
 @node Java Interface Functions
 @subsection Java Interface Functions
 
@@ -1818,6 +2174,7 @@
 which return results to Octave.
 
 @cindex object, creating a Java object
+@cindex instance, creating a Java instance
 @DOCSTRING(javaObject)
 
 @cindex array, creating a Java array
@@ -1949,209 +2306,3 @@
 @DOCSTRING(java_unsigned_autoconversion)
 
 @DOCSTRING(debug_java)
-
-@node Making Java Classes Available
-@subsection Making Java Classes Available
-
-@c - index -
-@cindex classpath, setting
-@cindex classpath, difference between static and dynamic
-@cindex static classpath
-@cindex dynamic classpath
-@cindex @file{javaclasspath.txt}
-@cindex @file{classpath.txt}
-@cindex classes, making available to Octave
-@c - index -
-
-Java finds classes by searching a @var{classpath} which is a list of Java
-archive files and/or directories containing class files.  In Octave the
-@var{classpath} is composed of two parts:
-
-@itemize
-@item the @var{static classpath} is initialized once at startup of the JVM, and
-
-@item the @var{dynamic classpath} which can be modified at runtime.
-@end itemize
-
-Octave searches the @var{static classpath} first, and then the
-@var{dynamic classpath}.  Classes appearing in the @var{static classpath}, as
-well as in the @var{dynamic classpath}, will therefore be found in the
-@var{static classpath} and loaded from this location.  Classes which will be
-used frequently, or must be available to all users, should be added to the
-@var{static classpath}.  The @var{static classpath} is populated once from the
-contents of a plain text file named @file{javaclasspath.txt} (or
-@file{classpath.txt} historically) when the Java Virtual Machine starts.  This
-file contains one line for each individual classpath to be added to the
-@var{static classpath}.  These lines can identify directories containing class
-files, or Java archives with complete class file hierarchies.  Comment lines
-starting with a @samp{#} or a @samp{%} character are ignored.
-
-The search rules for the file @file{javaclasspath.txt} (or
-@file{classpath.txt}) are:
-
-@itemize
-@item
-First, Octave tries to locate it in the current directory (where Octave was
-started from).  If such a file is found, it is read and defines the initial
-@var{static classpath}.  Thus, it is possible to define a static classpath on a
-'per Octave invocation' basis.
-
-@item
-Next, Octave searches in the user's home directory.  If a file
-@file{javaclasspath.txt} exists here, its contents are appended to the static
-classpath (if any).  Thus, it is possible to build an initial static classpath
-on a @nospell{'per user'} basis.
-
-@item
-Finally, Octave looks for a @file{javaclasspath.txt} in the m-file directory
-where Octave Java functions live.  This is where the function
-@file{javaclasspath.m} resides, usually something like
-@file{@w{@env{OCTAVE_HOME}}/share/octave/@w{@env{OCTAVE_VERSION}}/m/java/}.
-You can find this directory by executing the command
-
-@example
-which javaclasspath
-@end example
-
-If this file exists here, its contents are also appended to the
-@var{static classpath}.  Note that the archives and class directories defined
-in this last step will affect all users.
-@end itemize
-
-Classes which are used only by a specific script should be placed in the
-@var{dynamic classpath}.  This portion of the classpath can be modified at
-runtime using the @code{javaaddpath} and @code{javarmpath} functions.
-
-Example:
-
-@example
-octave> base_path = "C:/Octave/java_files";
-
-octave> # add two JAR archives to the dynamic classpath
-octave> javaaddpath ([base_path, "/someclasses.jar"]);
-octave> javaaddpath ([base_path, "/moreclasses.jar"]);
-
-octave> # check the dynamic classpath
-octave> p = javaclasspath;
-octave> disp (p@{1@});
-C:/Octave/java_files/someclasses.jar
-octave> disp (p@{2@});
-C:/Octave/java_files/moreclasses.jar
-
-octave> # remove the first element from the classpath
-octave> javarmpath ([base_path, "/someclasses.jar"]);
-octave> p = javaclasspath;
-octave> disp (p@{1@});
-C:/Octave/java_files/moreclasses.jar
-
-octave> # provoke an error
-octave> disp (p@{2@});
-error: A(I): Index exceeds matrix dimension.
-@end example
-
-Another way to add files to the @var{dynamic classpath} exclusively for your
-user account is to use the file @file{.octaverc} which is stored in your home
-directory.  All Octave commands in this file are executed each time you start a
-new instance of Octave.  The following example adds the directory @file{octave}
-to Octave's search path and the archive @file{myclasses.jar} in this directory
-to the Java search path.
-
-@example
-@group
-# contents of .octaverc:
-addpath ("~/octave");
-javaaddpath ("~/octave/myclasses.jar");
-@end group
-@end example
-
-@c ------------------------------------------------------------------------
-@node Creating an Instance of a Java Class
-@subsection Creating an Instance of a Java Class
-@c - index -
-@cindex object, how to create
-@cindex instance, how to create
-@c - index -
-
-The function @code{javaObject} can be used to create Java objects.
-
-Example:
-
-@example
-Passenger = javaObject ("package.FirstClass", row, seat);
-@end example
-
-@node Handling Java Memory Limitations
-@subsection Handling Java Memory Limitations
-@cindex memory, limitations
-
-In order to execute Java code Octave creates a Java Virtual Machine (JVM).
-Such a JVM allocates a fixed amount of initial memory and may expand this pool
-up to a fixed maximum memory limit.  The default values depend on the Java
-version (@pxref{XREFjavamem,,javamem}).  The memory pool is shared by all Java
-objects running in the JVM@.  This strict memory limit is intended mainly to
-avoid runaway applications inside web browsers or in enterprise servers which
-can consume all memory and crash the system.  When the maximum memory limit is
-hit, Java code will throw exceptions so that applications will fail or behave
-unexpectedly.
-
-You can specify options for the creation of the JVM inside a file named
-@file{java.opts}.  This is a text file where enter you enter lines containing
-@option{-X} and @option{-D} options that are then passed to the JVM during
-initialization.
-
-The directory where the Java options file is located is specified by the
-environment variable @w{@env{OCTAVE_JAVA_DIR}}.  If unset the directory where
-@file{javaclasspath.m} resides is used instead (typically
-@file{@w{@env{OCTAVE_HOME}}/share/octave/@w{@env{OCTAVE_VERSION}}/m/java/}).
-You can find this directory by executing
-
-@example
-which javaclasspath
-@end example
-
-The @option{-X} options allow you to increase the maximum amount of memory
-available to the JVM@.  The following example allows up to 256 Megabytes to be
-used by adding the following line to the @file{java.opts} file:
-
-@example
--Xmx256m
-@end example
-
-The maximum possible amount of memory depends on your system.  On a Windows
-system with 2 Gigabytes main memory you should be able to set this maximum to
-about 1 Gigabyte.
-
-If your application requires a large amount of memory from the beginning, you
-can also specify the initial amount of memory allocated to the JVM@.  Adding
-the following line to the @file{java.opts} file starts the JVM with 64
-Megabytes of initial memory:
-
-@example
--Xms64m
-@end example
-
-For more details on the available @option{-X} options of your Java Virtual
-Machine issue the command @samp{java -X} at the operating system command prompt
-and consult the Java documentation.
-
-The @option{-D} options can be used to define system properties which can then
-be used by Java classes inside Octave.  System properties can be retrieved by
-using the @code{getProperty()} methods of the @code{java.lang.System} class.
-The following example line defines the property @var{MyProperty} and assigns it
-the string @code{12.34}.
-
-@example
--DMyProperty=12.34
-@end example
-
-The value of this property can then be retrieved as a string by a Java object
-or in Octave:
-
-@example
-@group
-octave> javaMethod ("getProperty", "java.lang.System", "MyProperty");
-ans = 12.34
-@end group
-@end example
-
-@seealso{javamem}
--- a/doc/interpreter/numbers.txi	Sun Feb 19 12:37:59 2017 +0100
+++ b/doc/interpreter/numbers.txi	Tue Feb 21 16:56:38 2017 -0800
@@ -21,67 +21,75 @@
 @cindex numeric constant
 @cindex numeric value
 
-A @dfn{numeric constant} may be a scalar, a vector, or a matrix, and it
-may contain complex values.
+A @dfn{numeric constant} may be a scalar, a vector, or a matrix, and it may
+contain complex values.
+
+The simplest form of a numeric constant, a scalar, is a single number.  Note
+that by default numeric constants are represented within Octave by IEEE 754
+double precision (binary64) floating-point format (complex constants are
+stored as pairs of binary64 values).  It is, however, possible to represent
+real integers as described in @ref{Integer Data Types}.
 
-The simplest form of a numeric constant, a scalar, is a single number
-that can be an integer, a decimal fraction, a number in scientific
-(exponential) notation, or a complex number.  Note that by default numeric
-constants are represented within Octave in double-precision floating
-point format (complex constants are stored as pairs of double-precision
-floating point values).  It is, however, possible to represent real
-integers as described in @ref{Integer Data Types}.  Here are some
-examples of real-valued numeric constants, which all have the same
-value:
+If the numeric constant is a real integer, it can be defined in decimal,
+hexadecimal, or binary notation.  Hexadecimal notation starts with @samp{0x} or
+@samp{0X}, binary notation starts with @samp{0b} or @samp{0B}, otherwise
+decimal notation is assumed.  As a consequence, @samp{0b} is not a hexadecimal
+number, in fact, it is not a valid number at all.
+
+For better readability, digits may be partitioned by the underscore separator
+@samp{_}, which is ignored by the Octave interpreter.  Here are some examples
+of real-valued integer constants, which all represent the same value and are
+internally stored as binary64:
 
 @example
 @group
-105
-1.05e+2
-1050e-1
-@end group
-@end example
-
-To specify complex constants, you can write an expression of the form
-
-@example
-@group
-3 + 4i
-3.0 + 4.0i
-0.3e1 + 40e-1i
+42            # decimal notation
+0x2A          # hexadecimal notation
+0b101010      # binary notation
+0b10_1010     # underscore notation
+round (42.1)  # also binary64
 @end group
 @end example
 
-@noindent
-all of which are equivalent.  The letter @samp{i} in the previous example
-stands for the pure imaginary constant, defined as
-@tex
-  $\sqrt{-1}$.
-@end tex
-@ifnottex
-  @code{sqrt (-1)}.
-@end ifnottex
-
-For Octave to recognize a value as the imaginary part of a complex
-constant, a space must not appear between the number and the @samp{i}.
-If it does, Octave will print an error message, like this:
+In decimal notation, the numeric constant may be denoted as decimal fraction
+or even in scientific (exponential) notation.  Note that this is not possible
+for hexadecimal or binary notation.  Again, in the following example all
+numeric constants represent the same value:
 
 @example
 @group
-octave:13> 3 + 4 i
-
-parse error:
-
-  syntax error
-
->>> 3 + 4 i
-          ^
+.105
+1.05e-1
+.00105e+2
 @end group
 @end example
 
-@noindent
-You may also use @samp{j}, @samp{I}, or @samp{J} in place of the
-@samp{i} above.  All four forms are equivalent.
+Unlike most programming languages, complex numeric constants are denoted as
+the sum of real and imaginary parts.  The imaginary part is denoted by a
+real-valued numeric constant followed immediately by a complex value indicator
+(@samp{i}, @samp{j}, @samp{I}, or @samp{J} which represents
+@tex
+  $\sqrt{-1}$).
+@end tex
+@ifnottex
+  @code{sqrt (-1)}).
+@end ifnottex
+No spaces are allowed between the numeric constant and the complex value
+indicator.  Some examples of complex numeric constants that all represent the
+same value:
+
+@example
+@group
+3 + 42i
+3 + 42j
+3 + 42I
+3 + 42J
+3.0 + 42.0i
+3.0 + 0x2Ai
+3.0 + 0b10_1010i
+0.3e1 + 420e-1i
+@end group
+@end example
 
 @DOCSTRING(double)
 
--- a/doc/interpreter/octave.texi	Sun Feb 19 12:37:59 2017 +0100
+++ b/doc/interpreter/octave.texi	Tue Feb 21 16:56:38 2017 -0800
@@ -877,10 +877,10 @@
 
 Java Interface
 
+* Making Java Classes Available::
+* How to use Java from within Octave::
+* Passing parameters to the JVM::
 * Java Interface Functions::
-* Making Java Classes Available::
-* Creating an Instance of a Java Class::
-* Handling Java Memory Limitations::
 
 Test and Demo Functions
 
--- a/doc/interpreter/plot.txi	Sun Feb 19 12:37:59 2017 +0100
+++ b/doc/interpreter/plot.txi	Tue Feb 21 16:56:38 2017 -0800
@@ -89,6 +89,9 @@
 @group
 x = -10:0.1:10;
 plot (x, sin (x));
+xlabel ("x");
+ylabel ("sin (x)");
+title ("Simple 2-D Plot");
 @end group
 @end example
 
@@ -123,13 +126,20 @@
 
 @example
 @group
+randn ("state", 1);
 hist (randn (10000, 1), 30);
+xlabel ("Value");
+ylabel ("Count");
+title ("Histogram of 10,000 normally distributed random numbers");
 @end group
 @end example
 
 @noindent
 produces the histogram of 10,000 normally distributed random numbers
-shown in @ref{fig:hist}.
+shown in @ref{fig:hist}.  Note that, @code{randn ("state", 1);}, initializes
+the random number generator for @code{randn} to a known value so that the
+returned values are reproducible; This guarantees that the figure produced
+is identical to the one in this manual.
 
 @float Figure,fig:hist
 @center @image{hist,4in}
@@ -177,11 +187,16 @@
 
 @example
 @group
+rand ("state", 2);
 x = 0:0.1:10;
 y = sin (x);
 lerr = 0.1 .* rand (size (x));
 uerr = 0.1 .* rand (size (x));
 errorbar (x, y, lerr, uerr);
+axis ([0, 10, -1.1, 1.1]);
+xlabel ("x");
+ylabel ("sin (x)");
+title ("Errorbar plot of sin (x)");
 @end group
 @end example
 
@@ -207,6 +222,7 @@
 
 @example
 polar (0:0.1:10*pi, 0:0.1:10*pi);
+title ("Example polar plot from 0 to 10*pi");
 @end example
 
 @noindent
@@ -318,6 +334,10 @@
 r = sqrt (xx .^ 2 + yy .^ 2) + eps;
 tz = sin (r) ./ r;
 mesh (tx, ty, tz);
+xlabel ("tx");
+ylabel ("ty");
+zlabel ("tz");
+title ("3-D Sombrero plot");
 @end group
 @end example
 
@@ -343,7 +363,11 @@
 t = 0:0.1:10*pi;
 r = linspace (0, 1, numel (t));
 z = linspace (0, 1, numel (t));
-plot3 (r.*sin(t), r.*cos(t), z);
+plot3 (r.*sin (t), r.*cos (t), z);
+xlabel ("r.*sin (t)");
+ylabel ("r.*cos (t)");
+zlabel ("z");
+title ("plot3 display of 3-D helix");
 @end group
 @end example
 
--- a/libgui/graphics/GLCanvas.cc	Sun Feb 19 12:37:59 2017 +0100
+++ b/libgui/graphics/GLCanvas.cc	Tue Feb 21 16:56:38 2017 -0800
@@ -114,12 +114,12 @@
   void
   GLCanvas::drawZoomBox (const QPoint& p1, const QPoint& p2)
   {
+    glMatrixMode (GL_MODELVIEW);
     glPushMatrix ();
-
-    glMatrixMode (GL_MODELVIEW);
     glLoadIdentity ();
 
     glMatrixMode (GL_PROJECTION);
+    glPushMatrix ();
     glLoadIdentity ();
     glOrtho (0, width (), height (), 0, 1, -1);
 
@@ -131,13 +131,18 @@
     glDrawZoomBox (p1, p2);
     glEnd ();
 
+    glLineWidth (1.5);
     glBegin (GL_LINE_STRIP);
-    glLineWidth (1.5);
     glColor4f (0.45, 0.62, 0.81, 0.9);
     glDrawZoomBox (p1, p2);
     glEnd ();
 
     glPopAttrib ();
+
+    glMatrixMode (GL_MODELVIEW);
+    glPopMatrix ();
+
+    glMatrixMode (GL_PROJECTION);
     glPopMatrix ();
   }
 
--- a/libinterp/dldfcn/__init_fltk__.cc	Sun Feb 19 12:37:59 2017 +0100
+++ b/libinterp/dldfcn/__init_fltk__.cc	Tue Feb 21 16:56:38 2017 -0800
@@ -236,12 +236,12 @@
   {
 #if defined (HAVE_OPENGL)
 
+    glMatrixMode (GL_MODELVIEW);
     glPushMatrix ();
-
-    glMatrixMode (GL_MODELVIEW);
     glLoadIdentity ();
 
     glMatrixMode (GL_PROJECTION);
+    glPushMatrix ();
     glLoadIdentity ();
     gluOrtho2D (0.0, w (), 0.0, h ());
 
@@ -253,13 +253,16 @@
     zoom_box_vertex ();
     glEnd ();
 
+    glLineWidth (1.5);
     glBegin (GL_LINE_STRIP);
-    glLineWidth (1.5);
     glColor4f (0.45, 0.62, 0.81, 0.9);
     zoom_box_vertex ();
     glEnd ();
 
     glPopAttrib ();
+    glMatrixMode (GL_MODELVIEW);
+    glPopMatrix ();
+    glMatrixMode (GL_PROJECTION);
     glPopMatrix ();
 
 #else
--- a/libinterp/parse-tree/lex.ll	Sun Feb 19 12:37:59 2017 +0100
+++ b/libinterp/parse-tree/lex.ll	Tue Feb 21 16:56:38 2017 -0800
@@ -2794,8 +2794,13 @@
 
         for (size_t i = 0; i < strlen (tmptxt); i++)
           {
-            long_int_value <<= 1;
-            long_int_value += static_cast<uintmax_t> (tmptxt[i] == '1');
+            if (tmptxt[i] == '0')
+              long_int_value <<= 1;
+            else if (tmptxt[i] == '1')
+            {
+              long_int_value <<= 1;
+              long_int_value += 1;
+            }
           }
 
         value = static_cast<double> (long_int_value);
--- a/scripts/general/chop.m	Sun Feb 19 12:37:59 2017 +0100
+++ b/scripts/general/chop.m	Tue Feb 21 16:56:38 2017 -0800
@@ -25,6 +25,7 @@
 ##
 ## @example
 ## @group
+## format long
 ## chop (-pi, 5, 10)
 ##    @result{} -3.14200000000000
 ## chop (-pi, 5, 5)