Mercurial > hg > octave-lojdl
changeset 17475:0b6f44d31edc default tip Latex-interpreter
Merge with main after adding Windows name fot GS.
author | Andrej Lojdl <andrej.lojdl@gmail.com> |
---|---|
date | Thu, 19 Sep 2013 22:53:49 +0200 |
parents | 981103844b51 (diff) 2fee3022ac2f (current diff) |
children | |
files | libinterp/corefcn/graphics.cc |
diffstat | 16 files changed, 6607 insertions(+), 5794 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac +++ b/configure.ac @@ -19,380 +19,380 @@ ### <http://www.gnu.org/licenses/>. AC_PREREQ([2.62]) -AC_INIT([GNU Octave], [3.7.6+], [http://octave.org/bugs.html], [octave]) - -dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg -OCTAVE_VERSION="$PACKAGE_VERSION" -OCTAVE_API_VERSION_NUMBER="48" -OCTAVE_API_VERSION="api-v$OCTAVE_API_VERSION_NUMBER+" -OCTAVE_RELEASE_DATE="2013-08-20" -OCTAVE_COPYRIGHT="Copyright (C) 2013 John W. Eaton and others." -AC_SUBST(OCTAVE_VERSION) -AC_SUBST(OCTAVE_API_VERSION_NUMBER) -AC_SUBST(OCTAVE_API_VERSION) -AC_SUBST(OCTAVE_RELEASE_DATE) + AC_INIT([GNU Octave], [3.7.6+], [http://octave.org/bugs.html], [octave]) + + dnl PACKAGE_VERSION is set by the AC_INIT VERSION arg + OCTAVE_VERSION="$PACKAGE_VERSION" + OCTAVE_API_VERSION_NUMBER="48" + OCTAVE_API_VERSION="api-v$OCTAVE_API_VERSION_NUMBER+" + OCTAVE_RELEASE_DATE="2013-08-20" + OCTAVE_COPYRIGHT="Copyright (C) 2013 John W. Eaton and others." + AC_SUBST(OCTAVE_VERSION) + AC_SUBST(OCTAVE_API_VERSION_NUMBER) + AC_SUBST(OCTAVE_API_VERSION) + AC_SUBST(OCTAVE_RELEASE_DATE) AC_SUBST(OCTAVE_COPYRIGHT) -dnl FIXME: We should auto-insert the Mercurial changeset ID into the -dnl AC_REVISION field whenever configure.ac is modified. -dnl AC_REVISION($Revision: 1.603 $) -AC_CONFIG_SRCDIR([libinterp/octave.cc]) -AC_CONFIG_HEADERS([config.h:config.in.h]) -AC_CONFIG_AUX_DIR([build-aux]) + dnl FIXME: We should auto-insert the Mercurial changeset ID into the + dnl AC_REVISION field whenever configure.ac is modified. + dnl AC_REVISION($Revision: 1.603 $) + AC_CONFIG_SRCDIR([libinterp/octave.cc]) + AC_CONFIG_HEADERS([config.h:config.in.h]) + AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([1.11 tar-ustar subdir-objects]) ## Add the option to enable silent rules, available since Automake 1.11 ## and included by default starting with Automake 1.13. -AM_SILENT_RULES - -OCTAVE_CANONICAL_HOST + AM_SILENT_RULES + + OCTAVE_CANONICAL_HOST AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.]) - -AC_USE_SYSTEM_EXTENSIONS + + AC_USE_SYSTEM_EXTENSIONS ### Make configure args available for other uses. -config_opts=$ac_configure_args + config_opts=$ac_configure_args AC_SUBST(config_opts) ### Set default file locations -OCTAVE_SET_DEFAULT([octlibdir], '$(libdir)/octave/$(version)') -OCTAVE_SET_DEFAULT([archlibdir], - '$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([localarchlibdir], - '$(libexecdir)/octave/site/exec/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([localapiarchlibdir], - '$(libexecdir)/octave/$(api_version)/site/exec/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([localverarchlibdir], - '$(libexecdir)/octave/$(version)/site/exec/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([octfiledir], - '$(libdir)/octave/$(version)/oct/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([localoctfiledir], - '$(libdir)/octave/site/oct/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([localapioctfiledir], - '$(libdir)/octave/site/oct/$(api_version)/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([localveroctfiledir], - '$(libdir)/octave/$(version)/site/oct/$(canonical_host_type)') -OCTAVE_SET_DEFAULT([octincludedir], '$(includedir)/octave-$(version)/octave') -OCTAVE_SET_DEFAULT([fcnfiledir], '$(datadir)/octave/$(version)/m') -OCTAVE_SET_DEFAULT([localfcnfiledir], '$(datadir)/octave/site/m') -OCTAVE_SET_DEFAULT([localapifcnfiledir], - '$(datadir)/octave/site/$(api_version)/m') -OCTAVE_SET_DEFAULT([localverfcnfiledir], '$(datadir)/octave/$(version)/site/m') -OCTAVE_SET_DEFAULT([octetcdir], '$(datadir)/octave/$(version)/etc') -OCTAVE_SET_DEFAULT([octlocaledir], '$(datadir)/octave/$(version)/locale') -OCTAVE_SET_DEFAULT([doc_cache_file], '$(octetcdir)/doc-cache') -OCTAVE_SET_DEFAULT([octtestsdir], '$(octetcdir)/tests') -OCTAVE_SET_DEFAULT([texi_macros_file], '$(octetcdir)/macros.texi') -OCTAVE_SET_DEFAULT([imagedir], '$(datadir)/octave/$(version)/imagelib') -OCTAVE_SET_DEFAULT([man1dir], '$(mandir)/man1') -OCTAVE_SET_DEFAULT([man1ext], '.1') -OCTAVE_SET_DEFAULT([infofile], '$(infodir)/octave.info') + OCTAVE_SET_DEFAULT([octlibdir], '$(libdir)/octave/$(version)') + OCTAVE_SET_DEFAULT([archlibdir], + '$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([localarchlibdir], + '$(libexecdir)/octave/site/exec/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([localapiarchlibdir], + '$(libexecdir)/octave/$(api_version)/site/exec/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([localverarchlibdir], + '$(libexecdir)/octave/$(version)/site/exec/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([octfiledir], + '$(libdir)/octave/$(version)/oct/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([localoctfiledir], + '$(libdir)/octave/site/oct/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([localapioctfiledir], + '$(libdir)/octave/site/oct/$(api_version)/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([localveroctfiledir], + '$(libdir)/octave/$(version)/site/oct/$(canonical_host_type)') + OCTAVE_SET_DEFAULT([octincludedir], '$(includedir)/octave-$(version)/octave') + OCTAVE_SET_DEFAULT([fcnfiledir], '$(datadir)/octave/$(version)/m') + OCTAVE_SET_DEFAULT([localfcnfiledir], '$(datadir)/octave/site/m') + OCTAVE_SET_DEFAULT([localapifcnfiledir], + '$(datadir)/octave/site/$(api_version)/m') + OCTAVE_SET_DEFAULT([localverfcnfiledir], '$(datadir)/octave/$(version)/site/m') + OCTAVE_SET_DEFAULT([octetcdir], '$(datadir)/octave/$(version)/etc') + OCTAVE_SET_DEFAULT([octlocaledir], '$(datadir)/octave/$(version)/locale') + OCTAVE_SET_DEFAULT([doc_cache_file], '$(octetcdir)/doc-cache') + OCTAVE_SET_DEFAULT([octtestsdir], '$(octetcdir)/tests') + OCTAVE_SET_DEFAULT([texi_macros_file], '$(octetcdir)/macros.texi') + OCTAVE_SET_DEFAULT([imagedir], '$(datadir)/octave/$(version)/imagelib') + OCTAVE_SET_DEFAULT([man1dir], '$(mandir)/man1') + OCTAVE_SET_DEFAULT([man1ext], '.1') + OCTAVE_SET_DEFAULT([infofile], '$(infodir)/octave.info') ### Check for programs used in building, installing, and running Octave. ## Programs used in configuring Octave. ## Find pkg-config executable (sets $PKG_CONFIG) -PKG_PROG_PKG_CONFIG + PKG_PROG_PKG_CONFIG ## Programs used in Makefiles. -AC_PROG_AWK -AC_PROG_GREP -OCTAVE_PROG_FIND -OCTAVE_PROG_SED -OCTAVE_PROG_PERL + AC_PROG_AWK + AC_PROG_GREP + OCTAVE_PROG_FIND + OCTAVE_PROG_SED + OCTAVE_PROG_PERL ## Programs used to build parts of Octave. -OCTAVE_PROG_GPERF - -OCTAVE_PROG_FLEX + OCTAVE_PROG_GPERF + + OCTAVE_PROG_FLEX AC_SUBST([LEX_OUTPUT_ROOT], [lex.octave_]) -OCTAVE_PROG_BISON - -OCTAVE_PROG_MAKEINFO -OCTAVE_PROG_TEXI2DVI -OCTAVE_PROG_TEXI2PDF + OCTAVE_PROG_BISON + + OCTAVE_PROG_MAKEINFO + OCTAVE_PROG_TEXI2DVI + OCTAVE_PROG_TEXI2PDF ## Programs used when installing Octave. -AC_PROG_LN_S -AC_PROG_MKDIR_P - -AC_PROG_INSTALL -INSTALL_SCRIPT='${INSTALL}' + AC_PROG_LN_S + AC_PROG_MKDIR_P + + AC_PROG_INSTALL + INSTALL_SCRIPT='${INSTALL}' AC_SUBST(INSTALL_SCRIPT) -OCTAVE_PROG_DESKTOP_FILE_INSTALL + OCTAVE_PROG_DESKTOP_FILE_INSTALL ## Programs used when running Octave -OCTAVE_PROG_GHOSTSCRIPT -OCTAVE_PROG_GNUPLOT -OCTAVE_PROG_PAGER -OCTAVE_PROG_PYTHON + OCTAVE_PROG_GHOSTSCRIPT + OCTAVE_PROG_GNUPLOT + OCTAVE_PROG_PAGER + OCTAVE_PROG_PYTHON ### Default terminal font for the GUI -case $host_os in - mingw* | msdosmsvc) - DEFAULT_TERMINAL_FONT="Lucida Console" - ;; - *) - DEFAULT_TERMINAL_FONT="Courier" - ;; -esac -DEFAULT_TERMINAL_FONT_SIZE=10 -AC_SUBST(DEFAULT_TERMINAL_FONT) + case $host_os in + mingw* | msdosmsvc) + DEFAULT_TERMINAL_FONT="Lucida Console" + ;; + *) + DEFAULT_TERMINAL_FONT="Courier" + ;; + esac + DEFAULT_TERMINAL_FONT_SIZE=10 + AC_SUBST(DEFAULT_TERMINAL_FONT) AC_SUBST(DEFAULT_TERMINAL_FONT_SIZE) ### Path separator. -sepchar=':' + sepchar=':' AC_ARG_WITH([sepchar], - [AS_HELP_STRING([--with-sepchar=<char>], - [use <char> as the path separation character])]) -case $with_sepchar in - yes | "") - case $host_os in - mingw* | msdosmsvc) - sepchar=';' ;; - esac - ;; - no) - AC_MSG_ERROR([You are required to define a path separation character]) - ;; - *) - sepchar=$with_sepchar - ;; -esac + [AS_HELP_STRING([--with-sepchar=<char>], + [use <char> as the path separation character])]) + case $with_sepchar in + yes | "") + case $host_os in + mingw* | msdosmsvc) + sepchar=';' ;; + esac + ;; + no) +AC_MSG_ERROR([You are required to define a path separation character]) + ;; + *) + sepchar=$with_sepchar + ;; + esac AC_SUBST(sepchar) -AC_DEFINE_UNQUOTED(SEPCHAR, ['$sepchar'], - [Define this to be the path separator for your system, as a character constant.]) -AC_DEFINE_UNQUOTED(SEPCHAR_STR, ["$sepchar"], - [Define this to be the path separator for your system, as a string.]) + AC_DEFINE_UNQUOTED(SEPCHAR, ['$sepchar'], + [Define this to be the path separator for your system, as a character constant.]) + AC_DEFINE_UNQUOTED(SEPCHAR_STR, ["$sepchar"], + [Define this to be the path separator for your system, as a string.]) ### Define the path to the shell on the host system. Most systems will ### ensure /bin/sh is the default shell so this can be safely ignored by ### almost everyone. However, when building for Android, for example, ### this will need to be set. -SHELL_PATH=/bin/sh + SHELL_PATH=/bin/sh AC_ARG_WITH([shell], - [AS_HELP_STRING([--with-shell=SHELL], - [use SHELL as the shell interpreter (default: /bin/sh)])]) -case $with_shell in - no) - AC_MSG_ERROR([A shell interpreter is required]) - ;; - yes | "") - ;; - *) - SHELL_PATH=$with_shell - ;; -esac -AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"], - [Define this to be the path to the shell command interpreter.]) + [AS_HELP_STRING([--with-shell=SHELL], + [use SHELL as the shell interpreter (default: /bin/sh)])]) + case $with_shell in + no) +AC_MSG_ERROR([A shell interpreter is required]) + ;; + yes | "") + ;; + *) + SHELL_PATH=$with_shell + ;; + esac + AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"], + [Define this to be the path to the shell command interpreter.]) ### Enable bounds checking on element references within Octave's array and ### matrix classes. This slows down some operations a bit, so it is turned off ### by default. -BOUNDS_CHECKING=no -AC_ARG_ENABLE([bounds-check], - [AS_HELP_STRING([--enable-bounds-check], - [enable bounds checking for indexing in internal array classes])], - [if test "$enableval" = yes; then BOUNDS_CHECKING=yes; fi], []) -if test $BOUNDS_CHECKING = yes; then - AC_DEFINE(BOUNDS_CHECKING, 1, [Define to 1 to use internal bounds checking.]) -fi + BOUNDS_CHECKING=no + AC_ARG_ENABLE([bounds-check], + [AS_HELP_STRING([--enable-bounds-check], + [enable bounds checking for indexing in internal array classes])], + [if test "$enableval" = yes; then BOUNDS_CHECKING=yes; fi], []) + if test $BOUNDS_CHECKING = yes; then +AC_DEFINE(BOUNDS_CHECKING, 1, [Define to 1 to use internal bounds checking.]) + fi ### Use Octave's built-in memory allocator rather than straightforward malloc. ### Disabled by default. -USE_OCTAVE_ALLOCATOR=no -AC_ARG_ENABLE([octave-allocator], - [AS_HELP_STRING([--enable-octave-allocator], - [use the obsolete octave_allocator class for many of Octave's objects (mostly octave_value types). You probably do NOT want to enable this feature.])], - [if test "$enableval" = yes; then USE_OCTAVE_ALLOCATOR=yes; fi], []) -if test $USE_OCTAVE_ALLOCATOR = yes; then - AC_DEFINE(USE_OCTAVE_ALLOCATOR, 1, - [Define to 1 to use octave_allocator class.]) -fi + USE_OCTAVE_ALLOCATOR=no + AC_ARG_ENABLE([octave-allocator], + [AS_HELP_STRING([--enable-octave-allocator], + [use the obsolete octave_allocator class for many of Octave's objects (mostly octave_value types). You probably do NOT want to enable this feature.])], + [if test "$enableval" = yes; then USE_OCTAVE_ALLOCATOR=yes; fi], []) + if test $USE_OCTAVE_ALLOCATOR = yes; then +AC_DEFINE(USE_OCTAVE_ALLOCATOR, 1, + [Define to 1 to use octave_allocator class.]) + fi ### Use atomic operations for internal reference counting. This is required ### for thread-safe behavior but incurs a significant slowdown, and is thus ### disabled by default. -USE_ATOMIC_REFCOUNT=no -AC_ARG_ENABLE([atomic-refcount], - [AS_HELP_STRING([--enable-atomic-refcount], - [use atomic operations for internal reference counting. This is required for thread-safe behavior but does not by itself make Octave internals thread safe.])], - [if test "$enableval" = yes; then USE_ATOMIC_REFCOUNT=yes; fi], []) -if test $USE_ATOMIC_REFCOUNT = yes; then - AC_DEFINE(USE_ATOMIC_REFCOUNT, 1, - [Define to 1 to use atomic operations for reference counting.]) -fi + USE_ATOMIC_REFCOUNT=no + AC_ARG_ENABLE([atomic-refcount], + [AS_HELP_STRING([--enable-atomic-refcount], + [use atomic operations for internal reference counting. This is required for thread-safe behavior but does not by itself make Octave internals thread safe.])], + [if test "$enableval" = yes; then USE_ATOMIC_REFCOUNT=yes; fi], []) + if test $USE_ATOMIC_REFCOUNT = yes; then +AC_DEFINE(USE_ATOMIC_REFCOUNT, 1, + [Define to 1 to use atomic operations for reference counting.]) + fi ### Disable running Make in the doc directory. ### This is useful, for example, when building Octave on systems without TeX. -DOCDIR=doc -AC_ARG_ENABLE([docs], - [AS_HELP_STRING([--disable-docs], [don't build documentation files])], - [if test "$enableval" = no; then - DOCDIR= - warn_docs="building documentation disabled; make dist will fail" - OCTAVE_CONFIGURE_WARNING([warn_docs]) - fi], - []) + DOCDIR=doc + AC_ARG_ENABLE([docs], + [AS_HELP_STRING([--disable-docs], [don't build documentation files])], + [if test "$enableval" = no; then + DOCDIR= + warn_docs="building documentation disabled; make dist will fail" + OCTAVE_CONFIGURE_WARNING([warn_docs]) + fi], + []) AC_SUBST(DOCDIR) ### If possible, use a 64-bit integer type for array dimensions and indexing. -USE_64_BIT_IDX_T=no -OCTAVE_IDX_TYPE=int -AC_ARG_ENABLE(64, - [AS_HELP_STRING([--enable-64], - [(EXPERIMENTAL) use 64-bit integers for array dimensions and indexing])], - [if test "$enableval" = yes; then USE_64_BIT_IDX_T=yes; fi], []) -if test $USE_64_BIT_IDX_T = yes; then - AC_CHECK_SIZEOF([void *]) - AC_CHECK_SIZEOF([int]) - AC_CHECK_SIZEOF([long]) - AC_CHECK_SIZEOF([int64_t]) - if test $ac_cv_sizeof_void_p -eq 8; then - OCTAVE_IDX_TYPE=int64_t - else - warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features" - OCTAVE_CONFIGURE_WARNING([warn_64_bit]) - USE_64_BIT_IDX_T=no - fi -fi -AC_SUBST(OCTAVE_IDX_TYPE) + USE_64_BIT_IDX_T=no + OCTAVE_IDX_TYPE=int + AC_ARG_ENABLE(64, + [AS_HELP_STRING([--enable-64], + [(EXPERIMENTAL) use 64-bit integers for array dimensions and indexing])], + [if test "$enableval" = yes; then USE_64_BIT_IDX_T=yes; fi], []) + if test $USE_64_BIT_IDX_T = yes; then + AC_CHECK_SIZEOF([void *]) + AC_CHECK_SIZEOF([int]) + AC_CHECK_SIZEOF([long]) +AC_CHECK_SIZEOF([int64_t]) + if test $ac_cv_sizeof_void_p -eq 8; then + OCTAVE_IDX_TYPE=int64_t + else + warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features" +OCTAVE_CONFIGURE_WARNING([warn_64_bit]) + USE_64_BIT_IDX_T=no + fi + fi + AC_SUBST(OCTAVE_IDX_TYPE) AC_DEFINE_UNQUOTED(OCTAVE_IDX_TYPE, [$OCTAVE_IDX_TYPE], - [Define to the type of octave_idx_type (64 or 32 bit signed integer).]) -if test $USE_64_BIT_IDX_T = yes; then - AC_DEFINE(USE_64_BIT_IDX_T, 1, - [Define to 1 if using 64-bit integers for array dimensions and indexing.]) -fi + [Define to the type of octave_idx_type (64 or 32 bit signed integer).]) + if test $USE_64_BIT_IDX_T = yes; then +AC_DEFINE(USE_64_BIT_IDX_T, 1, + [Define to 1 if using 64-bit integers for array dimensions and indexing.]) + fi AC_SUBST(USE_64_BIT_IDX_T) ### It seems that there are some broken inline assembly functions in ### the GNU libc. Since I'm not sure how to test whether we are using ### GNU libc, just disable them for all platforms. -AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function]) + AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function]) AC_DEFINE(__NO_MATH_INLINES, 1, - [Define to 1 if your version of GNU libc has buggy inline assembly code for math functions like exp.]) + [Define to 1 if your version of GNU libc has buggy inline assembly code for math functions like exp.]) ### Determine which C++ compiler to use (we expect to find g++). -AC_PROG_CXX -AC_PROG_CXXCPP + AC_PROG_CXX + AC_PROG_CXXCPP ### Check version number when using g++. -GXX_VERSION= -if test "$GXX" = yes; then - gxx_version=`$CXX -v 2>&1 | grep "^.*g.. version" | \ - sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'` - - AX_COMPARE_VERSION([$gxx_version], [lt], [3.5], - [AC_MSG_ERROR([g++ version $gxx_version will probably fail to compile Octave])]) - - GXX_VERSION=$gxx_version -fi + GXX_VERSION= + if test "$GXX" = yes; then + gxx_version=`$CXX -v 2>&1 | grep "^.*g.. version" | \ + sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'` + +AX_COMPARE_VERSION([$gxx_version], [lt], [3.5], + [AC_MSG_ERROR([g++ version $gxx_version will probably fail to compile Octave])]) + + GXX_VERSION=$gxx_version + fi AC_SUBST(GXX_VERSION) ## FIXME: CXX_VERSION is deprecated and should be removed in Octave version 3.12 -CXX_VERSION=$gxx_version + CXX_VERSION=$gxx_version AC_SUBST(CXX_VERSION) ### Determine which C compiler to use (we expect to find gcc). -AC_PROG_CC -AC_PROG_CPP -AC_PROG_GCC_TRADITIONAL + AC_PROG_CC + AC_PROG_CPP + AC_PROG_GCC_TRADITIONAL ## Check for MSVC -have_msvc=no -case $host_os in - msdosmsvc) - have_msvc=yes - ;; - mingw*) - AC_MSG_CHECKING([for MSVC compiler]) - AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ - #ifndef _MSC_VER - #error "Not MSVC compiler" - #endif - ]])], - have_msvc=yes, have_msvc=no) - AC_MSG_RESULT([$have_msvc]) - ;; -esac + have_msvc=no + case $host_os in + msdosmsvc) + have_msvc=yes + ;; + mingw*) +AC_MSG_CHECKING([for MSVC compiler]) + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ +#ifndef _MSC_VER +#error "Not MSVC compiler" +#endif + ]])], + have_msvc=yes, have_msvc=no) +AC_MSG_RESULT([$have_msvc]) + ;; + esac ### gnulib initialization: part 1 ### Must take place immediately after a compiler is determined -gl_EARLY + gl_EARLY ### Check version number when using gcc. -GCC_VERSION= -if test "$GCC" = yes; then - gcc_version=`$CC -v 2>&1 | grep "^.*gcc version" | \ - sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'` - - AX_COMPARE_VERSION([$gcc_version], [lt], [3], - [warn_gcc_version="gcc version $gcc_version is likely to cause problems" - OCTAVE_CONFIGURE_WARNING([warn_gcc_version])]) - - GCC_VERSION=$gcc_version -fi + GCC_VERSION= + if test "$GCC" = yes; then + gcc_version=`$CC -v 2>&1 | grep "^.*gcc version" | \ + sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'` + + AX_COMPARE_VERSION([$gcc_version], [lt], [3], + [warn_gcc_version="gcc version $gcc_version is likely to cause problems" + OCTAVE_CONFIGURE_WARNING([warn_gcc_version])]) + + GCC_VERSION=$gcc_version + fi AC_SUBST(CC_VERSION) ## FIXME: CC_VERSION is deprecated and should be removed in Octave version 3.12 -CC_VERSION=$gcc_version + CC_VERSION=$gcc_version AC_SUBST(GCC_VERSION) ### Determine the compiler flag necessary to create dependencies ## Assume GCC. -INCLUDE_DEPS=yes -DEPEND_FLAGS="-M" -DEPEND_EXTRA_SED_PATTERN="" -if test "$GCC" != yes; then - case $canonical_host_type in - sparc-sun-solaris2* | i386-pc-solaris2*) - DEPEND_FLAGS="-xM1" - DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'" - ;; - *-*-msdosmsvc) - ;; - *-*-mingw*) - if test $have_msvc = no; then - INCLUDE_DEPS=no - fi - ;; - *) - INCLUDE_DEPS=no - ;; - esac -fi -AC_SUBST(INCLUDE_DEPS) -AC_SUBST(DEPEND_FLAGS) + INCLUDE_DEPS=yes + DEPEND_FLAGS="-M" + DEPEND_EXTRA_SED_PATTERN="" + if test "$GCC" != yes; then + case $canonical_host_type in + sparc-sun-solaris2* | i386-pc-solaris2*) + DEPEND_FLAGS="-xM1" + DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'" + ;; + *-*-msdosmsvc) + ;; + *-*-mingw*) + if test $have_msvc = no; then + INCLUDE_DEPS=no + fi + ;; + *) + INCLUDE_DEPS=no + ;; + esac + fi + AC_SUBST(INCLUDE_DEPS) + AC_SUBST(DEPEND_FLAGS) AC_SUBST(DEPEND_EXTRA_SED_PATTERN) ### Check for pthread library -AX_PTHREAD + AX_PTHREAD ## Include pthread libs and flags early in case other tests need them. ## They seem to be required for the OpenGL tests on Debian systems. -LIBS="$PTHREAD_LIBS $LIBS" -CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS" ### When compiling math for x87, problems may arise in some code comparing ### floating-point intermediate results. @@ -401,18 +401,18 @@ ### Thus, we provide a FLOAT_TRUNCATE macro that may be defined to "volatile" ### when compiling for x87 target, or left empty for modern SSE math, that ### doesn't suffer from this problem at all. -AC_ARG_ENABLE([float-truncate], - [AS_HELP_STRING([--enable-float-truncate], - [enables truncating intermediate FP results.])], - [if test "$enableval" = yes; then - ac_float_truncate=volatile - else - ac_float_truncate= - fi], - [ac_float_truncate=]) + AC_ARG_ENABLE([float-truncate], + [AS_HELP_STRING([--enable-float-truncate], + [enables truncating intermediate FP results.])], + [if test "$enableval" = yes; then + ac_float_truncate=volatile + else + ac_float_truncate= + fi], + [ac_float_truncate=]) AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, [$ac_float_truncate], - [Define to volatile if you need to truncate intermediate FP results.]) + [Define to volatile if you need to truncate intermediate FP results.]) ### Determine extra CFLAGS that may be necessary for Octave. @@ -421,349 +421,385 @@ ## ## On Alpha/OSF systems, we need -mieee. -ieee_fp_flag= -case $canonical_host_type in - i[[3456789]]86-*-*) - if test "$GCC" = yes; then - OCTAVE_CC_FLAG([-mieee-fp], [ - ieee_fp_flag=-mieee-fp - XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp" - AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])]) - fi - if test "$GXX" = yes; then - OCTAVE_CXX_FLAG([-mieee-fp], [ - ieee_fp_flag=-mieee-fp - XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp" - AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])]) - fi - ;; - alpha*-*-*) - if test "$GCC" = yes; then - OCTAVE_CC_FLAG([-mieee], [ - ieee_fp_flag=-mieee - XTRA_CFLAGS="$XTRA_CFLAGS -mieee" - AC_MSG_NOTICE([adding -mieee to XTRA_CFLAGS])]) - else - OCTAVE_CC_FLAG([-ieee], [ - ieee_fp_flag=-ieee - XTRA_CFLAGS="$XTRA_CFLAGS -ieee" - AC_MSG_NOTICE([adding -ieee to XTRA_CFLAGS])]) - fi - if test "$GXX" = yes; then - OCTAVE_CXX_FLAG([-mieee], [ - ieee_fp_flag=-mieee - XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee" - AC_MSG_NOTICE([adding -mieee to XTRA_CXXFLAGS])]) - else - OCTAVE_CXX_FLAG([-ieee], [ - ieee_fp_flag=-ieee - XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ieee" - AC_MSG_NOTICE([adding -ieee to XTRA_CXXFLAGS])]) - fi - ;; - *ibm-aix4*) - OCTAVE_CC_FLAG([-mminimal-toc], [ - XTRA_CFLAGS="$XTRA_CFLAGS -mminimal-toc"]) - - OCTAVE_CXX_FLAG([-mminimal-toc], [ - XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"]) - ;; -esac - -AC_SUBST(XTRA_CFLAGS) + ieee_fp_flag= + case $canonical_host_type in + i[[3456789]]86-*-*) + if test "$GCC" = yes; then + OCTAVE_CC_FLAG([-mieee-fp], [ + ieee_fp_flag=-mieee-fp + XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp" + AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])]) + fi + if test "$GXX" = yes; then + OCTAVE_CXX_FLAG([-mieee-fp], [ + ieee_fp_flag=-mieee-fp + XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp" + AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])]) + fi + ;; + alpha*-*-*) + if test "$GCC" = yes; then + OCTAVE_CC_FLAG([-mieee], [ + ieee_fp_flag=-mieee + XTRA_CFLAGS="$XTRA_CFLAGS -mieee" + AC_MSG_NOTICE([adding -mieee to XTRA_CFLAGS])]) + else + OCTAVE_CC_FLAG([-ieee], [ + ieee_fp_flag=-ieee + XTRA_CFLAGS="$XTRA_CFLAGS -ieee" + AC_MSG_NOTICE([adding -ieee to XTRA_CFLAGS])]) + fi + if test "$GXX" = yes; then + OCTAVE_CXX_FLAG([-mieee], [ + ieee_fp_flag=-mieee + XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee" + AC_MSG_NOTICE([adding -mieee to XTRA_CXXFLAGS])]) + else + OCTAVE_CXX_FLAG([-ieee], [ + ieee_fp_flag=-ieee + XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ieee" + AC_MSG_NOTICE([adding -ieee to XTRA_CXXFLAGS])]) + fi + ;; + *ibm-aix4*) + OCTAVE_CC_FLAG([-mminimal-toc], [ + XTRA_CFLAGS="$XTRA_CFLAGS -mminimal-toc"]) + + OCTAVE_CXX_FLAG([-mminimal-toc], [ + XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mminimal-toc"]) + ;; + esac + + AC_SUBST(XTRA_CFLAGS) AC_SUBST(XTRA_CXXFLAGS) ### Test whether the compiler supports OpenMP. This is experimental so disable ### it by default. Enable it with the flag --enable-openmp. -USE_OPENMP=no -AC_ARG_ENABLE([openmp], - [AS_HELP_STRING([--enable-openmp], - [(EXPERIMENTAL) use OpenMP SMP multi-threading])], - [if test "$enableval" = yes; then USE_OPENMP=yes; fi], []) -if test $USE_OPENMP = yes; then - case $host_os in - mingw* | cygwin* | *-gnu*) - OCTAVE_CHECK_OPENMP(-fopenmp) - ;; - msdosmsvc) - ## FIXME: is this the right flag for MSVC? - OCTAVE_CHECK_OPENMP(-openmp) - ;; - ## Add other compilers supporting OpenMP here - esac -fi + USE_OPENMP=no + AC_ARG_ENABLE([openmp], + [AS_HELP_STRING([--enable-openmp], + [(EXPERIMENTAL) use OpenMP SMP multi-threading])], + [if test "$enableval" = yes; then USE_OPENMP=yes; fi], []) + if test $USE_OPENMP = yes; then + case $host_os in + mingw* | cygwin* | *-gnu*) +OCTAVE_CHECK_OPENMP(-fopenmp) + ;; + msdosmsvc) +## FIXME: is this the right flag for MSVC? +OCTAVE_CHECK_OPENMP(-openmp) + ;; +## Add other compilers supporting OpenMP here + esac + fi ### Defaults for cross compiling. BUILD_CC and BUILD_CXX are ### the compilers that we use for building tools on the build system. ### For now, we assume that the only cross compiling we can do is ### with gcc on a Unixy system, but the dedicated hacker can override these. -if test "$cross_compiling" = yes; then - BUILD_CC="gcc" - BUILD_CFLAGS="-O2 -g" - BUILD_CXX="g++" - BUILD_CXXFLAGS="-O2 -g" - BUILD_LDFLAGS="" - BUILD_EXEEXT="" -else - BUILD_CC='$(CC)' - BUILD_CFLAGS='$(CFLAGS)' - BUILD_CXX='$(CXX)' - BUILD_CXXFLAGS='$(CXXFLAGS)' - BUILD_LDFLAGS='$(LDFLAGS)' - BUILD_EXEEXT='$(EXEEXT)' -fi + if test "$cross_compiling" = yes; then + BUILD_CC="gcc" + BUILD_CFLAGS="-O2 -g" + BUILD_CXX="g++" + BUILD_CXXFLAGS="-O2 -g" + BUILD_LDFLAGS="" + BUILD_EXEEXT="" + else + BUILD_CC='$(CC)' + BUILD_CFLAGS='$(CFLAGS)' + BUILD_CXX='$(CXX)' + BUILD_CXXFLAGS='$(CXXFLAGS)' + BUILD_LDFLAGS='$(LDFLAGS)' + BUILD_EXEEXT='$(EXEEXT)' + fi AC_ARG_VAR([BUILD_CC], - [build system C compiler (used if cross compiling)]) + [build system C compiler (used if cross compiling)]) AC_ARG_VAR([BUILD_CFLAGS], - [build system C compiler flags (used if cross compiling)]) + [build system C compiler flags (used if cross compiling)]) AC_ARG_VAR([BUILD_CXX], - [build system C++ compiler (used if cross compiling)]) + [build system C++ compiler (used if cross compiling)]) AC_ARG_VAR([BUILD_CXXFLAGS], - [build system C++ compiler flags (used if cross compiling)]) + [build system C++ compiler flags (used if cross compiling)]) AC_ARG_VAR([BUILD_LDFLAGS], - [build system C++ compiler link flags (used if cross compiling)]) + [build system C++ compiler link flags (used if cross compiling)]) AC_ARG_VAR([BUILD_EXEEXT], - [build system executable extension (used if cross compiling)]) + [build system executable extension (used if cross compiling)]) ### Look for math library. If found, this will add -lm to LIBS. -dnl Keep this check before the check for the Fortran compiler, -dnl in case -lm is needed to compile Fortran programs. + dnl Keep this check before the check for the Fortran compiler, + dnl in case -lm is needed to compile Fortran programs. AC_CHECK_LIB(m, sin) ### Determine the Fortran compiler and how to invoke it ## Default FFLAGS is -O. -if test x"$FFLAGS" = x""; then - FFLAGS="-O" -fi + if test x"$FFLAGS" = x""; then + FFLAGS="-O" + fi ## the F77 variable, if set, overrides AC_PROG_F77 automatically -AC_PROG_F77 -AC_F77_LIBRARY_LDFLAGS -AC_F77_DUMMY_MAIN -AC_F77_WRAPPERS - -F77_TOLOWER=yes -F77_APPEND_UNDERSCORE=yes -F77_APPEND_EXTRA_UNDERSCORE=yes - -case $ac_cv_f77_mangling in - "upper case") F77_TOLOWER=no ;; -esac -case $ac_cv_f77_mangling in - "no underscore") F77_APPEND_UNDERSCORE=no ;; -esac -case $ac_cv_f77_mangling in - "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;; -esac - -case $canonical_host_type in - i[[3456789]]86-*-*) - if test $ac_cv_f77_compiler_gnu = yes; then - OCTAVE_F77_FLAG([-mieee-fp]) - fi - ;; - alpha*-*-*) - if test $ac_cv_f77_compiler_gnu = yes; then - OCTAVE_F77_FLAG([-mieee]) - else - OCTAVE_F77_FLAG([-ieee]) - OCTAVE_F77_FLAG([-fpe1]) - fi - ;; - powerpc-apple-machten*) - FFLAGS= - ;; -esac - -if test -n "$FFLAGS"; then - AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS]) -fi - -AC_SUBST(F77_TOLOWER) -AC_SUBST(F77_APPEND_UNDERSCORE) + AC_PROG_F77 + AC_F77_LIBRARY_LDFLAGS + AC_F77_DUMMY_MAIN + AC_F77_WRAPPERS + + F77_TOLOWER=yes + F77_APPEND_UNDERSCORE=yes + F77_APPEND_EXTRA_UNDERSCORE=yes + + case $ac_cv_f77_mangling in + "upper case") F77_TOLOWER=no ;; + esac + case $ac_cv_f77_mangling in + "no underscore") F77_APPEND_UNDERSCORE=no ;; + esac + case $ac_cv_f77_mangling in + "no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;; + esac + + case $canonical_host_type in + i[[3456789]]86-*-*) + if test $ac_cv_f77_compiler_gnu = yes; then +OCTAVE_F77_FLAG([-mieee-fp]) + fi + ;; + alpha*-*-*) + if test $ac_cv_f77_compiler_gnu = yes; then +OCTAVE_F77_FLAG([-mieee]) + else + OCTAVE_F77_FLAG([-ieee]) +OCTAVE_F77_FLAG([-fpe1]) + fi + ;; + powerpc-apple-machten*) + FFLAGS= + ;; + esac + + if test -n "$FFLAGS"; then +AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS]) + fi + + AC_SUBST(F77_TOLOWER) + AC_SUBST(F77_APPEND_UNDERSCORE) AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE) -if test -z "$F77"; then - AC_MSG_ERROR([in order to build Octave, you must have a compatible Fortran compiler or wrapper script for f2c that functions as a Fortran compiler installed and in your path. See the file INSTALL for more information.]) -fi - -OCTAVE_CHECK_FUNC_FORTRAN_ISNAN -F77_ISNAN_MACRO= -if test $octave_cv_func_fortran_isnan = no; then - AC_MSG_NOTICE([substituting ISNAN(X) with X.NE.X in Fortran sources]) - F77_ISNAN_MACRO="s|ISNAN(\(@<:@^)@:>@*\))|(\1.NE.\1)|" -fi + if test -z "$F77"; then +AC_MSG_ERROR([in order to build Octave, you must have a compatible Fortran compiler or wrapper script for f2c that functions as a Fortran compiler installed and in your path. See the file INSTALL for more information.]) + fi + + OCTAVE_CHECK_FUNC_FORTRAN_ISNAN + F77_ISNAN_MACRO= + if test $octave_cv_func_fortran_isnan = no; then +AC_MSG_NOTICE([substituting ISNAN(X) with X.NE.X in Fortran sources]) + F77_ISNAN_MACRO="s|ISNAN(\(@<:@^)@:>@*\))|(\1.NE.\1)|" + fi AC_SUBST(F77_ISNAN_MACRO) -OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER -if test $octave_cv_sizeof_fortran_integer = no; then - if test $USE_64_BIT_IDX_T = yes; then - case $F77 in - *gfortran*) - case $F77_INTEGER_8_FLAG in - *-fdefault-integer-8*) - ;; - *) - case $FFLAGS in - *-fdefault-integer-8*) - AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS]) - FFLAGS=`echo $FFLAGS | sed 's/-fdefault-integer-8//g'` - F77_INTEGER_8_FLAG="-fdefault-integer-8" - ;; - *) - AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG]) - F77_INTEGER_8_FLAG="-fdefault-integer-8" - ## Invalidate the cache and try again. - $as_unset octave_cv_sizeof_fortran_integer - ;; - esac - ;; - esac - ;; - esac - if test -z "$octave_cv_sizeof_fortran_integer"; then - OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER - fi - if test $octave_cv_sizeof_fortran_integer = no; then - AC_MSG_ERROR([in order to build Octave with 64-bit indexing support your Fortran compiler must have an option for setting the default integer size to 8 bytes. See the file INSTALL for more information.]) - fi - else - AC_MSG_ERROR([your Fortran compiler must have an option to make integers the same size as octave_idx_type ($OCTAVE_IDX_TYPE). See the file INSTALL for more information.]) - fi -fi + OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER + if test $octave_cv_sizeof_fortran_integer = no; then + if test $USE_64_BIT_IDX_T = yes; then + case $F77 in + *gfortran*) + case $F77_INTEGER_8_FLAG in + *-fdefault-integer-8*) + ;; + *) + case $FFLAGS in + *-fdefault-integer-8*) +AC_MSG_NOTICE([setting -fdefault-integer-8 in F77_INTEGER_8_FLAG instead of FFLAGS]) + FFLAGS=`echo $FFLAGS | sed 's/-fdefault-integer-8//g'` + F77_INTEGER_8_FLAG="-fdefault-integer-8" + ;; + *) +AC_MSG_NOTICE([adding -fdefault-integer-8 to F77_INTEGER_8_FLAG]) + F77_INTEGER_8_FLAG="-fdefault-integer-8" +## Invalidate the cache and try again. + $as_unset octave_cv_sizeof_fortran_integer + ;; + esac + ;; + esac + ;; + esac + if test -z "$octave_cv_sizeof_fortran_integer"; then + OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER + fi + if test $octave_cv_sizeof_fortran_integer = no; then +AC_MSG_ERROR([in order to build Octave with 64-bit indexing support your Fortran compiler must have an option for setting the default integer size to 8 bytes. See the file INSTALL for more information.]) + fi + else +AC_MSG_ERROR([your Fortran compiler must have an option to make integers the same size as octave_idx_type ($OCTAVE_IDX_TYPE). See the file INSTALL for more information.]) + fi + fi AC_SUBST(F77_INTEGER_8_FLAG) ## FIXME: Is this really used? Makefile seems to use $F77 for compiler -FC=$F77 + FC=$F77 AC_SUBST(FC) -OCTAVE_F77_FLAG([-ffloat-store], [ - AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store]) - F77_FLOAT_STORE_FLAG=-ffloat-store - AC_SUBST(F77_FLOAT_STORE_FLAG) -]) + OCTAVE_F77_FLAG([-ffloat-store], [ + AC_MSG_RESULT([setting F77_FLOAT_STORE_FLAG to -ffloat-store]) + F77_FLOAT_STORE_FLAG=-ffloat-store + AC_SUBST(F77_FLOAT_STORE_FLAG) + ]) ### Check for the Qhull library -OCTAVE_CHECK_LIB(qhull, QHull, - [Qhull library not found -- this will result in loss of functionality of some geometry functions.], - [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h], - [qh_qhull], [], [], - [warn_qhull= - OCTAVE_CHECK_QHULL_VERSION - OCTAVE_CHECK_LIB_QHULL_OK( - [TEXINFO_QHULL="@set HAVE_QHULL" - AC_DEFINE(HAVE_QHULL, 1, [Define to 1 if Qhull is available.])], - [warn_qhull="Qhull library found, but does not seem to work properly -- this will result in loss of functionality of some geometry functions. Please try recompiling the library with -fno-strict-aliasing."])]) + OCTAVE_CHECK_LIB(qhull, QHull, + [Qhull library not found -- this will result in loss of functionality of some geometry functions.], + [libqhull/libqhull.h qhull/libqhull.h libqhull.h qhull/qhull.h qhull.h], + [qh_qhull], [], [], + [warn_qhull= + OCTAVE_CHECK_QHULL_VERSION + OCTAVE_CHECK_LIB_QHULL_OK( + [TEXINFO_QHULL="@set HAVE_QHULL" + AC_DEFINE(HAVE_QHULL, 1, [Define to 1 if Qhull is available.])], + [warn_qhull="Qhull library found, but does not seem to work properly -- this will result in loss of functionality of some geometry functions. Please try recompiling the library with -fno-strict-aliasing."])]) ### Check for PCRE regex library. -REGEX_LIBS= - -pcre_fail_msg="to build Octave, you must have the PCRE library and header files installed" + REGEX_LIBS= + + pcre_fail_msg="to build Octave, you must have the PCRE library and header files installed" AC_CHECK_HEADERS([pcre.h pcre/pcre.h]) -AC_CACHE_CHECK([whether pcre.h defines the macros we need], - [ac_cv_pcre_h_macros_present], - [AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [ - #if defined (HAVE_PCRE_H) - # include <pcre.h> - #elif defined (HAVE_PCRE_PCRE_H) - # include <pcre/pcre.h> - #error "NO PCRE HEADER" - #endif - #if defined (PCRE_INFO_NAMECOUNT) \ - && defined (PCRE_INFO_NAMEENTRYSIZE) \ - && defined (PCRE_INFO_NAMETABLE) - PCRE_HAS_MACROS_WE_NEED - #endif], - ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)]) - -if test $ac_cv_pcre_h_macros_present = yes; then - ## check for pcre-config, and if so, set XTRA_CXXFLAGS appropriately - AC_CHECK_PROG(HAVE_PCRE_CONFIG, pcre-config, [yes], [no]) - if test $HAVE_PCRE_CONFIG = yes; then - XTRA_CXXFLAGS="$XTRA_CXXFLAGS `pcre-config --cflags`" - REGEX_LIBS=`pcre-config --libs` - else - REGEX_LIBS="-lpcre" - fi - save_LIBS="$LIBS" - LIBS="$REGEX_LIBS $LIBS" - AC_CHECK_FUNCS([pcre_compile], - [AC_SUBST(REGEX_LIBS)], - [AC_MSG_ERROR([$pcre_fail_msg])]) - LIBS="$save_LIBS" -else - AC_MSG_ERROR([$pcre_fail_msg]) -fi + AC_CACHE_CHECK([whether pcre.h defines the macros we need], + [ac_cv_pcre_h_macros_present], + [AC_EGREP_CPP([PCRE_HAS_MACROS_WE_NEED], [ +#if defined (HAVE_PCRE_H) +# include <pcre.h> +#elif defined (HAVE_PCRE_PCRE_H) +# include <pcre/pcre.h> +#error "NO PCRE HEADER" +#endif +#if defined (PCRE_INFO_NAMECOUNT) \ + && defined (PCRE_INFO_NAMEENTRYSIZE) \ + && defined (PCRE_INFO_NAMETABLE) + PCRE_HAS_MACROS_WE_NEED +#endif], + ac_cv_pcre_h_macros_present=yes, ac_cv_pcre_h_macros_present=no)]) + + if test $ac_cv_pcre_h_macros_present = yes; then +## check for pcre-config, and if so, set XTRA_CXXFLAGS appropriately +AC_CHECK_PROG(HAVE_PCRE_CONFIG, pcre-config, [yes], [no]) + if test $HAVE_PCRE_CONFIG = yes; then + XTRA_CXXFLAGS="$XTRA_CXXFLAGS `pcre-config --cflags`" + REGEX_LIBS=`pcre-config --libs` + else + REGEX_LIBS="-lpcre" + fi + save_LIBS="$LIBS" + LIBS="$REGEX_LIBS $LIBS" +AC_CHECK_FUNCS([pcre_compile], + [AC_SUBST(REGEX_LIBS)], + [AC_MSG_ERROR([$pcre_fail_msg])]) + LIBS="$save_LIBS" + else +AC_MSG_ERROR([$pcre_fail_msg]) + fi ### Check for ZLIB library. OCTAVE_CHECK_LIB(z, ZLIB, - [ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.], - [zlib.h], [gzclearerr]) + [ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.], + [zlib.h], [gzclearerr]) ### Also define HAVE_ZLIB if libz is found. -if test $octave_cv_lib_z = yes; then - AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.]) -fi - - ### Check for the LLVM library - -build_jit=no -AC_ARG_ENABLE([jit], - [AS_HELP_STRING([--enable-jit], - [(EXPERIMENTAL) enable JIT compiler])], - [if test "$enableval" = yes; then - build_jit=yes - fi], - []) - -LLVM_CXXFLAGS= -LLVM_CPPFLAGS= -LLVM_LDFLAGS= -LLVM_LIBS= - -if test $build_jit = yes; then - - ## Find llvm-config program from environment variable or by searching - AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility]) - AC_CHECK_PROG([LLVM_CONFIG], llvm-config, llvm-config, []) - - if test -z "$LLVM_CONFIG"; then - warn_llvm="llvm-config utility not found. JIT compiler is disabled." - else - dnl Preset warning message in case compile fails - warn_llvm="LLVM was not found or is to old. JIT compiler is disabled." - - save_CPPFLAGS="$CPPFLAGS" - save_CXXFLAGS="$CXXFLAGS" + if test $octave_cv_lib_z = yes; then +AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.]) + fi + +### Check for LIBPNG library. + +OCTAVE_CHECK_LIB(png, PNG, + [LIBPNG library not found. Octave will not be able to save or load PNG image format files.], + [libpng/png.h], [png_init_io]) + +### Check if user have libpng library and define ENABLE_LATEX if this is true. + + + PKG_CHECK_MODULES([PNG],[libpng], + [AC_DEFINE(ENABLE_LATEX, 1, [Define to 1 if LIBPNG is available.])], + warn_png="png library not found. Latex interpreter will be disabled.") + + if test -n "$warn_png"; then +OCTAVE_CONFIGURE_WARNING([warn_png]) + fi + +### Check for the LLVM library + + build_jit=no + AC_ARG_ENABLE([jit], + [AS_HELP_STRING([--enable-jit], + [(EXPERIMENTAL) enable JIT compiler])], + [if test "$enableval" = yes; then + build_jit=yes + fi], + []) + + LLVM_CXXFLAGS= + LLVM_CPPFLAGS= + LLVM_LDFLAGS= + LLVM_LIBS= + + if test $build_jit = yes; then + +## Find llvm-config program from environment variable or by searching + AC_ARG_VAR([LLVM_CONFIG], [path to llvm-config utility]) +AC_CHECK_PROG([LLVM_CONFIG], llvm-config, llvm-config, []) + + if test -z "$LLVM_CONFIG"; then + warn_llvm="llvm-config utility not found. JIT compiler is disabled." + else + dnl Preset warning message in case compile fails + warn_llvm="LLVM was not found or is to old. JIT compiler is disabled." + + save_CPPFLAGS="$CPPFLAGS" + save_CXXFLAGS="$CXXFLAGS" save_LDFLAGS="$LDFLAGS" - ## Use -isystem if available because we don't want to see warnings in LLVM - LLVM_INCLUDE_FLAG=-I - OCTAVE_CC_FLAG([-isystem .], [ - LLVM_INCLUDE_FLAG=-isystem - AC_MSG_NOTICE([using -isystem for LLVM headers])]) - - dnl Use -isystem so we don't get warnings from llvm headers - LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`" - LLVM_CXXFLAGS= - LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`" +## Use -isystem if available because we don't want to see warnings in LLVM + LLVM_INCLUDE_FLAG=-I + OCTAVE_CC_FLAG([-isystem .], [ + LLVM_INCLUDE_FLAG=-isystem + AC_MSG_NOTICE([using -isystem for LLVM headers])]) + + dnl Use -isystem so we don't get warnings from llvm headers + LLVM_CPPFLAGS="$LLVM_INCLUDE_FLAG `$LLVM_CONFIG --includedir`" + LLVM_CXXFLAGS= + LLVM_LDFLAGS="-L`$LLVM_CONFIG --libdir`" LDFLAGS="$LDFLAGS $LLVM_LDFLAGS" LLVM_SO=LLVM-`$LLVM_CONFIG --version` AC_CHECK_LIB([$LLVM_SO], [LLVMBuildAdd], [LLVM_LIBS="-l$LLVM_SO"], [LLVM_LIBS=`$LLVM_CONFIG --libs`]) + dnl + dnl Define some extra flags that LLVM requires in order to include headers. + dnl Ideally we should get these from llvm-config, but llvm-config isn't + dnl very helpful. + dnl + CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS" + CXXFLAGS="$LLVM_CXXFLAGS $CXXFLAGS" +AC_LANG_PUSH(C++) + AC_CHECK_HEADER([llvm/Support/TargetSelect.h], [ + warn_llvm= + XTRA_CXXFLAGS="$XTRA_CXXFLAGS $LLVM_CXXFLAGS $LLVM_CPPFLAGS"]) + OCTAVE_LLVM_IRBUILDER_HEADER + OCTAVE_LLVM_DATALAYOUT_HEADER + OCTAVE_LLVM_FUNCTION_ADDATTRIBUTE_API + OCTAVE_LLVM_FUNCTION_ADDFNATTR_API + OCTAVE_LLVM_CALLINST_ADDATTRIBUTE_API +AC_LANG_POP(C++) + CPPFLAGS="$save_CPPFLAGS" + CXXFLAGS="$save_CXXFLAGS" dnl dnl Define some extra flags that LLVM requires in order to include headers. dnl Ideally we should get these from llvm-config, but llvm-config isn't @@ -802,1023 +838,1018 @@ CPPFLAGS="$save_CPPFLAGS" CXXFLAGS="$save_CXXFLAGS" LDFLAGS="$save_LDFLAGS" - fi - - if test -z "$warn_llvm"; then - AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.]) - else - build_jit=no - LLVM_CPPFLAGS= - LLVM_CXXFLAGS= - LLVM_LDFLAGS= - LLVM_LIBS= - OCTAVE_CONFIGURE_WARNING([warn_llvm]) - fi -dnl FIXME: Re-instate when JIT is enabled by default -dnl else -dnl ## JIT build disabled -dnl warn_llvm="JIT compiler disabled, some performance loss for loops" + fi + + if test -z "$warn_llvm"; then +AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.]) + else + build_jit=no + LLVM_CPPFLAGS= + LLVM_CXXFLAGS= + LLVM_LDFLAGS= + LLVM_LIBS= +OCTAVE_CONFIGURE_WARNING([warn_llvm]) + fi + dnl FIXME: Re-instate when JIT is enabled by default + dnl else + dnl ## JIT build disabled + dnl warn_llvm="JIT compiler disabled, some performance loss for loops" dnl OCTAVE_CONFIGURE_WARNING([warn_llvm]) -fi - -AC_SUBST(LLVM_CPPFLAGS) -AC_SUBST(LLVM_CXXFLAGS) -AC_SUBST(LLVM_LDFLAGS) + fi + + AC_SUBST(LLVM_CPPFLAGS) + AC_SUBST(LLVM_CXXFLAGS) + AC_SUBST(LLVM_LDFLAGS) AC_SUBST(LLVM_LIBS) ### Check for HDF5 library. -save_CPPFLAGS="$CPPFLAGS" -save_LIBS="$LIBS" -CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" -LIBS="$Z_LDFLAGS $Z_LIBS $LIBS" -OCTAVE_CHECK_LIB(hdf5, HDF5, - [HDF5 library not found. Octave will not be able to save or load HDF5 data files.], - [hdf5.h], [H5Gget_num_objs], [], [], - [warn_hdf5= - OCTAVE_CHECK_HDF5_HAS_VER_16_API - TEXINFO_HDF5="@set HAVE_HDF5" - AC_DEFINE(HAVE_HDF5, 1, - [Define to 1 if HDF5 is available and newer than version 1.6.]) - if test $have_msvc = yes; then - OCTAVE_CHECK_LIB_HDF5_DLL - fi - ]) -CPPFLAGS="$save_CPPFLAGS" -LIBS="$save_LIBS" + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" + LIBS="$Z_LDFLAGS $Z_LIBS $LIBS" + OCTAVE_CHECK_LIB(hdf5, HDF5, + [HDF5 library not found. Octave will not be able to save or load HDF5 data files.], + [hdf5.h], [H5Gget_num_objs], [], [], + [warn_hdf5= + OCTAVE_CHECK_HDF5_HAS_VER_16_API + TEXINFO_HDF5="@set HAVE_HDF5" + AC_DEFINE(HAVE_HDF5, 1, + [Define to 1 if HDF5 is available and newer than version 1.6.]) + if test $have_msvc = yes; then + OCTAVE_CHECK_LIB_HDF5_DLL + fi + ]) + CPPFLAGS="$save_CPPFLAGS" + LIBS="$save_LIBS" ### Check for FFTW library. Default to Fortran FFTPACK if it is not available. ## Check for FFTW header and library. OCTAVE_CHECK_LIB(fftw3, FFTW3, - [FFTW3 library not found. The slower FFTPACK library will be used instead.], - [fftw3.h], [fftw_plan_dft_1d]) + [FFTW3 library not found. The slower FFTPACK library will be used instead.], + [fftw3.h], [fftw_plan_dft_1d]) OCTAVE_CHECK_LIB(fftw3f, FFTW3F, - [FFTW3F library not found. The slower FFTPACK library will be used instead.], - [fftw3.h], [fftwf_plan_dft_1d]) + [FFTW3F library not found. The slower FFTPACK library will be used instead.], + [fftw3.h], [fftwf_plan_dft_1d]) ## Check for the multithreaded FFTW library. ## Fallback to singlethreaded if not found or disabled -build_fftw_threads=yes -AC_ARG_ENABLE([fftw-threads], - [AS_HELP_STRING([--disable-fftw-threads], - [disable Multi-threaded FFTW])], - [if test "$enableval" = no; then - build_fftw_threads=no - fi], - []) - -if test $build_fftw_threads = yes; then - OCTAVE_CHECK_FFTW_THREADS(fftw3, fftw_plan_with_nthreads) - OCTAVE_CHECK_FFTW_THREADS(fftw3f, fftwf_plan_with_nthreads) -fi + build_fftw_threads=yes + AC_ARG_ENABLE([fftw-threads], + [AS_HELP_STRING([--disable-fftw-threads], + [disable Multi-threaded FFTW])], + [if test "$enableval" = no; then + build_fftw_threads=no + fi], + []) + + if test $build_fftw_threads = yes; then + OCTAVE_CHECK_FFTW_THREADS(fftw3, fftw_plan_with_nthreads) +OCTAVE_CHECK_FFTW_THREADS(fftw3f, fftwf_plan_with_nthreads) + fi ## Octave is currently unable to use FFTW unless both float ## and double versions are available. -AM_CONDITIONAL([AMCOND_HAVE_FFTW], - [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"]) - -if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then - AC_DEFINE(HAVE_FFTW, 1, [Define if you have both FFTW3 and FFTW3F libraries.]) -fi + AM_CONDITIONAL([AMCOND_HAVE_FFTW], + [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"]) + + if test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"; then +AC_DEFINE(HAVE_FFTW, 1, [Define if you have both FFTW3 and FFTW3F libraries.]) + fi ## Subdirectory of liboctave/cruft to build if FFTW is not found. -FFT_DIR="fftpack" + FFT_DIR="fftpack" AC_SUBST(FFT_DIR) ### Check for GLPK library and header. -save_CPPFLAGS="$CPPFLAGS" -save_LIBS="$LIBS" -CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" -LIBS="$Z_LDFLAGS $Z_LIBS $LIBS" + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" + LIBS="$Z_LDFLAGS $Z_LIBS $LIBS" OCTAVE_CHECK_LIB(glpk, GLPK, - [GLPK library not found. The glpk function for solving linear programs will be disabled.], - [glpk/glpk.h glpk.h], [glp_simplex], [], [], - [warn_glpk= - OCTAVE_CHECK_LIB_GLPK_OK( - [TEXINFO_GLPK="@set HAVE_GLPK" - AC_DEFINE(HAVE_GLPK, 1, [Define to 1 if GLPK is available.])], - [warn_glpk="GLPK library found, but does not seem to work properly -- disabling glpk function"])]) -LIBS="$save_LIBS" -CPPFLAGS="$save_CPPFLAGS" + [GLPK library not found. The glpk function for solving linear programs will be disabled.], + [glpk/glpk.h glpk.h], [_glp_lpx_simplex]) + LIBS="$save_LIBS" + CPPFLAGS="$save_CPPFLAGS" ### Checks for cURL header and library. -save_CPPFLAGS="$CPPFLAGS" -save_LIBS="$LIBS" -CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" -LIBS="$Z_LDFLAGS $Z_LIBS $LIBS" + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" + LIBS="$Z_LDFLAGS $Z_LIBS $LIBS" OCTAVE_CHECK_LIB(curl, cURL, - [cURL library not found. The ftp objects, urlread and urlwrite functions will be disabled.], - [curl/curl.h], [curl_easy_escape]) -if test -z "$warn_curl"; then - ## Additional check on cURL library that was found - AC_CACHE_CHECK([for CURLOPT_DIRLISTONLY in curl/curl.h], - [octave_cv_curl_has_curlopt_dirlistonly], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <curl/curl.h> - ]], [[ - curl_easy_setopt ((CURL*)NULL, CURLOPT_DIRLISTONLY, 0); - ]])], - [octave_cv_curl_has_curlopt_dirlistonly=yes], - [octave_cv_curl_has_curlopt_dirlistonly=no]) - ]) - if test $octave_cv_curl_has_curlopt_dirlistonly = no; then - AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY, - [Define to the legacy option name if using an older version of cURL.]) - fi -fi -LIBS="$save_LIBS" -CPPFLAGS="$save_CPPFLAGS" + [cURL library not found. The ftp objects, urlread and urlwrite functions will be disabled.], + [curl/curl.h], [curl_easy_escape]) + if test -z "$warn_curl"; then +## Additional check on cURL library that was found + AC_CACHE_CHECK([for CURLOPT_DIRLISTONLY in curl/curl.h], + [octave_cv_curl_has_curlopt_dirlistonly], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <curl/curl.h> + ]], [[ + curl_easy_setopt ((CURL*)NULL, CURLOPT_DIRLISTONLY, 0); + ]])], + [octave_cv_curl_has_curlopt_dirlistonly=yes], + [octave_cv_curl_has_curlopt_dirlistonly=no]) + ]) + if test $octave_cv_curl_has_curlopt_dirlistonly = no; then +AC_DEFINE(CURLOPT_DIRLISTONLY, CURLOPT_FTPLISTONLY, + [Define to the legacy option name if using an older version of cURL.]) + fi + fi + LIBS="$save_LIBS" + CPPFLAGS="$save_CPPFLAGS" ### Check for either of Graphics/ImageMagick++ libraries -AC_ARG_WITH([magick], - [AS_HELP_STRING([--with-magick=LIB], - [select library to use for image I/O (options: GraphicsMagick(default) or ImageMagick)])], - [magick="$withval"], - [magick="GraphicsMagick"]) - -warn_magick="$magick++ library not found. The imread function for reading image files will not be fully functional." - -MAGICK_CPPFLAGS= -MAGICK_LDFLAGS= -MAGICK_LIBS= - -PKG_CHECK_EXISTS([$magick++], [ - ## Make sure we only get -I, -L, and -l flags. Some Graphics/ImageMagick++ - ## packages add extra flags that are useful when building - ## Graphics/ImageMagick++ extentions. These extra flags break the - ## Octave build. - MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++` - MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++` - MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++` - - warn_magick="$magick++ library fails tests. The imread function for reading image files will not be fully functional." - - save_CPPFLAGS="$CPPFLAGS" - save_LIBS="$LIBS" - CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS" - LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS" - AC_LANG_PUSH(C++) - AC_CHECK_HEADER([Magick++.h], [ - AC_CACHE_CHECK([for Magick::ColorRGB in Magick++.h], - [octave_cv_func_magick_colorrgb], - [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ - #include <Magick++.h> - ]], [[ - Magick::ColorRGB c; - ]])], - octave_cv_func_magick_colorrgb=yes, - octave_cv_func_magick_colorrgb=no) - ]) - if test $octave_cv_func_magick_colorrgb = yes; then - warn_magick= - fi - ]) - AC_LANG_POP(C++) - CPPFLAGS="$save_CPPFLAGS" - LIBS="$save_LIBS" - - AC_CHECK_FUNCS([setlocale], [], - [warn_magick="$magick++ requires setlocale function. The imread function for reading image files will not be fully functional."]) -]) - -if test -z "$warn_magick"; then - AC_DEFINE(HAVE_MAGICK, 1, - [Define to 1 if Graphics/ImageMagick++ is available.]) -else - MAGICK_CPPFLAGS= - MAGICK_LDFLAGS= - MAGICK_LIBS= -fi -AC_SUBST(MAGICK_CPPFLAGS) -AC_SUBST(MAGICK_LDFLAGS) + AC_ARG_WITH([magick], + [AS_HELP_STRING([--with-magick=LIB], + [select library to use for image I/O (options: GraphicsMagick(default) or ImageMagick)])], + [magick="$withval"], + [magick="GraphicsMagick"]) + + warn_magick="$magick++ library not found. The imread function for reading image files will not be fully functional." + + MAGICK_CPPFLAGS= + MAGICK_LDFLAGS= + MAGICK_LIBS= + + PKG_CHECK_EXISTS([$magick++], [ +## Make sure we only get -I, -L, and -l flags. Some Graphics/ImageMagick++ +## packages add extra flags that are useful when building +## Graphics/ImageMagick++ extentions. These extra flags break the +## Octave build. + MAGICK_LDFLAGS=`$PKG_CONFIG --libs-only-L $magick++` + MAGICK_LIBS=`$PKG_CONFIG --libs-only-l $magick++` + MAGICK_CPPFLAGS=`$PKG_CONFIG --cflags-only-I $magick++` + + warn_magick="$magick++ library fails tests. The imread function for reading image files will not be fully functional." + + save_CPPFLAGS="$CPPFLAGS" + save_LIBS="$LIBS" + CPPFLAGS="$MAGICK_CPPFLAGS $CPPFLAGS" + LIBS="$MAGICK_LDFLAGS $MAGICK_LIBS $LIBS" + AC_LANG_PUSH(C++) + AC_CHECK_HEADER([Magick++.h], [ + AC_CACHE_CHECK([for Magick::ColorRGB in Magick++.h], + [octave_cv_func_magick_colorrgb], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ +#include <Magick++.h> + ]], [[ + Magick::ColorRGB c; + ]])], + octave_cv_func_magick_colorrgb=yes, + octave_cv_func_magick_colorrgb=no) + ]) + if test $octave_cv_func_magick_colorrgb = yes; then + warn_magick= + fi + ]) +AC_LANG_POP(C++) + CPPFLAGS="$save_CPPFLAGS" + LIBS="$save_LIBS" + + AC_CHECK_FUNCS([setlocale], [], + [warn_magick="$magick++ requires setlocale function. The imread function for reading image files will not be fully functional."]) + ]) + + if test -z "$warn_magick"; then +AC_DEFINE(HAVE_MAGICK, 1, + [Define to 1 if Graphics/ImageMagick++ is available.]) + else + MAGICK_CPPFLAGS= + MAGICK_LDFLAGS= + MAGICK_LIBS= + fi + AC_SUBST(MAGICK_CPPFLAGS) + AC_SUBST(MAGICK_LDFLAGS) AC_SUBST(MAGICK_LIBS) ### Check for X11 libraries -AC_PATH_X -if test "$have_x" = yes; then - AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you have X11.]) - - if test "$x_includes" != "NONE"; then - X11_INCFLAGS="$x_includes" - fi - AC_SUBST(X11_INCFLAGS) - - if test -z "$x_libraries"; then - AC_CHECK_LIB([X11], XrmInitialize, [X11_LIBS="-lX11"], [X11_LIBS=]) - elif test $x_libraries != "NONE"; then - AC_CHECK_LIB([X11], XrmInitialize, - [X11_LIBS="-L$x_libraries -lX11"], [X11_LIBS=], "-L$x_libraries") - fi - AC_SUBST(X11_LIBS) -fi + AC_PATH_X + if test "$have_x" = yes; then +AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you have X11.]) + + if test "$x_includes" != "NONE"; then + X11_INCFLAGS="$x_includes" + fi +AC_SUBST(X11_INCFLAGS) + + if test -z "$x_libraries"; then + AC_CHECK_LIB([X11], XrmInitialize, [X11_LIBS="-lX11"], [X11_LIBS=]) + elif test $x_libraries != "NONE"; then + AC_CHECK_LIB([X11], XrmInitialize, + [X11_LIBS="-L$x_libraries -lX11"], [X11_LIBS=], "-L$x_libraries") + fi +AC_SUBST(X11_LIBS) + fi ### Check for the Carbon framework on MacOSX systems OCTAVE_HAVE_FRAMEWORK([Carbon], - [[#include <Carbon/Carbon.h>]], [[CGMainDisplayID ()]], - [have_framework_carbon=yes], [have_framework_carbon=no]) -if test $have_framework_carbon = yes; then - AC_DEFINE(HAVE_FRAMEWORK_CARBON, 1, - [Define to 1 if framework CARBON is available.]) - CARBON_LIBS="-Wl,-framework -Wl,Carbon" - AC_MSG_NOTICE([adding -Wl,-framework -Wl,Carbon to CARBON_LIBS]) - AC_SUBST(CARBON_LIBS) -fi + [[#include <Carbon/Carbon.h>]], [[CGMainDisplayID ()]], + [have_framework_carbon=yes], [have_framework_carbon=no]) + if test $have_framework_carbon = yes; then +AC_DEFINE(HAVE_FRAMEWORK_CARBON, 1, + [Define to 1 if framework CARBON is available.]) + CARBON_LIBS="-Wl,-framework -Wl,Carbon" + AC_MSG_NOTICE([adding -Wl,-framework -Wl,Carbon to CARBON_LIBS]) +AC_SUBST(CARBON_LIBS) + fi ### Check for list of libraries needed for native graphics renderer. -native_graphics=yes -warn_freetype="" - -check_opengl=no -AC_ARG_WITH([opengl], - [AS_HELP_STRING([--without-opengl], - [don't use OpenGL libraries, disable native graphics])], - [if test x"$withval" = x"no"; then - native_graphics=no - warn_opengl="--without-opengl specified. Native graphics will be disabled." - OCTAVE_CONFIGURE_WARNING([warn_opengl]) - else - check_opengl=yes - fi], - [check_opengl=yes]) + native_graphics=yes + warn_freetype="" + + check_opengl=no + AC_ARG_WITH([opengl], + [AS_HELP_STRING([--without-opengl], + [don't use OpenGL libraries, disable native graphics])], + [if test x"$withval" = x"no"; then + native_graphics=no + warn_opengl="--without-opengl specified. Native graphics will be disabled." + OCTAVE_CONFIGURE_WARNING([warn_opengl]) + else + check_opengl=yes + fi], + [check_opengl=yes]) ## Check for OpenGL library -if test $check_opengl = yes; then - OCTAVE_CHECK_LIB_OPENGL -fi - -GRAPHICS_LIBS= -GRAPHICS_CFLAGS= - -if test -z "$OPENGL_LIBS"; then - if test $check_opengl = yes; then - native_graphics=no - warn_fltk_opengl="OpenGL libs (GL and GLU) not found. Native graphics will be disabled." - OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl]) - fi -fi - -if test -n "$OPENGL_LIBS"; then - AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.]) - - ## Check for FreeType 2 library - - PKG_CHECK_MODULES([FT2], [freetype2], [ - min_ft2_version=9.03 - AC_MSG_CHECKING([for FreeType -- version >= $min_ft2_version]) - $PKG_CONFIG freetype2 --atleast-version=$min_ft2_version - ac_status=$? - if test $ac_status = 0; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have Freetype library.]) - XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FT2_CFLAGS" - save_LIBS="$LIBS" - LIBS="$FT2_LIBS $LIBS" - AC_CHECK_FUNCS([FT_Reference_Face]) - LIBS="$save_LIBS" - else - AC_MSG_RESULT(no) - warn_freetype="FreeType library not found. Native graphics will be disabled." - fi]) - - if test -n "$warn_freetype"; then - OCTAVE_CONFIGURE_WARNING([warn_freetype]) - native_graphics=no - fi - - ## Check for fontconfig library - - warn_fontconfig="" - if test -z "$warn_freetype"; then - PKG_CHECK_MODULES(FONTCONFIG, [fontconfig], - [have_fontconfig=yes - OPENGL_LIBS="$FONTCONFIG_LIBS $OPENGL_LIBS" - XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FONTCONFIG_CFLAGS" - AC_DEFINE(HAVE_FONTCONFIG, 1, [Define to 1 if fontconfig is present.])], - [have_fontconfig=no - warn_fontconfig="Fontconfig library not found. Native graphics will be disabled."]) - fi - - if test -n "$warn_fontconfig"; then - native_graphics=no - OCTAVE_CONFIGURE_WARNING([warn_fontconfig]) - fi - - ## Check for FLTK (www.fltk.org) library - - AC_ARG_WITH([fltk-prefix], [ - AS_HELP_STRING([--with-fltk-prefix=PFX], - [prefix where FLTK is installed (optional)])], - [fltk_prefix="$withval"], - [fltk_prefix=""]) - - AC_ARG_WITH([fltk-exec-prefix], [ - AS_HELP_STRING([--with-fltk-exec-prefix=PFX], - [exec prefix where FLTK is installed (optional)])], - [fltk_exec_prefix="$withval"], - [fltk_exec_prefix=""]) - - if test x"$fltk_exec_prefix" != x""; then - fltk_args="$fltk_args --exec-prefix=$fltk_exec_prefix" - if test "x${FLTK_CONFIG+set}" != xset ; then - FLTK_CONFIG="$fltk_exec_prefix/bin/fltk-config" - fi - fi - - if test x"$fltk_prefix" != x""; then - fltk_args="$fltk_args --prefix=$fltk_prefix" - if test x${FLTK_CONFIG+set} != xset ; then - FLTK_CONFIG="$fltk_prefix/bin/fltk-config" - fi - fi - - AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no]) - - warn_fltk_config="" - warn_fltk_opengl="" - - if test "$FLTK_CONFIG" = no; then - native_graphics=no - warn_fltk_config="FLTK config script not found. Native graphics will be disabled." - OCTAVE_CONFIGURE_WARNING([warn_fltk_config]) - else - FLTK_CFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --cflags` - FLTK_LDFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags` - - case $host_os in - mingw*) - FLTK_LDFLAGS=`echo $FLTK_LDFLAGS | sed -e 's/-mwindows//g'` - ;; - esac - - AC_CACHE_CHECK([for OpenGL support in FLTK], - [octave_cv_fltk_opengl_support], - [save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $FLTK_CFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <FL/gl.h> - ]], [[ - int nothing = 0; - ]])], - octave_cv_fltk_opengl_support=no, - octave_cv_fltk_opengl_support=yes) - CFLAGS="$save_CFLAGS" - ]) - if test $octave_cv_fltk_opengl_support = no; then - warn_fltk_opengl="FLTK does not have OpenGL support. Native graphics will be disabled." - else - AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.]) - fi - - if test -z "$warn_fltk_opengl"; then - GRAPHICS_CFLAGS="$FLTK_CFLAGS" - GRAPHICS_LIBS="$FLTK_LDFLAGS" - else - native_graphics=no - OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl]) - fi - fi -fi - -AC_SUBST(GRAPHICS_CFLAGS) + if test $check_opengl = yes; then + OCTAVE_CHECK_LIB_OPENGL + fi + + GRAPHICS_LIBS= + GRAPHICS_CFLAGS= + + if test -z "$OPENGL_LIBS"; then + if test $check_opengl = yes; then + native_graphics=no + warn_fltk_opengl="OpenGL libs (GL and GLU) not found. Native graphics will be disabled." +OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl]) + fi + fi + + if test -n "$OPENGL_LIBS"; then +AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.]) + +## Check for FreeType 2 library + + PKG_CHECK_MODULES([FT2], [freetype2], [ + min_ft2_version=9.03 + AC_MSG_CHECKING([for FreeType -- version >= $min_ft2_version]) + $PKG_CONFIG freetype2 --atleast-version=$min_ft2_version + ac_status=$? + if test $ac_status = 0; then + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have Freetype library.]) + XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FT2_CFLAGS" + save_LIBS="$LIBS" + LIBS="$FT2_LIBS $LIBS" + AC_CHECK_FUNCS([FT_Reference_Face]) + LIBS="$save_LIBS" + else + AC_MSG_RESULT(no) + warn_freetype="FreeType library not found. Native graphics will be disabled." + fi]) + + if test -n "$warn_freetype"; then +OCTAVE_CONFIGURE_WARNING([warn_freetype]) + native_graphics=no + fi + +## Check for fontconfig library + + warn_fontconfig="" + if test -z "$warn_freetype"; then + PKG_CHECK_MODULES(FONTCONFIG, [fontconfig], + [have_fontconfig=yes + OPENGL_LIBS="$FONTCONFIG_LIBS $OPENGL_LIBS" + XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FONTCONFIG_CFLAGS" + AC_DEFINE(HAVE_FONTCONFIG, 1, [Define to 1 if fontconfig is present.])], + [have_fontconfig=no + warn_fontconfig="Fontconfig library not found. Native graphics will be disabled."]) + fi + + if test -n "$warn_fontconfig"; then + native_graphics=no +OCTAVE_CONFIGURE_WARNING([warn_fontconfig]) + fi + +## Check for FLTK (www.fltk.org) library + + AC_ARG_WITH([fltk-prefix], [ + AS_HELP_STRING([--with-fltk-prefix=PFX], + [prefix where FLTK is installed (optional)])], + [fltk_prefix="$withval"], + [fltk_prefix=""]) + + AC_ARG_WITH([fltk-exec-prefix], [ + AS_HELP_STRING([--with-fltk-exec-prefix=PFX], + [exec prefix where FLTK is installed (optional)])], + [fltk_exec_prefix="$withval"], + [fltk_exec_prefix=""]) + + if test x"$fltk_exec_prefix" != x""; then + fltk_args="$fltk_args --exec-prefix=$fltk_exec_prefix" + if test "x${FLTK_CONFIG+set}" != xset ; then + FLTK_CONFIG="$fltk_exec_prefix/bin/fltk-config" + fi + fi + + if test x"$fltk_prefix" != x""; then + fltk_args="$fltk_args --prefix=$fltk_prefix" + if test x${FLTK_CONFIG+set} != xset ; then + FLTK_CONFIG="$fltk_prefix/bin/fltk-config" + fi + fi + +AC_PATH_PROG([FLTK_CONFIG], [fltk-config], [no]) + + warn_fltk_config="" + warn_fltk_opengl="" + + if test "$FLTK_CONFIG" = no; then + native_graphics=no + warn_fltk_config="FLTK config script not found. Native graphics will be disabled." +OCTAVE_CONFIGURE_WARNING([warn_fltk_config]) + else + FLTK_CFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --cflags` + FLTK_LDFLAGS=`$FLTK_CONFIG $fltkconf_args --use-gl --ldflags` + + case $host_os in + mingw*) + FLTK_LDFLAGS=`echo $FLTK_LDFLAGS | sed -e 's/-mwindows//g'` + ;; + esac + + AC_CACHE_CHECK([for OpenGL support in FLTK], + [octave_cv_fltk_opengl_support], + [save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $FLTK_CFLAGS" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <FL/gl.h> + ]], [[ + int nothing = 0; + ]])], + octave_cv_fltk_opengl_support=no, + octave_cv_fltk_opengl_support=yes) + CFLAGS="$save_CFLAGS" + ]) + if test $octave_cv_fltk_opengl_support = no; then + warn_fltk_opengl="FLTK does not have OpenGL support. Native graphics will be disabled." + else +AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.]) + fi + + if test -z "$warn_fltk_opengl"; then + GRAPHICS_CFLAGS="$FLTK_CFLAGS" + GRAPHICS_LIBS="$FLTK_LDFLAGS" + else + native_graphics=no +OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl]) + fi + fi + fi + + AC_SUBST(GRAPHICS_CFLAGS) AC_SUBST(GRAPHICS_LIBS) ### Start determination of shared vs. static libraries ## Use -static if compiling on Alpha OSF/1 1.3 systems. -case $canonical_host_type in - alpha*-dec-osf1.3) - LD_STATIC_FLAG=-static - ;; -esac -if test -n "$LD_STATIC_FLAG"; then - AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG]) -fi + case $canonical_host_type in + alpha*-dec-osf1.3) + LD_STATIC_FLAG=-static + ;; + esac + if test -n "$LD_STATIC_FLAG"; then +AC_MSG_NOTICE([defining LD_STATIC_FLAG to be $LD_STATIC_FLAG]) + fi AC_SUBST(LD_STATIC_FLAG) -OCTAVE_PROG_AR - -ifdef([LT_INIT], [], [ - errprint([error: you must have libtool 2.2.2 or a more recent version -]) - m4exit([1])]) - -LT_PREREQ([2.2.2]) + OCTAVE_PROG_AR + + ifdef([LT_INIT], [], [ + errprint([error: you must have libtool 2.2.2 or a more recent version + ]) + m4exit([1])]) + + LT_PREREQ([2.2.2]) LT_INIT([disable-static dlopen win32-dll]) -if test x"$enable_shared" = x"yes"; then - SHARED_LIBS=yes -else - SHARED_LIBS=no -fi - -if test x"$enable_static" = x"yes"; then - STATIC_LIBS=yes -else - STATIC_LIBS=no -fi - -XTRA_CRUFT_SH_LDFLAGS= -if test $have_msvc = yes; then - FLIBS="$FLIBS -lkernel32" - XTRA_CRUFT_SH_LDFLAGS="-Wl,-def:cruft/cruft.def" -fi + if test x"$enable_shared" = x"yes"; then + SHARED_LIBS=yes + else + SHARED_LIBS=no + fi + + if test x"$enable_static" = x"yes"; then + STATIC_LIBS=yes + else + STATIC_LIBS=no + fi + + XTRA_CRUFT_SH_LDFLAGS= + if test $have_msvc = yes; then + FLIBS="$FLIBS -lkernel32" + XTRA_CRUFT_SH_LDFLAGS="-Wl,-def:cruft/cruft.def" + fi AC_SUBST(XTRA_CRUFT_SH_LDFLAGS) ### Check for BLAS and LAPACK libraries: ## Need to adjust FFLAGS to include correct integer size. -save_FFLAGS="$FFLAGS" -FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" - -AX_BLAS_WITH_F77_FUNC([:], [:]) + save_FFLAGS="$FFLAGS" + FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" + + AX_BLAS_WITH_F77_FUNC([:], [:]) AX_LAPACK([:], [:]) ## Restore FFLAGS. -FFLAGS="$save_FFLAGS" + FFLAGS="$save_FFLAGS" ## If necessary, try again with -ff2c in FFLAGS -if test $ax_blas_f77_func_ok = no; then - save_FFLAGS="$FFLAGS" - FFLAGS="-ff2c $FFLAGS $F77_INTEGER_8_FLAG" - - AX_BLAS_WITH_F77_FUNC([:], [:]) - AX_LAPACK([:], [:]) - - ## Restore FFLAGS, with -ff2c if that was helpful - - if test $ax_blas_f77_func_ok = no; then - FFLAGS="$save_FFLAGS" - else - FFLAGS="-ff2c $save_FFLAGS" - fi -fi + if test $ax_blas_f77_func_ok = no; then + save_FFLAGS="$FFLAGS" + FFLAGS="-ff2c $FFLAGS $F77_INTEGER_8_FLAG" + + AX_BLAS_WITH_F77_FUNC([:], [:]) +AX_LAPACK([:], [:]) + +## Restore FFLAGS, with -ff2c if that was helpful + + if test $ax_blas_f77_func_ok = no; then + FFLAGS="$save_FFLAGS" + else + FFLAGS="-ff2c $save_FFLAGS" + fi + fi ## On OSX, try again with a wrapper library (without -ff2c!) -if test $ax_blas_f77_func_ok = no; then - case $host_os in - darwin*) - ## test if wrapper functions help - octave_blaswrap_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -DUSE_BLASWRAP" - AC_LANG_PUSH(C) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ - #include "liboctave/cruft/misc/blaswrap.c" - ]])], - [mv conftest.$ac_objext blaswrap.$ac_objext - octave_blaswrap_save_BLAS_LIBS="$BLAS_LIBS" - BLAS_LIBS="blaswrap.$ac_objext -framework vecLib" - - save_FFLAGS="$FFLAGS" - FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" - - AX_BLAS_WITH_F77_FUNC([:], [:]) - AX_LAPACK([:], [:]) - - ## Restore FFLAGS. - FFLAGS="$save_FFLAGS" - - ## remove temp file - rm -f blaswrap.$ac_objext], - [AC_MSG_FAILURE([cannot compile liboctave/cruft/misc/blaswrap.c])]) - AC_LANG_POP(C) - CFLAGS="$octave_blaswrap_save_CFLAGS" - - if test $ax_blas_f77_func_ok = no; then - BLAS_LIBS="$octave_blaswrap_save_BLAS_LIBS" - else - ## wrapper in cruft, remove from BLAS_LIBS - BLAS_LIBS=`echo $BLAS_LIBS | sed -e 's/blaswrap.[[^ ]]* //g'` - AC_DEFINE(USE_BLASWRAP, 1, - [Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).]) - fi - ;; - esac -fi - -if test $ax_blas_f77_func_ok = no; then - if test $USE_64_BIT_IDX_T = yes && test $ax_blas_integer_size_ok = no; then - ## Attempt to be more informative. - AC_MSG_ERROR([BLAS doesn't seem to support 64-bit integers. This is incompatible with --enable-64.]) - else - AC_MSG_ERROR([A BLAS library was detected but found incompatible with your Fortran 77 compiler settings.]) - fi -fi - -if test $ax_blas_ok = no || test $ax_lapack_ok = no; then - AC_MSG_ERROR([BLAS and LAPACK libraries are required]) -fi + if test $ax_blas_f77_func_ok = no; then + case $host_os in + darwin*) +## test if wrapper functions help + octave_blaswrap_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -DUSE_BLASWRAP" +AC_LANG_PUSH(C) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#include "liboctave/cruft/misc/blaswrap.c" + ]])], + [mv conftest.$ac_objext blaswrap.$ac_objext + octave_blaswrap_save_BLAS_LIBS="$BLAS_LIBS" + BLAS_LIBS="blaswrap.$ac_objext -framework vecLib" + + save_FFLAGS="$FFLAGS" + FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG" + + AX_BLAS_WITH_F77_FUNC([:], [:]) + AX_LAPACK([:], [:]) + +## Restore FFLAGS. + FFLAGS="$save_FFLAGS" + +## remove temp file + rm -f blaswrap.$ac_objext], + [AC_MSG_FAILURE([cannot compile liboctave/cruft/misc/blaswrap.c])]) +AC_LANG_POP(C) + CFLAGS="$octave_blaswrap_save_CFLAGS" + + if test $ax_blas_f77_func_ok = no; then + BLAS_LIBS="$octave_blaswrap_save_BLAS_LIBS" + else +## wrapper in cruft, remove from BLAS_LIBS + BLAS_LIBS=`echo $BLAS_LIBS | sed -e 's/blaswrap.[[^ ]]* //g'` +AC_DEFINE(USE_BLASWRAP, 1, + [Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).]) + fi + ;; + esac + fi + + if test $ax_blas_f77_func_ok = no; then + if test $USE_64_BIT_IDX_T = yes && test $ax_blas_integer_size_ok = no; then +## Attempt to be more informative. + AC_MSG_ERROR([BLAS doesn't seem to support 64-bit integers. This is incompatible with --enable-64.]) + else +AC_MSG_ERROR([A BLAS library was detected but found incompatible with your Fortran 77 compiler settings.]) + fi + fi + + if test $ax_blas_ok = no || test $ax_lapack_ok = no; then +AC_MSG_ERROR([BLAS and LAPACK libraries are required]) + fi ### Check for the qrupdate library ## No need to adjust FFLAGS because only link is attempted. ## Must supply proper LIBS, however. -save_LIBS="$LIBS" -LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS" -OCTAVE_CHECK_LIB(qrupdate, qrupdate, - [qrupdate not found. The QR & Cholesky updating functions will be slow.], - [], - [sqr1up], - [Fortran 77], [don't use qrupdate, disable QR & Cholesky updating functions]) - -if test $octave_cv_lib_qrupdate = yes; then - AC_CACHE_CHECK([for slup1up in $QRUPDATE_LIBS], - [octave_cv_func_slup1up], - [LIBS="$LIBS $QRUPDATE_LIBS" - AC_LANG_PUSH([Fortran 77]) - AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])], - octave_cv_func_slup1up=yes, octave_cv_func_slup1up=no) - AC_LANG_POP([Fortran 77]) - ]) - if test $octave_cv_func_slup1up = yes; then - AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.]) - fi -fi -LIBS="$save_LIBS" - -if test $USE_64_BIT_IDX_T = yes; then - CHOLMOD_TAG="_l_" - CXSPARSE_TAG="_dl_" - UMFPACK_TAG="_zl_" -else - CHOLMOD_TAG="_" - CXSPARSE_TAG="_di_" - UMFPACK_TAG="_zi_" -fi + save_LIBS="$LIBS" + LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS" + OCTAVE_CHECK_LIB(qrupdate, qrupdate, + [qrupdate not found. The QR & Cholesky updating functions will be slow.], + [], + [sqr1up], + [Fortran 77], [don't use qrupdate, disable QR & Cholesky updating functions]) + + if test $octave_cv_lib_qrupdate = yes; then + AC_CACHE_CHECK([for slup1up in $QRUPDATE_LIBS], + [octave_cv_func_slup1up], + [LIBS="$LIBS $QRUPDATE_LIBS" + AC_LANG_PUSH([Fortran 77]) + AC_LINK_IFELSE([AC_LANG_CALL([], [slup1up])], + octave_cv_func_slup1up=yes, octave_cv_func_slup1up=no) + AC_LANG_POP([Fortran 77]) + ]) + if test $octave_cv_func_slup1up = yes; then +AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.]) + fi + fi + LIBS="$save_LIBS" + + if test $USE_64_BIT_IDX_T = yes; then + CHOLMOD_TAG="_l_" + CXSPARSE_TAG="_dl_" + UMFPACK_TAG="_zl_" + else + CHOLMOD_TAG="_" + CXSPARSE_TAG="_di_" + UMFPACK_TAG="_zi_" + fi ### Check for AMD library -OCTAVE_CHECK_LIB(amd, AMD, - [AMD library not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h], - [amd_postorder], - [], [don't use AMD library, disable some sparse matrix functionality]) + OCTAVE_CHECK_LIB(amd, AMD, + [AMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/amd.h ufsparse/amd.h amd/amd.h amd.h], + [amd_postorder], + [], [don't use AMD library, disable some sparse matrix functionality]) ### Check for CAMD library -OCTAVE_CHECK_LIB(camd, CAMD, - [CAMD library not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/camd.h ufsparse/camd.h camd/camd.h camd.h], - [camd_postorder], - [], [don't use CAMD library, disable some sparse matrix functionality]) + OCTAVE_CHECK_LIB(camd, CAMD, + [CAMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/camd.h ufsparse/camd.h camd/camd.h camd.h], + [camd_postorder], + [], [don't use CAMD library, disable some sparse matrix functionality]) ### Check for COLAMD library -OCTAVE_CHECK_LIB(colamd, COLAMD, - [COLAMD library not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/colamd.h ufsparse/colamd.h colamd/colamd.h colamd.h], - [colamd], - [], [don't use COLAMD library, disable some sparse matrix functionality]) + OCTAVE_CHECK_LIB(colamd, COLAMD, + [COLAMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/colamd.h ufsparse/colamd.h colamd/colamd.h colamd.h], + [colamd], + [], [don't use COLAMD library, disable some sparse matrix functionality]) ### Check for CCOLAMD library -OCTAVE_CHECK_LIB(ccolamd, CCOLAMD, - [CCOLAMD library not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/ccolamd.h ufsparse/ccolamd.h ccolamd/ccolamd.h ccolamd.h], - [ccolamd], - [], [don't use CCOLAMD library, disable some sparse matrix functionality]) + OCTAVE_CHECK_LIB(ccolamd, CCOLAMD, + [CCOLAMD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/ccolamd.h ufsparse/ccolamd.h ccolamd/ccolamd.h ccolamd.h], + [ccolamd], + [], [don't use CCOLAMD library, disable some sparse matrix functionality]) ### Check for CHOLMOD library. ### If your cholmod library requires cblas, then you will need to ### configure with --with-cholmod="-lcholmod -lcblas". -save_LIBS="$LIBS" -LIBS="$COLAMD_LDFLAGS $COLAMD_LIBS $AMD_LDFLAGS $AMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS" -OCTAVE_CHECK_LIB(cholmod, CHOLMOD, - [CHOLMOD library not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h], - [cholmod${CHOLMOD_TAG}start], - [], [don't use CHOLMOD library, disable some sparse matrix functionality]) -LIBS="$save_LIBS" + save_LIBS="$LIBS" + LIBS="$COLAMD_LDFLAGS $COLAMD_LIBS $AMD_LDFLAGS $AMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS" + OCTAVE_CHECK_LIB(cholmod, CHOLMOD, + [CHOLMOD library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/cholmod.h ufsparse/cholmod.h cholmod/cholmod.h cholmod.h], + [cholmod${CHOLMOD_TAG}start], + [], [don't use CHOLMOD library, disable some sparse matrix functionality]) + LIBS="$save_LIBS" ### Check for CXSparse library -OCTAVE_CHECK_LIB(cxsparse, CXSparse, - [CXSparse library not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/cs.h ufsparse/cs.h cxsparse/cs.h cs.h], - [cs${CXSPARSE_TAG}sqr], - [C++], [don't use CXSparse library, disable some sparse matrix functionality]) + OCTAVE_CHECK_LIB(cxsparse, CXSparse, + [CXSparse library not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/cs.h ufsparse/cs.h cxsparse/cs.h cs.h], + [cs${CXSPARSE_TAG}sqr], + [C++], [don't use CXSparse library, disable some sparse matrix functionality]) ### Check for UMFPACK library. -save_LIBS="$LIBS" -save_CPPFLAGS="$CPPFLAGS" -LIBS="$AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS" -CPPFLAGS="$AMD_CPPFLAGS $CPPFLAGS" -OCTAVE_CHECK_LIB([umfpack], UMFPACK, - [UMFPACK not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h], - [umfpack${UMFPACK_TAG}get_determinant], - [], [don't use UMFPACK, disable some sparse matrix functionality]) -CPPFLAGS="$save_CPPFLAGS" -LIBS="$save_LIBS" - -if test -z "$UMFPACK_LIBS"; then - ## Invalidate the cache and try again with -lcblas. - $as_unset ac_cv_lib_umfpack_umfpack${UMFPACK_TAG}get_determinant - $as_unset octave_cv_lib_umfpack - save_LIBS="$LIBS" - LIBS="-lcblas $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS" - OCTAVE_CHECK_LIB([umfpack], UMFPACK, - [UMFPACK not found. This will result in some lack of functionality for sparse matrices.], - [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h], - [umfpack${UMFPACK_TAG}get_determinant], - [], [don't use UMFPACK, disable some sparse matrix functionality]) - if test -n "$UMFPACK_LIBS"; then - UMFPACK_LIBS="$UMFPACK_LIBS -lcblas" - fi - LIBS="$save_LIBS" -fi + save_LIBS="$LIBS" + save_CPPFLAGS="$CPPFLAGS" + LIBS="$AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS" + CPPFLAGS="$AMD_CPPFLAGS $CPPFLAGS" + OCTAVE_CHECK_LIB([umfpack], UMFPACK, + [UMFPACK not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h], + [umfpack${UMFPACK_TAG}get_determinant], + [], [don't use UMFPACK, disable some sparse matrix functionality]) + CPPFLAGS="$save_CPPFLAGS" + LIBS="$save_LIBS" + + if test -z "$UMFPACK_LIBS"; then +## Invalidate the cache and try again with -lcblas. + $as_unset ac_cv_lib_umfpack_umfpack${UMFPACK_TAG}get_determinant + $as_unset octave_cv_lib_umfpack + save_LIBS="$LIBS" + LIBS="-lcblas $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS" + OCTAVE_CHECK_LIB([umfpack], UMFPACK, + [UMFPACK not found. This will result in some lack of functionality for sparse matrices.], + [suitesparse/umfpack.h ufsparse/umfpack.h umfpack/umfpack.h umfpack.h], + [umfpack${UMFPACK_TAG}get_determinant], + [], [don't use UMFPACK, disable some sparse matrix functionality]) + if test -n "$UMFPACK_LIBS"; then + UMFPACK_LIBS="$UMFPACK_LIBS -lcblas" + fi + LIBS="$save_LIBS" + fi ## Test features of the installed UMFPACK library -if test -n "$UMFPACK_LIBS"; then - ## SuiteSparse >= 4.0 needs additional link library for SuiteSparse_time() - save_LIBS="$LIBS"; - LIBS="$UMFPACK_LIBS $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS" - xtra_libs= - OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME - if test $octave_cv_umfpack_need_suitesparse_time = yes; then - AC_CHECK_LIB([rt], [clock_gettime], [xtra_libs="-lrt"], [xtra_libs=]) - ## FIXME: This library list is only accurate for Linux, Mac OS X. - ## Possibly need other library names for MinGW, Cygwin. - AC_SEARCH_LIBS([SuiteSparse_time], - [suitesparseconfig SuiteSparse], - [], [], [$xtra_libs]) - case $ac_cv_search_SuiteSparse_time in - -l*) - UMFPACK_LIBS="$UMFPACK_LIBS $ac_cv_search_SuiteSparse_time" - ;; - no) - UMFPACK_LIBS= - AC_MSG_WARN([UMFPACK library found but is missing SuiteSparse_time functionality.]) - AC_MSG_WARN([UMFPACK library will be disabled.]) - ;; - esac - fi - LIBS="$save_LIBS" - - ## Check for UMFPACK separately split complex matrix and RHS. - if test -n "$UMFPACK_LIBS"; then - save_LIBS="$LIBS"; - LIBS="$UMFPACK_LIBS $CHOLMOD_LDFLAGS $CHOLMOD_LIBS $AMD_LDFLAGS $AMD_LIBS $COLAMD_LDFLAGS $COLAMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS $xtra_libs" - OCTAVE_UMFPACK_SEPARATE_SPLIT - LIBS="$save_LIBS" - fi -fi + if test -n "$UMFPACK_LIBS"; then +## SuiteSparse >= 4.0 needs additional link library for SuiteSparse_time() + save_LIBS="$LIBS"; + LIBS="$UMFPACK_LIBS $AMD_LDFLAGS $AMD_LIBS $BLAS_LIBS $FLIBS $LIBS" + xtra_libs= + OCTAVE_UMFPACK_NEED_SUITESPARSE_TIME + if test $octave_cv_umfpack_need_suitesparse_time = yes; then + AC_CHECK_LIB([rt], [clock_gettime], [xtra_libs="-lrt"], [xtra_libs=]) +## FIXME: This library list is only accurate for Linux, Mac OS X. +## Possibly need other library names for MinGW, Cygwin. +AC_SEARCH_LIBS([SuiteSparse_time], + [suitesparseconfig SuiteSparse], + [], [], [$xtra_libs]) + case $ac_cv_search_SuiteSparse_time in + -l*) + UMFPACK_LIBS="$UMFPACK_LIBS $ac_cv_search_SuiteSparse_time" + ;; + no) + UMFPACK_LIBS= + AC_MSG_WARN([UMFPACK library found but is missing SuiteSparse_time functionality.]) +AC_MSG_WARN([UMFPACK library will be disabled.]) + ;; + esac + fi + LIBS="$save_LIBS" + +## Check for UMFPACK separately split complex matrix and RHS. + if test -n "$UMFPACK_LIBS"; then + save_LIBS="$LIBS"; + LIBS="$UMFPACK_LIBS $CHOLMOD_LDFLAGS $CHOLMOD_LIBS $AMD_LDFLAGS $AMD_LIBS $COLAMD_LDFLAGS $COLAMD_LIBS $LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS $xtra_libs" + OCTAVE_UMFPACK_SEPARATE_SPLIT + LIBS="$save_LIBS" + fi + fi ### Check for ARPACK library. -save_LIBS="$LIBS" -LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS" -OCTAVE_CHECK_LIB([arpack], ARPACK, - [ARPACK not found. The eigs function will be disabled.], - [], - [dseupd], - [Fortran 77], [don't use the ARPACK library, disable eigs function], - [warn_arpack= - OCTAVE_CHECK_LIB_ARPACK_OK( - [AC_DEFINE(HAVE_ARPACK, 1, [Define to 1 if ARPACK is available.])], - [warn_arpack="ARPACK library found, but does not seem to work properly -- disabling eigs function"])]) -LIBS="$save_LIBS" + save_LIBS="$LIBS" + LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS" + OCTAVE_CHECK_LIB([arpack], ARPACK, + [ARPACK not found. The eigs function will be disabled.], + [], + [dseupd], + [Fortran 77], [don't use the ARPACK library, disable eigs function], + [warn_arpack= + OCTAVE_CHECK_LIB_ARPACK_OK( + [AC_DEFINE(HAVE_ARPACK, 1, [Define to 1 if ARPACK is available.])], + [warn_arpack="ARPACK library found, but does not seem to work properly -- disabling eigs function"])]) + LIBS="$save_LIBS" ### Check for readline library. -OCTAVE_ENABLE_READLINE + OCTAVE_ENABLE_READLINE ### Enable dynamic linking. --enable-shared implies this, so ### --enable-dl is only need if you are only building static libraries ### and want to try dynamic linking too (works on some systems, for ### example, OS X and Windows). -AC_ARG_ENABLE([dl], - [AS_HELP_STRING([--disable-dl], - [disable loading of dynamically linked modules])], - [case $enableval in - yes) ENABLE_DYNAMIC_LINKING=yes ;; - no) ENABLE_DYNAMIC_LINKING=no ;; - *) AC_MSG_ERROR([bad value $enableval for --enable-dl]) ;; - esac], - [ENABLE_DYNAMIC_LINKING=no]) - -if test $STATIC_LIBS = no && test $SHARED_LIBS = no; then - AC_MSG_ERROR([You can't disable building both static AND shared libraries!]) -fi - -CPICFLAG=-fPIC -CXXPICFLAG=-fPIC -FPICFLAG=-fPIC -SHLEXT=so -SHLLIB='$(SHLEXT)' -SHLBIN= -SHLEXT_VER='$(SHLEXT).$(version)' -SHLLIB_VER='$(SHLLIB).$(version)' -SHLBIN_VER='$(SHLBIN).$(version)' -SHLLINKEXT= -LIBPRE=lib -SHLPRE=lib -SHLLIBPRE=lib -SHLBINPRE=lib -SH_LD='$(CXX)' -SH_LDFLAGS=-shared -DL_LD='$(SH_LD)' -DL_LDFLAGS='$(SH_LDFLAGS)' -MKOCTFILE_DL_LDFLAGS='$(DL_LDFLAGS)' -SONAME_FLAGS= -NO_OCT_FILE_STRIP=false -TEMPLATE_AR='$(AR)' -TEMPLATE_ARFLAGS="$ARFLAGS" -CRUFT_DLL_DEFS= -OCTAVE_DLL_DEFS= -OCTINTERP_DLL_DEFS= -OCTGUI_DLL_DEFS= -OCTGRAPHICS_DLL_DEFS= -library_path_var=LD_LIBRARY_PATH -ldpreloadsep=" " -BUILD_COMPILED_AUX_PROGRAMS=no -case $canonical_host_type in - *-*-386bsd* | *-*-netbsd*) - SH_LD=ld - SH_LDFLAGS=-Bshareable - ;; - *-*-openbsd*) - SH_LDFLAGS='-shared -fPIC' - ;; - *-*-freebsd*) - SH_LDFLAGS="-shared -Wl,-x" - ;; - alpha*-dec-osf*) - CPICFLAG= - CXXPICFLAG= - FPICFLAG= - SH_LDFLAGS="-shared -Wl,-expect_unresolved -Wl,'*'" - ;; - *-*-darwin*) - DL_LDFLAGS='-bundle -bundle_loader $(top_builddir)/libinterp/octave $(LDFLAGS)' - MKOCTFILE_DL_LDFLAGS='-bundle -bundle_loader $$BINDIR/octave-$$OCTAVE_VERSION$$EXEEXT' - SH_LDFLAGS='-dynamiclib -single_module $(LDFLAGS)' - case $canonical_host_type in - powerpc-*) - CXXPICFLAG= - CPICFLAG= - FPICFLAG= - ;; - esac - SHLEXT=dylib - SHLLIB='$(SHLEXT)' - SHLEXT_VER='$(version).$(SHLEXT)' - SHLLIB_VER='$(version).$(SHLLIB)' - NO_OCT_FILE_STRIP=true - SONAME_FLAGS='-install_name $(octlibdir)/$@' - library_path_var=DYLD_LIBRARY_PATH - ;; - *-*-cygwin*) - CPICFLAG= - CXXPICFLAG= - FPICFLAG= - LIBPRE=lib - SHLPRE=cyg - SHLBINPRE=cyg - SHLEXT=dll - SHLLIB=dll.a - SHLBIN=dll - DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc" - SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" - SONAME_FLAGS='-Wl,--out-implib=$(patsubst $(SHLPRE)%,$(LIBPRE)%,$@).a' - ldpreloadsep=":" - ;; - *-*-mingw*) - BUILD_COMPILED_AUX_PROGRAMS=yes - if test $have_msvc = yes; then - DL_LDFLAGS="-shared" - CPICFLAG= - CXXPICFLAG= - FPICFLAG= - SHLEXT=dll - SHLLIB=lib - SHLBIN=dll - LIBPRE= - SHLPRE= - SHLLIBPRE= - SHLBINPRE= - SH_LDFLAGS="-shared" - if test -n "`echo $CFLAGS | grep -e '-g'`" || test -n "`echo $CXXFLAGS | grep -e '-g'`"; then - DL_LDFLAGS="$DL_LDFLAGS -g" - SH_LDFLAGS="$SH_LDFLAGS -g" - fi - NO_OCT_FILE_STRIP=true - library_path_var=PATH - ## Extra compilation flags. - CRUFT_DLL_DEFS="-DCRUFT_DLL" - OCTAVE_DLL_DEFS="-DOCTAVE_DLL" - OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL" - OCTGUI_DLL_DEFS="-DOCTGUI_DLL" - OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL" - else - CPICFLAG= - CXXPICFLAG= - FPICFLAG= - SHLEXT=dll - SHLLIB=dll.a - SHLBIN=dll - DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc" - SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" - SONAME_FLAGS='-Wl,--out-implib=$@.a' - library_path_var=PATH - fi - ;; - - *-*-msdosmsvc) - BUILD_COMPILED_AUX_PROGRAMS=yes - DL_LDFLAGS="-shared" - CPICFLAG= - CXXPICFLAG= - FPICFLAG= - SHLEXT=dll - SHLLIB=lib - SHLBIN=dll - LIBPRE= - SHLPRE= - SHLLIBPRE= - SHLBINPRE= - SH_LDFLAGS="-shared" - if test -n "`echo $CFLAGS | grep -e '-g'`" || test -n "`echo $CXXFLAGS | grep -e '-g'`"; then - DL_LDFLAGS="$DL_LDFLAGS -g" - SH_LDFLAGS="$SH_LDFLAGS -g" - fi - NO_OCT_FILE_STRIP=true - library_path_var=PATH - ## Extra compilation flags. - CRUFT_DLL_DEFS="-DCRUFT_DLL" - OCTAVE_DLL_DEFS="-DOCTAVE_DLL" - OCTGUI_DLL_DEFS="-DOCTGUI_DLL" - OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL" - ;; - *-*-linux* | *-*-gnu*) - MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic" - SONAME_FLAGS='-Wl,-soname -Wl,$@' - ;; - i[[3456]]86-*-sco3.2v5*) - SONAME_FLAGS='-Wl,-h -Wl,$@' - SH_LDFLAGS=-G - ;; - rs6000-ibm-aix* | powerpc-ibm-aix*) - CPICFLAG= - CXXPICFLAG= - FPICFLAG= - library_path_var=LIBPATH - ;; - hppa*-hp-hpux*) - if test $ac_cv_f77_compiler_gnu = yes; then - FPICFLAG=-fPIC - else - FPICFLAG=+Z - fi - SHLEXT=sl - SH_LDFLAGS="-shared -fPIC" - library_path_var=SHLIB_PATH - ;; - ia64*-hp-hpux*) - if test $ac_cv_f77_compiler_gnu = yes; then - FPICFLAG=-fPIC - else - FPICFLAG=+Z - fi - SH_LDFLAGS="-shared -fPIC" - ;; - *-sgi-*) - CPICFLAG= - CXXPICFLAG= - FPICFLAG= - ;; - sparc-sun-sunos4*) - if test $ac_cv_f77_compiler_gnu = yes; then - FPICFLAG=-fPIC - else - FPICFLAG=-PIC - fi - SH_LD=ld - SH_LDFLAGS="-assert nodefinitions" - ;; - sparc-sun-solaris2* | i386-pc-solaris2*) - if test $ac_cv_f77_compiler_gnu = yes; then - FPICFLAG=-fPIC - else - FPICFLAG=-KPIC - fi - if test "$GCC" = yes; then - CPICFLAG=-fPIC - else - CPICFLAG=-KPIC - fi - if test "$GXX" = yes; then - CXXPICFLAG=-fPIC - SH_LDFLAGS=-shared - else - CXXPICFLAG=-KPIC - SH_LDFLAGS=-G - fi - ## Template closures in archive libraries need a different mechanism. - if test "$GXX" != yes; then - TEMPLATE_AR='$(CXX)' - TEMPLATE_ARFLAGS="-xar -o" - fi - ;; -esac + AC_ARG_ENABLE([dl], + [AS_HELP_STRING([--disable-dl], + [disable loading of dynamically linked modules])], + [case $enableval in + yes) ENABLE_DYNAMIC_LINKING=yes ;; + no) ENABLE_DYNAMIC_LINKING=no ;; + *) AC_MSG_ERROR([bad value $enableval for --enable-dl]) ;; + esac], + [ENABLE_DYNAMIC_LINKING=no]) + + if test $STATIC_LIBS = no && test $SHARED_LIBS = no; then + AC_MSG_ERROR([You can't disable building both static AND shared libraries!]) + fi + + CPICFLAG=-fPIC + CXXPICFLAG=-fPIC + FPICFLAG=-fPIC + SHLEXT=so + SHLLIB='$(SHLEXT)' + SHLBIN= + SHLEXT_VER='$(SHLEXT).$(version)' + SHLLIB_VER='$(SHLLIB).$(version)' + SHLBIN_VER='$(SHLBIN).$(version)' + SHLLINKEXT= + LIBPRE=lib + SHLPRE=lib + SHLLIBPRE=lib + SHLBINPRE=lib + SH_LD='$(CXX)' + SH_LDFLAGS=-shared + DL_LD='$(SH_LD)' + DL_LDFLAGS='$(SH_LDFLAGS)' + MKOCTFILE_DL_LDFLAGS='$(DL_LDFLAGS)' + SONAME_FLAGS= + NO_OCT_FILE_STRIP=false + TEMPLATE_AR='$(AR)' + TEMPLATE_ARFLAGS="$ARFLAGS" + CRUFT_DLL_DEFS= + OCTAVE_DLL_DEFS= + OCTINTERP_DLL_DEFS= + OCTGUI_DLL_DEFS= + OCTGRAPHICS_DLL_DEFS= + library_path_var=LD_LIBRARY_PATH + ldpreloadsep=" " + BUILD_COMPILED_AUX_PROGRAMS=no + case $canonical_host_type in + *-*-386bsd* | *-*-netbsd*) + SH_LD=ld + SH_LDFLAGS=-Bshareable + ;; + *-*-openbsd*) + SH_LDFLAGS='-shared -fPIC' + ;; + *-*-freebsd*) + SH_LDFLAGS="-shared -Wl,-x" + ;; + alpha*-dec-osf*) + CPICFLAG= + CXXPICFLAG= + FPICFLAG= + SH_LDFLAGS="-shared -Wl,-expect_unresolved -Wl,'*'" + ;; + *-*-darwin*) + DL_LDFLAGS='-bundle -bundle_loader $(top_builddir)/libinterp/octave $(LDFLAGS)' + MKOCTFILE_DL_LDFLAGS='-bundle -bundle_loader $$BINDIR/octave-$$OCTAVE_VERSION$$EXEEXT' + SH_LDFLAGS='-dynamiclib -single_module $(LDFLAGS)' + case $canonical_host_type in + powerpc-*) + CXXPICFLAG= + CPICFLAG= + FPICFLAG= + ;; + esac + SHLEXT=dylib + SHLLIB='$(SHLEXT)' + SHLEXT_VER='$(version).$(SHLEXT)' + SHLLIB_VER='$(version).$(SHLLIB)' + NO_OCT_FILE_STRIP=true + SONAME_FLAGS='-install_name $(octlibdir)/$@' + library_path_var=DYLD_LIBRARY_PATH + ;; + *-*-cygwin*) + CPICFLAG= + CXXPICFLAG= + FPICFLAG= + LIBPRE=lib + SHLPRE=cyg + SHLBINPRE=cyg + SHLEXT=dll + SHLLIB=dll.a + SHLBIN=dll + DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc" + SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" + SONAME_FLAGS='-Wl,--out-implib=$(patsubst $(SHLPRE)%,$(LIBPRE)%,$@).a' + ldpreloadsep=":" + ;; + *-*-mingw*) + BUILD_COMPILED_AUX_PROGRAMS=yes + if test $have_msvc = yes; then + DL_LDFLAGS="-shared" + CPICFLAG= + CXXPICFLAG= + FPICFLAG= + SHLEXT=dll + SHLLIB=lib + SHLBIN=dll + LIBPRE= + SHLPRE= + SHLLIBPRE= + SHLBINPRE= + SH_LDFLAGS="-shared" + if test -n "`echo $CFLAGS | grep -e '-g'`" || test -n "`echo $CXXFLAGS | grep -e '-g'`"; then + DL_LDFLAGS="$DL_LDFLAGS -g" + SH_LDFLAGS="$SH_LDFLAGS -g" + fi + NO_OCT_FILE_STRIP=true + library_path_var=PATH +## Extra compilation flags. + CRUFT_DLL_DEFS="-DCRUFT_DLL" + OCTAVE_DLL_DEFS="-DOCTAVE_DLL" + OCTINTERP_DLL_DEFS="-DOCTINTERP_DLL" + OCTGUI_DLL_DEFS="-DOCTGUI_DLL" + OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL" + else + CPICFLAG= + CXXPICFLAG= + FPICFLAG= + SHLEXT=dll + SHLLIB=dll.a + SHLBIN=dll + DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc" + SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base" + SONAME_FLAGS='-Wl,--out-implib=$@.a' + library_path_var=PATH + fi + ;; + + *-*-msdosmsvc) + BUILD_COMPILED_AUX_PROGRAMS=yes + DL_LDFLAGS="-shared" + CPICFLAG= + CXXPICFLAG= + FPICFLAG= + SHLEXT=dll + SHLLIB=lib + SHLBIN=dll + LIBPRE= + SHLPRE= + SHLLIBPRE= + SHLBINPRE= + SH_LDFLAGS="-shared" + if test -n "`echo $CFLAGS | grep -e '-g'`" || test -n "`echo $CXXFLAGS | grep -e '-g'`"; then + DL_LDFLAGS="$DL_LDFLAGS -g" + SH_LDFLAGS="$SH_LDFLAGS -g" + fi + NO_OCT_FILE_STRIP=true + library_path_var=PATH +## Extra compilation flags. + CRUFT_DLL_DEFS="-DCRUFT_DLL" + OCTAVE_DLL_DEFS="-DOCTAVE_DLL" + OCTGUI_DLL_DEFS="-DOCTGUI_DLL" + OCTGRAPHICS_DLL_DEFS="-DOCTGRAPHICS_DLL" + ;; + *-*-linux* | *-*-gnu*) + MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic" + SONAME_FLAGS='-Wl,-soname -Wl,$@' + ;; + i[[3456]]86-*-sco3.2v5*) + SONAME_FLAGS='-Wl,-h -Wl,$@' + SH_LDFLAGS=-G + ;; + rs6000-ibm-aix* | powerpc-ibm-aix*) + CPICFLAG= + CXXPICFLAG= + FPICFLAG= + library_path_var=LIBPATH + ;; + hppa*-hp-hpux*) + if test $ac_cv_f77_compiler_gnu = yes; then + FPICFLAG=-fPIC + else + FPICFLAG=+Z + fi + SHLEXT=sl + SH_LDFLAGS="-shared -fPIC" + library_path_var=SHLIB_PATH + ;; + ia64*-hp-hpux*) + if test $ac_cv_f77_compiler_gnu = yes; then + FPICFLAG=-fPIC + else + FPICFLAG=+Z + fi + SH_LDFLAGS="-shared -fPIC" + ;; + *-sgi-*) + CPICFLAG= + CXXPICFLAG= + FPICFLAG= + ;; + sparc-sun-sunos4*) + if test $ac_cv_f77_compiler_gnu = yes; then + FPICFLAG=-fPIC + else + FPICFLAG=-PIC + fi + SH_LD=ld + SH_LDFLAGS="-assert nodefinitions" + ;; + sparc-sun-solaris2* | i386-pc-solaris2*) + if test $ac_cv_f77_compiler_gnu = yes; then + FPICFLAG=-fPIC + else + FPICFLAG=-KPIC + fi + if test "$GCC" = yes; then + CPICFLAG=-fPIC + else + CPICFLAG=-KPIC + fi + if test "$GXX" = yes; then + CXXPICFLAG=-fPIC + SH_LDFLAGS=-shared + else + CXXPICFLAG=-KPIC + SH_LDFLAGS=-G + fi +## Template closures in archive libraries need a different mechanism. + if test "$GXX" != yes; then + TEMPLATE_AR='$(CXX)' + TEMPLATE_ARFLAGS="-xar -o" + fi + ;; + esac AM_CONDITIONAL([AMCOND_BUILD_COMPILED_AUX_PROGRAMS], - [test $BUILD_COMPILED_AUX_PROGRAMS = yes]) - -AC_MSG_NOTICE([defining FPICFLAG to be $FPICFLAG]) -AC_MSG_NOTICE([defining CPICFLAG to be $CPICFLAG]) -AC_MSG_NOTICE([defining CXXPICFLAG to be $CXXPICFLAG]) -AC_MSG_NOTICE([defining SHLEXT to be $SHLEXT]) -AC_MSG_NOTICE([defining SHLLIB to be $SHLLIB]) -AC_MSG_NOTICE([defining SHLBIN to be $SHLBIN]) -AC_MSG_NOTICE([defining SHLEXT_VER to be $SHLEXT_VER]) -AC_MSG_NOTICE([defining SHLLIB_VER to be $SHLLIB_VER]) -AC_MSG_NOTICE([defining SHLBIN_VER to be $SHLBIN_VER]) -AC_MSG_NOTICE([defining SHLLINKEXT to be $SHLLINKEXT]) -AC_MSG_NOTICE([defining LIBPRE to be $LIBPRE]) -AC_MSG_NOTICE([defining SHLPRE to be $SHLPRE]) -AC_MSG_NOTICE([defining SHLLIBPRE to be $SHLLIBPRE]) -AC_MSG_NOTICE([defining SHLBINPRE to be $SHLBINPRE]) -AC_MSG_NOTICE([defining SH_LD to be $SH_LD]) -AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS]) -AC_MSG_NOTICE([defining DL_LD to be $DL_LD]) -AC_MSG_NOTICE([defining DL_LDFLAGS to be $DL_LDFLAGS]) -AC_MSG_NOTICE([defining MKOCTFILE_DL_LDFLAGS to be $MKOCTFILE_DL_LDFLAGS]) -AC_MSG_NOTICE([defining SONAME_FLAGS to be $SONAME_FLAGS]) -AC_MSG_NOTICE([defining NO_OCT_FILE_STRIP to be $NO_OCT_FILE_STRIP]) -AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR]) -AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS]) -AC_MSG_NOTICE([defining CRUFT_DLL_DEFS to be $CRUFT_DLL_DEFS]) -AC_MSG_NOTICE([defining OCTAVE_DLL_DEFS to be $OCTAVE_DLL_DEFS]) -AC_MSG_NOTICE([defining OCTINTERP_DLL_DEFS to be $OCTINTERP_DLL_DEFS]) -AC_MSG_NOTICE([defining OCTGUI_DLL_DEFS to be $OCTGUI_DLL_DEFS]) -AC_MSG_NOTICE([defining OCTGRAPHICS_DLL_DEFS to be $OCTGRAPHICS_DLL_DEFS]) -AC_MSG_NOTICE([defining library_path_var to be $library_path_var]) -AC_SUBST(FPICFLAG) -AC_SUBST(CPICFLAG) -AC_SUBST(CXXPICFLAG) -AC_SUBST(SHLEXT) -AC_SUBST(SHLLIB) -AC_SUBST(SHLBIN) -AC_SUBST(SHLEXT_VER) -AC_SUBST(SHLLIB_VER) -AC_SUBST(SHLBIN_VER) -AC_SUBST(SHLLINKEXT) -AC_SUBST(LIBPRE) -AC_SUBST(SHLPRE) -AC_SUBST(SHLLIBPRE) -AC_SUBST(SHLBINPRE) -AC_SUBST(SH_LD) -AC_SUBST(SH_LDFLAGS) -AC_SUBST(DL_LD) -AC_SUBST(DL_LDFLAGS) -AC_SUBST(MKOCTFILE_DL_LDFLAGS) -AC_SUBST(SONAME_FLAGS) -AC_SUBST(NO_OCT_FILE_STRIP) -AC_SUBST(TEMPLATE_AR) -AC_SUBST(TEMPLATE_ARFLAGS) -AC_SUBST(CRUFT_DLL_DEFS) -AC_SUBST(OCTAVE_DLL_DEFS) -AC_SUBST(OCTINTERP_DLL_DEFS) -AC_SUBST(OCTGUI_DLL_DEFS) -AC_SUBST(OCTGRAPHICS_DLL_DEFS) -AC_SUBST(library_path_var) + [test $BUILD_COMPILED_AUX_PROGRAMS = yes]) + + AC_MSG_NOTICE([defining FPICFLAG to be $FPICFLAG]) + AC_MSG_NOTICE([defining CPICFLAG to be $CPICFLAG]) + AC_MSG_NOTICE([defining CXXPICFLAG to be $CXXPICFLAG]) + AC_MSG_NOTICE([defining SHLEXT to be $SHLEXT]) + AC_MSG_NOTICE([defining SHLLIB to be $SHLLIB]) + AC_MSG_NOTICE([defining SHLBIN to be $SHLBIN]) + AC_MSG_NOTICE([defining SHLEXT_VER to be $SHLEXT_VER]) + AC_MSG_NOTICE([defining SHLLIB_VER to be $SHLLIB_VER]) + AC_MSG_NOTICE([defining SHLBIN_VER to be $SHLBIN_VER]) + AC_MSG_NOTICE([defining SHLLINKEXT to be $SHLLINKEXT]) + AC_MSG_NOTICE([defining LIBPRE to be $LIBPRE]) + AC_MSG_NOTICE([defining SHLPRE to be $SHLPRE]) + AC_MSG_NOTICE([defining SHLLIBPRE to be $SHLLIBPRE]) + AC_MSG_NOTICE([defining SHLBINPRE to be $SHLBINPRE]) + AC_MSG_NOTICE([defining SH_LD to be $SH_LD]) + AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS]) + AC_MSG_NOTICE([defining DL_LD to be $DL_LD]) + AC_MSG_NOTICE([defining DL_LDFLAGS to be $DL_LDFLAGS]) + AC_MSG_NOTICE([defining MKOCTFILE_DL_LDFLAGS to be $MKOCTFILE_DL_LDFLAGS]) + AC_MSG_NOTICE([defining SONAME_FLAGS to be $SONAME_FLAGS]) + AC_MSG_NOTICE([defining NO_OCT_FILE_STRIP to be $NO_OCT_FILE_STRIP]) + AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR]) + AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS]) + AC_MSG_NOTICE([defining CRUFT_DLL_DEFS to be $CRUFT_DLL_DEFS]) + AC_MSG_NOTICE([defining OCTAVE_DLL_DEFS to be $OCTAVE_DLL_DEFS]) + AC_MSG_NOTICE([defining OCTINTERP_DLL_DEFS to be $OCTINTERP_DLL_DEFS]) + AC_MSG_NOTICE([defining OCTGUI_DLL_DEFS to be $OCTGUI_DLL_DEFS]) + AC_MSG_NOTICE([defining OCTGRAPHICS_DLL_DEFS to be $OCTGRAPHICS_DLL_DEFS]) + AC_MSG_NOTICE([defining library_path_var to be $library_path_var]) + AC_SUBST(FPICFLAG) + AC_SUBST(CPICFLAG) + AC_SUBST(CXXPICFLAG) + AC_SUBST(SHLEXT) + AC_SUBST(SHLLIB) + AC_SUBST(SHLBIN) + AC_SUBST(SHLEXT_VER) + AC_SUBST(SHLLIB_VER) + AC_SUBST(SHLBIN_VER) + AC_SUBST(SHLLINKEXT) + AC_SUBST(LIBPRE) + AC_SUBST(SHLPRE) + AC_SUBST(SHLLIBPRE) + AC_SUBST(SHLBINPRE) + AC_SUBST(SH_LD) + AC_SUBST(SH_LDFLAGS) + AC_SUBST(DL_LD) + AC_SUBST(DL_LDFLAGS) + AC_SUBST(MKOCTFILE_DL_LDFLAGS) + AC_SUBST(SONAME_FLAGS) + AC_SUBST(NO_OCT_FILE_STRIP) + AC_SUBST(TEMPLATE_AR) + AC_SUBST(TEMPLATE_ARFLAGS) + AC_SUBST(CRUFT_DLL_DEFS) + AC_SUBST(OCTAVE_DLL_DEFS) + AC_SUBST(OCTINTERP_DLL_DEFS) + AC_SUBST(OCTGUI_DLL_DEFS) + AC_SUBST(OCTGRAPHICS_DLL_DEFS) + AC_SUBST(library_path_var) AC_SUBST(ldpreloadsep) ### More configure argument checking related to linking -AC_ARG_ENABLE([no-undefined], - [AS_HELP_STRING([--disable-no-undefined], - [don't pass -no-undefined to libtool when linking Octave and its shared libraries])], - [case $enableval in - yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;; - no) NO_UNDEFINED_LDFLAG="" ;; - *) AC_MSG_ERROR([bad value $enableval for --disable-no-undefined]) ;; - esac], - [NO_UNDEFINED_LDFLAG="-no-undefined"]) + AC_ARG_ENABLE([no-undefined], + [AS_HELP_STRING([--disable-no-undefined], + [don't pass -no-undefined to libtool when linking Octave and its shared libraries])], + [case $enableval in + yes) NO_UNDEFINED_LDFLAG="-no-undefined" ;; + no) NO_UNDEFINED_LDFLAG="" ;; + *) AC_MSG_ERROR([bad value $enableval for --disable-no-undefined]) ;; + esac], + [NO_UNDEFINED_LDFLAG="-no-undefined"]) AC_SUBST(NO_UNDEFINED_LDFLAG) -AC_ARG_ENABLE([link-all-dependencies], - [AS_HELP_STRING([--enable-link-all-dependencies], - [link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems)])], - [case $enableval in - yes) link_all_deps=yes ;; - no) link_all_deps=no ;; - *) AC_MSG_ERROR([bad value $enableval for --enable-link-all-depenencies]) - ;; - esac], - [link_all_deps=no]) + AC_ARG_ENABLE([link-all-dependencies], + [AS_HELP_STRING([--enable-link-all-dependencies], + [link Octave and its shared libraries with all dependencies, not just those immediately referenced (should not be needed on most systems)])], + [case $enableval in + yes) link_all_deps=yes ;; + no) link_all_deps=no ;; +*) AC_MSG_ERROR([bad value $enableval for --enable-link-all-depenencies]) + ;; + esac], + [link_all_deps=no]) AM_CONDITIONAL([AMCOND_LINK_ALL_DEPS], [test $link_all_deps = yes]) ## Dynamic linking is now enabled only if we are building shared @@ -1827,150 +1858,150 @@ ## FIXME: A lot of the following duplicates the functionality of ## code generated by the dlopen option for LT_INIT. -LD_CXX='$(CXX)' -RDYNAMIC_FLAG= -DL_API_MSG="" -dlopen_api=no -shl_load_api=no -loadlibrary_api=no -dyld_api=no - -if test $SHARED_LIBS = yes || test $ENABLE_DYNAMIC_LINKING = yes; then - - case $lt_cv_dlopen in - dlopen) - dlopen_api=yes - DL_API_MSG="(dlopen)" - AC_DEFINE(HAVE_DLOPEN_API, 1, - [Define to 1 if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.]) - OCTAVE_CXX_FLAG([-rdynamic], [RDYNAMIC_FLAG=-rdynamic]) - ;; - shl_load) - shl_load_api=yes - DL_API_MSG="(shl_load)" - AC_DEFINE(HAVE_SHL_LOAD_API, 1, - [Define to 1 if your system has shl_load and shl_findsym for dynamic linking.]) - ;; - LoadLibrary) - loadlibrary_api=yes - DL_API_MSG="(LoadLibrary)" - AC_DEFINE(HAVE_LOADLIBRARY_API, 1, - [Define to 1 if your system has LoadLibrary for dynamic linking.]) - ;; - dyld) - dyld_api=yes - DL_API_MSG="(dyld)" - AC_DEFINE(HAVE_DYLD_API, 1, - [Define to 1 if your system has dyld for dynamic linking.]) - ;; - esac - - DL_LIBS="$lt_cv_dlopen_libs" - AC_SUBST(DL_LIBS) - - ## Disable dynamic linking if capability is not present. - if test $dlopen_api = yes \ - || test $shl_load_api = yes \ - || test $loadlibrary_api = yes \ - || test $dyld_api = yes; then - # some form of dynamic linking present - ENABLE_DYNAMIC_LINKING=yes - else - ENABLE_DYNAMIC_LINKING=no - fi -fi - -if test $ENABLE_DYNAMIC_LINKING = yes; then - AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define to 1 if using dynamic linking.]) -fi + LD_CXX='$(CXX)' + RDYNAMIC_FLAG= + DL_API_MSG="" + dlopen_api=no + shl_load_api=no + loadlibrary_api=no + dyld_api=no + + if test $SHARED_LIBS = yes || test $ENABLE_DYNAMIC_LINKING = yes; then + + case $lt_cv_dlopen in + dlopen) + dlopen_api=yes + DL_API_MSG="(dlopen)" +AC_DEFINE(HAVE_DLOPEN_API, 1, + [Define to 1 if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking.]) +OCTAVE_CXX_FLAG([-rdynamic], [RDYNAMIC_FLAG=-rdynamic]) + ;; + shl_load) + shl_load_api=yes + DL_API_MSG="(shl_load)" +AC_DEFINE(HAVE_SHL_LOAD_API, 1, + [Define to 1 if your system has shl_load and shl_findsym for dynamic linking.]) + ;; + LoadLibrary) + loadlibrary_api=yes + DL_API_MSG="(LoadLibrary)" +AC_DEFINE(HAVE_LOADLIBRARY_API, 1, + [Define to 1 if your system has LoadLibrary for dynamic linking.]) + ;; + dyld) + dyld_api=yes + DL_API_MSG="(dyld)" +AC_DEFINE(HAVE_DYLD_API, 1, + [Define to 1 if your system has dyld for dynamic linking.]) + ;; + esac + + DL_LIBS="$lt_cv_dlopen_libs" +AC_SUBST(DL_LIBS) + +## Disable dynamic linking if capability is not present. + if test $dlopen_api = yes \ + || test $shl_load_api = yes \ + || test $loadlibrary_api = yes \ + || test $dyld_api = yes; then +# some form of dynamic linking present + ENABLE_DYNAMIC_LINKING=yes + else + ENABLE_DYNAMIC_LINKING=no + fi + fi + + if test $ENABLE_DYNAMIC_LINKING = yes; then +AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define to 1 if using dynamic linking.]) + fi AM_CONDITIONAL([AMCOND_ENABLE_DYNAMIC_LINKING], - [test $ENABLE_DYNAMIC_LINKING = yes]) - -if test $SHARED_LIBS = yes; then - LIBOCTINTERP="-loctinterp$SHLLINKEXT" - LIBOCTAVE="-loctave$SHLLINKEXT" -else - LIBOCTINTERP='$(top_builddir)/libinterp/liboctinterp.$(LIBEXT)' - LIBOCTAVE='$(top_builddir)/liboctave/liboctave.$(LIBEXT)' -fi - -AC_SUBST(LD_CXX) -AC_SUBST(RDYNAMIC_FLAG) -AC_SUBST(ENABLE_DYNAMIC_LINKING) -AC_SUBST(LIBOCTINTERP) + [test $ENABLE_DYNAMIC_LINKING = yes]) + + if test $SHARED_LIBS = yes; then + LIBOCTINTERP="-loctinterp$SHLLINKEXT" + LIBOCTAVE="-loctave$SHLLINKEXT" + else + LIBOCTINTERP='$(top_builddir)/libinterp/liboctinterp.$(LIBEXT)' + LIBOCTAVE='$(top_builddir)/liboctave/liboctave.$(LIBEXT)' + fi + + AC_SUBST(LD_CXX) + AC_SUBST(RDYNAMIC_FLAG) + AC_SUBST(ENABLE_DYNAMIC_LINKING) + AC_SUBST(LIBOCTINTERP) AC_SUBST(LIBOCTAVE) -if test "$cross_compiling" = yes && test -n "$ac_tool_prefix"; then - CROSS_TOOL_PREFIX="$ac_tool_prefix" - MKOCTFILE_AR='$(shell echo $(AR) | sed "s,$(CROSS_TOOL_PREFIX),,")' - MKOCTFILE_CC='$(shell echo $(CC) | sed "s,$(CROSS_TOOL_PREFIX),,")' - MKOCTFILE_CXX='$(shell echo $(CXX) | sed "s,$(CROSS_TOOL_PREFIX),,")' - MKOCTFILE_DL_LD='$(shell echo $(DL_LD) | sed "s,$(CROSS_TOOL_PREFIX),,")' - MKOCTFILE_F77='$(shell echo $(F77) | sed "s,$(CROSS_TOOL_PREFIX),,")' - MKOCTFILE_LD_CXX='$(shell echo $(LD_CXX) | sed "s,$(CROSS_TOOL_PREFIX),,")' - MKOCTFILE_RANLIB='$(shell echo $(RANLIB) | sed "s,$(CROSS_TOOL_PREFIX),,")' -else - MKOCTFILE_AR="$AR" - MKOCTFILE_CC="$CC" - MKOCTFILE_CXX="$CXX" - MKOCTFILE_DL_LD="$DL_LD" - MKOCTFILE_F77="$F77" - MKOCTFILE_LD_CXX="$LD_CXX" - MKOCTFILE_RANLIB="$RANLIB" -fi -AC_MSG_NOTICE([defining CROSS_TOOL_PREFIX to be $CROSS_TOOL_PREFIX]) -AC_MSG_NOTICE([defining MKOCTFILE_AR to be $MKOCTFILE_AR]) -AC_MSG_NOTICE([defining MKOCTFILE_CC to be $MKOCTFILE_CC]) -AC_MSG_NOTICE([defining MKOCTFILE_CXX to be $MKOCTFILE_CXX]) -AC_MSG_NOTICE([defining MKOCTFILE_DL_LD to be $MKOCTFILE_DL_LD]) -AC_MSG_NOTICE([defining MKOCTFILE_F77 to be $MKOCTFILE_F77]) -AC_MSG_NOTICE([defining MKOCTFILE_LD_CXX to be $MKOCTFILE_LD_CXX]) -AC_MSG_NOTICE([defining MKOCTFILE_RANLIB to be $MKOCTFILE_RANLIB]) -AC_SUBST(CROSS_TOOL_PREFIX) -AC_SUBST(MKOCTFILE_AR) -AC_SUBST(MKOCTFILE_CC) -AC_SUBST(MKOCTFILE_CXX) -AC_SUBST(MKOCTFILE_DL_LD) -AC_SUBST(MKOCTFILE_F77) -AC_SUBST(MKOCTFILE_LD_CXX) + if test "$cross_compiling" = yes && test -n "$ac_tool_prefix"; then + CROSS_TOOL_PREFIX="$ac_tool_prefix" + MKOCTFILE_AR='$(shell echo $(AR) | sed "s,$(CROSS_TOOL_PREFIX),,")' + MKOCTFILE_CC='$(shell echo $(CC) | sed "s,$(CROSS_TOOL_PREFIX),,")' + MKOCTFILE_CXX='$(shell echo $(CXX) | sed "s,$(CROSS_TOOL_PREFIX),,")' + MKOCTFILE_DL_LD='$(shell echo $(DL_LD) | sed "s,$(CROSS_TOOL_PREFIX),,")' + MKOCTFILE_F77='$(shell echo $(F77) | sed "s,$(CROSS_TOOL_PREFIX),,")' + MKOCTFILE_LD_CXX='$(shell echo $(LD_CXX) | sed "s,$(CROSS_TOOL_PREFIX),,")' + MKOCTFILE_RANLIB='$(shell echo $(RANLIB) | sed "s,$(CROSS_TOOL_PREFIX),,")' + else + MKOCTFILE_AR="$AR" + MKOCTFILE_CC="$CC" + MKOCTFILE_CXX="$CXX" + MKOCTFILE_DL_LD="$DL_LD" + MKOCTFILE_F77="$F77" + MKOCTFILE_LD_CXX="$LD_CXX" + MKOCTFILE_RANLIB="$RANLIB" + fi + AC_MSG_NOTICE([defining CROSS_TOOL_PREFIX to be $CROSS_TOOL_PREFIX]) + AC_MSG_NOTICE([defining MKOCTFILE_AR to be $MKOCTFILE_AR]) + AC_MSG_NOTICE([defining MKOCTFILE_CC to be $MKOCTFILE_CC]) + AC_MSG_NOTICE([defining MKOCTFILE_CXX to be $MKOCTFILE_CXX]) + AC_MSG_NOTICE([defining MKOCTFILE_DL_LD to be $MKOCTFILE_DL_LD]) + AC_MSG_NOTICE([defining MKOCTFILE_F77 to be $MKOCTFILE_F77]) + AC_MSG_NOTICE([defining MKOCTFILE_LD_CXX to be $MKOCTFILE_LD_CXX]) + AC_MSG_NOTICE([defining MKOCTFILE_RANLIB to be $MKOCTFILE_RANLIB]) + AC_SUBST(CROSS_TOOL_PREFIX) + AC_SUBST(MKOCTFILE_AR) + AC_SUBST(MKOCTFILE_CC) + AC_SUBST(MKOCTFILE_CXX) + AC_SUBST(MKOCTFILE_DL_LD) + AC_SUBST(MKOCTFILE_F77) + AC_SUBST(MKOCTFILE_LD_CXX) AC_SUBST(MKOCTFILE_RANLIB) ### Check for existence of various libraries ## OS-specific test for dirent, opendir. -case $host_os in - mingw*) - if test $have_msvc = yes; then - AC_CHECK_LIB([dirent], [opendir]) - LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32" - else - LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32" - fi - LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32" - ;; - msdosmsvc) - AC_CHECK_LIB([dirent], [opendir]) - LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32" - ;; -esac + case $host_os in + mingw*) + if test $have_msvc = yes; then +AC_CHECK_LIB([dirent], [opendir]) + LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32" + else + LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32" + fi + LIBS="$LIBS -lgdi32 -lws2_32 -luser32 -lkernel32" + ;; + msdosmsvc) +AC_CHECK_LIB([dirent], [opendir]) + LIBS="$LIBS -ladvapi32 -lgdi32 -lws2_32 -luser32 -lkernel32" + ;; + esac ## Find a termlib to use. -OCTAVE_CHECK_LIB_TERMLIB + OCTAVE_CHECK_LIB_TERMLIB ### Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_SYS_WAIT + AC_HEADER_DIRENT + AC_HEADER_SYS_WAIT ## C headers -dnl Use multiple AC_CHECKs to avoid line continuations '\' in list -AC_CHECK_HEADERS([curses.h direct.h dlfcn.h floatingpoint.h fpu_control.h]) -AC_CHECK_HEADERS([grp.h ieeefp.h inttypes.h locale.h memory.h ncurses.h]) -AC_CHECK_HEADERS([poll.h pthread.h pwd.h sunmath.h sys/ioctl.h]) -AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h]) + dnl Use multiple AC_CHECKs to avoid line continuations '\' in list + AC_CHECK_HEADERS([curses.h direct.h dlfcn.h floatingpoint.h fpu_control.h]) + AC_CHECK_HEADERS([grp.h ieeefp.h inttypes.h locale.h memory.h ncurses.h]) + AC_CHECK_HEADERS([poll.h pthread.h pwd.h sunmath.h sys/ioctl.h]) + AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/resource.h ]) AC_CHECK_HEADERS([sys/select.h sys/utsname.h termcap.h]) ## C++ headers @@ -1978,49 +2009,49 @@ AC_LANG_PUSH(C++) AC_CHECK_HEADERS([sstream]) -OCTAVE_UNORDERED_MAP_HEADERS + OCTAVE_UNORDERED_MAP_HEADERS AC_LANG_POP(C++) ## Find a termio header to include. -AC_CHECK_HEADERS([termios.h], have_termios_h=yes, have_termios_h=no) -AC_CHECK_HEADERS([termio.h], have_termio_h=yes, have_termio_h=no) -AC_CHECK_HEADERS([sgtty.h], have_sgtty_h=yes, have_sgtty_h=no) -AC_CHECK_HEADERS([fnmatch.h], have_fnmatch_h=yes, have_fnmatch_h=no) + AC_CHECK_HEADERS([termios.h], have_termios_h=yes, have_termios_h=no) + AC_CHECK_HEADERS([termio.h], have_termio_h=yes, have_termio_h=no) + AC_CHECK_HEADERS([sgtty.h], have_sgtty_h=yes, have_sgtty_h=no) + AC_CHECK_HEADERS([fnmatch.h], have_fnmatch_h=yes, have_fnmatch_h=no) AC_CHECK_HEADERS([conio.h], have_conio_h=yes, have_conio_h=no) -if test $have_termios_h != yes \ - && test $have_termio_h != yes \ - && test $have_sgtty_h != yes; then - AC_MSG_WARN([I couldn't find termios.h, termio.h, or sgtty.h!]) -fi + if test $have_termios_h != yes \ + && test $have_termio_h != yes \ + && test $have_sgtty_h != yes; then + AC_MSG_WARN([I couldn't find termios.h, termio.h, or sgtty.h!]) + fi ## For MSVC compilers, avoid #define of min/max from windows.h header -if test $have_msvc = yes; then - AC_DEFINE(NOMINMAX, 1, [Define to 1 if you want to avoid min/max macro definition in Windows headers.]) -fi + if test $have_msvc = yes; then +AC_DEFINE(NOMINMAX, 1, [Define to 1 if you want to avoid min/max macro definition in Windows headers.]) + fi ### Determine types and size of types. -AC_TYPE_INT64_T -AC_TYPE_MODE_T -AC_TYPE_OFF_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_TYPE_UID_T -AC_TYPE_UINT64_T -AC_CHECK_TYPES([dev_t, ino_t]) -AC_CHECK_TYPES([long long int, unsigned long long int]) + AC_TYPE_INT64_T + AC_TYPE_MODE_T + AC_TYPE_OFF_T + AC_TYPE_PID_T + AC_TYPE_SIZE_T + AC_TYPE_SSIZE_T + AC_TYPE_UID_T + AC_TYPE_UINT64_T + AC_CHECK_TYPES([dev_t, ino_t]) + AC_CHECK_TYPES([long long int, unsigned long long int]) AC_CHECK_TYPES([ptrdiff_t]) ## How big are ints and how are they oriented? ## These could probably be eliminated in favor of run-time checks. -AC_CHECK_SIZEOF([short]) -AC_CHECK_SIZEOF([int]) -AC_CHECK_SIZEOF([long]) + AC_CHECK_SIZEOF([short]) + AC_CHECK_SIZEOF([int]) + AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([long long]) ## Check for long double type (for 64-bit integers) AC_CHECK_SIZEOF([long double]) @@ -2028,967 +2059,970 @@ ### Check structures and existence of necessary members AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, - struct stat.st_rdev]) + struct stat.st_rdev]) AC_CHECK_MEMBERS([struct group.gr_passwd]) -AC_STRUCT_TIMEZONE + AC_STRUCT_TIMEZONE ### Check compiler characteristics. ## Does compiler have support for new friend template declarations? -OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL + OCTAVE_CXX_NEW_FRIEND_TEMPLATE_DECL ## Does reinterpret_cast fail for function pointers? -OCTAVE_CXX_BROKEN_REINTERPRET_CAST + OCTAVE_CXX_BROKEN_REINTERPRET_CAST ## Check if C++ compiler allows placement delete. -OCTAVE_CXX_PLACEMENT_DELETE + OCTAVE_CXX_PLACEMENT_DELETE ## Check if C++ compiler can auto allocate variable sized arrays. -OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS + OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS ## Check that C compiler and libraries support IEEE754 data format. -OCTAVE_IEEE754_DATA_FORMAT + OCTAVE_IEEE754_DATA_FORMAT ## Is C++ runtime library ISO compliant? -OCTAVE_CXX_ISO_COMPLIANT_LIBRARY + OCTAVE_CXX_ISO_COMPLIANT_LIBRARY ## Are bit_and, bit_or, and bit_xor defined as templated operators? -OCTAVE_CXX_BITWISE_OP_TEMPLATES + OCTAVE_CXX_BITWISE_OP_TEMPLATES ## Can complex class set components independently? -OCTAVE_CXX_COMPLEX_SETTERS + OCTAVE_CXX_COMPLEX_SETTERS ## Are there functions to access real/imag parts of numbers via references? -OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS + OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS ## Check if fast integer arithmetics based on bit tricks is available. -OCTAVE_FAST_INT_OPS + OCTAVE_FAST_INT_OPS ## Does the C compiler handle alloca() and const correctly? -AC_FUNC_ALLOCA + AC_FUNC_ALLOCA ## Does the C compiler support Automake subdir-objects option? -AM_PROG_CC_C_O + AM_PROG_CC_C_O ### gnulib initialization: part 2 ### After all include and path modifications have taken place ### and at the same priority level as function checks. -gl_INIT + gl_INIT ### Checks for functions and variables. -dnl These checks define/undefine HAVE_FUNCNAME in config.h. -dnl Code tests HAVE_FUNCNAME and either uses function or provides workaround. -dnl Use multiple AC_CHECKs to avoid line continuations '\' in list -AC_CHECK_FUNCS([canonicalize_file_name dup2]) -AC_CHECK_FUNCS([endgrent endpwent execvp expm1 expm1f fork]) -AC_CHECK_FUNCS([getegid geteuid getgid getgrent getgrgid getgrnam]) -AC_CHECK_FUNCS([getpgrp getpid getppid getpwent getpwuid getuid]) -AC_CHECK_FUNCS([isascii kill]) -AC_CHECK_FUNCS([lgamma lgammaf lgamma_r lgammaf_r]) -AC_CHECK_FUNCS([log1p log1pf pipe]) -AC_CHECK_FUNCS([realpath resolvepath roundl]) -AC_CHECK_FUNCS([select setgrent setpwent siglongjmp strsignal]) -AC_CHECK_FUNCS([tempnam tgammaf toascii]) -AC_CHECK_FUNCS([umask uname waitpid]) + dnl These checks define/undefine HAVE_FUNCNAME in config.h. + dnl Code tests HAVE_FUNCNAME and either uses function or provides workaround. + dnl Use multiple AC_CHECKs to avoid line continuations '\' in list + AC_CHECK_FUNCS([canonicalize_file_name dup2]) + AC_CHECK_FUNCS([endgrent endpwent execvp expm1 expm1f fork]) + AC_CHECK_FUNCS([getegid geteuid getgid getgrent getgrgid getgrnam]) + AC_CHECK_FUNCS([getpgrp getpid getppid getpwent getpwuid getuid]) + AC_CHECK_FUNCS([isascii kill]) + AC_CHECK_FUNCS([lgamma lgammaf lgamma_r lgammaf_r]) + AC_CHECK_FUNCS([log1p log1pf pipe]) + AC_CHECK_FUNCS([realpath resolvepath roundl]) + AC_CHECK_FUNCS([select setgrent setpwent siglongjmp strsignal]) + AC_CHECK_FUNCS([tempnam tgammaf toascii]) + AC_CHECK_FUNCS([umask uname waitpid]) AC_CHECK_FUNCS([_kbhit]) -dnl There are no workarounds in the code for missing these functions. + dnl There are no workarounds in the code for missing these functions. AC_CHECK_FUNCS([modf pow sqrt sqrtf], [], - [AC_MSG_ERROR([Missing function required to build Octave])]) + [AC_MSG_ERROR([Missing function required to build Octave])]) ## exp2, round, tgamma function checks -AC_LANG_PUSH(C++) -AC_CHECK_DECLS([exp2, round, tgamma], [], [], [[#include <cmath>]]) + AC_LANG_PUSH(C++) + AC_CHECK_DECLS([exp2, round, tgamma], [], [], [[#include <cmath>]]) AC_CHECK_FUNCS([exp2 round tgamma]) -AH_VERBATIM([Z_FUNCS_AND_DECLS], [ + AH_VERBATIM([Z_FUNCS_AND_DECLS], [ #if defined (__cplusplus) -extern "C" { + extern "C" { #endif #if HAVE_EXP2 && ! HAVE_DECL_EXP2 -double exp2 (double); + double exp2 (double); #endif #if HAVE_ROUND && ! HAVE_DECL_ROUND -double round (double); + double round (double); #endif #if HAVE_TGAMMA && ! HAVE_DECL_TGAMMA -double tgamma (double); + double tgamma (double); #endif #if defined (__cplusplus) -} + } #endif -]) + ]) AC_LANG_POP(C++) ## Look in <cmath> for the IEEE functions isnan, isinf, isfinite that we need. -OCTAVE_CHECK_FUNC_CMATH(isnan) -OCTAVE_CHECK_FUNC_CMATH(isinf) + OCTAVE_CHECK_FUNC_CMATH(isnan) + OCTAVE_CHECK_FUNC_CMATH(isinf) OCTAVE_CHECK_FUNC_CMATH(isfinite) ## Check for Inf and NaN functions -case $canonical_host_type in - m68k-hp-hpux*) - ## I am told that Inf and NaN don't work on m68k HP sytems. - ;; - *) - AC_CHECK_FUNCS([finite isnan isinf signbit]) - AC_CHECK_FUNCS([_finite _isnan]) - AC_CHECK_DECLS([signbit], , , [#include <math.h>]) - ;; -esac + case $canonical_host_type in + m68k-hp-hpux*) +## I am told that Inf and NaN don't work on m68k HP sytems. + ;; + *) + AC_CHECK_FUNCS([finite isnan isinf signbit]) + AC_CHECK_FUNCS([_finite _isnan]) +AC_CHECK_DECLS([signbit], , , [#include <math.h>]) + ;; + esac ## Check for nonstandard, but common math functions, that we need. -dnl Use multiple AC_CHECKs to avoid line continuations '\' in list -AC_CHECK_FUNCS([acosh acoshf asinh asinhf atanh atanhf cbrt cbrtf]) + dnl Use multiple AC_CHECKs to avoid line continuations '\' in list + AC_CHECK_FUNCS([acosh acoshf asinh asinhf atanh atanhf cbrt cbrtf]) AC_CHECK_FUNCS([erf erff erfc erfcf exp2f hypotf _hypotf log2 log2f]) ## Check for math defines such as M_LN2 in math.h -AC_CACHE_CHECK([for MATH DEFINES in math.h], - [octave_cv_header_math_defines], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <math.h> - ]], [[ - double x = M_LN2;]])], - octave_cv_header_math_defines=yes, - octave_cv_header_math_defines=no) - ]) - -if test $octave_cv_header_math_defines = no; then - ## Check again and try defining _USE_MATH_DEFINES - AC_CACHE_CHECK([whether _USE_MATH_DEFINES needs to be defined], - [octave_cv_header__use_math_defines], - [save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <math.h> - ]], [[ - double x = M_LN2;]])], - octave_cv_header__use_math_defines=yes, - octave_cv_header__use_math_defines=no) - CPPFLAGS="$save_CPPFLAGS" - ]) - if test $octave_cv_header__use_math_defines = yes; then - octave_cv_header_math_defines=yes - AC_DEFINE(_USE_MATH_DEFINES, 1, - [Define to 1 if _USE_MATH_DEFINES is required to get math constants like M_LN2.]) - CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES" - fi -fi - -if test $octave_cv_header_math_defines = yes; then - AC_DEFINE(HAVE_MATH_DEFINES, 1, - [Define to 1 if defines such as M_PI are available in math.h]) -else - AC_MSG_ERROR([MATH DEFINES in math.h such as M_PI are required to build Octave]) -fi + AC_CACHE_CHECK([for MATH DEFINES in math.h], + [octave_cv_header_math_defines], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <math.h> + ]], [[ + double x = M_LN2;]])], + octave_cv_header_math_defines=yes, + octave_cv_header_math_defines=no) + ]) + + if test $octave_cv_header_math_defines = no; then +## Check again and try defining _USE_MATH_DEFINES + AC_CACHE_CHECK([whether _USE_MATH_DEFINES needs to be defined], + [octave_cv_header__use_math_defines], + [save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <math.h> + ]], [[ + double x = M_LN2;]])], + octave_cv_header__use_math_defines=yes, + octave_cv_header__use_math_defines=no) + CPPFLAGS="$save_CPPFLAGS" + ]) + if test $octave_cv_header__use_math_defines = yes; then + octave_cv_header_math_defines=yes +AC_DEFINE(_USE_MATH_DEFINES, 1, + [Define to 1 if _USE_MATH_DEFINES is required to get math constants like M_LN2.]) + CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES" + fi + fi + + if test $octave_cv_header_math_defines = yes; then +AC_DEFINE(HAVE_MATH_DEFINES, 1, + [Define to 1 if defines such as M_PI are available in math.h]) + else +AC_MSG_ERROR([MATH DEFINES in math.h such as M_PI are required to build Octave]) + fi ## Windows-specific tests for extra #defines -case $host_os in - msdosmsvc | mingw*) - AC_MSG_CHECKING([for required _WIN32_WINNT]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <windows.h> - #if _WIN32_WINNT < 0x0403 - #error "Wrong version" - #endif - ]], [])], - [AC_MSG_RESULT([none])], - [AC_DEFINE(_WIN32_WINNT, 0x0403, - [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.]) - AC_MSG_RESULT([0x0403])]) - ;; -esac + case $host_os in + msdosmsvc | mingw*) +AC_MSG_CHECKING([for required _WIN32_WINNT]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <windows.h> +#if _WIN32_WINNT < 0x0403 +#error "Wrong version" +#endif + ]], [])], + [AC_MSG_RESULT([none])], + [AC_DEFINE(_WIN32_WINNT, 0x0403, + [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.]) + AC_MSG_RESULT([0x0403])]) + ;; + esac ## Windows-specific use of functions -case $host_os in - msdosmsvc | mingw*) - AC_CHECK_FUNCS([setvbuf], [], - [AC_MSG_ERROR([Missing function required to build Octave])]) - ;; -esac + case $host_os in + msdosmsvc | mingw*) +AC_CHECK_FUNCS([setvbuf], [], + [AC_MSG_ERROR([Missing function required to build Octave])]) + ;; + esac ## Cygwin kluge for getrusage. AC_CHECK_FUNCS([getrusage]) -case $host_os in - cygwin*) - AC_DEFINE(RUSAGE_TIMES_ONLY, 1, - [Define to 1 if your struct rusage only has time information.]) - ;; -esac + case $host_os in + cygwin*) +AC_DEFINE(RUSAGE_TIMES_ONLY, 1, + [Define to 1 if your struct rusage only has time information.]) + ;; + esac ## Check for CGDisplayBitsPerPixel function on Mac OSX systems with Carbon -if test $have_framework_carbon = yes; then - OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL -fi + if test $have_framework_carbon = yes; then + OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL + fi AC_CHECK_FUNCS([getpwnam], [], [AC_CHECK_LIB([sun], [getpwnam])]) -AC_FUNC_CLOSEDIR_VOID + AC_FUNC_CLOSEDIR_VOID ## Check return type of matherr() -AC_CACHE_CHECK([for struct exception in math.h], - [octave_cv_func_matherr_type], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <math.h> - ]], [[ - struct exception *x; - x->type; - x->name; - ]])], - octave_cv_func_matherr_type=yes, - octave_cv_func_matherr_type=no) - ]) -if test $octave_cv_func_matherr_type = yes; then - AC_DEFINE(EXCEPTION_IN_MATH, 1, - [Define to 1 if math.h declares struct exception for matherr().]) -fi - + AC_CACHE_CHECK([for struct exception in math.h], + [octave_cv_func_matherr_type], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include <math.h> + ]], [[ + struct exception *x; + x->type; + x->name; + ]])], + octave_cv_func_matherr_type=yes, + octave_cv_func_matherr_type=no) + ]) + if test $octave_cv_func_matherr_type = yes; then +AC_DEFINE(EXCEPTION_IN_MATH, 1, + [Define to 1 if math.h declares struct exception for matherr().]) + fi + ## Signal stuff. -AC_CHECK_DECLS([sys_siglist], [], [], -[[#include <signal.h> -/* NetBSD declares sys_siglist in unistd.h. */ + AC_CHECK_DECLS([sys_siglist], [], [], + [[#include <signal.h> + /* NetBSD declares sys_siglist in unistd.h. */ #if HAVE_UNISTD_H # include <unistd.h> #endif -]]) + ]]) ### Need to disable building documentation if either gnuplot or ### makeinfo are missing. Skip this warning if building docs was ### disabled with a configure option. -if test -n "$DOCDIR"; then - if test -n "$warn_gnuplot"; then - DOCDIR= - warn_docs_gnuplot="building documentation disabled because gnuplot was not found; make dist will fail" - OCTAVE_CONFIGURE_WARNING([warn_docs_gnuplot]) - fi - if test -n "$warn_makeinfo"; then - DOCDIR= - warn_docs_makeinfo="building documentation disabled because makeinfo was not found; make dist will fail" - OCTAVE_CONFIGURE_WARNING([warn_docs_makeinfo]) - fi -fi -AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test -n "$DOCDIR"]) + if test -n "$DOCDIR"; then + if test -n "$warn_gnuplot"; then + DOCDIR= + warn_docs_gnuplot="building documentation disabled because gnuplot was not found; make dist will fail" +OCTAVE_CONFIGURE_WARNING([warn_docs_gnuplot]) + fi + if test -n "$warn_makeinfo"; then + DOCDIR= + warn_docs_makeinfo="building documentation disabled because makeinfo was not found; make dist will fail" +OCTAVE_CONFIGURE_WARNING([warn_docs_makeinfo]) + fi + fi + AM_CONDITIONAL([AMCOND_BUILD_DOCS], [test -n "$DOCDIR"]) ### Maybe add -Wall, -W, and -Wshadow to compiler flags now that we're ### done feature testing. -GCC_EXTRA_FLAGS="-Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual" - -GXX_EXTRA_FLAGS="-Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual" - -try_extra_warning_flags=yes - -AC_ARG_ENABLE([extra-warning-flags], - [AS_HELP_STRING([--disable-extra-warning-flags], - [don't add -Wall, -W, -Wshadow, and -Wold-style-cast options to CFLAGS and CXXFLAGS])], - [if test "$enableval" = no; then - try_extra_warning_flags=no - fi], - []) - -if test $try_extra_warning_flags = yes; then - for flag in $GCC_EXTRA_FLAGS; do - OCTAVE_CC_FLAG([$flag], [ - WARN_CFLAGS="$WARN_CFLAGS $flag"; - AC_MSG_RESULT([adding $flag to WARN_CFLAGS])]) - done - for flag in $GXX_EXTRA_FLAGS; do - OCTAVE_CXX_FLAG([$flag], [ - WARN_CXXFLAGS="$WARN_CXXFLAGS $flag"; - AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])]) - done -fi - -GCC_STRICT_FLAGS="-Wconversion" - -GXX_STRICT_FLAGS="-Wconversion -Weffc++" - -try_strict_warning_flags=no - -AC_ARG_ENABLE([strict-warning-flags], - [AS_HELP_STRING([--enable-strict-warning-flags], - [add extra strict warning options to CFLAGS and CXXFLAGS])], - [if test "$enableval" = yes; then - try_strict_warning_flags=yes - fi], - []) - -if test $try_strict_warning_flags = yes; then - for flag in $GCC_STRICT_FLAGS; do - OCTAVE_CC_FLAG([$flag], [ - WARN_CFLAGS="$WARN_CFLAGS $flag"; - AC_MSG_RESULT([adding $flag to WARN_CFLAGS])]) - done - for flag in $GXX_STRICT_FLAGS; do - OCTAVE_CXX_FLAG([$flag], [ - WARN_CXXFLAGS="$WARN_CXXFLAGS $flag"; - AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])]) - done -fi - -AC_SUBST(WARN_CFLAGS) + GCC_EXTRA_FLAGS="-Wall -W -Wshadow -Wformat -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wcast-align -Wcast-qual" + + GXX_EXTRA_FLAGS="-Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual" + + try_extra_warning_flags=yes + + AC_ARG_ENABLE([extra-warning-flags], + [AS_HELP_STRING([--disable-extra-warning-flags], + [don't add -Wall, -W, -Wshadow, and -Wold-style-cast options to CFLAGS and CXXFLAGS])], + [if test "$enableval" = no; then + try_extra_warning_flags=no + fi], + []) + + if test $try_extra_warning_flags = yes; then + for flag in $GCC_EXTRA_FLAGS; do + OCTAVE_CC_FLAG([$flag], [ + WARN_CFLAGS="$WARN_CFLAGS $flag"; + AC_MSG_RESULT([adding $flag to WARN_CFLAGS])]) + done + for flag in $GXX_EXTRA_FLAGS; do + OCTAVE_CXX_FLAG([$flag], [ + WARN_CXXFLAGS="$WARN_CXXFLAGS $flag"; + AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])]) + done + fi + + GCC_STRICT_FLAGS="-Wconversion" + + GXX_STRICT_FLAGS="-Wconversion -Weffc++" + + try_strict_warning_flags=no + + AC_ARG_ENABLE([strict-warning-flags], + [AS_HELP_STRING([--enable-strict-warning-flags], + [add extra strict warning options to CFLAGS and CXXFLAGS])], + [if test "$enableval" = yes; then + try_strict_warning_flags=yes + fi], + []) + + if test $try_strict_warning_flags = yes; then + for flag in $GCC_STRICT_FLAGS; do + OCTAVE_CC_FLAG([$flag], [ + WARN_CFLAGS="$WARN_CFLAGS $flag"; + AC_MSG_RESULT([adding $flag to WARN_CFLAGS])]) + done + for flag in $GXX_STRICT_FLAGS; do + OCTAVE_CXX_FLAG([$flag], [ + WARN_CXXFLAGS="$WARN_CXXFLAGS $flag"; + AC_MSG_RESULT([adding $flag to WARN_CXXFLAGS])]) + done + fi + + AC_SUBST(WARN_CFLAGS) AC_SUBST(WARN_CXXFLAGS) ### Check for Java. -build_java=yes -AC_ARG_ENABLE([java], - [AS_HELP_STRING([--disable-java], - [disable Java interface])], - [if test "$enableval" = no; then - build_java=no - fi], - []) - -AC_ARG_WITH([java-homedir], - [AS_HELP_STRING([--with-java-homedir=DIR], - [Java JDK directory in DIR])], - [JAVA_HOMEDIR="$withval"]) - -AC_ARG_WITH([java-includedir], - [AS_HELP_STRING([--with-java-includedir=DIR], - [look for java include file <jni.h> in DIR])], - [JAVA_CPPFLAGS="$withval"], [JAVA_CPPFLAGS=""]) - -AC_ARG_WITH([java-libdir], - [AS_HELP_STRING([--with-java-libdir=DIR], - [look for java library libjvm in DIR])], - [JAVA_LDPATH="$withval"], [JAVA_LDPATH=""]) + build_java=yes + AC_ARG_ENABLE([java], + [AS_HELP_STRING([--disable-java], + [disable Java interface])], + [if test "$enableval" = no; then + build_java=no + fi], + []) + + AC_ARG_WITH([java-homedir], + [AS_HELP_STRING([--with-java-homedir=DIR], + [Java JDK directory in DIR])], + [JAVA_HOMEDIR="$withval"]) + + AC_ARG_WITH([java-includedir], + [AS_HELP_STRING([--with-java-includedir=DIR], + [look for java include file <jni.h> in DIR])], + [JAVA_CPPFLAGS="$withval"], [JAVA_CPPFLAGS=""]) + + AC_ARG_WITH([java-libdir], + [AS_HELP_STRING([--with-java-libdir=DIR], + [look for java library libjvm in DIR])], + [JAVA_LDPATH="$withval"], [JAVA_LDPATH=""]) ## Grab JAVA_HOME from environment variable if it exists AC_ARG_VAR([JAVA_HOME], [path to Java JDK installation]) ## But --with-java-homedir option overrides environment variable -if test -n "$JAVA_HOMEDIR"; then - JAVA_HOME=$JAVA_HOMEDIR -fi -JAVA= -JAVAC= -JAR= -JAVA_LIBS= + if test -n "$JAVA_HOMEDIR"; then + JAVA_HOME=$JAVA_HOMEDIR + fi + JAVA= + JAVAC= + JAR= + JAVA_LIBS= ## Fake loop so that "break" can be used to skip code blocks. -while test $build_java = yes -do - ## Unset build_java. Variable is set only if all configuration tests pass. - build_java=no - - ## Warn if JAVA_HOME is unset. It is *strongly* advised to specify JAVA_HOME. - if test -z "$JAVA_HOME"; then - AC_MSG_WARN([JAVA_HOME environment variable not initialized.]) - AC_MSG_WARN([Auto-detection will proceed but is unreliable.]) - fi - - ## Search for a viable Java executable. - if test -z "$JAVA_HOME"; then - JAVA_PATH="$PATH" - else - JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/jre/bin$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}" - fi - AC_PATH_PROG(JAVA, java, [], [$JAVA_PATH]) - - if test -z "$JAVA"; then - AC_MSG_WARN([No Java executable found. Octave will not be able to call Java methods.]) - break - fi - - if test -z "$JAVA_HOME"; then - ## Find JAVA_HOME for JRE by running java and querying properties. - JAVA_TMP_HOME=`"$JAVA" -classpath ${srcdir}/build-aux OctJavaQry JAVA_HOME` - ## Strip directory back to top-level installation dir (JAVA_HOME for JDK). - JAVA_HOME=`echo $JAVA_TMP_HOME | sed -e 's|[[/\\]]bin[[/\\]]\?$||' | sed -e 's|[[/\\]]jre[[/\\]]\?$||'` - fi - - case $host_os in - mingw* | msdosmsvc) - ## Under Win32 platform, we want JAVA_HOME to be in MSYS format, that is - ## without colon and backslashes, as it is also used as path separator. - ## Use quoted paths as Java may be installed in a path with whitespaces - ## (e.g. C:\Program Files\Java\...). - if test -n "$JAVA_HOME"; then - JAVA_HOME=`cd "$JAVA_HOME" && pwd` - ## Maybe this will be useful in the future, as native Java won't - ## understand MSYS paths. - JAVA_HOME_NATIVE=`cd "$JAVA_HOME" && pwd -W` - fi - ;; - *) - JAVA_HOME_NATIVE="$JAVA_HOME" - ;; - esac - - ## Amend search path for JAVAC and JAR. - if test -z "$JAVA_HOME"; then - JAVA_PATH="$PATH" - else - JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}" - fi - - AC_PATH_PROG(JAVAC, javac, [], [$JAVA_PATH]) - AC_PATH_PROG(JAR, jar, [], [$JAVA_PATH]) - - if test -z "$JAVAC" || test -z "$JAR"; then - AC_MSG_WARN([No javac compiler or jar executable found. Octave will not be able to call Java methods.]) - break - fi - - ## Check Java version is recent enough. - AC_MSG_CHECKING([for Java version]) - java_version=[`"$JAVA" -version 2>&1 | sed -n -e 's/^[^ ]* version[^0-9"]*"\([^"]*\)"/\1/p'`] - AC_MSG_RESULT([$java_version]) - java_major=[`echo $java_version | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\1/'`] - java_minor=[`echo $java_version | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\2/'`] - if test $java_major -ge 1 && test $java_minor -ge 5; then - : # Version is ok. Do nothing. - else - AC_MSG_WARN([Java version is too old (< 1.5). Octave will not be able to call Java methods.]) - break - fi - - ## At this point Win32/MSVC systems have enough configuration data. We - ## assume that all appropriate variables (e.g. INCLUDE and LIB) already have - ## the required paths to compile and link against JDK. - case $host_os in - msdosmsvc) - build_java=yes - JAVA_LIBS=-ladvapi32 - AC_DEFINE(HAVE_JAVA, 1, - [Define to 1 if Java is available and is at least version 1.5]) - break - ;; - mingw*) - if test $have_msvc = yes; then - build_java=yes - JAVA_LIBS=-ladvapi32 - AC_DEFINE(HAVE_JAVA, 1, - [Define to 1 if Java is available and is at least version 1.5]) - break - fi - ;; - esac - - ## Determine which library file name to search for. - case $host_os in - darwin*) - jvmlib=libjvm.dylib - ;; - mingw* | cygwin*) - jvmlib=jvm.dll - ;; - *) - jvmlib=libjvm.so - ;; - esac - - AC_MSG_CHECKING([for $jvmlib]) - - if test -z "$JAVA_LDPATH"; then - ## Run Java to try and determine library path to libjvm.so. - JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_LDPATH` - JAVA_TMP_LDPATH=`echo $JAVA_TMP_LDPATH | sed -e "s/${PATH_SEPARATOR}/ /g"` - for dir in $JAVA_TMP_LDPATH; do - if test -f "$dir/$jvmlib"; then - JAVA_LDPATH=$dir - break - fi - done - fi - - if test -z "$JAVA_LDPATH"; then - ## Nothing found. Try Java again using bootpath argument. - JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_BOOTPATH` - JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_TMP_LDPATH}/client ${JAVA_TMP_LDPATH}/server" - for dir in $JAVA_TMP_LDPATH; do - if test -f "$dir/$jvmlib"; then - JAVA_LDPATH=$dir - break - fi - done - fi - - if test -z "$JAVA_LDPATH"; then - ## Java failed to find it's own library path. Guess wildly. - JAVA_TMP_LDPATH=`ls -d $JAVA_HOME/jre/lib/*/client` - JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} `ls -d $JAVA_HOME/jre/lib/*/server`" - ## Add some paths that might work on Macs. - JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/../Libraries ${JAVA_HOME}/Libraries" - ## Add some paths that might work on MinGW - JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/bin/client ${JAVA_HOME}/bin/server" - for dir in $JAVA_TMP_LDPATH; do - if test -f "$dir/$jvmlib"; then - JAVA_LDPATH=$dir - break - fi - done - fi - - ## Verify value passed in option --with-java-libdir - if test -n "$JAVA_LDPATH"; then - if test -f "${JAVA_LDPATH}/$jvmlib"; then - : # libjvm found - else - JAVA_LDPATH="" - fi - fi - - if test -z "$JAVA_LDPATH"; then - AC_MSG_RESULT([not found]) - AC_MSG_WARN([Library $jvmlib not found. Octave will not be able to call Java methods.]) - break - else - AC_MSG_RESULT([$JAVA_LDPATH]) - fi - - AC_MSG_CHECKING([for include file <jni.h>]) - - ## Java and JVM found. Set up flags. - case $host_os in - darwin*) - ## Sneak the -framework flag into mkoctfile via LDFLAGS - LDFLAGS="$LDFLAGS -framework JavaVM" - ## According to: http://developer.apple.com/unix/crossplatform.html - ## one must explicitly set the include path. - ## Unfortunately, the include path keeps moving around. - if test -n "$JAVA_CPPFLAGS"; then - JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}" - else - JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I/System/Library/Frameworks/JavaVM.framework/Home/include -I/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers" - fi - JAVA_LIBS="-framework JavaVM" - ;; - mingw* | cygwin*) - if test -n "$JAVA_CPPFLAGS"; then - JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}/include -I${JAVA_CPPFLAGS}/include/win32" - else - JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/win32" - fi - JAVA_LIBS=-ladvapi32 - LDFLAGS="$LDFLAGS -Wl,--export-all-symbols" - ;; - *) - if test -n "$JAVA_CPPFLAGS"; then - JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}/include -I${JAVA_CPPFLAGS}/include/linux" - else - JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux" - fi - ;; - esac - - ## Verify jni.h include file exists. - JNI_PATH=`echo $JAVA_CPPFLAGS | sed -e 's/-I//g'` - have_jni=no - for dir in $JNI_PATH; do - if test -f "${dir}/jni.h"; then have_jni=yes; break; fi - done - if test $have_jni = yes; then - AC_MSG_RESULT([$dir]) - else - AC_MSG_RESULT([not found]) - AC_MSG_WARN([Include file <jni.h> not found. Octave will not be able to call Java methods.]) - break - fi - - ## Passed all configuration tests. A workable Java installation was found. - build_java=yes - AC_DEFINE(HAVE_JAVA, 1, - [Define to 1 if Java is available and is at least version 1.5]) - break -done - -AM_CONDITIONAL([AMCOND_HAVE_JAVA], [test $build_java = yes]) -AC_SUBST(JAVA) -AC_SUBST(JAVAC) -AC_SUBST(JAR) -AC_SUBST(JAVA_CPPFLAGS) + while test $build_java = yes + do +## Unset build_java. Variable is set only if all configuration tests pass. + build_java=no + +## Warn if JAVA_HOME is unset. It is *strongly* advised to specify JAVA_HOME. + if test -z "$JAVA_HOME"; then + AC_MSG_WARN([JAVA_HOME environment variable not initialized.]) +AC_MSG_WARN([Auto-detection will proceed but is unreliable.]) + fi + +## Search for a viable Java executable. + if test -z "$JAVA_HOME"; then + JAVA_PATH="$PATH" + else + JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/jre/bin$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}" + fi +AC_PATH_PROG(JAVA, java, [], [$JAVA_PATH]) + + if test -z "$JAVA"; then +AC_MSG_WARN([No Java executable found. Octave will not be able to call Java methods.]) + break + fi + + if test -z "$JAVA_HOME"; then +## Find JAVA_HOME for JRE by running java and querying properties. + JAVA_TMP_HOME=`"$JAVA" -classpath ${srcdir}/build-aux OctJavaQry JAVA_HOME` +## Strip directory back to top-level installation dir (JAVA_HOME for JDK). + JAVA_HOME=`echo $JAVA_TMP_HOME | sed -e 's|[[/\\]]bin[[/\\]]\?$||' | sed -e 's|[[/\\]]jre[[/\\]]\?$||'` + fi + + case $host_os in + mingw* | msdosmsvc) +## Under Win32 platform, we want JAVA_HOME to be in MSYS format, that is +## without colon and backslashes, as it is also used as path separator. +## Use quoted paths as Java may be installed in a path with whitespaces +## (e.g. C:\Program Files\Java\...). + if test -n "$JAVA_HOME"; then + JAVA_HOME=`cd "$JAVA_HOME" && pwd` +## Maybe this will be useful in the future, as native Java won't +## understand MSYS paths. + JAVA_HOME_NATIVE=`cd "$JAVA_HOME" && pwd -W` + fi + ;; + *) + JAVA_HOME_NATIVE="$JAVA_HOME" + ;; + esac + +## Amend search path for JAVAC and JAR. + if test -z "$JAVA_HOME"; then + JAVA_PATH="$PATH" + else + JAVA_PATH="${JAVA_HOME}$PATH_SEPARATOR${JAVA_HOME}/bin$PATH_SEPARATOR${JAVA_HOME}/../bin$PATH_SEPARATOR${PATH}" + fi + + AC_PATH_PROG(JAVAC, javac, [], [$JAVA_PATH]) +AC_PATH_PROG(JAR, jar, [], [$JAVA_PATH]) + + if test -z "$JAVAC" || test -z "$JAR"; then +AC_MSG_WARN([No javac compiler or jar executable found. Octave will not be able to call Java methods.]) + break + fi + +## Check Java version is recent enough. +AC_MSG_CHECKING([for Java version]) + java_version=[`"$JAVA" -version 2>&1 | sed -n -e 's/^[^ ]* version[^0-9"]*"\([^"]*\)"/\1/p'`] +AC_MSG_RESULT([$java_version]) + java_major=[`echo $java_version | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\1/'`] + java_minor=[`echo $java_version | sed -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\..*$/\2/'`] + if test $java_major -ge 1 && test $java_minor -ge 5; then + : # Version is ok. Do nothing. + else +AC_MSG_WARN([Java version is too old (< 1.5). Octave will not be able to call Java methods.]) + break + fi + +## At this point Win32/MSVC systems have enough configuration data. We +## assume that all appropriate variables (e.g. INCLUDE and LIB) already have +## the required paths to compile and link against JDK. + case $host_os in + msdosmsvc) + build_java=yes + JAVA_LIBS=-ladvapi32 +AC_DEFINE(HAVE_JAVA, 1, + [Define to 1 if Java is available and is at least version 1.5]) + break + ;; + mingw*) + if test $have_msvc = yes; then + build_java=yes + JAVA_LIBS=-ladvapi32 +AC_DEFINE(HAVE_JAVA, 1, + [Define to 1 if Java is available and is at least version 1.5]) + break + fi + ;; + esac + +## Determine which library file name to search for. + case $host_os in + darwin*) + jvmlib=libjvm.dylib + ;; + mingw* | cygwin*) + jvmlib=jvm.dll + ;; + *) + jvmlib=libjvm.so + ;; + esac + +AC_MSG_CHECKING([for $jvmlib]) + + if test -z "$JAVA_LDPATH"; then +## Run Java to try and determine library path to libjvm.so. + JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_LDPATH` + JAVA_TMP_LDPATH=`echo $JAVA_TMP_LDPATH | sed -e "s/${PATH_SEPARATOR}/ /g"` + for dir in $JAVA_TMP_LDPATH; do + if test -f "$dir/$jvmlib"; then + JAVA_LDPATH=$dir + break + fi + done + fi + + if test -z "$JAVA_LDPATH"; then +## Nothing found. Try Java again using bootpath argument. + JAVA_TMP_LDPATH=`$JAVA -classpath ${srcdir}/build-aux OctJavaQry JAVA_BOOTPATH` + JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_TMP_LDPATH}/client ${JAVA_TMP_LDPATH}/server" + for dir in $JAVA_TMP_LDPATH; do + if test -f "$dir/$jvmlib"; then + JAVA_LDPATH=$dir + break + fi + done + fi + + if test -z "$JAVA_LDPATH"; then +## Java failed to find it's own library path. Guess wildly. + JAVA_TMP_LDPATH=`ls -d $JAVA_HOME/jre/lib/*/client` + JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} `ls -d $JAVA_HOME/jre/lib/*/server`" +## Add some paths that might work on Macs. + JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/../Libraries ${JAVA_HOME}/Libraries" +## Add some paths that might work on MinGW + JAVA_TMP_LDPATH="${JAVA_TMP_LDPATH} ${JAVA_HOME}/bin/client ${JAVA_HOME}/bin/server" + for dir in $JAVA_TMP_LDPATH; do + if test -f "$dir/$jvmlib"; then + JAVA_LDPATH=$dir + break + fi + done + fi + +## Verify value passed in option --with-java-libdir + if test -n "$JAVA_LDPATH"; then + if test -f "${JAVA_LDPATH}/$jvmlib"; then + : # libjvm found + else + JAVA_LDPATH="" + fi + fi + + if test -z "$JAVA_LDPATH"; then + AC_MSG_RESULT([not found]) +AC_MSG_WARN([Library $jvmlib not found. Octave will not be able to call Java methods.]) + break + else +AC_MSG_RESULT([$JAVA_LDPATH]) + fi + +AC_MSG_CHECKING([for include file <jni.h>]) + +## Java and JVM found. Set up flags. + case $host_os in + darwin*) +## Sneak the -framework flag into mkoctfile via LDFLAGS + LDFLAGS="$LDFLAGS -framework JavaVM" +## According to: http://developer.apple.com/unix/crossplatform.html +## one must explicitly set the include path. +## Unfortunately, the include path keeps moving around. + if test -n "$JAVA_CPPFLAGS"; then + JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}" + else + JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I/System/Library/Frameworks/JavaVM.framework/Home/include -I/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers" + fi + JAVA_LIBS="-framework JavaVM" + ;; + mingw* | cygwin*) + if test -n "$JAVA_CPPFLAGS"; then + JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}/include -I${JAVA_CPPFLAGS}/include/win32" + else + JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/win32" + fi + JAVA_LIBS=-ladvapi32 + LDFLAGS="$LDFLAGS -Wl,--export-all-symbols" + ;; + *) + if test -n "$JAVA_CPPFLAGS"; then + JAVA_CPPFLAGS="-I${JAVA_CPPFLAGS}/include -I${JAVA_CPPFLAGS}/include/linux" + else + JAVA_CPPFLAGS="-I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux" + fi + ;; + esac + +## Verify jni.h include file exists. + JNI_PATH=`echo $JAVA_CPPFLAGS | sed -e 's/-I//g'` + have_jni=no + for dir in $JNI_PATH; do + if test -f "${dir}/jni.h"; then have_jni=yes; break; fi + done + if test $have_jni = yes; then +AC_MSG_RESULT([$dir]) + else + AC_MSG_RESULT([not found]) +AC_MSG_WARN([Include file <jni.h> not found. Octave will not be able to call Java methods.]) + break + fi + +## Passed all configuration tests. A workable Java installation was found. + build_java=yes +AC_DEFINE(HAVE_JAVA, 1, + [Define to 1 if Java is available and is at least version 1.5]) + break + done + + AM_CONDITIONAL([AMCOND_HAVE_JAVA], [test $build_java = yes]) + AC_SUBST(JAVA) + AC_SUBST(JAVAC) + AC_SUBST(JAR) + AC_SUBST(JAVA_CPPFLAGS) AC_SUBST(JAVA_LIBS) -AC_DEFINE_UNQUOTED([JAVA_HOME], ["$JAVA_HOME"], [Java home (top-level installation dir)]) -AC_DEFINE_UNQUOTED([JAVA_LDPATH], ["$JAVA_LDPATH"], [Java library path (libjvm)]) + AC_DEFINE_UNQUOTED([JAVA_HOME], ["$JAVA_HOME"], [Java home (top-level installation dir)]) + AC_DEFINE_UNQUOTED([JAVA_LDPATH], ["$JAVA_LDPATH"], [Java library path (libjvm)]) ### GUI/Qt related tests. -QT_CPPFLAGS= -QT_LDFLAGS= -QT_LIBS= -win32_terminal=no -build_gui=yes -AC_ARG_ENABLE([gui], - [AS_HELP_STRING([--disable-gui], [don't build the GUI])], - [if test "$enableval" = no; then build_gui=no; fi], []) - -if test $build_gui = yes; then - ## Check for Qt libraries - PKG_CHECK_MODULES(QT, [QtCore, QtGui, QtNetwork], - [], - [AC_MSG_WARN([Qt libraries not found -- disabling GUI]) - build_gui=no]) - - if test $build_gui = yes; then - ## Retrieve Qt compilation and linker flags - QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I QtCore QtGui QtNetwork`" - QT_LDFLAGS="`$PKG_CONFIG --libs-only-L QtCore QtGui QtNetwork`" - QT_LIBS="`$PKG_CONFIG --libs-only-l QtCore QtGui QtNetwork`" - - ## Check for Qt4 - if ! `$PKG_CONFIG --atleast-version=4.0.0 QtCore`; then - AC_MSG_WARN([Qt >= 4.0.0 not found -- disabling GUI]) - build_gui=no - fi - fi - - if test $build_gui = yes; then - AC_CHECK_TOOLS(MOC, [moc-qt5 moc-qt4 moc]) - AC_CHECK_TOOLS(UIC, [uic-qt5 uic-qt4 uic]) - AC_CHECK_TOOLS(RCC, [rcc]) - AC_CHECK_TOOLS(LRELEASE, [lrelease-qt5 lrelease-qt4 lrelease]) - if test -n "$MOC" && test -n "$UIC" && test -n "$RCC" && test -n "$LRELEASE"; then - AC_DEFINE(HAVE_QT, 1, - [Define to 1 if Qt is available (libraries, developer header files, utility programs (moc, uic, rcc, and lrelease))]) - else - AC_MSG_WARN([Qt utility programs moc, uic, rcc, and lrelease not found -- disabling GUI]) - build_gui=no - fi - fi - - if test $build_gui = yes; then - OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL - if test $octave_cv_func_qabstractitemmodel_beginresetmodel = no; then - AC_MSG_WARN([QAbstractItemModel::beginResetModel() not found -- disabling GUI]) - build_gui=no - fi - fi - - if test $build_gui = yes; then - OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT - fi - - if test $build_gui = yes; then - ## Check for Qscintilla library which is used in the GUI editor. - AC_CACHE_CHECK([whether Qscintilla library is installed], - [octave_cv_lib_qscintilla], - [save_CPPFLAGS="$CPPFLAGS" - save_LDFLAGS="$LDFLAGS" - save_LIBS="$LIBS" - CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" - LDFLAGS="$QT_LDFLAGS $LDFLAGS" - LIBS="$QT_LIBS -lqscintilla2" - AC_LANG_PUSH(C++) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #include <Qsci/qscilexersql.h> - ]], [[ - QsciLexerSQL sqlLexer(0); - ]])], - octave_cv_lib_qscintilla=yes, - octave_cv_lib_qscintilla=no) - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - AC_LANG_POP([C++]) - ]) - if test $octave_cv_lib_qscintilla = no; then - AC_MSG_WARN([Qscintilla library not found -- disabling built-in GUI editor]) - else - ## Let's assume Qscintilla library is at the same location as - ## other regular Qt libraries. - QT_LIBS="$QT_LIBS -lqscintilla2" - OCTAVE_CHECK_VERSION_2_6_0 - AC_DEFINE(HAVE_QSCINTILLA, 1, - [Define to 1 if the QScintilla library and header files are available]) - - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" - AC_LANG_PUSH(C++) - AC_CHECK_HEADERS([Qsci/qscilexeroctave.h Qsci/qscilexermatlab.h]) - AC_LANG_POP(C++) - CPPFLAGS="$save_CPPFLAGS" - fi - - AC_CHECK_FUNCS([setlocale], [], - [AC_MSG_WARN([setlocale not found -- disabling GUI]) - build_gui=no]) - - if test $build_gui = yes; then - case $host_os in - mingw* | msdosmsvc*) - AC_CHECK_FUNCS([setvbuf], [win32_terminal=yes], - [AC_MSG_WARN([setvbuf not found -- disabling GUI]) - build_gui=no]) - ;; - *) - AC_CHECK_HEADERS([pty.h libutil.h util.h]) - AC_SEARCH_LIBS([openpty], [util], - [AC_DEFINE(HAVE_OPENPTY, [], [Define whether openpty exists])]) - AC_CHECK_FUNCS([chmod chown ftruncate mmap munmap], [], - [AC_MSG_ERROR([At least one of chmod, chown, ftruncate, mmap, and munmap not found -- disabling GUI]) - build_gui=no]) - ;; - esac - fi - fi -fi + QT_CPPFLAGS= + QT_LDFLAGS= + QT_LIBS= + win32_terminal=no + build_gui=yes + AC_ARG_ENABLE([gui], + [AS_HELP_STRING([--disable-gui], [don't build the GUI])], + [if test "$enableval" = no; then build_gui=no; fi], []) + + if test $build_gui = yes; then +## Check for Qt libraries +PKG_CHECK_MODULES(QT, [QtCore, QtGui, QtNetwork], + [], + [AC_MSG_WARN([Qt libraries not found -- disabling GUI]) + build_gui=no]) + + if test $build_gui = yes; then +## Retrieve Qt compilation and linker flags + QT_CPPFLAGS="`$PKG_CONFIG --cflags-only-I QtCore QtGui QtNetwork`" + QT_LDFLAGS="`$PKG_CONFIG --libs-only-L QtCore QtGui QtNetwork`" + QT_LIBS="`$PKG_CONFIG --libs-only-l QtCore QtGui QtNetwork`" + +## Check for Qt4 + if ! `$PKG_CONFIG --atleast-version=4.0.0 QtCore`; then +AC_MSG_WARN([Qt >= 4.0.0 not found -- disabling GUI]) + build_gui=no + fi + fi + + if test $build_gui = yes; then + AC_CHECK_TOOLS(MOC, [moc-qt5 moc-qt4 moc]) + AC_CHECK_TOOLS(UIC, [uic-qt5 uic-qt4 uic]) + AC_CHECK_TOOLS(RCC, [rcc]) +AC_CHECK_TOOLS(LRELEASE, [lrelease-qt5 lrelease-qt4 lrelease]) + if test -n "$MOC" && test -n "$UIC" && test -n "$RCC" && test -n "$LRELEASE"; then +AC_DEFINE(HAVE_QT, 1, + [Define to 1 if Qt is available (libraries, developer header files, utility programs (moc, uic, rcc, and lrelease))]) + else +AC_MSG_WARN([Qt utility programs moc, uic, rcc, and lrelease not found -- disabling GUI]) + build_gui=no + fi + fi + + if test $build_gui = yes; then + OCTAVE_CHECK_FUNC_QABSTRACTITEMMODEL_BEGINRESETMODEL + if test $octave_cv_func_qabstractitemmodel_beginresetmodel = no; then +AC_MSG_WARN([QAbstractItemModel::beginResetModel() not found -- disabling GUI]) + build_gui=no + fi + fi + + if test $build_gui = yes; then + OCTAVE_CHECK_FUNC_SETPLACEHOLDERTEXT + fi + + if test $build_gui = yes; then +## Check for Qscintilla library which is used in the GUI editor. + AC_CACHE_CHECK([whether Qscintilla library is installed], + [octave_cv_lib_qscintilla], + [save_CPPFLAGS="$CPPFLAGS" + save_LDFLAGS="$LDFLAGS" + save_LIBS="$LIBS" + CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" + LDFLAGS="$QT_LDFLAGS $LDFLAGS" + LIBS="$QT_LIBS -lqscintilla2" + AC_LANG_PUSH(C++) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ +#include <Qsci/qscilexersql.h> + ]], [[ + QsciLexerSQL sqlLexer(0); + ]])], + octave_cv_lib_qscintilla=yes, + octave_cv_lib_qscintilla=no) + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + AC_LANG_POP([C++]) + ]) + if test $octave_cv_lib_qscintilla = no; then +AC_MSG_WARN([Qscintilla library not found -- disabling built-in GUI editor]) + else +## Let's assume Qscintilla library is at the same location as +## other regular Qt libraries. + QT_LIBS="$QT_LIBS -lqscintilla2" + OCTAVE_CHECK_VERSION_2_6_0 +AC_DEFINE(HAVE_QSCINTILLA, 1, + [Define to 1 if the QScintilla library and header files are available]) + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$QT_CPPFLAGS $CPPFLAGS" + AC_LANG_PUSH(C++) + AC_CHECK_HEADERS([Qsci/qscilexeroctave.h Qsci/qscilexermatlab.h]) +AC_LANG_POP(C++) + CPPFLAGS="$save_CPPFLAGS" + fi + +AC_CHECK_FUNCS([setlocale], [], + [AC_MSG_WARN([setlocale not found -- disabling GUI]) + build_gui=no]) + + if test $build_gui = yes; then + case $host_os in + mingw* | msdosmsvc*) +AC_CHECK_FUNCS([setvbuf], [win32_terminal=yes], + [AC_MSG_WARN([setvbuf not found -- disabling GUI]) + build_gui=no]) + ;; + *) + AC_CHECK_HEADERS([pty.h libutil.h util.h]) +AC_SEARCH_LIBS([openpty], [util], + [AC_DEFINE(HAVE_OPENPTY, [], [Define whether openpty exists])]) +AC_CHECK_FUNCS([chmod chown ftruncate mmap munmap], [], + [AC_MSG_ERROR([At least one of chmod, chown, ftruncate, mmap, and munmap not found -- disabling GUI]) + build_gui=no]) + ;; + esac + fi + fi + fi AM_CONDITIONAL([AMCOND_BUILD_GUI], [test $build_gui = yes]) -AM_CONDITIONAL([AMCOND_HAVE_QSCINTILLA], [test "$octave_cv_lib_qscintilla" = yes]) -AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes]) -AC_SUBST(QT_CPPFLAGS) -AC_SUBST(QT_LDFLAGS) + AM_CONDITIONAL([AMCOND_HAVE_QSCINTILLA], [test "$octave_cv_lib_qscintilla" = yes]) + AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes]) + AC_SUBST(QT_CPPFLAGS) + AC_SUBST(QT_LDFLAGS) AC_SUBST(QT_LIBS) ### Run configure in subdirectories. -export CC -export CXX -export F77 - -AH_BOTTOM([#include "oct-conf-post.h"]) + export CC + export CXX + export F77 + + AH_BOTTOM([#include "oct-conf-post.h"]) ### Make all AC_DEFINES available to testif feature of test.m function. ### This must reside at the bottom of configure.ac after all AC_DEFINES ### have been made. -AC_OUTPUT_MAKE_DEFS + AC_OUTPUT_MAKE_DEFS ### Do the substitutions in all the Makefiles. -AC_SUBST(ac_config_files) + AC_SUBST(ac_config_files) AC_SUBST(ac_config_headers) -AC_CONFIG_FILES([ - oct-conf-post.h:oct-conf-post.in.h - Makefile - doc/Makefile - doc/doxyhtml/Makefile - doc/doxyhtml/Doxyfile - doc/icons/Makefile - doc/interpreter/Makefile - doc/liboctave/Makefile - doc/refcard/Makefile - examples/Makefile - libgnu/Makefile - libgui/Makefile - libinterp/Makefile - liboctave/Makefile - liboctave/cruft/Makefile - liboctave/cruft/mkf77def - scripts/Makefile - src/Makefile - test/Makefile]) - -AC_OUTPUT + AC_CONFIG_FILES([ + oct-conf-post.h:oct-conf-post.in.h + Makefile + doc/Makefile + doc/doxyhtml/Makefile + doc/doxyhtml/Doxyfile + doc/icons/Makefile + doc/interpreter/Makefile + doc/liboctave/Makefile + doc/refcard/Makefile + examples/Makefile + libgnu/Makefile + libgui/Makefile + libinterp/Makefile + liboctave/Makefile + liboctave/cruft/Makefile + liboctave/cruft/mkf77def + scripts/Makefile + src/Makefile + test/Makefile]) + + AC_OUTPUT ### Print a summary so that important information isn't missed. -AC_MSG_NOTICE([ - -Octave is now configured for $canonical_host_type - - Source directory: $srcdir - Installation prefix: $prefix - C compiler: $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS - C++ compiler: $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS - Fortran compiler: $F77 $FFLAGS - Fortran libraries: $FLIBS - Lex libraries: $LEXLIB - LIBS: $LIBS - - AMD CPPFLAGS: $AMD_CPPFLAGS - AMD LDFLAGS: $AMD_LDFLAGS - AMD libraries: $AMD_LIBS - ARPACK CPPFLAGS: $ARPACK_CPPFLAGS - ARPACK LDFLAGS: $ARPACK_LDFLAGS - ARPACK libraries: $ARPACK_LIBS - BLAS libraries: $BLAS_LIBS - CAMD CPPFLAGS: $CAMD_CPPFLAGS - CAMD LDFLAGS: $CAMD_LDFLAGS - CAMD libraries: $CAMD_LIBS - CARBON libraries: $CARBON_LIBS - CCOLAMD CPPFLAGS: $CCOLAMD_CPPFLAGS - CCOLAMD LDFLAGS: $CCOLAMD_LDFLAGS - CCOLAMD libraries: $CCOLAMD_LIBS - CHOLMOD CPPFLAGS: $CHOLMOD_CPPFLAGS - CHOLMOD LDFLAGS: $CHOLMOD_LDFLAGS - CHOLMOD libraries: $CHOLMOD_LIBS - COLAMD CPPFLAGS: $COLAMD_CPPFLAGS - COLAMD LDFLAGS: $COLAMD_LDFLAGS - COLAMD libraries: $COLAMD_LIBS - CURL CPPFLAGS: $CURL_CPPFLAGS - CURL LDFLAGS: $CURL_LDFLAGS - CURL libraries: $CURL_LIBS - CXSPARSE CPPFLAGS: $CXSPARSE_CPPFLAGS - CXSPARSE LDFLAGS: $CXSPARSE_LDFLAGS - CXSPARSE libraries: $CXSPARSE_LIBS - DL libraries: $DL_LIBS - FFTW3 CPPFLAGS: $FFTW3_CPPFLAGS - FFTW3 LDFLAGS: $FFTW3_LDFLAGS - FFTW3 libraries: $FFTW3_LIBS - FFTW3F CPPFLAGS: $FFTW3F_CPPFLAGS - FFTW3F LDFLAGS: $FFTW3F_LDFLAGS - FFTW3F libraries: $FFTW3F_LIBS - fontconfig CFLAGS: $FONTCONFIG_CFLAGS - fontconfig libraries: $FONTCONFIG_LIBS - FreeType2 CFLAGS: $FT2_CFLAGS - FreeType2 libraries: $FT2_LIBS - GLPK CPPFLAGS: $GLPK_CPPFLAGS - GLPK LDFLAGS: $GLPK_LDFLAGS - GLPK libraries: $GLPK_LIBS - graphics CFLAGS: $GRAPHICS_CFLAGS - graphics libraries: $GRAPHICS_LIBS - HDF5 CPPFLAGS: $HDF5_CPPFLAGS - HDF5 LDFLAGS: $HDF5_LDFLAGS - HDF5 libraries: $HDF5_LIBS - Java home: $JAVA_HOME - Java JVM path: $JAVA_LDPATH - Java CPPFLAGS: $JAVA_CPPFLAGS - Java libraries: $JAVA_LIBS - LAPACK libraries: $LAPACK_LIBS - LLVM CPPFLAGS: $LLVM_CPPFLAGS - LLVM LDFLAGS: $LLVM_LDFLAGS - LLVM libraries: $LLVM_LIBS - Magick++ CPPFLAGS: $MAGICK_CPPFLAGS - Magick++ LDFLAGS: $MAGICK_LDFLAGS - Magick++ libraries: $MAGICK_LIBS - OPENGL libraries: $OPENGL_LIBS - PTHREAD flags: $PTHREAD_CFLAGS - PTHREAD libraries: $PTHREAD_LIBS - QHULL CPPFLAGS: $QHULL_CPPFLAGS - QHULL LDFLAGS: $QHULL_LDFLAGS - QHULL libraries: $QHULL_LIBS - QRUPDATE CPPFLAGS: $QRUPDATE_CPPFLAGS - QRUPDATE LDFLAGS: $QRUPDATE_LDFLAGS - QRUPDATE libraries: $QRUPDATE_LIBS - Qt CPPFLAGS: $QT_CPPFLAGS - Qt LDFLAGS: $QT_LDFLAGS - Qt libraries: $QT_LIBS - READLINE libraries: $READLINE_LIBS - REGEX libraries: $REGEX_LIBS - TERM libraries: $TERM_LIBS - UMFPACK CPPFLAGS: $UMFPACK_CPPFLAGS - UMFPACK LDFLAGS: $UMFPACK_LDFLAGS - UMFPACK libraries: $UMFPACK_LIBS - X11 include flags: $X11_INCFLAGS - X11 libraries: $X11_LIBS - Z CPPFLAGS: $Z_CPPFLAGS - Z LDFLAGS: $Z_LDFLAGS - Z libraries: $Z_LIBS - - Default pager: $DEFAULT_PAGER - gnuplot: $GNUPLOT - - Build Octave GUI: $build_gui - JIT compiler for loops: $build_jit - Build Java interface: $build_java - Do internal array bounds checking: $BOUNDS_CHECKING - Use octave_allocator: $USE_OCTAVE_ALLOCATOR - Build static libraries: $STATIC_LIBS - Build shared libraries: $SHARED_LIBS - Dynamic Linking: $ENABLE_DYNAMIC_LINKING $DL_API_MSG - Include support for GNU readline: $USE_READLINE - 64-bit array dims and indexing: $USE_64_BIT_IDX_T -]) - -warn_msg_printed=false - -OCTAVE_CONFIGURE_WARNING_SUMMARY - -if test $ENABLE_DYNAMIC_LINKING = yes; then - if test $SHARED_LIBS = no; then - AC_MSG_WARN([You used --enable-dl but not --enable-shared.]) - AC_MSG_WARN([Are you sure that is what you want to do?]) - warn_msg_printed=true - fi -fi - -if test $USE_64_BIT_IDX_T = yes; then - AC_MSG_WARN([]) - AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.]) - AC_MSG_WARN([Are you sure that is what you want to do?]) - AC_MSG_WARN([]) - AC_MSG_WARN([Your Fortran compiler must have an option to generate]) - AC_MSG_WARN([code with 8 byte signed INTEGER values. This option]) - AC_MSG_WARN([should be specified in the F77_INTEGER_8_FLAG variable]) - AC_MSG_WARN([Make. This should work automatically for gfortran. If]) - AC_MSG_WARN([you use another compiler, you will need to set this]) - AC_MSG_WARN([variable on the configure command line. You must also]) - AC_MSG_WARN([compile the ARPACK, BLAS, LAPACK, QRUPDATE, and SuiteSparse]) - AC_MSG_WARN([libraries to use 8 byte signed integers for array indexing.]) - AC_MSG_WARN([]) - warn_msg_printed=true -fi - -if test $USE_OPENMP = yes; then - AC_MSG_WARN([]) - AC_MSG_WARN([You used the EXPERIMENTAL --enable-openmp option.]) - AC_MSG_WARN([Are you sure that is what you want to do?]) - AC_MSG_WARN([]) - AC_MSG_WARN([This option enables experimental SMP multithreding]) - AC_MSG_WARN([code that has had very little testing. There is no]) - AC_MSG_WARN([certainity that the results returned by Octave with]) - AC_MSG_WARN([this option enabled will be correct.]) - AC_MSG_WARN([]) - warn_msg_printed=true -fi - -if test $native_graphics != yes; then - AC_MSG_WARN([]) - AC_MSG_WARN([I didn't find the necessary libraries to compile native]) - AC_MSG_WARN([graphics. It isn't necessary to have native graphics,]) - AC_MSG_WARN([but you will need to have gnuplot installed or you won't]) - AC_MSG_WARN([be able to use any of Octave's plotting commands]) - AC_MSG_WARN([]) - warn_msg_printed=true -fi - -if test -n "$warn_gnuplot"; then - if test $native_graphics = yes; then - AC_MSG_WARN([]) - AC_MSG_WARN([I didn't find gnuplot. Plotting commands will use the]) - AC_MSG_WARN([native graphics toolkit.]) - else - AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) - AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) - AC_MSG_WARN([plotting commands without it.]) - fi - AC_MSG_WARN([]) - AC_MSG_WARN([If gnuplot is installed, but isn't in your path, you can]) - AC_MSG_WARN([tell Octave where to find it by using the gnuplot_binary]) - AC_MSG_WARN([function. For example,]) - AC_MSG_WARN([]) - AC_MSG_WARN([gnuplot_binary ("/full/path/and/name/of/gnuplot/binary")]) - AC_MSG_WARN([]) - AC_MSG_WARN([at the Octave prompt.]) - AC_MSG_WARN([]) - AC_MSG_WARN([Setting default value to $GNUPLOT]) - AC_MSG_WARN([]) - - warn_msg_printed=true -fi - -if test $USE_ATOMIC_REFCOUNT = yes; then - AC_MSG_WARN([]) - AC_MSG_WARN([Using atomic reference counting.]) - AC_MSG_WARN([This feature allows access to Octave data safely from]) - AC_MSG_WARN([another thread, for instance from a GUI. However this]) - AC_MSG_WARN([results in a small performance penalty in the Octave]) - AC_MSG_WARN([interpreter.]) - AC_MSG_WARN([]) - if test $USE_OCTAVE_ALLOCATOR = yes; then - AC_MSG_WARN([Thread-safe behavior is not guaranteed unless you also]) - AC_MSG_WARN([disable the use of the octave_allocator class.]) - AC_MSG_WARN([]) - fi - warn_msg_printed=true -fi - -if $warn_msg_printed; then - AC_MSG_NOTICE([]) - AC_MSG_NOTICE([NOTE: Libraries or auxiliary programs may be skipped if they are]) - AC_MSG_NOTICE([NOTE: not found OR if they are missing required features on your]) - AC_MSG_NOTICE([NOTE: system. ]) -fi + AC_MSG_NOTICE([ + + Octave is now configured for $canonical_host_type + + Source directory: $srcdir + Installation prefix: $prefix + C compiler: $CC $XTRA_CFLAGS $WARN_CFLAGS $CFLAGS + C++ compiler: $CXX $XTRA_CXXFLAGS $WARN_CXXFLAGS $CXXFLAGS + Fortran compiler: $F77 $FFLAGS + Fortran libraries: $FLIBS + Lex libraries: $LEXLIB + LIBS: $LIBS + + AMD CPPFLAGS: $AMD_CPPFLAGS + AMD LDFLAGS: $AMD_LDFLAGS + AMD libraries: $AMD_LIBS + ARPACK CPPFLAGS: $ARPACK_CPPFLAGS + ARPACK LDFLAGS: $ARPACK_LDFLAGS + ARPACK libraries: $ARPACK_LIBS + BLAS libraries: $BLAS_LIBS + CAMD CPPFLAGS: $CAMD_CPPFLAGS + CAMD LDFLAGS: $CAMD_LDFLAGS + CAMD libraries: $CAMD_LIBS + CARBON libraries: $CARBON_LIBS + CCOLAMD CPPFLAGS: $CCOLAMD_CPPFLAGS + CCOLAMD LDFLAGS: $CCOLAMD_LDFLAGS + CCOLAMD libraries: $CCOLAMD_LIBS + CHOLMOD CPPFLAGS: $CHOLMOD_CPPFLAGS + CHOLMOD LDFLAGS: $CHOLMOD_LDFLAGS + CHOLMOD libraries: $CHOLMOD_LIBS + COLAMD CPPFLAGS: $COLAMD_CPPFLAGS + COLAMD LDFLAGS: $COLAMD_LDFLAGS + COLAMD libraries: $COLAMD_LIBS + CURL CPPFLAGS: $CURL_CPPFLAGS + CURL LDFLAGS: $CURL_LDFLAGS + CURL libraries: $CURL_LIBS + CXSPARSE CPPFLAGS: $CXSPARSE_CPPFLAGS + CXSPARSE LDFLAGS: $CXSPARSE_LDFLAGS + CXSPARSE libraries: $CXSPARSE_LIBS + DL libraries: $DL_LIBS + FFTW3 CPPFLAGS: $FFTW3_CPPFLAGS + FFTW3 LDFLAGS: $FFTW3_LDFLAGS + FFTW3 libraries: $FFTW3_LIBS + FFTW3F CPPFLAGS: $FFTW3F_CPPFLAGS + FFTW3F LDFLAGS: $FFTW3F_LDFLAGS + FFTW3F libraries: $FFTW3F_LIBS + fontconfig CFLAGS: $FONTCONFIG_CFLAGS + fontconfig libraries: $FONTCONFIG_LIBS + FreeType2 CFLAGS: $FT2_CFLAGS + FreeType2 libraries: $FT2_LIBS + GLPK CPPFLAGS: $GLPK_CPPFLAGS + GLPK LDFLAGS: $GLPK_LDFLAGS + GLPK libraries: $GLPK_LIBS + graphics CFLAGS: $GRAPHICS_CFLAGS + graphics libraries: $GRAPHICS_LIBS + HDF5 CPPFLAGS: $HDF5_CPPFLAGS + HDF5 LDFLAGS: $HDF5_LDFLAGS + HDF5 libraries: $HDF5_LIBS + Java home: $JAVA_HOME + Java JVM path: $JAVA_LDPATH + Java CPPFLAGS: $JAVA_CPPFLAGS + Java libraries: $JAVA_LIBS + LAPACK libraries: $LAPACK_LIBS + LLVM CPPFLAGS: $LLVM_CPPFLAGS + LLVM LDFLAGS: $LLVM_LDFLAGS + LLVM libraries: $LLVM_LIBS + Magick++ CPPFLAGS: $MAGICK_CPPFLAGS + Magick++ LDFLAGS: $MAGICK_LDFLAGS + Magick++ libraries: $MAGICK_LIBS + OPENGL libraries: $OPENGL_LIBS + PTHREAD flags: $PTHREAD_CFLAGS + PTHREAD libraries: $PTHREAD_LIBS + QHULL CPPFLAGS: $QHULL_CPPFLAGS + QHULL LDFLAGS: $QHULL_LDFLAGS + QHULL libraries: $QHULL_LIBS + QRUPDATE CPPFLAGS: $QRUPDATE_CPPFLAGS + QRUPDATE LDFLAGS: $QRUPDATE_LDFLAGS + QRUPDATE libraries: $QRUPDATE_LIBS + Qt CPPFLAGS: $QT_CPPFLAGS + Qt LDFLAGS: $QT_LDFLAGS + Qt libraries: $QT_LIBS + READLINE libraries: $READLINE_LIBS + REGEX libraries: $REGEX_LIBS + TERM libraries: $TERM_LIBS + UMFPACK CPPFLAGS: $UMFPACK_CPPFLAGS + UMFPACK LDFLAGS: $UMFPACK_LDFLAGS + UMFPACK libraries: $UMFPACK_LIBS + X11 include flags: $X11_INCFLAGS + X11 libraries: $X11_LIBS + Z CPPFLAGS: $Z_CPPFLAGS + Z LDFLAGS: $Z_LDFLAGS + Z libraries: $Z_LIBS + PNG CPPFLAGS: $PNG_CPPFLAGS + PNG LDFLAGS: $PNG_LDFLAGS + PNG libraries: $PNG_LIBS + + Default pager: $DEFAULT_PAGER + gnuplot: $GNUPLOT + + Build Octave GUI: $build_gui + JIT compiler for loops: $build_jit + Build Java interface: $build_java + Do internal array bounds checking: $BOUNDS_CHECKING + Use octave_allocator: $USE_OCTAVE_ALLOCATOR + Build static libraries: $STATIC_LIBS + Build shared libraries: $SHARED_LIBS + Dynamic Linking: $ENABLE_DYNAMIC_LINKING $DL_API_MSG + Include support for GNU readline: $USE_READLINE + 64-bit array dims and indexing: $USE_64_BIT_IDX_T + ]) + + warn_msg_printed=false + + OCTAVE_CONFIGURE_WARNING_SUMMARY + + if test $ENABLE_DYNAMIC_LINKING = yes; then + if test $SHARED_LIBS = no; then + AC_MSG_WARN([You used --enable-dl but not --enable-shared.]) +AC_MSG_WARN([Are you sure that is what you want to do?]) + warn_msg_printed=true + fi + fi + + if test $USE_64_BIT_IDX_T = yes; then + AC_MSG_WARN([]) + AC_MSG_WARN([You used the EXPERIMENTAL --enable-64 option.]) + AC_MSG_WARN([Are you sure that is what you want to do?]) + AC_MSG_WARN([]) + AC_MSG_WARN([Your Fortran compiler must have an option to generate]) + AC_MSG_WARN([code with 8 byte signed INTEGER values. This option]) + AC_MSG_WARN([should be specified in the F77_INTEGER_8_FLAG variable]) + AC_MSG_WARN([Make. This should work automatically for gfortran. If]) + AC_MSG_WARN([you use another compiler, you will need to set this]) + AC_MSG_WARN([variable on the configure command line. You must also]) + AC_MSG_WARN([compile the ARPACK, BLAS, LAPACK, QRUPDATE, and SuiteSparse]) + AC_MSG_WARN([libraries to use 8 byte signed integers for array indexing.]) +AC_MSG_WARN([]) + warn_msg_printed=true + fi + + if test $USE_OPENMP = yes; then + AC_MSG_WARN([]) + AC_MSG_WARN([You used the EXPERIMENTAL --enable-openmp option.]) + AC_MSG_WARN([Are you sure that is what you want to do?]) + AC_MSG_WARN([]) + AC_MSG_WARN([This option enables experimental SMP multithreding]) + AC_MSG_WARN([code that has had very little testing. There is no]) + AC_MSG_WARN([certainity that the results returned by Octave with]) + AC_MSG_WARN([this option enabled will be correct.]) +AC_MSG_WARN([]) + warn_msg_printed=true + fi + + if test $native_graphics != yes; then +AC_MSG_WARN([]) + AC_MSG_WARN([I didn't find the necessary libraries to compile native]) + AC_MSG_WARN([graphics. It isn't necessary to have native graphics,]) + AC_MSG_WARN([but you will need to have gnuplot installed or you won't]) + AC_MSG_WARN([be able to use any of Octave's plotting commands]) +AC_MSG_WARN([]) + warn_msg_printed=true + fi + + if test -n "$warn_gnuplot"; then + if test $native_graphics = yes; then +AC_MSG_WARN([]) + AC_MSG_WARN([I didn't find gnuplot. Plotting commands will use the]) +AC_MSG_WARN([native graphics toolkit.]) + else + AC_MSG_WARN([I didn't find gnuplot. It isn't necessary to have gnuplot]) + AC_MSG_WARN([installed, but you won't be able to use any of Octave's]) +AC_MSG_WARN([plotting commands without it.]) + fi +AC_MSG_WARN([]) + AC_MSG_WARN([If gnuplot is installed, but isn't in your path, you can]) + AC_MSG_WARN([tell Octave where to find it by using the gnuplot_binary]) + AC_MSG_WARN([function. For example,]) +AC_MSG_WARN([]) + AC_MSG_WARN([gnuplot_binary ("/full/path/and/name/of/gnuplot/binary")]) + AC_MSG_WARN([]) + AC_MSG_WARN([at the Octave prompt.]) + AC_MSG_WARN([]) + AC_MSG_WARN([Setting default value to $GNUPLOT]) +AC_MSG_WARN([]) + + warn_msg_printed=true + fi + + if test $USE_ATOMIC_REFCOUNT = yes; then + AC_MSG_WARN([]) + AC_MSG_WARN([Using atomic reference counting.]) + AC_MSG_WARN([This feature allows access to Octave data safely from]) + AC_MSG_WARN([another thread, for instance from a GUI. However this]) + AC_MSG_WARN([results in a small performance penalty in the Octave]) + AC_MSG_WARN([interpreter.]) +AC_MSG_WARN([]) + if test $USE_OCTAVE_ALLOCATOR = yes; then + AC_MSG_WARN([Thread-safe behavior is not guaranteed unless you also]) + AC_MSG_WARN([disable the use of the octave_allocator class.]) +AC_MSG_WARN([]) + fi + warn_msg_printed=true + fi + + if $warn_msg_printed; then + AC_MSG_NOTICE([]) + AC_MSG_NOTICE([NOTE: Libraries or auxiliary programs may be skipped if they are]) + AC_MSG_NOTICE([NOTE: not found OR if they are missing required features on your]) +AC_MSG_NOTICE([NOTE: system. ]) + fi ### End of configure.
--- a/libinterp/Makefile.am +++ b/libinterp/Makefile.am @@ -38,6 +38,8 @@ AM_CXXFLAGS += $(WARN_CXXFLAGS) + + octlib_LTLIBRARIES = liboctinterp.la ## Order matters here. Leave builtins.cc last, because it depends on @@ -108,7 +110,7 @@ parse-tree/oct-gperf.h \ builtins.h \ builtin-defun-decls.h \ - octave.h \ + octave.h \ $(OCTAVE_VALUE_INC) \ $(PARSE_TREE_INC) \ $(PARSER_INC) \
--- a/libinterp/corefcn/gl-render.cc +++ b/libinterp/corefcn/gl-render.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2008-2012 Michael Goffioul - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ + Copyright (C) 2008-2012 Michael Goffioul + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -33,6 +33,7 @@ #include "oct-refcount.h" #include "gl-render.h" #include "txt-eng.h" +#include "txt-render.h" #include "txt-eng-ft.h" #define LIGHT_MODE GL_FRONT_AND_BACK @@ -55,17 +56,17 @@ { protected: class texture_rep - { + { public: texture_rep (void) : id (), w (), h (), tw (), th (), tx (), ty (), - valid (false), count (1) - { } + valid (false), count (1) + { } texture_rep (GLuint id_arg, int w_arg, int h_arg, int tw_arg, int th_arg) - : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg), - tx (double(w)/tw), ty (double(h)/th), valid (true), - count (1) { } + : id (id_arg), w (w_arg), h (h_arg), tw (tw_arg), th (th_arg), + tx (double(w)/tw), ty (double(h)/th), valid (true), + count (1) { } ~texture_rep (void) { @@ -85,7 +86,7 @@ double tx, ty; bool valid; octave_refcount<int> count; - }; + }; texture_rep *rep; @@ -96,7 +97,7 @@ opengl_texture (void) : rep (new texture_rep ()) { } opengl_texture (const opengl_texture& tx) - : rep (tx.rep) + : rep (tx.rep) { rep->count++; } @@ -333,7 +334,7 @@ { public: class vertex_data_rep - { + { public: Matrix coords; Matrix color; @@ -349,14 +350,14 @@ vertex_data_rep (void) : coords (), color (), normal (), alpha (), - ambient (), diffuse (), specular (), specular_exp (),count (1) { } + ambient (), diffuse (), specular (), specular_exp (),count (1) { } vertex_data_rep (const Matrix& c, const Matrix& col, const Matrix& n, double a, float as, float ds, float ss, float se) - : coords (c), color (col), normal (n), alpha (a), - ambient (as), diffuse (ds), specular (ss), specular_exp (se), - count (1) { } - }; + : coords (c), color (col), normal (n), alpha (a), + ambient (as), diffuse (ds), specular (ss), specular_exp (se), + count (1) { } + }; private: vertex_data_rep *rep; @@ -370,18 +371,18 @@ public: vertex_data (void) : rep (nil_rep ()) - { rep->count++; } + { rep->count++; } vertex_data (const vertex_data& v) : rep (v.rep) - { rep->count++; } + { rep->count++; } vertex_data (const Matrix& c, const Matrix& col, const Matrix& n, double a, float as, float ds, float ss, float se) - : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se)) + : rep (new vertex_data_rep (c, col, n, a, as, ds, ss, se)) { } vertex_data (vertex_data_rep *new_rep) - : rep (new_rep) { } + : rep (new_rep) { } ~vertex_data (void) { @@ -408,9 +409,9 @@ { public: patch_tesselator (opengl_renderer *r, int cmode, int lmode, int idx = 0) - : opengl_tesselator (), renderer (r), - color_mode (cmode), light_mode (lmode), index (idx), - first (true), tmp_vdata () + : opengl_tesselator (), renderer (r), + color_mode (cmode), light_mode (lmode), index (idx), + first (true), tmp_vdata () { } protected: @@ -440,7 +441,7 @@ void vertex (void *data) { vertex_data::vertex_data_rep *v - = reinterpret_cast<vertex_data::vertex_data_rep *> (data); + = reinterpret_cast<vertex_data::vertex_data_rep *> (data); //printf ("patch_tesselator::vertex (%g, %g, %g)\n", v->coords(0), v->coords(1), v->coords(2)); // FIXME: why did I need to keep the first vertex of the face @@ -1118,7 +1119,7 @@ int wmax = 0, hmax = 0; bool tick_along_z = nearhoriz || xisinf (fx); bool mirror = props.is_box () && ystate != AXE_ANY_DIR - && (! props.has_property ("__plotyy_axes__")); + && (! props.has_property ("__plotyy_axes__")); set_color (props.get_ycolor_rgb ()); @@ -2228,7 +2229,7 @@ } vdata[i+j*fr] = - vertex_data (vv, cc, nn, aa, as, ds, ss, se); + vertex_data (vv, cc, nn, aa, as, ds, ss, se); } if (fl_mode > 0 || el_mode > 0) @@ -2407,11 +2408,11 @@ // Single color specifications, we can simplify a little bit if (mfcolor.numel () == 0 - && ! props.markerfacecolor_is ("none")) + && ! props.markerfacecolor_is ("none")) mfcolor = mc; if (mecolor.numel () == 0 - && ! props.markeredgecolor_is ("none")) + && ! props.markeredgecolor_is ("none")) mecolor = mc; } else @@ -2419,7 +2420,7 @@ if (c.numel () == 0) c = props.get_color_data ().matrix_value (); has_markerfacecolor = ((c.numel () > 0) - && (c.rows () == f.rows ())); + && (c.rows () == f.rows ())); } } @@ -2895,14 +2896,14 @@ glEnd (); break; case '.': - { - double ang_step = M_PI / 5; - - glBegin (GL_POLYGON); - for (double ang = 0; ang < (2*M_PI); ang += ang_step) - glVertex2d (sz*cos (ang)/3, sz*sin (ang)/3); - glEnd (); - } + { + double ang_step = M_PI / 5; + + glBegin (GL_POLYGON); + for (double ang = 0; ang < (2*M_PI); ang += ang_step) + glVertex2d (sz*cos (ang)/3, sz*sin (ang)/3); + glEnd (); + } break; case 's': glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); @@ -2913,14 +2914,14 @@ glEnd (); break; case 'o': - { - double ang_step = M_PI / 5; - - glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); - for (double ang = 0; ang < (2*M_PI); ang += ang_step) - glVertex2d (sz*cos (ang)/2, sz*sin (ang)/2); - glEnd (); - } + { + double ang_step = M_PI / 5; + + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); + for (double ang = 0; ang < (2*M_PI); ang += ang_step) + glVertex2d (sz*cos (ang)/2, sz*sin (ang)/2); + glEnd (); + } break; case 'd': glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); @@ -2959,36 +2960,36 @@ glEnd (); break; case 'p': - { - double ang; - double r; - double dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02; - - glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); - for (int i = 0; i < 2*5; i++) - { - ang = (-0.5 + double(i+1)/5) * M_PI; - r = 1.0 - (dr * fmod (double(i+1), 2.0)); - glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); - } - glEnd (); - } + { + double ang; + double r; + double dr = 1.0 - sin (M_PI/10)/sin (3*M_PI/10)*1.02; + + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); + for (int i = 0; i < 2*5; i++) + { + ang = (-0.5 + double(i+1)/5) * M_PI; + r = 1.0 - (dr * fmod (double(i+1), 2.0)); + glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); + } + glEnd (); + } break; case 'h': - { - double ang; - double r; - double dr = 1.0 - 0.5/sin (M_PI/3)*1.02; - - glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); - for (int i = 0; i < 2*6; i++) - { - ang = (0.5 + double(i+1)/6.0) * M_PI; - r = 1.0 - (dr * fmod (double(i+1), 2.0)); - glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); - } - glEnd (); - } + { + double ang; + double r; + double dr = 1.0 - 0.5/sin (M_PI/3)*1.02; + + glBegin ((filled ? GL_POLYGON : GL_LINE_LOOP)); + for (int i = 0; i < 2*6; i++) + { + ang = (0.5 + double(i+1)/6.0) * M_PI; + r = 1.0 - (dr * fmod (double(i+1), 2.0)); + glVertex2d (sz*r*cos (ang)/2, sz*r*sin (ang)/2); + } + glEnd (); + } break; default: warning ("opengl_renderer: unsupported marker '%s'", @@ -3007,18 +3008,15 @@ Matrix& bbox, int halign, int valign, double rotation) { -#if HAVE_FREETYPE text_renderer.text_to_pixels (txt, pixels, bbox, - halign, valign, rotation, "none"); -#endif + halign, valign, rotation); } Matrix opengl_renderer::render_text (const std::string& txt, - double x, double y, double z, - int halign, int valign, double rotation) + double x, double y, double z, + int halign, int valign, double rotation) { -#if HAVE_FREETYPE if (txt.empty ()) return Matrix (1, 4, 0.0); @@ -3039,10 +3037,10 @@ glDisable (GL_BLEND); return bbox; -#else + ::warning ("render_text: cannot render text, Freetype library not available"); return Matrix (1, 4, 0.0); -#endif + } #endif
--- a/libinterp/corefcn/gl-render.h +++ b/libinterp/corefcn/gl-render.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2008-2012 Michael Goffioul + Copyright (C) 2008-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if !defined (gl_render_h) #define gl_render_h 1 @@ -41,6 +41,7 @@ #endif #include "graphics.h" +#include "txt-render.h" #include "txt-eng-ft.h" class @@ -51,10 +52,7 @@ opengl_renderer (void) : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (), zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (), - camera_pos (), camera_dir () -#if HAVE_FREETYPE - , text_renderer () -#endif + camera_pos (), camera_dir (), text_renderer () { } virtual ~opengl_renderer (void) { } @@ -140,11 +138,8 @@ opengl_renderer (const opengl_renderer&) : toolkit (), xform (), xmin (), xmax (), ymin (), ymax (), zmin (), zmax (), xZ1 (), xZ2 (), marker_id (), filled_marker_id (), - camera_pos (), camera_dir () -#if HAVE_FREETYPE - , text_renderer () -#endif - { } + camera_pos (), camera_dir (), text_renderer () + { } opengl_renderer& operator = (const opengl_renderer&) { return *this; } @@ -199,10 +194,8 @@ // camera information for primitive sorting ColumnVector camera_pos, camera_dir; -#if HAVE_FREETYPE - // freetype render, used for text rendering - ft_render text_renderer; -#endif + // freetype or latex render, used for text rendering + text_render text_renderer; private: class patch_tesselator;
--- a/libinterp/corefcn/graphics.cc +++ b/libinterp/corefcn/graphics.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2007-2012 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ + Copyright (C) 2007-2012 John W. Eaton + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -57,6 +57,7 @@ #include "parse.h" #include "toplev.h" #include "txt-eng-ft.h" +#include "txt-render.h" #include "unwind-prot.h" // forward declarations @@ -579,7 +580,7 @@ if (ax.valid_object ()) { const axes::properties& ax_props = - dynamic_cast<const axes::properties&> (ax.get_properties ()); + dynamic_cast<const axes::properties&> (ax.get_properties ()); graphics_xform ax_xform = ax_props.get_transform (); bool is_rectangle = (pos.numel () == 4); Matrix ax_bbox = ax_props.get_boundingbox (true), @@ -756,7 +757,7 @@ do \ { \ ARRAY_T tmp = cdata. VAL_FN ## array_value (); \ - \ + \ convert_cdata_1 (is_scaled, clim_0, clim_1, cmapv, \ tmp.data (), lda, nc, av); \ } \ @@ -966,7 +967,7 @@ } radio_values::radio_values (const std::string& opt_string) - : default_val (), possible_vals () +: default_val (), possible_vals () { size_t beg = 0; size_t len = opt_string.length (); @@ -1120,7 +1121,7 @@ } else error ("invalid value for color property \"%s\"", - get_name ().c_str ()); + get_name ().c_str ()); } else if (val.is_numeric_type ()) { @@ -1141,7 +1142,7 @@ } else error ("invalid value for color property \"%s\"", - get_name ().c_str ()); + get_name ().c_str ()); } else error ("invalid value for color property \"%s\"", @@ -1259,8 +1260,8 @@ #define CHECK_ARRAY_EQUAL(T,F,A) \ { \ if (data.numel () == 1) \ - return data.F ## scalar_value () == \ - v.F ## scalar_value (); \ + return data.F ## scalar_value () == \ + v.F ## scalar_value (); \ else \ { \ /* Keep copy of array_value to allow sparse/bool arrays */ \ @@ -1273,8 +1274,8 @@ bool flag = true; \ \ for (int i = 0; flag && i < data.numel (); i++) \ - if (d1[i] != d2[i]) \ - flag = false; \ + if (d1[i] != d2[i]) \ + flag = false; \ \ return flag; \ } \ @@ -1495,7 +1496,7 @@ else if (type.compare ("any")) { octave_value val = - (args.length () > 0 ? args(0) : octave_value (Matrix ())); + (args.length () > 0 ? args(0) : octave_value (Matrix ())); retval = property (new any_property (name, h, val)); } @@ -1585,12 +1586,12 @@ graphics_object go; std::map<caseless_str, graphics_object>::const_iterator it = - dprop_obj_map.find (go_name); + dprop_obj_map.find (go_name); if (it == dprop_obj_map.end ()) { base_graphics_object *bgo = - make_graphics_object_from_type (go_name); + make_graphics_object_from_type (go_name); if (bgo) { @@ -1928,7 +1929,7 @@ } graphics_handle::graphics_handle (const octave_value& a) - : val (octave_NaN) +: val (octave_NaN) { if (a.is_empty ()) /* do nothing */; @@ -1986,7 +1987,7 @@ %! close (hf); %! assert (lw, 10); %! assert (mk, "x"); -*/ + */ // Set properties given in two cell arrays containing names and values. void @@ -1996,7 +1997,7 @@ if (names.numel () != values.columns ()) { error ("set: number of names must match number of value columns (%d != %d)", - names.numel (), values.columns ()); + names.numel (), values.columns ()); } octave_idx_type k = names.columns (); @@ -2057,7 +2058,7 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect -*/ + */ // Set properties given in a struct array void @@ -2068,7 +2069,7 @@ caseless_str name = m.keys ()[p]; octave_value val = octave_value (m.contents (name).elem (m.numel () - 1)); - + set_value_or_default (name, val); if (error_state) @@ -2109,7 +2110,7 @@ %! close (hf); %! assert (class (xticklabel), "cell"); %! assert (size (xticklabel), [6, 1]); -*/ + */ /* ## test set with struct arguments @@ -2155,7 +2156,7 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect -*/ + */ // Set a property to a value or to its (factory) default value. @@ -2218,7 +2219,7 @@ %! close (hf); %! set (0, "defaultlinelinewidth", old_lw); %! end_unwind_protect -*/ + */ static double make_handle_fraction (void) @@ -3162,26 +3163,26 @@ } /* -%!test -%! old_units = get (0, "units"); -%! unwind_protect -%! set (0, "units", "pixels"); -%! sz = get (0, "screensize") - [1, 1, 0, 0]; -%! dpi = get (0, "screenpixelsperinch"); -%! set (0, "units", "inches"); -%! assert (get (0, "screensize"), sz / dpi, 0.5 / dpi); -%! set (0, "units", "centimeters"); -%! assert (get (0, "screensize"), sz / dpi * 2.54, 0.5 / dpi * 2.54); -%! set (0, "units", "points"); -%! assert (get (0, "screensize"), sz / dpi * 72, 0.5 / dpi * 72); -%! set (0, "units", "normalized"); -%! assert (get (0, "screensize"), [0.0, 0.0, 1.0, 1.0]); -%! set (0, "units", "pixels"); -%! assert (get (0, "screensize"), sz + [1, 1, 0, 0]); -%! unwind_protect_cleanup -%! set (0, "units", old_units); -%! end_unwind_protect -*/ + %!test + %! old_units = get (0, "units"); + %! unwind_protect + %! set (0, "units", "pixels"); + %! sz = get (0, "screensize") - [1, 1, 0, 0]; + %! dpi = get (0, "screenpixelsperinch"); + %! set (0, "units", "inches"); + %! assert (get (0, "screensize"), sz / dpi, 0.5 / dpi); + %! set (0, "units", "centimeters"); + %! assert (get (0, "screensize"), sz / dpi * 2.54, 0.5 / dpi * 2.54); + %! set (0, "units", "points"); + %! assert (get (0, "screensize"), sz / dpi * 72, 0.5 / dpi * 72); + %! set (0, "units", "normalized"); + %! assert (get (0, "screensize"), [0.0, 0.0, 1.0, 1.0]); + %! set (0, "units", "pixels"); + %! assert (get (0, "screensize"), sz + [1, 1, 0, 0]); + %! unwind_protect_cleanup + %! set (0, "units", old_units); + %! end_unwind_protect + */ void root_figure::properties::remove_child (const graphics_handle& gh) @@ -3787,36 +3788,36 @@ } /* -%!test -%! hf = figure ("visible", "off"); -%! unwind_protect -%! set (hf, "paperunits", "inches"); -%! set (hf, "papersize", [5, 4]); -%! set (hf, "paperunits", "points"); -%! assert (get (hf, "papersize"), [5, 4] * 72, 1); -%! papersize = get (hf, "papersize"); -%! set (hf, "papersize", papersize + 1); -%! set (hf, "papersize", papersize); -%! assert (get (hf, "papersize"), [5, 4] * 72, 1); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect - -%!test -%! hf = figure ("visible", "off"); -%! unwind_protect -%! set (hf, "paperunits", "inches"); -%! set (hf, "papersize", [5, 4]); -%! set (hf, "paperunits", "centimeters"); -%! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); -%! papersize = get (hf, "papersize"); -%! set (hf, "papersize", papersize + 1); -%! set (hf, "papersize", papersize); -%! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -*/ + %!test + %! hf = figure ("visible", "off"); + %! unwind_protect + %! set (hf, "paperunits", "inches"); + %! set (hf, "papersize", [5, 4]); + %! set (hf, "paperunits", "points"); + %! assert (get (hf, "papersize"), [5, 4] * 72, 1); + %! papersize = get (hf, "papersize"); + %! set (hf, "papersize", papersize + 1); + %! set (hf, "papersize", papersize); + %! assert (get (hf, "papersize"), [5, 4] * 72, 1); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + + %!test + %! hf = figure ("visible", "off"); + %! unwind_protect + %! set (hf, "paperunits", "inches"); + %! set (hf, "papersize", [5, 4]); + %! set (hf, "paperunits", "centimeters"); + %! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); + %! papersize = get (hf, "papersize"); + %! set (hf, "papersize", papersize + 1); + %! set (hf, "papersize", papersize); + %! assert (get (hf, "papersize"), [5, 4] * 2.54, 2.54/72); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + */ void figure::properties::update_paperorientation (void) @@ -3838,31 +3839,31 @@ } /* -%!test -%! hf = figure ("visible", "off"); -%! unwind_protect -%! tol = 100 * eps (); -%! ## UPPER case and MiXed case is part of test and should not be changed. -%! set (hf, "paperorientation", "PORTRAIT"); -%! set (hf, "paperunits", "inches"); -%! set (hf, "papertype", "USletter"); -%! assert (get (hf, "papersize"), [8.5, 11.0], tol); -%! set (hf, "paperorientation", "Landscape"); -%! assert (get (hf, "papersize"), [11.0, 8.5], tol); -%! set (hf, "paperunits", "centimeters"); -%! assert (get (hf, "papersize"), [11.0, 8.5] * 2.54, tol); -%! set (hf, "papertype", "a4"); -%! assert (get (hf, "papersize"), [29.7, 21.0], tol); -%! set (hf, "paperunits", "inches", "papersize", [8.5, 11.0]); -%! assert (get (hf, "papertype"), "usletter"); -%! assert (get (hf, "paperorientation"), "portrait"); -%! set (hf, "papersize", [11.0, 8.5]); -%! assert (get (hf, "papertype"), "usletter"); -%! assert (get (hf, "paperorientation"), "landscape"); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -*/ + %!test + %! hf = figure ("visible", "off"); + %! unwind_protect + %! tol = 100 * eps (); + %! ## UPPER case and MiXed case is part of test and should not be changed. + %! set (hf, "paperorientation", "PORTRAIT"); + %! set (hf, "paperunits", "inches"); + %! set (hf, "papertype", "USletter"); + %! assert (get (hf, "papersize"), [8.5, 11.0], tol); + %! set (hf, "paperorientation", "Landscape"); + %! assert (get (hf, "papersize"), [11.0, 8.5], tol); + %! set (hf, "paperunits", "centimeters"); + %! assert (get (hf, "papersize"), [11.0, 8.5] * 2.54, tol); + %! set (hf, "papertype", "a4"); + %! assert (get (hf, "papersize"), [29.7, 21.0], tol); + %! set (hf, "paperunits", "inches", "papersize", [8.5, 11.0]); + %! assert (get (hf, "papertype"), "usletter"); + %! assert (get (hf, "paperorientation"), "portrait"); + %! set (hf, "papersize", [11.0, 8.5]); + %! assert (get (hf, "papertype"), "usletter"); + %! assert (get (hf, "paperorientation"), "landscape"); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + */ void figure::properties::set_units (const octave_value& v) @@ -3886,22 +3887,22 @@ } /* -%!test -%! hf = figure ("visible", "off"); -%! old_units = get (0, "units"); -%! unwind_protect -%! set (0, "units", "pixels"); -%! rsz = get (0, "screensize"); -%! set (gcf (), "units", "pixels"); -%! fsz = get (gcf (), "position"); -%! set (gcf (), "units", "normalized"); -%! pos = get (gcf (), "position"); -%! assert (pos, (fsz - [1, 1, 0, 0]) ./ rsz([3, 4, 3, 4])); -%! unwind_protect_cleanup -%! close (hf); -%! set (0, "units", old_units); -%! end_unwind_protect -*/ + %!test + %! hf = figure ("visible", "off"); + %! old_units = get (0, "units"); + %! unwind_protect + %! set (0, "units", "pixels"); + %! rsz = get (0, "screensize"); + %! set (gcf (), "units", "pixels"); + %! fsz = get (gcf (), "position"); + %! set (gcf (), "units", "normalized"); + %! pos = get (gcf (), "position"); + %! assert (pos, (fsz - [1, 1, 0, 0]) ./ rsz([3, 4, 3, 4])); + %! unwind_protect_cleanup + %! close (hf); + %! set (0, "units", old_units); + %! end_unwind_protect + */ std::string figure::properties::get_title (void) const @@ -4092,65 +4093,65 @@ } /* -%!testif HAVE_FLTK -%! hf = figure ("visible", "off"); -%! graphics_toolkit (hf, "fltk"); -%! unwind_protect -%! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); -%! hax = findall (gcf (), "type", "axes"); -%! positions = cell2mat (get (hax, "position")); -%! outerpositions = cell2mat (get (hax, "outerposition")); -%! looseinsets = cell2mat (get (hax, "looseinset")); -%! tightinsets = cell2mat (get (hax, "tightinset")); -%! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); -%! hax = findall (gcf (), "type", "axes"); -%! assert (cell2mat (get (hax, "position")), positions, 1e-4); -%! assert (cell2mat (get (hax, "outerposition")), outerpositions, 1e-4); -%! assert (cell2mat (get (hax, "looseinset")), looseinsets, 1e-4); -%! assert (cell2mat (get (hax, "tightinset")), tightinsets, 1e-4); -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -%!testif HAVE_FLTK -%! hf = figure ("visible", "off"); -%! graphics_toolkit (hf, "fltk"); -%! fpos = get (hf, "position"); -%! unwind_protect -%! plot (rand (3)) -%! position = get (gca, "position"); -%! outerposition = get (gca, "outerposition"); -%! looseinset = get (gca, "looseinset"); -%! tightinset = get (gca, "tightinset"); -%! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) -%! set (hf, "position", fpos); -%! assert (get (gca, "outerposition"), outerposition, 0.001) -%! assert (get (gca, "position"), position, 0.001) -%! assert (get (gca, "looseinset"), looseinset, 0.001) -%! assert (get (gca, "tightinset"), tightinset, 0.001) -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -%!testif HAVE_FLTK -%! hf = figure ("visible", "off"); -%! graphics_toolkit (hf, "fltk"); -%! fpos = get (hf, "position"); -%! set (gca, "activepositionproperty", "position") -%! unwind_protect -%! plot (rand (3)) -%! position = get (gca, "position"); -%! outerposition = get (gca, "outerposition"); -%! looseinset = get (gca, "looseinset"); -%! tightinset = get (gca, "tightinset"); -%! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) -%! set (hf, "position", fpos); -%! assert (get (gca, "position"), position, 0.001) -%! assert (get (gca, "outerposition"), outerposition, 0.001) -%! assert (get (gca, "looseinset"), looseinset, 0.001) -%! assert (get (gca, "tightinset"), tightinset, 0.001) -%! unwind_protect_cleanup -%! close (hf); -%! end_unwind_protect -*/ + %!testif HAVE_FLTK + %! hf = figure ("visible", "off"); + %! graphics_toolkit (hf, "fltk"); + %! unwind_protect + %! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); + %! hax = findall (gcf (), "type", "axes"); + %! positions = cell2mat (get (hax, "position")); + %! outerpositions = cell2mat (get (hax, "outerposition")); + %! looseinsets = cell2mat (get (hax, "looseinset")); + %! tightinsets = cell2mat (get (hax, "tightinset")); + %! subplot(2,1,1); plot(rand(10,1)); subplot(2,1,2); plot(rand(10,1)); + %! hax = findall (gcf (), "type", "axes"); + %! assert (cell2mat (get (hax, "position")), positions, 1e-4); + %! assert (cell2mat (get (hax, "outerposition")), outerpositions, 1e-4); + %! assert (cell2mat (get (hax, "looseinset")), looseinsets, 1e-4); + %! assert (cell2mat (get (hax, "tightinset")), tightinsets, 1e-4); + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + %!testif HAVE_FLTK + %! hf = figure ("visible", "off"); + %! graphics_toolkit (hf, "fltk"); + %! fpos = get (hf, "position"); + %! unwind_protect + %! plot (rand (3)) + %! position = get (gca, "position"); + %! outerposition = get (gca, "outerposition"); + %! looseinset = get (gca, "looseinset"); + %! tightinset = get (gca, "tightinset"); + %! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) + %! set (hf, "position", fpos); + %! assert (get (gca, "outerposition"), outerposition, 0.001) + %! assert (get (gca, "position"), position, 0.001) + %! assert (get (gca, "looseinset"), looseinset, 0.001) + %! assert (get (gca, "tightinset"), tightinset, 0.001) + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + %!testif HAVE_FLTK + %! hf = figure ("visible", "off"); + %! graphics_toolkit (hf, "fltk"); + %! fpos = get (hf, "position"); + %! set (gca, "activepositionproperty", "position") + %! unwind_protect + %! plot (rand (3)) + %! position = get (gca, "position"); + %! outerposition = get (gca, "outerposition"); + %! looseinset = get (gca, "looseinset"); + %! tightinset = get (gca, "tightinset"); + %! set (hf, "position", [fpos(1:2), 2*fpos(3:4)]) + %! set (hf, "position", fpos); + %! assert (get (gca, "position"), position, 0.001) + %! assert (get (gca, "outerposition"), outerposition, 0.001) + %! assert (get (gca, "looseinset"), looseinset, 0.001) + %! assert (get (gca, "tightinset"), tightinset, 0.001) + %! unwind_protect_cleanup + %! close (hf); + %! end_unwind_protect + */ void axes::properties::set_text_child (handle_property& hp, @@ -4961,33 +4962,33 @@ y2Dright = false; layer2Dtop = false; if (xstate == AXE_HORZ_DIR && ystate == AXE_VERT_DIR) - { - if (xaxislocation_is ("top")) - { - double tmp = yPlane; - yPlane = yPlaneN; - yPlaneN = tmp; - x2Dtop = true; - } - ypTick = yPlaneN; - ypTickN = yPlane; - if (yaxislocation_is ("right")) - { - double tmp = xPlane; - xPlane = xPlaneN; - xPlaneN = tmp; - y2Dright = true; - } - xpTick = xPlaneN; - xpTickN = xPlane; - if (layer_is ("top")) - { - zpTick = zPlaneN; - layer2Dtop = true; - } - else - zpTick = zPlane; - } + { + if (xaxislocation_is ("top")) + { + double tmp = yPlane; + yPlane = yPlaneN; + yPlaneN = tmp; + x2Dtop = true; + } + ypTick = yPlaneN; + ypTickN = yPlane; + if (yaxislocation_is ("right")) + { + double tmp = xPlane; + xPlane = xPlaneN; + xPlaneN = tmp; + y2Dright = true; + } + xpTick = xPlaneN; + xpTickN = xPlane; + if (layer_is ("top")) + { + zpTick = zPlaneN; + layer2Dtop = true; + } + else + zpTick = zPlane; + } Matrix viewmat = get_view ().matrix_value (); nearhoriz = std::abs (viewmat(1)) <= 5; @@ -5042,7 +5043,7 @@ %! xlabel xlabel; %! ylabel ylabel; %! title title; -*/ + */ static bool updating_xlabel_position = false; @@ -5105,19 +5106,19 @@ switch (xstate) { - case AXE_ANY_DIR: - p(0) += (xyzSym ? wmax : -wmax); - p(1) += hmax; - break; - - case AXE_VERT_DIR: - p(0) -= wmax; - angle = 90; - break; - - case AXE_HORZ_DIR: - p(1) += (x2Dtop ? -hmax : hmax); - break; + case AXE_ANY_DIR: + p(0) += (xyzSym ? wmax : -wmax); + p(1) += hmax; + break; + + case AXE_VERT_DIR: + p(0) -= wmax; + angle = 90; + break; + + case AXE_HORZ_DIR: + p(1) += (x2Dtop ? -hmax : hmax); + break; } if (xlabel_props.positionmode_is ("auto")) @@ -5205,19 +5206,19 @@ switch (ystate) { - case AXE_ANY_DIR: - p(0) += (!xyzSym ? wmax : -wmax); - p(1) += hmax; - break; - - case AXE_VERT_DIR: - p(0) += (y2Dright ? wmax : -wmax); - angle = 90; - break; - - case AXE_HORZ_DIR: - p(1) += hmax; - break; + case AXE_ANY_DIR: + p(0) += (!xyzSym ? wmax : -wmax); + p(1) += hmax; + break; + + case AXE_VERT_DIR: + p(0) += (y2Dright ? wmax : -wmax); + angle = 90; + break; + + case AXE_HORZ_DIR: + p(1) += hmax; + break; } if (ylabel_props.positionmode_is ("auto")) @@ -5309,28 +5310,28 @@ switch (zstate) { - case AXE_ANY_DIR: - if (camAuto) - { - p(0) -= wmax; - angle = 90; - } - - // FIXME -- what's the correct offset? - // - // p[0] += (!xySym ? wmax : -wmax); - // p[1] += (zSign ? hmax : -hmax); - - break; - - case AXE_VERT_DIR: - p(0) -= wmax; - angle = 90; - break; - - case AXE_HORZ_DIR: - p(1) += hmax; - break; + case AXE_ANY_DIR: + if (camAuto) + { + p(0) -= wmax; + angle = 90; + } + + // FIXME -- what's the correct offset? + // + // p[0] += (!xySym ? wmax : -wmax); + // p[1] += (zSign ? hmax : -hmax); + + break; + + case AXE_VERT_DIR: + p(0) -= wmax; + angle = 90; + break; + + case AXE_HORZ_DIR: + p(1) += hmax; + break; } if (zlabel_props.positionmode_is ("auto")) @@ -5410,15 +5411,15 @@ normalized_aspectratios (Matrix& aspectratios, const Matrix& scalefactors, double xlength, double ylength, double zlength) { - double xval = xlength/scalefactors(0); - double yval = ylength/scalefactors(1); - double zval = zlength/scalefactors(2); - - double minval = xmin (xmin (xval, yval), zval); - - aspectratios(0) = xval/minval; - aspectratios(1) = yval/minval; - aspectratios(2) = zval/minval; + double xval = xlength/scalefactors(0); + double yval = ylength/scalefactors(1); + double zval = zlength/scalefactors(2); + + double minval = xmin (xmin (xval, yval), zval); + + aspectratios(0) = xval/minval; + aspectratios(1) = yval/minval; + aspectratios(2) = zval/minval; } static void @@ -5577,8 +5578,8 @@ const Matrix& parent_pix_size) const { Matrix pos = (internal ? - get_position ().matrix_value () - : get_outerposition ().matrix_value ()); + get_position ().matrix_value () + : get_outerposition ().matrix_value ()); Matrix parent_size (parent_pix_size); if (parent_size.numel () == 0) @@ -5586,7 +5587,7 @@ graphics_object obj = gh_manager::get_object (get_parent ()); parent_size = - obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); + obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); } pos = convert_position (pos, get_units (), "pixels", parent_size); @@ -5657,9 +5658,9 @@ { double text_rotation = text_props.get_rotation (); if (text_rotation == 0. || text_rotation == 180.) - ignore_horizontal = true; + ignore_horizontal = true; else if (text_rotation == 90. || text_rotation == 270.) - ignore_vertical = true; + ignore_vertical = true; } if (! ignore_horizontal) @@ -5718,7 +5719,7 @@ // Split string with delimiter '|' while (std::getline (iss, tmpstr, '|')) sv.append (tmpstr); - + // If string ends with '|' Matlab appends a null string if (*valstr.rbegin () == '|') sv.append (std::string ("")); @@ -5957,25 +5958,25 @@ // FIXME -- remove. // FIXME -- maybe this should go into array_property class? /* -static void -check_limit_vals (double& min_val, double& max_val, - double& min_pos, double& max_neg, - const array_property& data) -{ - double val = data.min_val (); - if (xfinite (val) && val < min_val) - min_val = val; - val = data.max_val (); - if (xfinite (val) && val > max_val) - max_val = val; - val = data.min_pos (); - if (xfinite (val) && val > 0 && val < min_pos) - min_pos = val; - val = data.max_neg (); - if (xfinite (val) && val < 0 && val > max_neg) - max_neg = val; -} -*/ + static void + check_limit_vals (double& min_val, double& max_val, + double& min_pos, double& max_neg, + const array_property& data) + { + double val = data.min_val (); + if (xfinite (val) && val < min_val) + min_val = val; + val = data.max_val (); + if (xfinite (val) && val > max_val) + max_val = val; + val = data.min_pos (); + if (xfinite (val) && val > 0 && val < min_pos) + min_pos = val; + val = data.max_neg (); + if (xfinite (val) && val < 0 && val > max_neg) + max_neg = val; + } + */ static void check_limit_vals (double& min_val, double& max_val, @@ -6342,7 +6343,7 @@ label.erase (0, label.find_first_not_of (" ")); label = label.substr (0, label.find_last_not_of (" ")+1); #ifdef HAVE_FREETYPE - ext = text_renderer.get_extent (label, 0.0, "none"); + ext = text_renderer.get_extent (label, 0.0); wmax = std::max (wmax, ext(0)); hmax = std::max (hmax, ext(1)); #else @@ -6469,16 +6470,16 @@ { \ val = limits(0); \ if (xfinite (val)) \ - min_val = val; \ + min_val = val; \ val = limits(1); \ if (xfinite (val)) \ - max_val = val; \ + max_val = val; \ val = limits(2); \ if (xfinite (val)) \ - min_pos = val; \ + min_pos = val; \ val = limits(3); \ if (xfinite (val)) \ - max_neg = val; \ + max_neg = val; \ } \ else \ { \ @@ -7137,21 +7138,24 @@ void text::properties::update_font (void) { + /* #ifdef HAVE_FREETYPE #ifdef HAVE_FONTCONFIG - renderer.set_font (get ("fontname").string_value (), - get ("fontweight").string_value (), - get ("fontangle").string_value (), - get ("fontsize").double_value ()); +renderer.set_font (get ("fontname").string_value (), +get ("fontweight").string_value (), +get ("fontangle").string_value (), +get ("fontsize").double_value ()); #endif - renderer.set_color (get_color_rgb ()); +renderer.set_color (get_color_rgb ()); #endif + */ } void text::properties::update_text_extent (void) { -#ifdef HAVE_FREETYPE + + text_render r (get_interpreter ()); int halign = 0, valign = 0; @@ -7177,16 +7181,24 @@ string_vector sv = string_prop.all_strings (); - renderer.text_to_pixels (sv.join ("\n"), pixels, bbox, - halign, valign, get_rotation (), - get_interpreter ()); + r.set_font (get ("fontname").string_value (), + get ("fontweight").string_value (), + get ("fontangle").string_value (), + get ("fontsize").double_value ()); + + r.set_color (get_color_rgb ()); + + r.text_to_pixels (sv.join ("\n"), pixels, bbox, + halign, valign, get_rotation ()); + + /* The bbox is relative to the text's position. We'll leave it that way, because get_position () does not return valid results when the text is first constructed. Conversion to proper coordinates is performed in get_extent. */ set_extent (bbox); -#endif + if (autopos_tag_is ("xlabel") || autopos_tag_is ("ylabel") || autopos_tag_is ("zlabel") || autopos_tag_is ("title")) @@ -7328,28 +7340,28 @@ double& nz = n(j, i, 2); if ((j > 0) && (i > 0)) - // upper left quadrangle - cross_product (x(j1,i-1)-x(j2,i), y(j-1,i1)-y(j,i2), z(j-1,i-1)-z(j,i), - x(j2,i-1)-x(j1,i), y(j,i1)-y(j-1,i2), z(j,i-1)-z(j-1,i), - nx, ny, nz); + // upper left quadrangle + cross_product (x(j1,i-1)-x(j2,i), y(j-1,i1)-y(j,i2), z(j-1,i-1)-z(j,i), + x(j2,i-1)-x(j1,i), y(j,i1)-y(j-1,i2), z(j,i-1)-z(j-1,i), + nx, ny, nz); if ((j > 0) && (i < (p -1))) - // upper right quadrangle - cross_product (x(j1,i+1)-x(j2,i), y(j-1,i3)-y(j,i2), z(j-1,i+1)-z(j,i), - x(j1,i)-x(j2,i+1), y(j-1,i2)-y(j,i3), z(j-1,i)-z(j,i+1), - nx, ny, nz); + // upper right quadrangle + cross_product (x(j1,i+1)-x(j2,i), y(j-1,i3)-y(j,i2), z(j-1,i+1)-z(j,i), + x(j1,i)-x(j2,i+1), y(j-1,i2)-y(j,i3), z(j-1,i)-z(j,i+1), + nx, ny, nz); if ((j < (q - 1)) && (i > 0)) - // lower left quadrangle - cross_product (x(j2,i-1)-x(j3,i), y(j,i1)-y(j+1,i2), z(j,i-1)-z(j+1,i), - x(j3,i-1)-x(j2,i), y(j+1,i1)-y(j,i2), z(j+1,i-1)-z(j,i), - nx, ny, nz); + // lower left quadrangle + cross_product (x(j2,i-1)-x(j3,i), y(j,i1)-y(j+1,i2), z(j,i-1)-z(j+1,i), + x(j3,i-1)-x(j2,i), y(j+1,i1)-y(j,i2), z(j+1,i-1)-z(j,i), + nx, ny, nz); if ((j < (q - 1)) && (i < (p -1))) - // lower right quadrangle - cross_product (x(j3,i)-x(j2,i+1), y(j+1,i2)-y(j,i3), z(j+1,i)-z(j,i+1), - x(j3,i+1)-x(j2,i), y(j+1,i3)-y(j,i2), z(j+1,i+1)-z(j,i), - nx, ny, nz); + // lower right quadrangle + cross_product (x(j3,i)-x(j2,i+1), y(j+1,i2)-y(j,i3), z(j+1,i)-z(j,i+1), + x(j3,i+1)-x(j2,i), y(j+1,i3)-y(j,i2), z(j+1,i+1)-z(j,i), + nx, ny, nz); double d = -std::max (std::max (fabs (nx), fabs (ny)), fabs (nz)); @@ -7618,7 +7630,7 @@ #ifdef HAVE_FREETYPE text_element *elt; - ft_render text_renderer; + text_render text_renderer; Matrix box; // FIXME: parsed content should be cached for efficiency @@ -7683,7 +7695,7 @@ graphics_object obj = gh_manager::get_object (get_parent ()); parent_size = - obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); + obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); } pos = convert_position (pos, get_units (), "pixels", parent_size); @@ -7747,7 +7759,7 @@ graphics_object obj = gh_manager::get_object (get_parent ()); parent_size = - obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); + obj.get_properties ().get_boundingbox (true).extract_n (0, 2, 1, 2); } pos = convert_position (pos, get_units (), "pixels", parent_size); @@ -7915,10 +7927,10 @@ // We use a random value for the handle to avoid issues with plots and // scalar values for the first argument. gh_manager::gh_manager (void) - : handle_map (), handle_free_list (), - next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)), - figure_list (), graphics_lock (), event_queue (), - callback_objects (), event_processing (0) +: handle_map (), handle_free_list (), + next_handle (-1.0 - (rand () + 1.0) / (RAND_MAX + 2.0)), + figure_list (), graphics_lock (), event_queue (), + callback_objects (), event_processing (0) { handle_map[0] = graphics_object (new root_figure ()); @@ -8013,13 +8025,13 @@ public: callback_event (const graphics_handle& h, const std::string& name, const octave_value& data = Matrix ()) - : base_graphics_event (), handle (h), callback_name (name), - callback (), callback_data (data) { } + : base_graphics_event (), handle (h), callback_name (name), + callback (), callback_data (data) { } callback_event (const graphics_handle& h, const octave_value& cb, const octave_value& data = Matrix ()) - : base_graphics_event (), handle (h), callback_name (), - callback (cb), callback_data (data) { } + : base_graphics_event (), handle (h), callback_name (), + callback (cb), callback_data (data) { } void execute (void) { @@ -8032,7 +8044,7 @@ private: callback_event (void) : base_graphics_event (), handle (), - callback_name (), callback_data () + callback_name (), callback_data () { } private: @@ -8047,8 +8059,8 @@ { public: function_event (graphics_event::event_fcn fcn, void* data = 0) - : base_graphics_event (), function (fcn), - function_data (data) { } + : base_graphics_event (), function (fcn), + function_data (data) { } void execute (void) { @@ -8077,8 +8089,8 @@ public: set_event (const graphics_handle& h, const std::string& name, const octave_value& value, bool do_notify_toolkit = true) - : base_graphics_event (), handle (h), property_name (name), - property_value (value), notify_toolkit (do_notify_toolkit) { } + : base_graphics_event (), handle (h), property_name (name), + property_value (value), notify_toolkit (do_notify_toolkit) { } void execute (void) { @@ -8098,7 +8110,7 @@ private: set_event (void) : base_graphics_event (), handle (), property_name (), property_value () - { } + { } private: graphics_handle handle; @@ -8160,7 +8172,7 @@ { graphics_object go = gh_manager::get_object (0); root_figure::properties& props = - dynamic_cast<root_figure::properties&> (go.get_properties ()); + dynamic_cast<root_figure::properties&> (go.get_properties ()); props.set_callbackobject (h.as_octave_value ()); } @@ -8438,15 +8450,15 @@ // --------------------------------------------------------------------- DEFUN (ishandle, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} ishandle (@var{h})\n\ -Return true if @var{h} is a graphics handle and false otherwise.\n\ -\n\ -@var{h} may also be a matrix of handles in which case a logical\n\ -array is returned that is true where the elements of @var{h} are\n\ -graphics handles and false where they are not.\n\ -@seealso{isaxes, isfigure}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} ishandle (@var{h})\n\ + Return true if @var{h} is a graphics handle and false otherwise.\n\ + \n\ + @var{h} may also be a matrix of handles in which case a logical\n\ + array is returned that is true where the elements of @var{h} are\n\ + graphics handles and false where they are not.\n\ + @seealso{isaxes, isfigure}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8498,10 +8510,10 @@ } DEFUN (__is_handle_visible__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} __is_handle_visible__ (@var{h})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} __is_handle_visible__ (@var{h})\n\ + Undocumented internal function.\n\ + @end deftypefn") { octave_value retval; @@ -8514,14 +8526,14 @@ } DEFUN (reset, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} reset (@var{h}, @var{property})\n\ -Remove any defaults set for the handle @var{h}. The default figure\n\ -properties of @qcode{\"position\"}, @qcode{\"units\"},\n\ -@qcode{\"windowstyle\"} and @qcode{\"paperunits\"} and the default axes\n\ -properties of @qcode{\"position\"} and @qcode{\"units\"} are not reset.\n\ + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} reset (@var{h}, @var{property})\n\ + Remove any defaults set for the handle @var{h}. The default figure\n\ + properties of @qcode{\"position\"}, @qcode{\"units\"},\n\ + @qcode{\"windowstyle\"} and @qcode{\"paperunits\"} and the default axes\n\ + properties of @qcode{\"position\"} and @qcode{\"units\"} are not reset.\n\ @seealso{cla, clf}\n\ -@end deftypefn") + @end deftypefn") { int nargin = args.length (); @@ -8544,40 +8556,40 @@ } DEFUN (set, args, nargout, - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} set (@var{h}, @var{property}, @var{value}, @dots{})\n\ -@deftypefnx {Built-in Function} {} set (@var{h}, @var{properties}, @var{values})\n\ -@deftypefnx {Built-in Function} {} set (@var{h}, @var{pv})\n\ -Set named property values for the graphics handle (or vector of graphics\n\ -handles) @var{h}.\n\ -There are three ways how to give the property names and values:\n\ -\n\ -@itemize\n\ -@item as a comma separated list of @var{property}, @var{value} pairs\n\ -\n\ -Here, each @var{property} is a string containing the property name, each\n\ -@var{value} is a value of the appropriate type for the property.\n\ -\n\ -@item as a cell array of strings @var{properties} containing property names\n\ -and a cell array @var{values} containing property values.\n\ -\n\ -In this case, the number of columns of @var{values} must match the number of\n\ -elements in @var{properties}. The first column of @var{values} contains\n\ -values for the first entry in @var{properties}, etc. The number of rows of\n\ -@var{values} must be 1 or match the number of elements of @var{h}. In the\n\ -first case, each handle in @var{h} will be assigned the same values. In the\n\ -latter case, the first handle in @var{h} will be assigned the values from\n\ -the first row of @var{values} and so on.\n\ -\n\ -@item as a structure array @var{pv}\n\ -\n\ -Here, the field names of @var{pv} represent the property names, and the field\n\ -values give the property values. In contrast to the previous case, all\n\ -elements of @var{pv} will be set in all handles in @var{h} independent of\n\ -the dimensions of @var{pv}.\n\ -@end itemize\n\ -@seealso{get}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} set (@var{h}, @var{property}, @var{value}, @dots{})\n\ + @deftypefnx {Built-in Function} {} set (@var{h}, @var{properties}, @var{values})\n\ + @deftypefnx {Built-in Function} {} set (@var{h}, @var{pv})\n\ + Set named property values for the graphics handle (or vector of graphics\n\ + handles) @var{h}.\n\ + There are three ways how to give the property names and values:\n\ + \n\ + @itemize\n\ + @item as a comma separated list of @var{property}, @var{value} pairs\n\ + \n\ + Here, each @var{property} is a string containing the property name, each\n\ + @var{value} is a value of the appropriate type for the property.\n\ + \n\ + @item as a cell array of strings @var{properties} containing property names\n\ + and a cell array @var{values} containing property values.\n\ + \n\ + In this case, the number of columns of @var{values} must match the number of\n\ + elements in @var{properties}. The first column of @var{values} contains\n\ + values for the first entry in @var{properties}, etc. The number of rows of\n\ + @var{values} must be 1 or match the number of elements of @var{h}. In the\n\ + first case, each handle in @var{h} will be assigned the same values. In the\n\ + latter case, the first handle in @var{h} will be assigned the values from\n\ + the first row of @var{values} and so on.\n\ + \n\ + @item as a structure array @var{pv}\n\ + \n\ + Here, the field names of @var{pv} represent the property names, and the field\n\ + values give the property values. In contrast to the previous case, all\n\ + elements of @var{pv} will be set in all handles in @var{h} independent of\n\ + the dimensions of @var{pv}.\n\ + @end itemize\n\ + @seealso{get}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8617,7 +8629,7 @@ else { error ("set: number of graphics handles must match number of value rows (%d != %d)", - hcv.length (), args(2).cell_value ().rows ()); + hcv.length (), args(2).cell_value ().rows ()); break; } @@ -8653,7 +8665,7 @@ break; request_drawnow = true; - } + } if (! error_state && request_drawnow) Vdrawnow_requested = true; @@ -8683,15 +8695,15 @@ } DEFUN (get, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{val} =} get (@var{h})\n\ -@deftypefnx {Built-in Function} {@var{val} =} get (@var{h}, @var{p})\n\ -Return the value of the named property @var{p} from the graphics handle\n\ -@var{h}. If @var{p} is omitted, return the complete property list for\n\ -@var{h}. If @var{h} is a vector, return a cell array including the property\n\ -values or lists respectively.\n\ -@seealso{set}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {@var{val} =} get (@var{h})\n\ + @deftypefnx {Built-in Function} {@var{val} =} get (@var{h}, @var{p})\n\ + Return the value of the named property @var{p} from the graphics handle\n\ + @var{h}. If @var{p} is omitted, return the complete property list for\n\ + @var{h}. If @var{h} is a vector, return a cell array including the property\n\ + values or lists respectively.\n\ + @seealso{set}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8850,18 +8862,18 @@ } /* -%!assert (get (findobj (0, "Tag", "nonexistenttag"), "nonexistentproperty"), []) -*/ + %!assert (get (findobj (0, "Tag", "nonexistenttag"), "nonexistentproperty"), []) + */ // Return all properties from the graphics handle @var{h}. // If @var{h} is a vector, return a cell array including the // property values or lists respectively. DEFUN (__get__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __get__ (@var{h})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __get__ (@var{h})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -8986,10 +8998,10 @@ } DEFUN (__go_figure__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_figure__ (@var{fignum})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_figure__ (@var{fignum})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9086,15 +9098,15 @@ #define GO_BODY(TYPE) \ gh_manager::auto_lock guard; \ - \ - octave_value retval; \ - \ - if (args.length () > 0) \ - retval = make_graphics_object (#TYPE, false, args); \ - else \ - print_usage (); \ - \ - return retval +\ +octave_value retval; \ +\ +if (args.length () > 0) \ +retval = make_graphics_object (#TYPE, false, args); \ +else \ +print_usage (); \ +\ +return retval int calc_dimensions (const graphics_object& go) @@ -9130,11 +9142,11 @@ } DEFUN (__calc_dimensions__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __calc_dimensions__ (@var{axes})\n\ -Internal function. Determine the number of dimensions in a graphics\n\ -object, whether 2 or 3.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __calc_dimensions__ (@var{axes})\n\ + Internal function. Determine the number of dimensions in a graphics\n\ + object, whether 2 or 3.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9158,136 +9170,136 @@ } DEFUN (__go_axes__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_axes__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (axes); } DEFUN (__go_line__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_line__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_line__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (line); } DEFUN (__go_text__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_text__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_text__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (text); } DEFUN (__go_image__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_image__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_image__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (image); } DEFUN (__go_surface__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_surface__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_surface__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (surface); } DEFUN (__go_patch__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_patch__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_patch__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (patch); } DEFUN (__go_hggroup__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_hggroup__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (hggroup); } DEFUN (__go_uimenu__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uimenu__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uimenu__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uimenu); } DEFUN (__go_uicontrol__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uicontrol__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uicontrol__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uicontrol); } DEFUN (__go_uipanel__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uipanel__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uipanel__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uipanel); } DEFUN (__go_uicontextmenu__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uicontextmenu__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uicontextmenu__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uicontextmenu); } DEFUN (__go_uitoolbar__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uitoolbar__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uitoolbar__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uitoolbar); } DEFUN (__go_uipushtool__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uipushtool__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uipushtool__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uipushtool); } DEFUN (__go_uitoggletool__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_uitoggletool__ (@var{parent})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_uitoggletool__ (@var{parent})\n\ + Undocumented internal function.\n\ + @end deftypefn") { GO_BODY (uitoggletool); } DEFUN (__go_delete__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_delete__ (@var{h})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9329,10 +9341,10 @@ } DEFUN (__go_axes_init__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_axes_init__ (@var{h}, @var{mode})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_axes_init__ (@var{h}, @var{mode})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9383,10 +9395,10 @@ } DEFUN (__go_handles__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_handles__ (@var{show_hidden})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_handles__ (@var{show_hidden})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9399,10 +9411,10 @@ } DEFUN (__go_figure_handles__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_figure_handles__ (@var{show_hidden})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_figure_handles__ (@var{show_hidden})\n\ + Undocumented internal function.\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9415,11 +9427,11 @@ } DEFUN (__go_execute_callback__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name})\n\ -@deftypefnx {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name}, @var{param})\n\ -Undocumented internal function.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name})\n\ + @deftypefnx {Built-in Function} {} __go_execute_callback__ (@var{h}, @var{name}, @var{param})\n\ + Undocumented internal function.\n\ + @end deftypefn") { octave_value retval; @@ -9461,10 +9473,10 @@ } DEFUN (__image_pixel_size__, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {@var{px}, @var{py}} __image_pixel_size__ (@var{h})\n\ -Internal function: returns the pixel size of the image in normalized units.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {@var{px}, @var{py}} __image_pixel_size__ (@var{h})\n\ + Internal function: returns the pixel size of the image in normalized units.\n\ + @end deftypefn") { octave_value retval; @@ -9546,11 +9558,11 @@ } DEFUN (available_graphics_toolkits, , , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} available_graphics_toolkits ()\n\ -Return a cell array of registered graphics toolkits.\n\ -@seealso{graphics_toolkit, register_graphics_toolkit}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} available_graphics_toolkits ()\n\ + Return a cell array of registered graphics toolkits.\n\ + @seealso{graphics_toolkit, register_graphics_toolkit}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9558,11 +9570,11 @@ } DEFUN (register_graphics_toolkit, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} register_graphics_toolkit (@var{toolkit})\n\ -List @var{toolkit} as an available graphics toolkit.\n\ -@seealso{available_graphics_toolkits}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} register_graphics_toolkit (@var{toolkit})\n\ + List @var{toolkit} as an available graphics toolkit.\n\ + @seealso{available_graphics_toolkits}\n\ + @end deftypefn") { octave_value retval; @@ -9584,11 +9596,11 @@ } DEFUN (loaded_graphics_toolkits, , , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} loaded_graphics_toolkits ()\n\ -Return a cell array of the currently loaded graphics toolkits.\n\ -@seealso{available_graphics_toolkits}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} loaded_graphics_toolkits ()\n\ + Return a cell array of the currently loaded graphics toolkits.\n\ + @seealso{available_graphics_toolkits}\n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9596,17 +9608,17 @@ } DEFUN (drawnow, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} drawnow ()\n\ -@deftypefnx {Built-in Function} {} drawnow (\"expose\")\n\ -@deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})\n\ -Update figure windows and their children. The event queue is flushed and\n\ -any callbacks generated are executed. With the optional argument\n\ -@qcode{\"expose\"}, only graphic objects are updated and no other events or\n\ -callbacks are processed.\n\ -The third calling form of @code{drawnow} is for debugging and is\n\ -undocumented.\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} drawnow ()\n\ + @deftypefnx {Built-in Function} {} drawnow (\"expose\")\n\ + @deftypefnx {Built-in Function} {} drawnow (@var{term}, @var{file}, @var{mono}, @var{debug_file})\n\ + Update figure windows and their children. The event queue is flushed and\n\ + any callbacks generated are executed. With the optional argument\n\ + @qcode{\"expose\"}, only graphic objects are updated and no other events or\n\ + callbacks are processed.\n\ + The third calling form of @code{drawnow} is for debugging and is\n\ + undocumented.\n\ + @end deftypefn") { static int drawnow_executing = 0; @@ -9757,37 +9769,37 @@ } DEFUN (addlistener, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} addlistener (@var{h}, @var{prop}, @var{fcn})\n\ -Register @var{fcn} as listener for the property @var{prop} of the graphics\n\ -object @var{h}. Property listeners are executed (in order of registration)\n\ -when the property is set. The new value is already available when the\n\ -listeners are executed.\n\ -\n\ -@var{prop} must be a string naming a valid property in @var{h}.\n\ -\n\ -@var{fcn} can be a function handle, a string or a cell array whose first\n\ -element is a function handle. If @var{fcn} is a function handle, the\n\ -corresponding function should accept at least 2 arguments, that will be\n\ -set to the object handle and the empty matrix respectively. If @var{fcn}\n\ -is a string, it must be any valid octave expression. If @var{fcn} is a cell\n\ -array, the first element must be a function handle with the same signature\n\ -as described above. The next elements of the cell array are passed\n\ -as additional arguments to the function.\n\ -\n\ -Example:\n\ -\n\ -@example\n\ -@group\n\ -function my_listener (h, dummy, p1)\n\ - fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ -endfunction\n\ -\n\ -addlistener (gcf, \"position\", @{@@my_listener, \"my string\"@})\n\ -@end group\n\ -@end example\n\ -\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} addlistener (@var{h}, @var{prop}, @var{fcn})\n\ + Register @var{fcn} as listener for the property @var{prop} of the graphics\n\ + object @var{h}. Property listeners are executed (in order of registration)\n\ + when the property is set. The new value is already available when the\n\ + listeners are executed.\n\ + \n\ + @var{prop} must be a string naming a valid property in @var{h}.\n\ + \n\ + @var{fcn} can be a function handle, a string or a cell array whose first\n\ + element is a function handle. If @var{fcn} is a function handle, the\n\ + corresponding function should accept at least 2 arguments, that will be\n\ + set to the object handle and the empty matrix respectively. If @var{fcn}\n\ + is a string, it must be any valid octave expression. If @var{fcn} is a cell\n\ + array, the first element must be a function handle with the same signature\n\ + as described above. The next elements of the cell array are passed\n\ + as additional arguments to the function.\n\ + \n\ + Example:\n\ + \n\ + @example\n\ + @group\n\ + function my_listener (h, dummy, p1)\n\ + fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ + endfunction\n\ + \n\ + addlistener (gcf, \"position\", @{@@my_listener, \"my string\"@})\n\ + @end group\n\ + @end example\n\ + \n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9835,31 +9847,31 @@ } DEFUN (dellistener, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} dellistener (@var{h}, @var{prop}, @var{fcn})\n\ -Remove the registration of @var{fcn} as a listener for the property\n\ -@var{prop} of the graphics object @var{h}. The function @var{fcn} must\n\ -be the same variable (not just the same value), as was passed to the\n\ -original call to @code{addlistener}.\n\ -\n\ -If @var{fcn} is not defined then all listener functions of @var{prop}\n\ -are removed.\n\ -\n\ -Example:\n\ -\n\ -@example\n\ -@group\n\ -function my_listener (h, dummy, p1)\n\ - fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ -endfunction\n\ -\n\ -c = @{@@my_listener, \"my string\"@};\n\ -addlistener (gcf, \"position\", c);\n\ -dellistener (gcf, \"position\", c);\n\ -@end group\n\ -@end example\n\ -\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} dellistener (@var{h}, @var{prop}, @var{fcn})\n\ + Remove the registration of @var{fcn} as a listener for the property\n\ + @var{prop} of the graphics object @var{h}. The function @var{fcn} must\n\ + be the same variable (not just the same value), as was passed to the\n\ + original call to @code{addlistener}.\n\ + \n\ + If @var{fcn} is not defined then all listener functions of @var{prop}\n\ + are removed.\n\ + \n\ + Example:\n\ + \n\ + @example\n\ + @group\n\ + function my_listener (h, dummy, p1)\n\ + fprintf (\"my_listener called with p1=%s\\n\", p1);\n\ + endfunction\n\ + \n\ + c = @{@@my_listener, \"my string\"@};\n\ + addlistener (gcf, \"position\", c);\n\ + dellistener (gcf, \"position\", c);\n\ + @end group\n\ + @end example\n\ + \n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -9912,74 +9924,74 @@ } DEFUN (addproperty, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type})\n\ -@deftypefnx {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type}, @var{arg}, @dots{})\n\ -Create a new property named @var{name} in graphics object @var{h}.\n\ -@var{type} determines the type of the property to create. @var{args}\n\ -usually contains the default value of the property, but additional\n\ -arguments might be given, depending on the type of the property.\n\ -\n\ -The supported property types are:\n\ -\n\ -@table @code\n\ -@item string\n\ -A string property. @var{arg} contains the default string value.\n\ -\n\ -@item any\n\ -An @nospell{un-typed} property. This kind of property can hold any octave\n\ -value. @var{args} contains the default value.\n\ -\n\ -@item radio\n\ -A string property with a limited set of accepted values. The first\n\ -argument must be a string with all accepted values separated by\n\ -a vertical bar ('|'). The default value can be marked by enclosing\n\ -it with a '@{' '@}' pair. The default value may also be given as\n\ -an optional second string argument.\n\ -\n\ -@item boolean\n\ -A boolean property. This property type is equivalent to a radio\n\ -property with \"on|off\" as accepted values. @var{arg} contains\n\ -the default property value.\n\ -\n\ -@item double\n\ -A scalar double property. @var{arg} contains the default value.\n\ -\n\ -@item handle\n\ -A handle property. This kind of property holds the handle of a\n\ -graphics object. @var{arg} contains the default handle value.\n\ -When no default value is given, the property is initialized to\n\ -the empty matrix.\n\ -\n\ -@item data\n\ -A data (matrix) property. @var{arg} contains the default data\n\ -value. When no default value is given, the data is initialized to\n\ -the empty matrix.\n\ -\n\ -@item color\n\ -A color property. @var{arg} contains the default color value.\n\ -When no default color is given, the property is set to black.\n\ -An optional second string argument may be given to specify an\n\ -additional set of accepted string values (like a radio property).\n\ -@end table\n\ -\n\ -@var{type} may also be the concatenation of a core object type and\n\ -a valid property name for that object type. The property created\n\ -then has the same characteristics as the referenced property (type,\n\ -possible values, hidden state@dots{}). This allows to clone an existing\n\ -property into the graphics object @var{h}.\n\ -\n\ -Examples:\n\ -\n\ -@example\n\ -@group\n\ -addproperty (\"my_property\", gcf, \"string\", \"a string value\");\n\ -addproperty (\"my_radio\", gcf, \"radio\", \"val_1|val_2|@{val_3@}\");\n\ -addproperty (\"my_style\", gcf, \"linelinestyle\", \"--\");\n\ -@end group\n\ -@end example\n\ -\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type})\n\ + @deftypefnx {Built-in Function} {} addproperty (@var{name}, @var{h}, @var{type}, @var{arg}, @dots{})\n\ + Create a new property named @var{name} in graphics object @var{h}.\n\ + @var{type} determines the type of the property to create. @var{args}\n\ + usually contains the default value of the property, but additional\n\ + arguments might be given, depending on the type of the property.\n\ + \n\ + The supported property types are:\n\ + \n\ + @table @code\n\ + @item string\n\ + A string property. @var{arg} contains the default string value.\n\ + \n\ + @item any\n\ + An @nospell{un-typed} property. This kind of property can hold any octave\n\ + value. @var{args} contains the default value.\n\ + \n\ + @item radio\n\ + A string property with a limited set of accepted values. The first\n\ + argument must be a string with all accepted values separated by\n\ + a vertical bar ('|'). The default value can be marked by enclosing\n\ + it with a '@{' '@}' pair. The default value may also be given as\n\ + an optional second string argument.\n\ + \n\ + @item boolean\n\ + A boolean property. This property type is equivalent to a radio\n\ + property with \"on|off\" as accepted values. @var{arg} contains\n\ + the default property value.\n\ + \n\ + @item double\n\ + A scalar double property. @var{arg} contains the default value.\n\ + \n\ + @item handle\n\ + A handle property. This kind of property holds the handle of a\n\ + graphics object. @var{arg} contains the default handle value.\n\ + When no default value is given, the property is initialized to\n\ + the empty matrix.\n\ + \n\ + @item data\n\ + A data (matrix) property. @var{arg} contains the default data\n\ + value. When no default value is given, the data is initialized to\n\ + the empty matrix.\n\ + \n\ + @item color\n\ + A color property. @var{arg} contains the default color value.\n\ + When no default color is given, the property is set to black.\n\ + An optional second string argument may be given to specify an\n\ + additional set of accepted string values (like a radio property).\n\ + @end table\n\ + \n\ + @var{type} may also be the concatenation of a core object type and\n\ + a valid property name for that object type. The property created\n\ + then has the same characteristics as the referenced property (type,\n\ + possible values, hidden state@dots{}). This allows to clone an existing\n\ + property into the graphics object @var{h}.\n\ + \n\ + Examples:\n\ + \n\ + @example\n\ + @group\n\ + addproperty (\"my_property\", gcf, \"string\", \"a string value\");\n\ + addproperty (\"my_radio\", gcf, \"radio\", \"val_1|val_2|@{val_3@}\");\n\ + addproperty (\"my_style\", gcf, \"linelinestyle\", \"--\");\n\ + @end group\n\ + @end example\n\ + \n\ + @end deftypefn") { gh_manager::auto_lock guard; @@ -10201,45 +10213,45 @@ } DEFUN (waitfor, args, , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} waitfor (@var{h})\n\ -@deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop})\n\ -@deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop}, @var{value})\n\ -@deftypefnx {Built-in Function} {} waitfor (@dots{}, \"timeout\", @var{timeout})\n\ -Suspend the execution of the current program until a condition is\n\ -satisfied on the graphics handle @var{h}. While the program is suspended\n\ -graphics events are still being processed normally, allowing callbacks to\n\ -modify the state of graphics objects. This function is reentrant and can be\n\ -called from a callback, while another @code{waitfor} call is pending at\n\ -top-level.\n\ -\n\ -In the first form, program execution is suspended until the graphics object\n\ -@var{h} is destroyed. If the graphics handle is invalid, the function\n\ -returns immediately.\n\ -\n\ -In the second form, execution is suspended until the graphics object is\n\ -destroyed or the property named @var{prop} is modified. If the graphics\n\ -handle is invalid or the property does not exist, the function returns\n\ -immediately.\n\ -\n\ -In the third form, execution is suspended until the graphics object is\n\ -destroyed or the property named @var{prop} is set to @var{value}. The\n\ -function @code{isequal} is used to compare property values. If the graphics\n\ -handle is invalid, the property does not exist or the property is already\n\ -set to @var{value}, the function returns immediately.\n\ -\n\ -An optional timeout can be specified using the property @code{timeout}.\n\ -This timeout value is the number of seconds to wait for the condition to be\n\ -true. @var{timeout} must be at least 1. If a smaller value is specified, a\n\ -warning is issued and a value of 1 is used instead. If the timeout value is\n\ -not an integer, it is truncated towards 0.\n\ -\n\ -To define a condition on a property named @code{timeout}, use the string\n\ -@code{\\timeout} instead.\n\ -\n\ -In all cases, typing CTRL-C stops program execution immediately.\n\ -@seealso{isequal}\n\ -@end deftypefn") + "-*- texinfo -*-\n\ + @deftypefn {Built-in Function} {} waitfor (@var{h})\n\ + @deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop})\n\ + @deftypefnx {Built-in Function} {} waitfor (@var{h}, @var{prop}, @var{value})\n\ + @deftypefnx {Built-in Function} {} waitfor (@dots{}, \"timeout\", @var{timeout})\n\ + Suspend the execution of the current program until a condition is\n\ + satisfied on the graphics handle @var{h}. While the program is suspended\n\ + graphics events are still being processed normally, allowing callbacks to\n\ + modify the state of graphics objects. This function is reentrant and can be\n\ + called from a callback, while another @code{waitfor} call is pending at\n\ + top-level.\n\ + \n\ + In the first form, program execution is suspended until the graphics object\n\ + @var{h} is destroyed. If the graphics handle is invalid, the function\n\ + returns immediately.\n\ + \n\ + In the second form, execution is suspended until the graphics object is\n\ + destroyed or the property named @var{prop} is modified. If the graphics\n\ + handle is invalid or the property does not exist, the function returns\n\ + immediately.\n\ + \n\ + In the third form, execution is suspended until the graphics object is\n\ + destroyed or the property named @var{prop} is set to @var{value}. The\n\ + function @code{isequal} is used to compare property values. If the graphics\n\ + handle is invalid, the property does not exist or the property is already\n\ + set to @var{value}, the function returns immediately.\n\ + \n\ + An optional timeout can be specified using the property @code{timeout}.\n\ + This timeout value is the number of seconds to wait for the condition to be\n\ + true. @var{timeout} must be at least 1. If a smaller value is specified, a\n\ + warning is issued and a value of 1 is used instead. If the timeout value is\n\ + not an integer, it is truncated towards 0.\n\ + \n\ + To define a condition on a property named @code{timeout}, use the string\n\ + @code{\\timeout} instead.\n\ + \n\ + In all cases, typing CTRL-C stops program execution immediately.\n\ + @seealso{isequal}\n\ + @end deftypefn") { if (args.length () > 0) {
--- a/libinterp/corefcn/graphics.in.h +++ b/libinterp/corefcn/graphics.in.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2007-2012 John W. Eaton - -This file is part of Octave. - -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. - -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. - -*/ + Copyright (C) 2007-2012 John W. Eaton + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ #if !defined (graphics_h) #define graphics_h 1 @@ -44,6 +44,7 @@ #include "oct-mutex.h" #include "oct-refcount.h" #include "ov.h" +#include "txt-render.h" #include "txt-eng-ft.h" // FIXME: maybe this should be a configure option? @@ -69,49 +70,49 @@ graphics_handle (const graphics_handle& a) : val (a.val) { } graphics_handle& operator = (const graphics_handle& a) - { - if (&a != this) - val = a.val; - - return *this; - } + { + if (&a != this) + val = a.val; + + return *this; + } ~graphics_handle (void) { } double value (void) const { return val; } octave_value as_octave_value (void) const - { - return ok () ? octave_value (val) : octave_value (Matrix ()); - } + { + return ok () ? octave_value (val) : octave_value (Matrix ()); + } // Prefix increment/decrement operators. graphics_handle& operator ++ (void) - { - ++val; - return *this; - } + { + ++val; + return *this; + } graphics_handle& operator -- (void) - { - --val; - return *this; - } + { + --val; + return *this; + } // Postfix increment/decrement operators. const graphics_handle operator ++ (int) - { - graphics_handle old_value = *this; - ++(*this); - return old_value; - } + { + graphics_handle old_value = *this; + ++(*this); + return old_value; + } const graphics_handle operator -- (int) - { - graphics_handle old_value = *this; - --(*this); - return old_value; - } + { + graphics_handle old_value = *this; + --(*this); + return old_value; + } bool ok (void) const { return ! xisnan (val); } @@ -305,7 +306,7 @@ ? new log_scaler () : (s == "neglog" ? new neg_log_scaler () : (s == "linear" ? new lin_scaler () : new base_scaler ()))) - { } + { } ~scaler (void) { delete rep; } @@ -383,8 +384,8 @@ base_property (const base_property& p) : id (-1), count (1), name (p.name), parent (p.parent), - hidden (p.hidden), listeners () - { } + hidden (p.hidden), listeners () + { } virtual ~base_property (void) { } @@ -620,7 +621,7 @@ string_array_property (const string_array_property& p) : base_property (p), desired_type (p.desired_type), - separator (p.separator), str (p.str) { } + separator (p.separator), str (p.str) { } octave_value get (void) const { @@ -779,76 +780,76 @@ text_label_property (const std::string& s, const graphics_handle& h, const std::string& val = "") : base_property (s, h), value (val), stored_type (char_t) - { } + { } text_label_property (const std::string& s, const graphics_handle& h, const NDArray& nda) : base_property (s, h), stored_type (char_t) - { - octave_idx_type nel = nda.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - std::ostringstream buf; - buf << nda(i); - value[i] = buf.str (); - } - } + { + octave_idx_type nel = nda.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + std::ostringstream buf; + buf << nda(i); + value[i] = buf.str (); + } + } text_label_property (const std::string& s, const graphics_handle& h, const Cell& c) : base_property (s, h), stored_type (cellstr_t) - { - octave_idx_type nel = c.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - octave_value tmp = c(i); - - if (tmp.is_string ()) - value[i] = c(i).string_value (); - else - { - double d = c(i).double_value (); - - if (! error_state) - { - std::ostringstream buf; - buf << d; - value[i] = buf.str (); - } - else - break; - } - } - } + { + octave_idx_type nel = c.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + octave_value tmp = c(i); + + if (tmp.is_string ()) + value[i] = c(i).string_value (); + else + { + double d = c(i).double_value (); + + if (! error_state) + { + std::ostringstream buf; + buf << d; + value[i] = buf.str (); + } + else + break; + } + } + } text_label_property (const text_label_property& p) : base_property (p), value (p.value), stored_type (p.stored_type) - { } + { } bool empty (void) const - { - octave_value tmp = get (); - return tmp.is_empty (); - } + { + octave_value tmp = get (); + return tmp.is_empty (); + } octave_value get (void) const - { - if (stored_type == char_t) - return octave_value (char_value ()); - else - return octave_value (cell_value ()); - } + { + if (stored_type == char_t) + return octave_value (char_value ()); + else + return octave_value (cell_value ()); + } std::string string_value (void) const - { - return value.empty () ? std::string () : value[0]; - } + { + return value.empty () ? std::string () : value[0]; + } string_vector string_vector_value (void) const { return value; } @@ -857,84 +858,84 @@ Cell cell_value (void) const {return Cell (value); } text_label_property& operator = (const octave_value& val) - { - set (val); - return *this; - } + { + set (val); + return *this; + } base_property* clone (void) const { return new text_label_property (*this); } protected: bool do_set (const octave_value& val) - { - if (val.is_string ()) - { - value = val.all_strings (); - - stored_type = char_t; - } - else if (val.is_cell ()) - { - Cell c = val.cell_value (); - - octave_idx_type nel = c.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - octave_value tmp = c(i); - - if (tmp.is_string ()) - value[i] = c(i).string_value (); - else - { - double d = c(i).double_value (); - - if (! error_state) - { - std::ostringstream buf; - buf << d; - value[i] = buf.str (); - } - else - return false; - } - } - - stored_type = cellstr_t; - } - else - { - NDArray nda = val.array_value (); - - if (! error_state) - { - octave_idx_type nel = nda.numel (); - - value.resize (nel); - - for (octave_idx_type i = 0; i < nel; i++) - { - std::ostringstream buf; - buf << nda(i); - value[i] = buf.str (); - } - - stored_type = char_t; - } - else - { - error ("set: invalid string property value for \"%s\"", - get_name ().c_str ()); - - return false; - } - } - - return true; - } + { + if (val.is_string ()) + { + value = val.all_strings (); + + stored_type = char_t; + } + else if (val.is_cell ()) + { + Cell c = val.cell_value (); + + octave_idx_type nel = c.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + octave_value tmp = c(i); + + if (tmp.is_string ()) + value[i] = c(i).string_value (); + else + { + double d = c(i).double_value (); + + if (! error_state) + { + std::ostringstream buf; + buf << d; + value[i] = buf.str (); + } + else + return false; + } + } + + stored_type = cellstr_t; + } + else + { + NDArray nda = val.array_value (); + + if (! error_state) + { + octave_idx_type nel = nda.numel (); + + value.resize (nel); + + for (octave_idx_type i = 0; i < nel; i++) + { + std::ostringstream buf; + buf << nda(i); + value[i] = buf.str (); + } + + stored_type = char_t; + } + else + { + error ("set: invalid string property value for \"%s\"", + get_name ().c_str ()); + + return false; + } + } + + return true; + } private: string_vector value; @@ -952,72 +953,72 @@ : default_val (a.default_val), possible_vals (a.possible_vals) { } radio_values& operator = (const radio_values& a) - { - if (&a != this) - { - default_val = a.default_val; - possible_vals = a.possible_vals; - } - - return *this; - } + { + if (&a != this) + { + default_val = a.default_val; + possible_vals = a.possible_vals; + } + + return *this; + } std::string default_value (void) const { return default_val; } bool validate (const std::string& val, std::string& match) - { - bool retval = true; - - if (! contains (val, match)) - { - error ("invalid value = %s", val.c_str ()); - retval = false; - } - - return retval; - } + { + bool retval = true; + + if (! contains (val, match)) + { + error ("invalid value = %s", val.c_str ()); + retval = false; + } + + return retval; + } bool contains (const std::string& val, std::string& match) - { - size_t k = 0; - - size_t len = val.length (); - - std::string first_match; - - for (std::set<caseless_str>::const_iterator p = possible_vals.begin (); - p != possible_vals.end (); p++) - { - if (p->compare (val, len)) - { - if (len == p->length ()) - { - // We found a full match (consider the case of val == - // "replace" with possible values "replace" and - // "replacechildren"). Any other matches are - // irrelevant, so set match and return now. - - match = *p; - return true; - } - else - { - if (k == 0) - first_match = *p; - - k++; - } - } - } - - if (k == 1) - { - match = first_match; - return true; - } - else - return false; - } + { + size_t k = 0; + + size_t len = val.length (); + + std::string first_match; + + for (std::set<caseless_str>::const_iterator p = possible_vals.begin (); + p != possible_vals.end (); p++) + { + if (p->compare (val, len)) + { + if (len == p->length ()) + { + // We found a full match (consider the case of val == + // "replace" with possible values "replace" and + // "replacechildren"). Any other matches are + // irrelevant, so set match and return now. + + match = *p; + return true; + } + else + { + if (k == 0) + first_match = *p; + + k++; + } + } + } + + if (k == 1) + { + match = first_match; + return true; + } + else + return false; + } std::string values_as_string (void) const; @@ -1037,17 +1038,17 @@ radio_property (const std::string& nm, const graphics_handle& h, const radio_values& v = radio_values ()) : base_property (nm, h), - vals (v), current_val (v.default_value ()) { } + vals (v), current_val (v.default_value ()) { } radio_property (const std::string& nm, const graphics_handle& h, const std::string& v) : base_property (nm, h), - vals (v), current_val (vals.default_value ()) { } + vals (v), current_val (vals.default_value ()) { } radio_property (const std::string& nm, const graphics_handle& h, const radio_values& v, const std::string& def) : base_property (nm, h), - vals (v), current_val (def) { } + vals (v), current_val (def) { } radio_property (const radio_property& p) : base_property (p), vals (p.vals), current_val (p.current_val) { } @@ -1075,35 +1076,35 @@ protected: bool do_set (const octave_value& newval) - { - if (newval.is_string ()) - { - std::string s = newval.string_value (); - - std::string match; - - if (vals.validate (s, match)) - { - if (match != current_val) - { - if (s.length () != match.length ()) - warning_with_id ("Octave:abbreviated-property-match", - "%s: allowing %s to match %s value %s", - "set", s.c_str (), get_name ().c_str (), - match.c_str ()); - current_val = match; - return true; - } - } - else - error ("set: invalid value for radio property \"%s\" (value = %s)", - get_name ().c_str (), s.c_str ()); - } - else - error ("set: invalid value for radio property \"%s\"", - get_name ().c_str ()); - return false; - } + { + if (newval.is_string ()) + { + std::string s = newval.string_value (); + + std::string match; + + if (vals.validate (s, match)) + { + if (match != current_val) + { + if (s.length () != match.length ()) + warning_with_id ("Octave:abbreviated-property-match", + "%s: allowing %s to match %s value %s", + "set", s.c_str (), get_name ().c_str (), + match.c_str ()); + current_val = match; + return true; + } + } + else + error ("set: invalid value for radio property \"%s\" (value = %s)", + get_name ().c_str (), s.c_str ()); + } + else + error ("set: invalid value for radio property \"%s\"", + get_name ().c_str ()); + return false; + } private: radio_values vals; @@ -1117,32 +1118,32 @@ public: color_values (double r = 0, double g = 0, double b = 1) : xrgb (1, 3) - { - xrgb(0) = r; - xrgb(1) = g; - xrgb(2) = b; - - validate (); - } + { + xrgb(0) = r; + xrgb(1) = g; + xrgb(2) = b; + + validate (); + } color_values (std::string str) : xrgb (1, 3) - { - if (! str2rgb (str)) - error ("invalid color specification: %s", str.c_str ()); - } + { + if (! str2rgb (str)) + error ("invalid color specification: %s", str.c_str ()); + } color_values (const color_values& c) : xrgb (c.xrgb) - { } + { } color_values& operator = (const color_values& c) - { - if (&c != this) - xrgb = c.xrgb; - - return *this; - } + { + if (&c != this) + xrgb = c.xrgb; + + return *this; + } bool operator == (const color_values& c) const { @@ -1159,16 +1160,16 @@ operator octave_value (void) const { return xrgb; } void validate (void) const - { - for (int i = 0; i < 3; i++) - { - if (xrgb(i) < 0 || xrgb(i) > 1) - { - error ("invalid RGB color specification"); - break; - } - } - } + { + for (int i = 0; i < 3; i++) + { + if (xrgb(i) < 0 || xrgb(i) > 1) + { + error ("invalid RGB color specification"); + break; + } + } + } private: Matrix xrgb; @@ -1181,51 +1182,51 @@ public: color_property (const color_values& c, const radio_values& v) : base_property ("", graphics_handle ()), - current_type (color_t), color_val (c), radio_val (v), - current_val (v.default_value ()) + current_type (color_t), color_val (c), radio_val (v), + current_val (v.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const color_values& c = color_values (), const radio_values& v = radio_values ()) : base_property (nm, h), - current_type (color_t), color_val (c), radio_val (v), - current_val (v.default_value ()) + current_type (color_t), color_val (c), radio_val (v), + current_val (v.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const radio_values& v) : base_property (nm, h), - current_type (radio_t), color_val (color_values ()), radio_val (v), - current_val (v.default_value ()) + current_type (radio_t), color_val (color_values ()), radio_val (v), + current_val (v.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const std::string& v) : base_property (nm, h), - current_type (radio_t), color_val (color_values ()), radio_val (v), - current_val (radio_val.default_value ()) + current_type (radio_t), color_val (color_values ()), radio_val (v), + current_val (radio_val.default_value ()) { } color_property (const std::string& nm, const graphics_handle& h, const color_property& v) : base_property (nm, h), - current_type (v.current_type), color_val (v.color_val), - radio_val (v.radio_val), current_val (v.current_val) + current_type (v.current_type), color_val (v.color_val), + radio_val (v.radio_val), current_val (v.current_val) { } color_property (const color_property& p) : base_property (p), current_type (p.current_type), - color_val (p.color_val), radio_val (p.radio_val), - current_val (p.current_val) { } + color_val (p.color_val), radio_val (p.radio_val), + current_val (p.current_val) { } octave_value get (void) const - { - if (current_type == color_t) - return color_val.rgb (); - - return current_val; - } + { + if (current_type == color_t) + return color_val.rgb (); + + return current_val; + } bool is_rgb (void) const { return (current_type == color_t); } @@ -1235,20 +1236,20 @@ { return (is_radio () && current_val == v); } Matrix rgb (void) const - { - if (current_type != color_t) - error ("color has no rgb value"); - - return color_val.rgb (); - } + { + if (current_type != color_t) + error ("color has no rgb value"); + + return color_val.rgb (); + } const std::string& current_value (void) const - { - if (current_type != radio_t) - error ("color has no radio value"); - - return current_val; - } + { + if (current_type != radio_t) + error ("color has no radio value"); + + return current_val; + } color_property& operator = (const octave_value& val) { @@ -1282,7 +1283,7 @@ double_property (const std::string& nm, const graphics_handle& h, double d = 0) : base_property (nm, h), - current_val (d) { } + current_val (d) { } double_property (const double_property& p) : base_property (p), current_val (p.current_val) { } @@ -1328,37 +1329,37 @@ { public: double_radio_property (double d, const radio_values& v) - : base_property ("", graphics_handle ()), - current_type (double_t), dval (d), radio_val (v), - current_val (v.default_value ()) + : base_property ("", graphics_handle ()), + current_type (double_t), dval (d), radio_val (v), + current_val (v.default_value ()) { } double_radio_property (const std::string& nm, const graphics_handle& h, const std::string& v) - : base_property (nm, h), - current_type (radio_t), dval (0), radio_val (v), - current_val (radio_val.default_value ()) + : base_property (nm, h), + current_type (radio_t), dval (0), radio_val (v), + current_val (radio_val.default_value ()) { } double_radio_property (const std::string& nm, const graphics_handle& h, const double_radio_property& v) - : base_property (nm, h), - current_type (v.current_type), dval (v.dval), - radio_val (v.radio_val), current_val (v.current_val) + : base_property (nm, h), + current_type (v.current_type), dval (v.dval), + radio_val (v.radio_val), current_val (v.current_val) { } double_radio_property (const double_radio_property& p) : base_property (p), current_type (p.current_type), - dval (p.dval), radio_val (p.radio_val), - current_val (p.current_val) { } + dval (p.dval), radio_val (p.radio_val), + current_val (p.current_val) { } octave_value get (void) const - { - if (current_type == double_t) - return dval; - - return current_val; - } + { + if (current_type == double_t) + return dval; + + return current_val; + } bool is_double (void) const { return (current_type == double_t); } @@ -1368,20 +1369,20 @@ { return (is_radio () && current_val == v); } double double_value (void) const - { - if (current_type != double_t) - error ("%s: property has no double", get_name ().c_str ()); - - return dval; - } + { + if (current_type != double_t) + error ("%s: property has no double", get_name ().c_str ()); + + return dval; + } const std::string& current_value (void) const - { - if (current_type != radio_t) - error ("%s: property has no radio value"); - - return current_val; - } + { + if (current_type != radio_t) + error ("%s: property has no radio value"); + + return current_val; + } double_radio_property& operator = (const octave_value& val) { @@ -1411,29 +1412,29 @@ public: array_property (void) : base_property ("", graphics_handle ()), data (Matrix ()), - xmin (), xmax (), xminp (), xmaxp (), - type_constraints (), size_constraints () - { - get_data_limits (); - } + xmin (), xmax (), xminp (), xmaxp (), + type_constraints (), size_constraints () + { + get_data_limits (); + } array_property (const std::string& nm, const graphics_handle& h, const octave_value& m) : base_property (nm, h), data (m.is_sparse_type () ? m.full_value () : m), - xmin (), xmax (), xminp (), xmaxp (), - type_constraints (), size_constraints () - { - get_data_limits (); - } + xmin (), xmax (), xminp (), xmaxp (), + type_constraints (), size_constraints () + { + get_data_limits (); + } // This copy constructor is only intended to be used // internally to access min/max values; no need to // copy constraints. array_property (const array_property& p) : base_property (p), data (p.data), - xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp), - type_constraints (), size_constraints () - { } + xmin (p.xmin), xmax (p.xmax), xminp (p.xminp), xmaxp (p.xmaxp), + type_constraints (), size_constraints () + { } octave_value get (void) const { return data; } @@ -1523,42 +1524,42 @@ row_vector_property (const std::string& nm, const graphics_handle& h, const octave_value& m) : array_property (nm, h, m) - { - add_constraint (dim_vector (-1, 1)); - add_constraint (dim_vector (1, -1)); - } + { + add_constraint (dim_vector (-1, 1)); + add_constraint (dim_vector (1, -1)); + } row_vector_property (const row_vector_property& p) : array_property (p) - { - add_constraint (dim_vector (-1, 1)); - add_constraint (dim_vector (1, -1)); - } + { + add_constraint (dim_vector (-1, 1)); + add_constraint (dim_vector (1, -1)); + } void add_constraint (const std::string& type) - { - array_property::add_constraint (type); - } + { + array_property::add_constraint (type); + } void add_constraint (const dim_vector& dims) - { - array_property::add_constraint (dims); - } + { + array_property::add_constraint (dims); + } void add_constraint (octave_idx_type len) - { - size_constraints.remove (dim_vector (1, -1)); - size_constraints.remove (dim_vector (-1, 1)); - - add_constraint (dim_vector (1, len)); - add_constraint (dim_vector (len, 1)); - } + { + size_constraints.remove (dim_vector (1, -1)); + size_constraints.remove (dim_vector (-1, 1)); + + add_constraint (dim_vector (1, len)); + add_constraint (dim_vector (len, 1)); + } row_vector_property& operator = (const octave_value& val) - { - set (val); - return *this; - } + { + set (val); + return *this; + } base_property* clone (void) const { @@ -1572,27 +1573,27 @@ protected: bool do_set (const octave_value& v) - { - bool retval = array_property::do_set (v); - - if (! error_state) - { - dim_vector dv = data.dims (); - - if (dv(0) > 1 && dv(1) == 1) - { - int tmp = dv(0); - dv(0) = dv(1); - dv(1) = tmp; - - data = data.reshape (dv); - } - - return retval; - } - - return false; - } + { + bool retval = array_property::do_set (v); + + if (! error_state) + { + dim_vector dv = data.dims (); + + if (dv(0) > 1 && dv(1) == 1) + { + int tmp = dv(0); + dv(0) = dv(1); + dv(1) = tmp; + + data = data.reshape (dv); + } + + return retval; + } + + return false; + } private: OCTINTERP_API bool validate (const octave_value& v); @@ -1606,7 +1607,7 @@ bool_property (const std::string& nm, const graphics_handle& h, bool val) : radio_property (nm, h, radio_values (val ? "{on}|off" : "on|{off}")) - { } + { } bool_property (const std::string& nm, const graphics_handle& h, const char* val) @@ -1644,7 +1645,7 @@ handle_property (const std::string& nm, const graphics_handle& h, const graphics_handle& val = graphics_handle ()) : base_property (nm, h), - current_val (val) { } + current_val (val) { } handle_property (const handle_property& p) : base_property (p), current_val (p.current_val) { } @@ -1680,7 +1681,7 @@ { public: any_property (const std::string& nm, const graphics_handle& h, - const octave_value& m = Matrix ()) + const octave_value& m = Matrix ()) : base_property (nm, h), data (m) { } any_property (const any_property& p) @@ -1760,9 +1761,9 @@ } Matrix get_all (void) const - { - return do_get_all_children (); - } + { + return do_get_all_children (); + } octave_value get (void) const { @@ -1957,15 +1958,15 @@ { public: property (void) : rep (new base_property ("", graphics_handle ())) - { } + { } property (base_property *bp, bool persist = false) : rep (bp) - { if (persist) rep->count++; } + { if (persist) rep->count++; } property (const property& p) : rep (p.rep) - { - rep->count++; - } + { + rep->count++; + } ~property (void) { @@ -2038,38 +2039,38 @@ void delete_listener (const octave_value& v = octave_value (), listener_mode mode = POSTSET) - { rep->delete_listener (v, mode); } + { rep->delete_listener (v, mode); } void run_listeners (listener_mode mode = POSTSET) { rep->run_listeners (mode); } OCTINTERP_API static - property create (const std::string& name, const graphics_handle& parent, - const caseless_str& type, - const octave_value_list& args); + property create (const std::string& name, const graphics_handle& parent, + const caseless_str& type, + const octave_value_list& args); property clone (void) const { return property (rep->clone ()); } /* - const string_property& as_string_property (void) const - { return *(dynamic_cast<string_property*> (rep)); } - - const radio_property& as_radio_property (void) const - { return *(dynamic_cast<radio_property*> (rep)); } - - const color_property& as_color_property (void) const - { return *(dynamic_cast<color_property*> (rep)); } - - const double_property& as_double_property (void) const - { return *(dynamic_cast<double_property*> (rep)); } - - const bool_property& as_bool_property (void) const - { return *(dynamic_cast<bool_property*> (rep)); } - - const handle_property& as_handle_property (void) const - { return *(dynamic_cast<handle_property*> (rep)); } - */ + const string_property& as_string_property (void) const + { return *(dynamic_cast<string_property*> (rep)); } + + const radio_property& as_radio_property (void) const + { return *(dynamic_cast<radio_property*> (rep)); } + + const color_property& as_color_property (void) const + { return *(dynamic_cast<color_property*> (rep)); } + + const double_property& as_double_property (void) const + { return *(dynamic_cast<double_property*> (rep)); } + + const bool_property& as_bool_property (void) const + { return *(dynamic_cast<bool_property*> (rep)); } + + const handle_property& as_handle_property (void) const + { return *(dynamic_cast<handle_property*> (rep)); } + */ private: base_property *rep; @@ -2105,14 +2106,14 @@ plist_map_const_iterator end (void) const { return plist_map.end (); } plist_map_iterator find (const std::string& go_name) - { - return plist_map.find (go_name); - } + { + return plist_map.find (go_name); + } plist_map_const_iterator find (const std::string& go_name) const - { - return plist_map.find (go_name); - } + { + return plist_map.find (go_name); + } octave_scalar_map as_struct (const std::string& prefix_arg) const; @@ -2132,7 +2133,7 @@ public: base_graphics_toolkit (const std::string& nm) - : name (nm), count (0) { } + : name (nm), count (0) { } virtual ~base_graphics_toolkit (void) { } @@ -2192,7 +2193,7 @@ // Close the graphics toolkit. virtual void close (void) - { gripe_invalid ("base_graphics_toolkit::close"); } + { gripe_invalid ("base_graphics_toolkit::close"); } private: std::string name; @@ -2210,19 +2211,19 @@ { public: graphics_toolkit (void) - : rep (new base_graphics_toolkit ("unknown")) + : rep (new base_graphics_toolkit ("unknown")) { rep->count++; } graphics_toolkit (base_graphics_toolkit* b) - : rep (b) + : rep (b) { rep->count++; } graphics_toolkit (const graphics_toolkit& b) - : rep (b.rep) + : rep (b.rep) { rep->count++; } @@ -2304,60 +2305,60 @@ public: static graphics_toolkit get_toolkit (void) - { - return instance_ok () ? instance->do_get_toolkit () : graphics_toolkit (); - } + { + return instance_ok () ? instance->do_get_toolkit () : graphics_toolkit (); + } static void register_toolkit (const std::string& name) - { - if (instance_ok ()) - instance->do_register_toolkit (name); - } + { + if (instance_ok ()) + instance->do_register_toolkit (name); + } static void unregister_toolkit (const std::string& name) - { - if (instance_ok ()) - instance->do_unregister_toolkit (name); - } + { + if (instance_ok ()) + instance->do_unregister_toolkit (name); + } static void load_toolkit (const graphics_toolkit& tk) - { - if (instance_ok ()) - instance->do_load_toolkit (tk); - } + { + if (instance_ok ()) + instance->do_load_toolkit (tk); + } static void unload_toolkit (const std::string& name) - { - if (instance_ok ()) - instance->do_unload_toolkit (name); - } + { + if (instance_ok ()) + instance->do_unload_toolkit (name); + } static graphics_toolkit find_toolkit (const std::string& name) - { - return instance_ok () - ? instance->do_find_toolkit (name) : graphics_toolkit (); - } + { + return instance_ok () + ? instance->do_find_toolkit (name) : graphics_toolkit (); + } static Cell available_toolkits_list (void) - { - return instance_ok () ? instance->do_available_toolkits_list () : Cell (); - } + { + return instance_ok () ? instance->do_available_toolkits_list () : Cell (); + } static Cell loaded_toolkits_list (void) - { - return instance_ok () ? instance->do_loaded_toolkits_list () : Cell (); - } + { + return instance_ok () ? instance->do_loaded_toolkits_list () : Cell (); + } static void unload_all_toolkits (void) - { - if (instance_ok ()) - instance->do_unload_all_toolkits (); - } + { + if (instance_ok ()) + instance->do_unload_all_toolkits (); + } static std::string default_toolkit (void) - { - return instance_ok () ? instance->do_default_toolkit () : std::string (); - } + { + return instance_ok () ? instance->do_default_toolkit () : std::string (); + } private: @@ -2371,21 +2372,21 @@ OCTINTERP_API static void create_instance (void); static bool instance_ok (void) - { - bool retval = true; - - if (! instance) - create_instance (); - - if (! instance) - { - ::error ("unable to create gh_manager!"); - - retval = false; - } - - return retval; - } + { + bool retval = true; + + if (! instance) + create_instance (); + + if (! instance) + { + ::error ("unable to create gh_manager!"); + + retval = false; + } + + return retval; + } static void cleanup_instance (void) { delete instance; instance = 0; } @@ -2414,75 +2415,75 @@ graphics_toolkit do_get_toolkit (void) const; void do_register_toolkit (const std::string& name) - { - available_toolkits.insert (name); - } + { + available_toolkits.insert (name); + } void do_unregister_toolkit (const std::string& name) - { - available_toolkits.erase (name); - } + { + available_toolkits.erase (name); + } void do_load_toolkit (const graphics_toolkit& tk) - { - loaded_toolkits[tk.get_name ()] = tk; - } + { + loaded_toolkits[tk.get_name ()] = tk; + } void do_unload_toolkit (const std::string& name) - { - loaded_toolkits.erase (name); - } + { + loaded_toolkits.erase (name); + } graphics_toolkit do_find_toolkit (const std::string& name) const - { - const_loaded_toolkits_iterator p = loaded_toolkits.find (name); - - if (p != loaded_toolkits.end ()) - return p->second; - else - return graphics_toolkit (); - } + { + const_loaded_toolkits_iterator p = loaded_toolkits.find (name); + + if (p != loaded_toolkits.end ()) + return p->second; + else + return graphics_toolkit (); + } Cell do_available_toolkits_list (void) const - { - Cell m (1 , available_toolkits.size ()); - - octave_idx_type i = 0; - for (const_available_toolkits_iterator p = available_toolkits.begin (); - p != available_toolkits.end (); p++) - m(i++) = *p; - - return m; - } + { + Cell m (1 , available_toolkits.size ()); + + octave_idx_type i = 0; + for (const_available_toolkits_iterator p = available_toolkits.begin (); + p != available_toolkits.end (); p++) + m(i++) = *p; + + return m; + } Cell do_loaded_toolkits_list (void) const - { - Cell m (1 , loaded_toolkits.size ()); - - octave_idx_type i = 0; - for (const_loaded_toolkits_iterator p = loaded_toolkits.begin (); - p != loaded_toolkits.end (); p++) - m(i++) = p->first; - - return m; - } + { + Cell m (1 , loaded_toolkits.size ()); + + octave_idx_type i = 0; + for (const_loaded_toolkits_iterator p = loaded_toolkits.begin (); + p != loaded_toolkits.end (); p++) + m(i++) = p->first; + + return m; + } void do_unload_all_toolkits (void) - { - while (! loaded_toolkits.empty ()) - { - loaded_toolkits_iterator p = loaded_toolkits.begin (); - - std::string name = p->first; - - p->second.close (); - - // The toolkit may have unloaded itself. If not, we'll do - // it here. - if (loaded_toolkits.find (name) != loaded_toolkits.end ()) - unload_toolkit (name); - } - } + { + while (! loaded_toolkits.empty ()) + { + loaded_toolkits_iterator p = loaded_toolkits.begin (); + + std::string name = p->first; + + p->second.close (); + + // The toolkit may have unloaded itself. If not, we'll do + // it here. + if (loaded_toolkits.find (name) != loaded_toolkits.end ()) + unload_toolkit (name); + } + } std::string do_default_toolkit (void) { return dtk; } }; @@ -2529,24 +2530,24 @@ virtual octave_value get (const caseless_str& pname) const; virtual octave_value get (const std::string& pname) const - { - return get (caseless_str (pname)); - } + { + return get (caseless_str (pname)); + } virtual octave_value get (const char *pname) const - { - return get (caseless_str (pname)); - } + { + return get (caseless_str (pname)); + } virtual octave_value get (bool all = false) const; virtual property get_property (const caseless_str& pname); virtual bool has_property (const caseless_str&) const - { - panic_impossible (); - return false; - } + { + panic_impossible (); + return false; + } bool is_modified (void) const { return is___modified__ (); } @@ -2557,10 +2558,10 @@ } virtual void adopt (const graphics_handle& h) - { - children.adopt (h.value ()); - mark_modified (); - } + { + children.adopt (h.value ()); + mark_modified (); + } virtual graphics_toolkit get_toolkit (void) const; @@ -2685,29 +2686,29 @@ // additional (Octave-specific) properties bool_property __modified__ s , "on" graphics_handle __myhandle__ fhrs , mh - END_PROPERTIES + END_PROPERTIES protected: - struct cmp_caseless_str - { - bool operator () (const caseless_str &a, const caseless_str &b) const - { - std::string a1 = a; - std::transform (a1.begin (), a1.end (), a1.begin (), tolower); - std::string b1 = b; - std::transform (b1.begin (), b1.end (), b1.begin (), tolower); - - return a1 < b1; - } - }; - - std::map<caseless_str, property, cmp_caseless_str> all_props; + struct cmp_caseless_str + { + bool operator () (const caseless_str &a, const caseless_str &b) const + { + std::string a1 = a; + std::transform (a1.begin (), a1.end (), a1.begin (), tolower); + std::string b1 = b; + std::transform (b1.begin (), b1.end (), b1.begin (), tolower); + + return a1 < b1; + } + }; + + std::map<caseless_str, property, cmp_caseless_str> all_props; protected: - void insert_static_property (const std::string& name, base_property& p) - { insert_property (name, property (&p, true)); } - - virtual void init (void) { } + void insert_static_property (const std::string& name, base_property& p) + { insert_property (name, property (&p, true)); } + + virtual void init (void) { } }; class OCTINTERP_API base_graphics_object @@ -2720,154 +2721,154 @@ virtual ~base_graphics_object (void) { } virtual void mark_modified (void) - { - if (valid_object ()) - get_properties ().mark_modified (); - else - error ("base_graphics_object::mark_modified: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().mark_modified (); + else + error ("base_graphics_object::mark_modified: invalid graphics object"); + } virtual void override_defaults (base_graphics_object& obj) - { - if (valid_object ()) - get_properties ().override_defaults (obj); - else - error ("base_graphics_object::override_defaults: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().override_defaults (obj); + else + error ("base_graphics_object::override_defaults: invalid graphics object"); + } virtual void set_from_list (property_list& plist) - { - if (valid_object ()) - get_properties ().set_from_list (*this, plist); - else - error ("base_graphics_object::set_from_list: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().set_from_list (*this, plist); + else + error ("base_graphics_object::set_from_list: invalid graphics object"); + } virtual void set (const caseless_str& pname, const octave_value& pval) - { - if (valid_object ()) - get_properties ().set (pname, pval); - else - error ("base_graphics_object::set: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().set (pname, pval); + else + error ("base_graphics_object::set: invalid graphics object"); + } virtual void set_defaults (const std::string&) - { - error ("base_graphics_object::set_defaults: invalid graphics object"); - } + { + error ("base_graphics_object::set_defaults: invalid graphics object"); + } virtual octave_value get (bool all = false) const - { - if (valid_object ()) - return get_properties ().get (all); - else - { - error ("base_graphics_object::get: invalid graphics object"); - return octave_value (); - } - } + { + if (valid_object ()) + return get_properties ().get (all); + else + { + error ("base_graphics_object::get: invalid graphics object"); + return octave_value (); + } + } virtual octave_value get (const caseless_str& pname) const - { - if (valid_object ()) - return get_properties ().get (pname); - else - { - error ("base_graphics_object::get: invalid graphics object"); - return octave_value (); - } - } + { + if (valid_object ()) + return get_properties ().get (pname); + else + { + error ("base_graphics_object::get: invalid graphics object"); + return octave_value (); + } + } virtual octave_value get_default (const caseless_str&) const; virtual octave_value get_factory_default (const caseless_str&) const; virtual octave_value get_defaults (void) const - { - error ("base_graphics_object::get_defaults: invalid graphics object"); - return octave_value (); - } + { + error ("base_graphics_object::get_defaults: invalid graphics object"); + return octave_value (); + } virtual octave_value get_factory_defaults (void) const - { - error ("base_graphics_object::get_factory_defaults: invalid graphics object"); - return octave_value (); - } + { + error ("base_graphics_object::get_factory_defaults: invalid graphics object"); + return octave_value (); + } virtual std::string values_as_string (void); virtual octave_scalar_map values_as_struct (void); virtual graphics_handle get_parent (void) const - { - if (valid_object ()) - return get_properties ().get_parent (); - else - { - error ("base_graphics_object::get_parent: invalid graphics object"); - return graphics_handle (); - } - } + { + if (valid_object ()) + return get_properties ().get_parent (); + else + { + error ("base_graphics_object::get_parent: invalid graphics object"); + return graphics_handle (); + } + } graphics_handle get_handle (void) const - { - if (valid_object ()) - return get_properties ().get___myhandle__ (); - else - { - error ("base_graphics_object::get_handle: invalid graphics object"); - return graphics_handle (); - } - } + { + if (valid_object ()) + return get_properties ().get___myhandle__ (); + else + { + error ("base_graphics_object::get_handle: invalid graphics object"); + return graphics_handle (); + } + } virtual void remove_child (const graphics_handle& h) - { - if (valid_object ()) - get_properties ().remove_child (h); - else - error ("base_graphics_object::remove_child: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().remove_child (h); + else + error ("base_graphics_object::remove_child: invalid graphics object"); + } virtual void adopt (const graphics_handle& h) - { - if (valid_object ()) - get_properties ().adopt (h); - else - error ("base_graphics_object::adopt: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().adopt (h); + else + error ("base_graphics_object::adopt: invalid graphics object"); + } virtual void reparent (const graphics_handle& np) - { - if (valid_object ()) - get_properties ().reparent (np); - else - error ("base_graphics_object::reparent: invalid graphics object"); - } + { + if (valid_object ()) + get_properties ().reparent (np); + else + error ("base_graphics_object::reparent: invalid graphics object"); + } virtual void defaults (void) const - { - if (valid_object ()) - { - std::string msg = (type () + "::defaults"); - gripe_not_implemented (msg.c_str ()); - } - else - error ("base_graphics_object::default: invalid graphics object"); - } + { + if (valid_object ()) + { + std::string msg = (type () + "::defaults"); + gripe_not_implemented (msg.c_str ()); + } + else + error ("base_graphics_object::default: invalid graphics object"); + } virtual base_properties& get_properties (void) - { - static base_properties properties; - error ("base_graphics_object::get_properties: invalid graphics object"); - return properties; - } + { + static base_properties properties; + error ("base_graphics_object::get_properties: invalid graphics object"); + return properties; + } virtual const base_properties& get_properties (void) const - { - static base_properties properties; - error ("base_graphics_object::get_properties: invalid graphics object"); - return properties; - } + { + static base_properties properties; + error ("base_graphics_object::get_properties: invalid graphics object"); + return properties; + } virtual void update_axis_limits (const std::string& axis_type); @@ -2879,26 +2880,26 @@ bool valid_toolkit_object (void) const { return toolkit_flag; } virtual std::string type (void) const - { - return (valid_object () ? get_properties ().graphics_object_name () - : "unknown"); - } + { + return (valid_object () ? get_properties ().graphics_object_name () + : "unknown"); + } bool isa (const std::string& go_name) const - { - return type () == go_name; - } + { + return type () == go_name; + } virtual graphics_toolkit get_toolkit (void) const - { - if (valid_object ()) - return get_properties ().get_toolkit (); - else - { - error ("base_graphics_object::get_toolkit: invalid graphics object"); - return graphics_toolkit (); - } - } + { + if (valid_object ()) + return get_properties ().get_toolkit (); + else + { + error ("base_graphics_object::get_toolkit: invalid graphics object"); + return graphics_toolkit (); + } + } virtual void add_property_listener (const std::string& nm, const octave_value& v, @@ -2964,9 +2965,9 @@ base_graphics_object (const base_graphics_object&) : count (0) { } base_graphics_object& operator = (const base_graphics_object&) - { - return *this; - } + { + return *this; + } }; class OCTINTERP_API graphics_object @@ -2983,38 +2984,38 @@ } graphics_object& operator = (const graphics_object& obj) - { - if (rep != obj.rep) - { - if (--rep->count == 0) - delete rep; - - rep = obj.rep; - rep->count++; - } - - return *this; - } + { + if (rep != obj.rep) + { + if (--rep->count == 0) + delete rep; + + rep = obj.rep; + rep->count++; + } + + return *this; + } ~graphics_object (void) - { - if (--rep->count == 0) - delete rep; - } + { + if (--rep->count == 0) + delete rep; + } void mark_modified (void) { rep->mark_modified (); } void override_defaults (base_graphics_object& obj) - { - rep->override_defaults (obj); - } + { + rep->override_defaults (obj); + } void set_from_list (property_list& plist) { rep->set_from_list (plist); } void set (const caseless_str& name, const octave_value& val) - { - rep->set (name, val); - } + { + rep->set (name, val); + } void set (const octave_value_list& args); @@ -3031,39 +3032,39 @@ octave_value get (bool all = false) const { return rep->get (all); } octave_value get (const caseless_str& name) const - { - return name.compare ("default") - ? get_defaults () - : (name.compare ("factory") - ? get_factory_defaults () : rep->get (name)); - } + { + return name.compare ("default") + ? get_defaults () + : (name.compare ("factory") + ? get_factory_defaults () : rep->get (name)); + } octave_value get (const std::string& name) const - { - return get (caseless_str (name)); - } + { + return get (caseless_str (name)); + } octave_value get (const char *name) const - { - return get (caseless_str (name)); - } + { + return get (caseless_str (name)); + } octave_value get_default (const caseless_str& name) const - { - return rep->get_default (name); - } + { + return rep->get_default (name); + } octave_value get_factory_default (const caseless_str& name) const - { - return rep->get_factory_default (name); - } + { + return rep->get_factory_default (name); + } octave_value get_defaults (void) const { return rep->get_defaults (); } octave_value get_factory_defaults (void) const - { - return rep->get_factory_defaults (); - } + { + return rep->get_factory_defaults (); + } std::string values_as_string (void) { return rep->values_as_string (); } @@ -3088,20 +3089,20 @@ base_properties& get_properties (void) { return rep->get_properties (); } const base_properties& get_properties (void) const - { - return rep->get_properties (); - } + { + return rep->get_properties (); + } void update_axis_limits (const std::string& axis_type) - { - rep->update_axis_limits (axis_type); - } + { + rep->update_axis_limits (axis_type); + } void update_axis_limits (const std::string& axis_type, const graphics_handle& h) - { - rep->update_axis_limits (axis_type, h); - } + { + rep->update_axis_limits (axis_type, h); + } bool valid_object (void) const { return rep->valid_object (); } @@ -3115,37 +3116,37 @@ // EMIT_GRAPHICS_OBJECT_GET_FUNCTIONS octave_value get_alim (void) const - { return get_properties ().get_alim (); } + { return get_properties ().get_alim (); } octave_value get_clim (void) const - { return get_properties ().get_clim (); } + { return get_properties ().get_clim (); } octave_value get_xlim (void) const - { return get_properties ().get_xlim (); } + { return get_properties ().get_xlim (); } octave_value get_ylim (void) const - { return get_properties ().get_ylim (); } + { return get_properties ().get_ylim (); } octave_value get_zlim (void) const - { return get_properties ().get_zlim (); } + { return get_properties ().get_zlim (); } bool is_aliminclude (void) const - { return get_properties ().is_aliminclude (); } + { return get_properties ().is_aliminclude (); } bool is_climinclude (void) const - { return get_properties ().is_climinclude (); } + { return get_properties ().is_climinclude (); } bool is_xliminclude (void) const - { return get_properties ().is_xliminclude (); } + { return get_properties ().is_xliminclude (); } bool is_yliminclude (void) const - { return get_properties ().is_yliminclude (); } + { return get_properties ().is_yliminclude (); } bool is_zliminclude (void) const - { return get_properties ().is_zliminclude (); } + { return get_properties ().is_zliminclude (); } bool is_handle_visible (void) const - { return get_properties ().is_handle_visible (); } + { return get_properties ().is_handle_visible (); } graphics_toolkit get_toolkit (void) const { return rep->get_toolkit (); } @@ -3158,13 +3159,13 @@ { rep->delete_property_listener (nm, v, mode); } void initialize (void) { rep->initialize (*this); } - + void finalize (void) { rep->finalize (*this); } void update (int id) { rep->update (*this, id); } void reset_default_properties (void) - { rep->reset_default_properties (); } + { rep->reset_default_properties (); } private: base_graphics_object *rep; @@ -3177,56 +3178,56 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void remove_child (const graphics_handle& h); - - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - - // FIXME: it seems strange to me that the diary, diaryfile, - // echo, errormessage, format, formatspacing, language, and - // recursionlimit properties are here. - // WTF do they have to do with graphics? - // Also note that these properties (and the monitorpositions, - // pointerlocation, and pointerwindow properties) are not yet used - // by Octave, so setting them will have no effect, and changes - // made elswhere (say, the diary or format functions) will not - // cause these properties to be updated. - // ANSWER: Matlab defines these properties and uses them in - // the same way that Octave uses an internal static variable to - // keep track of state. set (0, "echo", "on") is equivalent - // to Octave's echo ("on"). Maybe someday we can connect callbacks - // that actually call Octave's own functions for this. - - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (root_figure, root) - handle_property callbackobject Sr , graphics_handle () - array_property commandwindowsize r , Matrix (1, 2, 0) - handle_property currentfigure S , graphics_handle () - bool_property diary , "off" - string_property diaryfile , "diary" - bool_property echo , "off" - string_property errormessage , "" - string_property fixedwidthfontname , "Courier" - radio_property format , "+|bank|bit|hex|long|longe|longeng|longg|native-bit|native-hex|none|rational|{short}|shorte|shorteng|shortg" - radio_property formatspacing , "compact|{loose}" - string_property language , "ascii" - array_property monitorpositions , Matrix (1, 4, 0) - array_property pointerlocation , Matrix (1, 2, 0) - double_property pointerwindow r , 0.0 - double_property recursionlimit , 256.0 - double_property screendepth r , default_screendepth () - double_property screenpixelsperinch r , default_screenpixelsperinch () - array_property screensize r , default_screensize () - bool_property showhiddenhandles , "off" - radio_property units U , "inches|centimeters|normalized|points|{pixels}" +public: + void remove_child (const graphics_handle& h); + + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + + // FIXME: it seems strange to me that the diary, diaryfile, + // echo, errormessage, format, formatspacing, language, and + // recursionlimit properties are here. + // WTF do they have to do with graphics? + // Also note that these properties (and the monitorpositions, + // pointerlocation, and pointerwindow properties) are not yet used + // by Octave, so setting them will have no effect, and changes + // made elswhere (say, the diary or format functions) will not + // cause these properties to be updated. + // ANSWER: Matlab defines these properties and uses them in + // the same way that Octave uses an internal static variable to + // keep track of state. set (0, "echo", "on") is equivalent + // to Octave's echo ("on"). Maybe someday we can connect callbacks + // that actually call Octave's own functions for this. + + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (root_figure, root) + handle_property callbackobject Sr , graphics_handle () + array_property commandwindowsize r , Matrix (1, 2, 0) + handle_property currentfigure S , graphics_handle () + bool_property diary , "off" + string_property diaryfile , "diary" + bool_property echo , "off" + string_property errormessage , "" + string_property fixedwidthfontname , "Courier" + radio_property format , "+|bank|bit|hex|long|longe|longeng|longg|native-bit|native-hex|none|rational|{short}|shorte|shorteng|shortg" + radio_property formatspacing , "compact|{loose}" + string_property language , "ascii" + array_property monitorpositions , Matrix (1, 4, 0) + array_property pointerlocation , Matrix (1, 2, 0) + double_property pointerwindow r , 0.0 + double_property recursionlimit , 256.0 + double_property screendepth r , default_screendepth () + double_property screenpixelsperinch r , default_screenpixelsperinch () + array_property screensize r , default_screensize () + bool_property showhiddenhandles , "off" + radio_property units U , "inches|centimeters|normalized|points|{pixels}" END_PROPERTIES - private: +private: std::list<graphics_handle> cbo_stack; }; @@ -3242,75 +3243,75 @@ void mark_modified (void) { } void override_defaults (base_graphics_object& obj) - { - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - if (name.compare ("default", 7)) - return get_default (name.substr (7)); - else if (name.compare ("factory", 7)) - return get_factory_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + if (name.compare ("default", 7)) + return get_default (name.substr (7)); + else if (name.compare ("factory", 7)) + return get_factory_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const - { - octave_value retval = default_properties.lookup (name); - - if (retval.is_undefined ()) - { - // no default property found, use factory default - retval = factory_properties.lookup (name); - - if (retval.is_undefined ()) - error ("get: invalid default property '%s'", name.c_str ()); - } - - return retval; - } + { + octave_value retval = default_properties.lookup (name); + + if (retval.is_undefined ()) + { + // no default property found, use factory default + retval = factory_properties.lookup (name); + + if (retval.is_undefined ()) + error ("get: invalid default property '%s'", name.c_str ()); + } + + return retval; + } octave_value get_factory_default (const caseless_str& name) const - { - octave_value retval = factory_properties.lookup (name); - - if (retval.is_undefined ()) - error ("get: invalid factory default property '%s'", name.c_str ()); - - return retval; - } + { + octave_value retval = factory_properties.lookup (name); + + if (retval.is_undefined ()) + error ("get: invalid factory default property '%s'", name.c_str ()); + + return retval; + } octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } octave_value get_factory_defaults (void) const - { - return factory_properties.as_struct ("factory"); - } + { + return factory_properties.as_struct ("factory"); + } base_properties& get_properties (void) { return xproperties; } @@ -3335,27 +3336,27 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void init_integerhandle (const octave_value& val) - { - integerhandle = val; - } - - void remove_child (const graphics_handle& h); - - void set_visible (const octave_value& val); - - graphics_toolkit get_toolkit (void) const - { - if (! toolkit) - toolkit = gtk_manager::get_toolkit (); - - return toolkit; - } - - void set_toolkit (const graphics_toolkit& b); - - void set___graphics_toolkit__ (const octave_value& val) +public: + void init_integerhandle (const octave_value& val) + { + integerhandle = val; + } + + void remove_child (const graphics_handle& h); + + void set_visible (const octave_value& val); + + graphics_toolkit get_toolkit (void) const + { + if (! toolkit) + toolkit = gtk_manager::get_toolkit (); + + return toolkit; + } + + void set_toolkit (const graphics_toolkit& b); + + void set___graphics_toolkit__ (const octave_value& val) { if (! error_state) { @@ -3378,92 +3379,92 @@ } } - void set_position (const octave_value& val, - bool do_notify_toolkit = true); - - void set_outerposition (const octave_value& val, - bool do_notify_toolkit = true); - - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - - void set_boundingbox (const Matrix& bb, bool internal = false, + void set_position (const octave_value& val, + bool do_notify_toolkit = true); + + void set_outerposition (const octave_value& val, bool do_notify_toolkit = true); - Matrix map_from_boundingbox (double x, double y) const; - - Matrix map_to_boundingbox (double x, double y) const; - - void update_units (const caseless_str& old_units); - - void update_paperunits (const caseless_str& old_paperunits); - - std::string get_title (void) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (figure) - array_property alphamap , Matrix (64, 1, 1) - callback_property buttondownfcn , Matrix () - callback_property closerequestfcn , "closereq" - color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) - array_property colormap , jet_colormap () - handle_property currentaxes S , graphics_handle () - string_property currentcharacter r , "" - handle_property currentobject r , graphics_handle () - array_property currentpoint r , Matrix (2, 1, 0) - bool_property dockcontrols , "off" - bool_property doublebuffer , "on" - string_property filename , "" - bool_property integerhandle S , "on" - bool_property inverthardcopy , "off" - callback_property keypressfcn , Matrix () - callback_property keyreleasefcn , Matrix () - radio_property menubar , "none|{figure}" - double_property mincolormap , 64 - string_property name , "" - radio_property nextplot , "new|{add}|replacechildren|replace" - bool_property numbertitle , "on" - array_property outerposition s , Matrix (1, 4, -1.0) - radio_property paperorientation U , "{portrait}|landscape|rotated" - array_property paperposition , default_figure_paperposition () - radio_property paperpositionmode , "auto|{manual}" - array_property papersize U , default_figure_papersize () - radio_property papertype SU , "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>" - radio_property paperunits Su , "{inches}|centimeters|normalized|points" - radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand" - array_property pointershapecdata , Matrix (16, 16, 0) - array_property pointershapehotspot , Matrix (1, 2, 0) - array_property position s , default_figure_position () - radio_property renderer , "{painters}|zbuffer|opengl|none" - radio_property renderermode , "{auto}|manual" - bool_property resize , "on" - callback_property resizefcn , Matrix () - radio_property selectiontype , "{normal}|open|alt|extend" - radio_property toolbar , "none|{auto}|figure" - radio_property units Su , "inches|centimeters|normalized|points|{pixels}|characters" - callback_property windowbuttondownfcn , Matrix () - callback_property windowbuttonmotionfcn , Matrix () - callback_property windowbuttonupfcn , Matrix () - callback_property windowkeypressfcn , Matrix () - callback_property windowkeyreleasefcn , Matrix () - callback_property windowscrollwheelfcn , Matrix () - radio_property windowstyle , "{normal}|modal|docked" - string_property wvisual , "" - radio_property wvisualmode , "{auto}|manual" - string_property xdisplay , "" - string_property xvisual , "" - radio_property xvisualmode , "{auto}|manual" - // Octave-specific properties - bool_property __enhanced__ h , "on" - string_property __graphics_toolkit__ s , "gnuplot" - any_property __guidata__ h , Matrix () - any_property __plot_stream__ h , Matrix () + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + void set_boundingbox (const Matrix& bb, bool internal = false, + bool do_notify_toolkit = true); + + Matrix map_from_boundingbox (double x, double y) const; + + Matrix map_to_boundingbox (double x, double y) const; + + void update_units (const caseless_str& old_units); + + void update_paperunits (const caseless_str& old_paperunits); + + std::string get_title (void) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (figure) + array_property alphamap , Matrix (64, 1, 1) + callback_property buttondownfcn , Matrix () + callback_property closerequestfcn , "closereq" + color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) + array_property colormap , jet_colormap () + handle_property currentaxes S , graphics_handle () + string_property currentcharacter r , "" + handle_property currentobject r , graphics_handle () + array_property currentpoint r , Matrix (2, 1, 0) + bool_property dockcontrols , "off" + bool_property doublebuffer , "on" + string_property filename , "" + bool_property integerhandle S , "on" + bool_property inverthardcopy , "off" + callback_property keypressfcn , Matrix () + callback_property keyreleasefcn , Matrix () + radio_property menubar , "none|{figure}" + double_property mincolormap , 64 + string_property name , "" + radio_property nextplot , "new|{add}|replacechildren|replace" + bool_property numbertitle , "on" + array_property outerposition s , Matrix (1, 4, -1.0) + radio_property paperorientation U , "{portrait}|landscape|rotated" + array_property paperposition , default_figure_paperposition () + radio_property paperpositionmode , "auto|{manual}" + array_property papersize U , default_figure_papersize () + radio_property papertype SU , "{usletter}|uslegal|a0|a1|a2|a3|a4|a5|b0|b1|b2|b3|b4|b5|arch-a|arch-b|arch-c|arch-d|arch-e|a|b|c|d|e|tabloid|<custom>" + radio_property paperunits Su , "{inches}|centimeters|normalized|points" + radio_property pointer , "crosshair|fullcrosshair|{arrow}|ibeam|watch|topl|topr|botl|botr|left|top|right|bottom|circle|cross|fleur|custom|hand" + array_property pointershapecdata , Matrix (16, 16, 0) + array_property pointershapehotspot , Matrix (1, 2, 0) + array_property position s , default_figure_position () + radio_property renderer , "{painters}|zbuffer|opengl|none" + radio_property renderermode , "{auto}|manual" + bool_property resize , "on" + callback_property resizefcn , Matrix () + radio_property selectiontype , "{normal}|open|alt|extend" + radio_property toolbar , "none|{auto}|figure" + radio_property units Su , "inches|centimeters|normalized|points|{pixels}|characters" + callback_property windowbuttondownfcn , Matrix () + callback_property windowbuttonmotionfcn , Matrix () + callback_property windowbuttonupfcn , Matrix () + callback_property windowkeypressfcn , Matrix () + callback_property windowkeyreleasefcn , Matrix () + callback_property windowscrollwheelfcn , Matrix () + radio_property windowstyle , "{normal}|modal|docked" + string_property wvisual , "" + radio_property wvisualmode , "{auto}|manual" + string_property xdisplay , "" + string_property xvisual , "" + radio_property xvisualmode , "{auto}|manual" + // Octave-specific properties + bool_property __enhanced__ h , "on" + string_property __graphics_toolkit__ s , "gnuplot" + any_property __guidata__ h , Matrix () + any_property __plot_stream__ h , Matrix () END_PROPERTIES - protected: +protected: void init (void) { colormap.add_constraint (dim_vector (-1, 3)); @@ -3475,7 +3476,7 @@ outerposition.add_constraint (dim_vector (1, 4)); } - private: +private: mutable graphics_toolkit toolkit; }; @@ -3485,55 +3486,55 @@ public: figure (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p), default_properties () - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~figure (void) { } void override_defaults (base_graphics_object& obj) - { - // Allow parent (root figure) to override first (properties knows how - // to find the parent object). - xproperties.override_defaults (obj); - - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Allow parent (root figure) to override first (properties knows how + // to find the parent object). + xproperties.override_defaults (obj); + + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - if (name.compare ("default", 7)) - retval = get_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + if (name.compare ("default", 7)) + retval = get_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const; octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } base_properties& get_properties (void) { return xproperties; } @@ -3554,19 +3555,19 @@ public: graphics_xform (void) : xform (xform_eye ()), xform_inv (xform_eye ()), - sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0) - { - zlim(1) = 1.0; - } + sx ("linear"), sy ("linear"), sz ("linear"), zlim (1, 2, 0.0) + { + zlim(1) = 1.0; + } graphics_xform (const Matrix& xm, const Matrix& xim, const scaler& x, const scaler& y, const scaler& z, const Matrix& zl) - : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } + : xform (xm), xform_inv (xim), sx (x), sy (y), sz (z), zlim (zl) { } graphics_xform (const graphics_xform& g) - : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), - sy (g.sy), sz (g.sz), zlim (g.zlim) { } + : xform (g.xform), xform_inv (g.xform_inv), sx (g.sx), + sy (g.sy), sz (g.sz), zlim (g.zlim) { } ~graphics_xform (void) { } @@ -3630,10 +3631,10 @@ }; enum { - AXE_ANY_DIR = 0, - AXE_DEPTH_DIR = 1, - AXE_HORZ_DIR = 2, - AXE_VERT_DIR = 3 + AXE_ANY_DIR = 0, + AXE_DEPTH_DIR = 1, + AXE_HORZ_DIR = 2, + AXE_VERT_DIR = 3 }; class OCTINTERP_API axes : public base_graphics_object @@ -3641,284 +3642,284 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void set_defaults (base_graphics_object& obj, const std::string& mode); - - void remove_child (const graphics_handle& h); - - const scaler& get_x_scaler (void) const { return sx; } - const scaler& get_y_scaler (void) const { return sy; } - const scaler& get_z_scaler (void) const { return sz; } - - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - Matrix get_extent (bool with_text = false, bool only_text_height=false) const; - - double get_fontsize_points (double box_pix_height = 0) const; - - void update_boundingbox (void) - { - if (units_is ("normalized")) - { - sync_positions (); - base_properties::update_boundingbox (); - } - } - - void update_camera (void); - void update_axes_layout (void); - void update_aspectratios (void); - void update_transform (void) - { - update_aspectratios (); - update_camera (); - update_axes_layout (); - } - - void sync_positions (void); - - void update_autopos (const std::string& elem_type); - void update_xlabel_position (void); - void update_ylabel_position (void); - void update_zlabel_position (void); - void update_title_position (void); - - graphics_xform get_transform (void) const - { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } - - Matrix get_transform_matrix (void) const { return x_render; } - Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } - Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } - Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } - Matrix get_transform_zlim (void) const { return x_zlim; } - - int get_xstate (void) const { return xstate; } - int get_ystate (void) const { return ystate; } - int get_zstate (void) const { return zstate; } - double get_xPlane (void) const { return xPlane; } - double get_xPlaneN (void) const { return xPlaneN; } - double get_yPlane (void) const { return yPlane; } - double get_yPlaneN (void) const { return yPlaneN; } - double get_zPlane (void) const { return zPlane; } - double get_zPlaneN (void) const { return zPlaneN; } - double get_xpTick (void) const { return xpTick; } - double get_xpTickN (void) const { return xpTickN; } - double get_ypTick (void) const { return ypTick; } - double get_ypTickN (void) const { return ypTickN; } - double get_zpTick (void) const { return zpTick; } - double get_zpTickN (void) const { return zpTickN; } - double get_x_min (void) const { return std::min (xPlane, xPlaneN); } - double get_x_max (void) const { return std::max (xPlane, xPlaneN); } - double get_y_min (void) const { return std::min (yPlane, yPlaneN); } - double get_y_max (void) const { return std::max (yPlane, yPlaneN); } - double get_z_min (void) const { return std::min (zPlane, zPlaneN); } - double get_z_max (void) const { return std::max (zPlane, zPlaneN); } - double get_fx (void) const { return fx; } - double get_fy (void) const { return fy; } - double get_fz (void) const { return fz; } - double get_xticklen (void) const { return xticklen; } - double get_yticklen (void) const { return yticklen; } - double get_zticklen (void) const { return zticklen; } - double get_xtickoffset (void) const { return xtickoffset; } - double get_ytickoffset (void) const { return ytickoffset; } - double get_ztickoffset (void) const { return ztickoffset; } - bool get_x2Dtop (void) const { return x2Dtop; } - bool get_y2Dright (void) const { return y2Dright; } - bool get_layer2Dtop (void) const { return layer2Dtop; } - bool get_xySym (void) const { return xySym; } - bool get_xyzSym (void) const { return xyzSym; } - bool get_zSign (void) const { return zSign; } - bool get_nearhoriz (void) const { return nearhoriz; } - - ColumnVector pixel2coord (double px, double py) const +public: + void set_defaults (base_graphics_object& obj, const std::string& mode); + + void remove_child (const graphics_handle& h); + + const scaler& get_x_scaler (void) const { return sx; } + const scaler& get_y_scaler (void) const { return sy; } + const scaler& get_z_scaler (void) const { return sz; } + + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + Matrix get_extent (bool with_text = false, bool only_text_height=false) const; + + double get_fontsize_points (double box_pix_height = 0) const; + + void update_boundingbox (void) + { + if (units_is ("normalized")) + { + sync_positions (); + base_properties::update_boundingbox (); + } + } + + void update_camera (void); + void update_axes_layout (void); + void update_aspectratios (void); + void update_transform (void) + { + update_aspectratios (); + update_camera (); + update_axes_layout (); + } + + void sync_positions (void); + + void update_autopos (const std::string& elem_type); + void update_xlabel_position (void); + void update_ylabel_position (void); + void update_zlabel_position (void); + void update_title_position (void); + + graphics_xform get_transform (void) const + { return graphics_xform (x_render, x_render_inv, sx, sy, sz, x_zlim); } + + Matrix get_transform_matrix (void) const { return x_render; } + Matrix get_inverse_transform_matrix (void) const { return x_render_inv; } + Matrix get_opengl_matrix_1 (void) const { return x_gl_mat1; } + Matrix get_opengl_matrix_2 (void) const { return x_gl_mat2; } + Matrix get_transform_zlim (void) const { return x_zlim; } + + int get_xstate (void) const { return xstate; } + int get_ystate (void) const { return ystate; } + int get_zstate (void) const { return zstate; } + double get_xPlane (void) const { return xPlane; } + double get_xPlaneN (void) const { return xPlaneN; } + double get_yPlane (void) const { return yPlane; } + double get_yPlaneN (void) const { return yPlaneN; } + double get_zPlane (void) const { return zPlane; } + double get_zPlaneN (void) const { return zPlaneN; } + double get_xpTick (void) const { return xpTick; } + double get_xpTickN (void) const { return xpTickN; } + double get_ypTick (void) const { return ypTick; } + double get_ypTickN (void) const { return ypTickN; } + double get_zpTick (void) const { return zpTick; } + double get_zpTickN (void) const { return zpTickN; } + double get_x_min (void) const { return std::min (xPlane, xPlaneN); } + double get_x_max (void) const { return std::max (xPlane, xPlaneN); } + double get_y_min (void) const { return std::min (yPlane, yPlaneN); } + double get_y_max (void) const { return std::max (yPlane, yPlaneN); } + double get_z_min (void) const { return std::min (zPlane, zPlaneN); } + double get_z_max (void) const { return std::max (zPlane, zPlaneN); } + double get_fx (void) const { return fx; } + double get_fy (void) const { return fy; } + double get_fz (void) const { return fz; } + double get_xticklen (void) const { return xticklen; } + double get_yticklen (void) const { return yticklen; } + double get_zticklen (void) const { return zticklen; } + double get_xtickoffset (void) const { return xtickoffset; } + double get_ytickoffset (void) const { return ytickoffset; } + double get_ztickoffset (void) const { return ztickoffset; } + bool get_x2Dtop (void) const { return x2Dtop; } + bool get_y2Dright (void) const { return y2Dright; } + bool get_layer2Dtop (void) const { return layer2Dtop; } + bool get_xySym (void) const { return xySym; } + bool get_xyzSym (void) const { return xyzSym; } + bool get_zSign (void) const { return zSign; } + bool get_nearhoriz (void) const { return nearhoriz; } + + ColumnVector pixel2coord (double px, double py) const { return get_transform ().untransform (px, py, (x_zlim(0)+x_zlim(1))/2); } - ColumnVector coord2pixel (double x, double y, double z) const + ColumnVector coord2pixel (double x, double y, double z) const { return get_transform ().transform (x, y, z); } - void zoom_about_point (double x, double y, double factor, - bool push_to_zoom_stack = true); - void zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack = true); - void translate_view (double x0, double x1, double y0, double y1); - void rotate_view (double delta_az, double delta_el); - void unzoom (void); - void clear_zoom_stack (void); - - void update_units (const caseless_str& old_units); - - void update_fontunits (const caseless_str& old_fontunits); - - private: - scaler sx, sy, sz; - Matrix x_render, x_render_inv; - Matrix x_gl_mat1, x_gl_mat2; - Matrix x_zlim; - std::list<octave_value> zoom_stack; - - // Axes layout data - int xstate, ystate, zstate; - double xPlane, xPlaneN, yPlane, yPlaneN, zPlane, zPlaneN; - double xpTick, xpTickN, ypTick, ypTickN, zpTick, zpTickN; - double fx, fy, fz; - double xticklen, yticklen, zticklen; - double xtickoffset, ytickoffset, ztickoffset; - bool x2Dtop, y2Dright, layer2Dtop; - bool xySym, xyzSym, zSign, nearhoriz; + void zoom_about_point (double x, double y, double factor, + bool push_to_zoom_stack = true); + void zoom (const Matrix& xl, const Matrix& yl, bool push_to_zoom_stack = true); + void translate_view (double x0, double x1, double y0, double y1); + void rotate_view (double delta_az, double delta_el); + void unzoom (void); + void clear_zoom_stack (void); + + void update_units (const caseless_str& old_units); + + void update_fontunits (const caseless_str& old_fontunits); + +private: + scaler sx, sy, sz; + Matrix x_render, x_render_inv; + Matrix x_gl_mat1, x_gl_mat2; + Matrix x_zlim; + std::list<octave_value> zoom_stack; + + // Axes layout data + int xstate, ystate, zstate; + double xPlane, xPlaneN, yPlane, yPlaneN, zPlane, zPlaneN; + double xpTick, xpTickN, ypTick, ypTickN, zpTick, zpTickN; + double fx, fy, fz; + double xticklen, yticklen, zticklen; + double xtickoffset, ytickoffset, ztickoffset; + bool x2Dtop, y2Dright, layer2Dtop; + bool xySym, xyzSym, zSign, nearhoriz; #if HAVE_FREETYPE - // freetype renderer, used for calculation of text (tick labels) size - ft_render text_renderer; + // freetype renderer, used for calculation of text (tick labels) size + text_render text_renderer; #endif - void set_text_child (handle_property& h, const std::string& who, - const octave_value& v); - - void delete_text_child (handle_property& h); - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (axes) - radio_property activepositionproperty , "{outerposition}|position" - row_vector_property alim m , default_lim () - radio_property alimmode , "{auto}|manual" - color_property ambientlightcolor , color_values (1, 1, 1) - bool_property box , "on" - array_property cameraposition m , Matrix (1, 3, 0.0) - radio_property camerapositionmode , "{auto}|manual" - array_property cameratarget m , Matrix (1, 3, 0.0) - radio_property cameratargetmode , "{auto}|manual" - array_property cameraupvector m , Matrix () - radio_property cameraupvectormode , "{auto}|manual" - double_property cameraviewangle m , 10.0 - radio_property cameraviewanglemode , "{auto}|manual" - row_vector_property clim m , default_lim () - radio_property climmode al , "{auto}|manual" - color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) - array_property colororder , default_colororder () - array_property currentpoint , Matrix (2, 3, 0.0) - array_property dataaspectratio mu , Matrix (1, 3, 1.0) - radio_property dataaspectratiomode u , "{auto}|manual" - radio_property drawmode , "{normal}|fast" - radio_property fontangle u , "{normal}|italic|oblique" - string_property fontname u , OCTAVE_DEFAULT_FONTNAME - double_property fontsize u , 10 - radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels" - radio_property fontweight u , "{normal}|light|demi|bold" - radio_property gridlinestyle , "-|--|{:}|-.|none" - // NOTE: interpreter is not a Matlab axis property, but it makes - // more sense to have it so that axis ticklabels can use it. - radio_property interpreter , "tex|{none}|latex" - radio_property layer u , "{bottom}|top" + void set_text_child (handle_property& h, const std::string& who, + const octave_value& v); + + void delete_text_child (handle_property& h); + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (axes) + radio_property activepositionproperty , "{outerposition}|position" + row_vector_property alim m , default_lim () + radio_property alimmode , "{auto}|manual" + color_property ambientlightcolor , color_values (1, 1, 1) + bool_property box , "on" + array_property cameraposition m , Matrix (1, 3, 0.0) + radio_property camerapositionmode , "{auto}|manual" + array_property cameratarget m , Matrix (1, 3, 0.0) + radio_property cameratargetmode , "{auto}|manual" + array_property cameraupvector m , Matrix () + radio_property cameraupvectormode , "{auto}|manual" + double_property cameraviewangle m , 10.0 + radio_property cameraviewanglemode , "{auto}|manual" + row_vector_property clim m , default_lim () + radio_property climmode al , "{auto}|manual" + color_property color , color_property (color_values (1, 1, 1), radio_values ("none")) + array_property colororder , default_colororder () + array_property currentpoint , Matrix (2, 3, 0.0) + array_property dataaspectratio mu , Matrix (1, 3, 1.0) + radio_property dataaspectratiomode u , "{auto}|manual" + radio_property drawmode , "{normal}|fast" + radio_property fontangle u , "{normal}|italic|oblique" + string_property fontname u , OCTAVE_DEFAULT_FONTNAME + double_property fontsize u , 10 + radio_property fontunits SU , "{points}|normalized|inches|centimeters|pixels" + radio_property fontweight u , "{normal}|light|demi|bold" + radio_property gridlinestyle , "-|--|{:}|-.|none" + // NOTE: interpreter is not a Matlab axis property, but it makes + // more sense to have it so that axis ticklabels can use it. + radio_property interpreter , "tex|{none}|latex" + radio_property layer u , "{bottom}|top" // FIXME: should be kind of string array. any_property linestyleorder S , "-" - double_property linewidth , 0.5 - radio_property minorgridlinestyle , "-|--|{:}|-.|none" - radio_property nextplot , "add|replacechildren|{replace}" - array_property outerposition u , default_axes_outerposition () - array_property plotboxaspectratio mu , Matrix (1, 3, 1.0) - radio_property plotboxaspectratiomode u , "{auto}|manual" - array_property position u , default_axes_position () - radio_property projection , "{orthographic}|perpective" - radio_property tickdir mu , "{in}|out" - radio_property tickdirmode u , "{auto}|manual" - array_property ticklength u , default_axes_ticklength () - array_property tightinset r , Matrix (1, 4, 0.0) - handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - // FIXME: uicontextmenu should be moved here. - radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters" - array_property view u , Matrix () - radio_property xaxislocation u , "{bottom}|top|zero" - color_property xcolor , color_values (0, 0, 0) - radio_property xdir u , "{normal}|reverse" - bool_property xgrid , "off" - handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - row_vector_property xlim mu , default_lim () - radio_property xlimmode al , "{auto}|manual" - bool_property xminorgrid , "off" - bool_property xminortick , "off" - radio_property xscale alu , "{linear}|log" - row_vector_property xtick mu , default_axes_tick () - // FIXME: should be kind of string array. - any_property xticklabel S , "" - radio_property xticklabelmode u , "{auto}|manual" - radio_property xtickmode u , "{auto}|manual" - radio_property yaxislocation u , "{left}|right|zero" - color_property ycolor , color_values (0, 0, 0) - radio_property ydir u , "{normal}|reverse" - bool_property ygrid , "off" - handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - row_vector_property ylim mu , default_lim () - radio_property ylimmode al , "{auto}|manual" - bool_property yminorgrid , "off" - bool_property yminortick , "off" - radio_property yscale alu , "{linear}|log" - row_vector_property ytick mu , default_axes_tick () - any_property yticklabel S , "" - radio_property yticklabelmode u , "{auto}|manual" - radio_property ytickmode u , "{auto}|manual" - color_property zcolor , color_values (0, 0, 0) - radio_property zdir u , "{normal}|reverse" - bool_property zgrid , "off" - handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) - row_vector_property zlim mu , default_lim () - radio_property zlimmode al , "{auto}|manual" - bool_property zminorgrid , "off" - bool_property zminortick , "off" - radio_property zscale alu , "{linear}|log" - row_vector_property ztick mu , default_axes_tick () - any_property zticklabel S , "" - radio_property zticklabelmode u , "{auto}|manual" - radio_property ztickmode u , "{auto}|manual" - // Octave-specific properties - bool_property __hold_all__ h , "off" - // hidden properties for alignment of subplots - radio_property autopos_tag h , "{none}|subplot" - // hidden properties for inset - array_property looseinset hu , Matrix (1, 4, 0.0) - // hidden properties for transformation computation - array_property x_viewtransform h , Matrix (4, 4, 0.0) - array_property x_projectiontransform h , Matrix (4, 4, 0.0) - array_property x_viewporttransform h , Matrix (4, 4, 0.0) - array_property x_normrendertransform h , Matrix (4, 4, 0.0) - array_property x_rendertransform h , Matrix (4, 4, 0.0) - // hidden properties for minor ticks - row_vector_property xmtick h , Matrix () - row_vector_property ymtick h , Matrix () - row_vector_property zmtick h , Matrix () - END_PROPERTIES - - protected: + double_property linewidth , 0.5 + radio_property minorgridlinestyle , "-|--|{:}|-.|none" + radio_property nextplot , "add|replacechildren|{replace}" + array_property outerposition u , default_axes_outerposition () + array_property plotboxaspectratio mu , Matrix (1, 3, 1.0) + radio_property plotboxaspectratiomode u , "{auto}|manual" + array_property position u , default_axes_position () + radio_property projection , "{orthographic}|perpective" + radio_property tickdir mu , "{in}|out" + radio_property tickdirmode u , "{auto}|manual" + array_property ticklength u , default_axes_ticklength () + array_property tightinset r , Matrix (1, 4, 0.0) + handle_property title SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + // FIXME: uicontextmenu should be moved here. + radio_property units SU , "{normalized}|inches|centimeters|points|pixels|characters" + array_property view u , Matrix () + radio_property xaxislocation u , "{bottom}|top|zero" + color_property xcolor , color_values (0, 0, 0) + radio_property xdir u , "{normal}|reverse" + bool_property xgrid , "off" + handle_property xlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + row_vector_property xlim mu , default_lim () + radio_property xlimmode al , "{auto}|manual" + bool_property xminorgrid , "off" + bool_property xminortick , "off" + radio_property xscale alu , "{linear}|log" + row_vector_property xtick mu , default_axes_tick () + // FIXME: should be kind of string array. + any_property xticklabel S , "" + radio_property xticklabelmode u , "{auto}|manual" + radio_property xtickmode u , "{auto}|manual" + radio_property yaxislocation u , "{left}|right|zero" + color_property ycolor , color_values (0, 0, 0) + radio_property ydir u , "{normal}|reverse" + bool_property ygrid , "off" + handle_property ylabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + row_vector_property ylim mu , default_lim () + radio_property ylimmode al , "{auto}|manual" + bool_property yminorgrid , "off" + bool_property yminortick , "off" + radio_property yscale alu , "{linear}|log" + row_vector_property ytick mu , default_axes_tick () + any_property yticklabel S , "" + radio_property yticklabelmode u , "{auto}|manual" + radio_property ytickmode u , "{auto}|manual" + color_property zcolor , color_values (0, 0, 0) + radio_property zdir u , "{normal}|reverse" + bool_property zgrid , "off" + handle_property zlabel SOf , gh_manager::make_graphics_handle ("text", __myhandle__, false, false, false) + row_vector_property zlim mu , default_lim () + radio_property zlimmode al , "{auto}|manual" + bool_property zminorgrid , "off" + bool_property zminortick , "off" + radio_property zscale alu , "{linear}|log" + row_vector_property ztick mu , default_axes_tick () + any_property zticklabel S , "" + radio_property zticklabelmode u , "{auto}|manual" + radio_property ztickmode u , "{auto}|manual" + // Octave-specific properties + bool_property __hold_all__ h , "off" + // hidden properties for alignment of subplots + radio_property autopos_tag h , "{none}|subplot" + // hidden properties for inset + array_property looseinset hu , Matrix (1, 4, 0.0) + // hidden properties for transformation computation + array_property x_viewtransform h , Matrix (4, 4, 0.0) + array_property x_projectiontransform h , Matrix (4, 4, 0.0) + array_property x_viewporttransform h , Matrix (4, 4, 0.0) + array_property x_normrendertransform h , Matrix (4, 4, 0.0) + array_property x_rendertransform h , Matrix (4, 4, 0.0) + // hidden properties for minor ticks + row_vector_property xmtick h , Matrix () + row_vector_property ymtick h , Matrix () + row_vector_property zmtick h , Matrix () + END_PROPERTIES + +protected: void init (void); - private: +private: std::string - get_scale (const std::string& scale, const Matrix& lims) - { - std::string retval = scale; - - if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0) - retval = "neglog"; - - return retval; - } + get_scale (const std::string& scale, const Matrix& lims) + { + std::string retval = scale; + + if (scale == "log" && lims.numel () > 1 && lims(0) < 0 && lims(1) < 0) + retval = "neglog"; + + return retval; + } void update_xscale (void) - { - sx = get_scale (get_xscale (), xlim.get ().matrix_value ()); - } + { + sx = get_scale (get_xscale (), xlim.get ().matrix_value ()); + } void update_yscale (void) - { - sy = get_scale (get_yscale (), ylim.get ().matrix_value ()); - } + { + sy = get_scale (get_yscale (), ylim.get ().matrix_value ()); + } void update_zscale (void) - { - sz = get_scale (get_zscale (), zlim.get ().matrix_value ()); - } + { + sz = get_scale (get_zscale (), zlim.get ().matrix_value ()); + } void update_view (void) { sync_positions (); } void update_dataaspectratio (void) { sync_positions (); } @@ -3964,27 +3965,27 @@ void update_xtickmode (void) { - if (xtickmode.is ("auto")) - { - calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); - update_xtick (); - } + if (xtickmode.is ("auto")) + { + calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); + update_xtick (); + } } void update_ytickmode (void) { - if (ytickmode.is ("auto")) - { - calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); - update_ytick (); - } + if (ytickmode.is ("auto")) + { + calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); + update_ytick (); + } } void update_ztickmode (void) { - if (ztickmode.is ("auto")) - { - calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); - update_ztick (); - } + if (ztickmode.is ("auto")) + { + calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); + update_ztick (); + } } void update_xticklabelmode (void) @@ -4010,48 +4011,48 @@ void update_fontweight (void) { update_font (); } void update_outerposition (void) - { - set_activepositionproperty ("outerposition"); - caseless_str old_units = get_units (); - set_units ("normalized"); - Matrix outerbox = outerposition.get ().matrix_value (); - Matrix innerbox = position.get ().matrix_value (); - Matrix linset = looseinset.get ().matrix_value (); - Matrix tinset = tightinset.get ().matrix_value (); - outerbox(2) = outerbox(2) + outerbox(0); - outerbox(3) = outerbox(3) + outerbox(1); - innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0)); - innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1)); - innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2)); - innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3)); - innerbox(2) = innerbox(2) - innerbox(0); - innerbox(3) = innerbox(3) - innerbox(1); - position = innerbox; - set_units (old_units); - update_transform (); - } + { + set_activepositionproperty ("outerposition"); + caseless_str old_units = get_units (); + set_units ("normalized"); + Matrix outerbox = outerposition.get ().matrix_value (); + Matrix innerbox = position.get ().matrix_value (); + Matrix linset = looseinset.get ().matrix_value (); + Matrix tinset = tightinset.get ().matrix_value (); + outerbox(2) = outerbox(2) + outerbox(0); + outerbox(3) = outerbox(3) + outerbox(1); + innerbox(0) = outerbox(0) + std::max (linset(0), tinset(0)); + innerbox(1) = outerbox(1) + std::max (linset(1), tinset(1)); + innerbox(2) = outerbox(2) - std::max (linset(2), tinset(2)); + innerbox(3) = outerbox(3) - std::max (linset(3), tinset(3)); + innerbox(2) = innerbox(2) - innerbox(0); + innerbox(3) = innerbox(3) - innerbox(1); + position = innerbox; + set_units (old_units); + update_transform (); + } void update_position (void) - { - set_activepositionproperty ("position"); - caseless_str old_units = get_units (); - set_units ("normalized"); - Matrix outerbox = outerposition.get ().matrix_value (); - Matrix innerbox = position.get ().matrix_value (); - Matrix linset = looseinset.get ().matrix_value (); - Matrix tinset = tightinset.get ().matrix_value (); - innerbox(2) = innerbox(2) + innerbox(0); - innerbox(3) = innerbox(3) + innerbox(1); - outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0)); - outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1)); - outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2)); - outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3)); - outerbox(2) = outerbox(2) - outerbox(0); - outerbox(3) = outerbox(3) - outerbox(1); - outerposition = outerbox; - set_units (old_units); - update_transform (); - } + { + set_activepositionproperty ("position"); + caseless_str old_units = get_units (); + set_units ("normalized"); + Matrix outerbox = outerposition.get ().matrix_value (); + Matrix innerbox = position.get ().matrix_value (); + Matrix linset = looseinset.get ().matrix_value (); + Matrix tinset = tightinset.get ().matrix_value (); + innerbox(2) = innerbox(2) + innerbox(0); + innerbox(3) = innerbox(3) + innerbox(1); + outerbox(0) = innerbox(0) - std::max (linset(0), tinset(0)); + outerbox(1) = innerbox(1) - std::max (linset(1), tinset(1)); + outerbox(2) = innerbox(2) + std::max (linset(2), tinset(2)); + outerbox(3) = innerbox(3) + std::max (linset(3), tinset(3)); + outerbox(2) = outerbox(2) - outerbox(0); + outerbox(3) = outerbox(3) - outerbox(1); + outerposition = outerbox; + set_units (old_units); + update_transform (); + } void update_looseinset (void) { @@ -4098,81 +4099,81 @@ const Matrix& limits); void fix_limits (array_property& lims) - { - if (lims.get ().is_empty ()) - return; - - Matrix l = lims.get ().matrix_value (); - if (l(0) > l(1)) - { - l(0) = 0; - l(1) = 1; - lims = l; - } - else if (l(0) == l(1)) - { - l(0) -= 0.5; - l(1) += 0.5; - lims = l; - } - } + { + if (lims.get ().is_empty ()) + return; + + Matrix l = lims.get ().matrix_value (); + if (l(0) > l(1)) + { + l(0) = 0; + l(1) = 1; + lims = l; + } + else if (l(0) == l(1)) + { + l(0) -= 0.5; + l(1) += 0.5; + lims = l; + } + } Matrix calc_tightbox (const Matrix& init_pos); - public: +public: Matrix get_axis_limits (double xmin, double xmax, double min_pos, double max_neg, bool logscale); void update_xlim (bool do_clr_zoom = true) - { - if (xtickmode.is ("auto")) - calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); - if (xticklabelmode.is ("auto")) - calc_ticklabels (xtick, xticklabel, xscale.is ("log")); - - fix_limits (xlim); - - update_xscale (); - - if (do_clr_zoom) - zoom_stack.clear (); - - update_axes_layout (); - } + { + if (xtickmode.is ("auto")) + calc_ticks_and_lims (xlim, xtick, xmtick, xlimmode.is ("auto"), xscale.is ("log")); + if (xticklabelmode.is ("auto")) + calc_ticklabels (xtick, xticklabel, xscale.is ("log")); + + fix_limits (xlim); + + update_xscale (); + + if (do_clr_zoom) + zoom_stack.clear (); + + update_axes_layout (); + } void update_ylim (bool do_clr_zoom = true) - { - if (ytickmode.is ("auto")) - calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); - if (yticklabelmode.is ("auto")) - calc_ticklabels (ytick, yticklabel, yscale.is ("log")); - - fix_limits (ylim); - - update_yscale (); - - if (do_clr_zoom) - zoom_stack.clear (); - - update_axes_layout (); - } + { + if (ytickmode.is ("auto")) + calc_ticks_and_lims (ylim, ytick, ymtick, ylimmode.is ("auto"), yscale.is ("log")); + if (yticklabelmode.is ("auto")) + calc_ticklabels (ytick, yticklabel, yscale.is ("log")); + + fix_limits (ylim); + + update_yscale (); + + if (do_clr_zoom) + zoom_stack.clear (); + + update_axes_layout (); + } void update_zlim (void) - { - if (ztickmode.is ("auto")) - calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); - if (zticklabelmode.is ("auto")) - calc_ticklabels (ztick, zticklabel, zscale.is ("log")); - - fix_limits (zlim); - - update_zscale (); - - zoom_stack.clear (); - - update_axes_layout (); - } + { + if (ztickmode.is ("auto")) + calc_ticks_and_lims (zlim, ztick, zmtick, zlimmode.is ("auto"), zscale.is ("log")); + if (zticklabelmode.is ("auto")) + calc_ticklabels (ztick, zticklabel, zscale.is ("log")); + + fix_limits (zlim); + + update_zscale (); + + zoom_stack.clear (); + + update_axes_layout (); + } }; @@ -4182,63 +4183,63 @@ public: axes (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p), default_properties () - { - xproperties.override_defaults (*this); - xproperties.update_transform (); - } + { + xproperties.override_defaults (*this); + xproperties.update_transform (); + } ~axes (void) { } void override_defaults (base_graphics_object& obj) - { - // Allow parent (figure) to override first (properties knows how - // to find the parent object). - xproperties.override_defaults (obj); - - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Allow parent (figure) to override first (properties knows how + // to find the parent object). + xproperties.override_defaults (obj); + + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } void set_defaults (const std::string& mode) - { - remove_all_listeners (); - xproperties.set_defaults (*this, mode); - } + { + remove_all_listeners (); + xproperties.set_defaults (*this, mode); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - // FIXME: finish this. - if (name.compare ("default", 7)) - retval = get_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + // FIXME: finish this. + if (name.compare ("default", 7)) + retval = get_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const; octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } base_properties& get_properties (void) { return xproperties; } @@ -4267,41 +4268,41 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (line) - color_property color , color_values (0, 0, 0) - string_property displayname , "" - radio_property erasemode , "{normal}|none|xor|background" - // FIXME: interpreter is not a property of Matlab line objects. - // Octave uses this for legend() with the string displayname. - radio_property interpreter , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" - color_property markeredgecolor , "{auto}|none" - color_property markerfacecolor , "auto|{none}" - double_property markersize , 6 - row_vector_property xdata u , default_data () - string_property xdatasource , "" - row_vector_property ydata u , default_data () - string_property ydatasource , "" - row_vector_property zdata u , Matrix () - string_property zdatasource , "" - - // hidden properties for limit computation - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" - bool_property zliminclude hl , "off" +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (line) + color_property color , color_values (0, 0, 0) + string_property displayname , "" + radio_property erasemode , "{normal}|none|xor|background" + // FIXME: interpreter is not a property of Matlab line objects. + // Octave uses this for legend() with the string displayname. + radio_property interpreter , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" + color_property markeredgecolor , "{auto}|none" + color_property markerfacecolor , "auto|{none}" + double_property markersize , 6 + row_vector_property xdata u , default_data () + string_property xdatasource , "" + row_vector_property ydata u , default_data () + string_property ydatasource , "" + row_vector_property zdata u , Matrix () + string_property zdatasource , "" + + // hidden properties for limit computation + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" + bool_property zliminclude hl , "off" END_PROPERTIES - private: +private: Matrix compute_xlim (void) const; Matrix compute_ylim (void) const; @@ -4322,9 +4323,9 @@ public: line (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~line (void) { } @@ -4342,19 +4343,19 @@ public: class OCTINTERP_API properties : public base_properties { - public: - double get_fontsize_points (double box_pix_height = 0) const; - - void set_position (const octave_value& val) +public: + double get_fontsize_points (double box_pix_height = 0) const; + + void set_position (const octave_value& val) { if (! error_state) { octave_value new_val (val); - + if (new_val.numel () == 2) { dim_vector dv (1, 3); - + new_val = new_val.resize (dv, true); } @@ -4370,114 +4371,116 @@ } } - // See the genprops.awk script for an explanation of the - // properties declarations. - - BEGIN_PROPERTIES (text) - color_property backgroundcolor , "{none}" - color_property color u , color_values (0, 0, 0) - string_property displayname , "" - color_property edgecolor , "{none}" - bool_property editing , "off" - radio_property erasemode , "{normal}|none|xor|background" - array_property extent rG , Matrix (1, 4, 0.0) - radio_property fontangle u , "{normal}|italic|oblique" - string_property fontname u , OCTAVE_DEFAULT_FONTNAME - double_property fontsize u , 10 - radio_property fontunits , "inches|centimeters|normalized|{points}|pixels" - radio_property fontweight u , "light|{normal}|demi|bold" - radio_property horizontalalignment mu , "{left}|center|right" - radio_property interpreter u , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - double_property margin , 1 - array_property position smu , Matrix (1, 3, 0.0) - double_property rotation mu , 0 - text_label_property string u , "" - radio_property units u , "{data}|pixels|normalized|inches|centimeters|points" - radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom" - - // hidden properties for limit computation - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property xliminclude hl , "off" - bool_property yliminclude hl , "off" - bool_property zliminclude hl , "off" - // hidden properties for auto-positioning - radio_property positionmode hu , "{auto}|manual" - radio_property rotationmode hu , "{auto}|manual" - radio_property horizontalalignmentmode hu , "{auto}|manual" - radio_property verticalalignmentmode hu , "{auto}|manual" - radio_property autopos_tag h , "{none}|xlabel|ylabel|zlabel|title" + // See the genprops.awk script for an explanation of the + // properties declarations. + + BEGIN_PROPERTIES (text) + color_property backgroundcolor , "{none}" + color_property color u , color_values (0, 0, 0) + string_property displayname , "" + color_property edgecolor , "{none}" + bool_property editing , "off" + radio_property erasemode , "{normal}|none|xor|background" + array_property extent rG , Matrix (1, 4, 0.0) + radio_property fontangle u , "{normal}|italic|oblique" + string_property fontname u , OCTAVE_DEFAULT_FONTNAME + double_property fontsize u , 10 + radio_property fontunits , "inches|centimeters|normalized|{points}|pixels" + radio_property fontweight u , "light|{normal}|demi|bold" + radio_property horizontalalignment mu , "{left}|center|right" + radio_property interpreter u , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + double_property margin , 1 + array_property position smu , Matrix (1, 3, 0.0) + double_property rotation mu , 0 + text_label_property string u , "" + radio_property units u , "{data}|pixels|normalized|inches|centimeters|points" + radio_property verticalalignment mu , "top|cap|{middle}|baseline|bottom" + + // hidden properties for limit computation + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property xliminclude hl , "off" + bool_property yliminclude hl , "off" + bool_property zliminclude hl , "off" + // hidden properties for auto-positioning + radio_property positionmode hu , "{auto}|manual" + radio_property rotationmode hu , "{auto}|manual" + radio_property horizontalalignmentmode hu , "{auto}|manual" + radio_property verticalalignmentmode hu , "{auto}|manual" + radio_property autopos_tag h , "{none}|xlabel|ylabel|zlabel|title" END_PROPERTIES Matrix get_data_position (void) const; - Matrix get_extent_matrix (void) const; - const uint8NDArray& get_pixels (void) const { return pixels; } + Matrix get_extent_matrix (void) const; + const uint8NDArray& get_pixels (void) const { return pixels; } + /* #if HAVE_FREETYPE - // freetype renderer, used for calculation of text size - ft_render renderer; + // freetype renderer, used for calculation of text size + text_render renderer; #endif - - protected: - void init (void) - { - position.add_constraint (dim_vector (1, 3)); - cached_units = get_units (); - update_font (); - } - - private: - void update_position (void) - { - Matrix pos = get_data_position (); - Matrix lim; - - lim = Matrix (1, 3, pos(0)); - lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); - set_xlim (lim); - - lim = Matrix (1, 3, pos(1)); - lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); - set_ylim (lim); - - if (pos.numel () == 3) - { - lim = Matrix (1, 3, pos(2)); - lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); - set_zliminclude ("on"); - set_zlim (lim); - } - else - set_zliminclude ("off"); - } - - void update_text_extent (void); - - void request_autopos (void); - void update_positionmode (void) { request_autopos (); } - void update_rotationmode (void) { request_autopos (); } - void update_horizontalalignmentmode (void) { request_autopos (); } - void update_verticalalignmentmode (void) { request_autopos (); } - - void update_font (void); - void update_string (void) { request_autopos (); update_text_extent (); } - void update_rotation (void) { update_text_extent (); } - void update_color (void) { update_font (); update_text_extent (); } - void update_fontname (void) { update_font (); update_text_extent (); } - void update_fontsize (void) { update_font (); update_text_extent (); } - void update_fontangle (void) { update_font (); update_text_extent (); } - void update_fontweight (void) { update_font (); update_text_extent (); } - void update_interpreter (void) { update_text_extent (); } - void update_horizontalalignment (void) { update_text_extent (); } - void update_verticalalignment (void) { update_text_extent (); } - - void update_units (void); - - private: - std::string cached_units; - uint8NDArray pixels; + */ + +protected: + void init (void) + { + position.add_constraint (dim_vector (1, 3)); + cached_units = get_units (); + update_font (); + } + +private: + void update_position (void) + { + Matrix pos = get_data_position (); + Matrix lim; + + lim = Matrix (1, 3, pos(0)); + lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); + set_xlim (lim); + + lim = Matrix (1, 3, pos(1)); + lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); + set_ylim (lim); + + if (pos.numel () == 3) + { + lim = Matrix (1, 3, pos(2)); + lim(2) = (lim(2) <= 0 ? octave_Inf : lim(2)); + set_zliminclude ("on"); + set_zlim (lim); + } + else + set_zliminclude ("off"); + } + + void update_text_extent (void); + + void request_autopos (void); + void update_positionmode (void) { request_autopos (); } + void update_rotationmode (void) { request_autopos (); } + void update_horizontalalignmentmode (void) { request_autopos (); } + void update_verticalalignmentmode (void) { request_autopos (); } + + void update_font (void); + void update_string (void) { request_autopos (); update_text_extent (); } + void update_rotation (void) { update_text_extent (); } + void update_color (void) { update_font (); update_text_extent (); } + void update_fontname (void) { update_font (); update_text_extent (); } + void update_fontsize (void) { update_font (); update_text_extent (); } + void update_fontangle (void) { update_font (); update_text_extent (); } + void update_fontweight (void) { update_font (); update_text_extent (); } + void update_interpreter (void) { update_text_extent (); } + void update_horizontalalignment (void) { update_text_extent (); } + void update_verticalalignment (void) { update_text_extent (); } + + void update_units (void); + +private: + std::string cached_units; + uint8NDArray pixels; }; private: @@ -4486,10 +4489,10 @@ public: text (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.set_clipping ("off"); - xproperties.override_defaults (*this); - } + { + xproperties.set_clipping ("off"); + xproperties.override_defaults (*this); + } ~text (void) { } @@ -4507,43 +4510,43 @@ public: class OCTINTERP_API properties : public base_properties { - public: - bool is_aliminclude (void) const - { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } - std::string get_aliminclude (void) const - { return aliminclude.current_value (); } - - bool is_climinclude (void) const - { return (climinclude.is_on () && cdatamapping.is ("scaled")); } - std::string get_climinclude (void) const - { return climinclude.current_value (); } - - octave_value get_color_data (void) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (image) - array_property alphadata u , Matrix () - radio_property alphadatamapping al , "none|direct|{scaled}" - array_property cdata u , Matrix () - radio_property cdatamapping al , "scaled|{direct}" - radio_property erasemode , "{normal}|none|xor|background" - row_vector_property xdata u , Matrix () - row_vector_property ydata u , Matrix () - // hidden properties for limit computation - row_vector_property alim hlr , Matrix () - row_vector_property clim hlr , Matrix () - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - bool_property aliminclude hlg , "on" - bool_property climinclude hlg , "on" - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" +public: + bool is_aliminclude (void) const + { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } + std::string get_aliminclude (void) const + { return aliminclude.current_value (); } + + bool is_climinclude (void) const + { return (climinclude.is_on () && cdatamapping.is ("scaled")); } + std::string get_climinclude (void) const + { return climinclude.current_value (); } + + octave_value get_color_data (void) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (image) + array_property alphadata u , Matrix () + radio_property alphadatamapping al , "none|direct|{scaled}" + array_property cdata u , Matrix () + radio_property cdatamapping al , "scaled|{direct}" + radio_property erasemode , "{normal}|none|xor|background" + row_vector_property xdata u , Matrix () + row_vector_property ydata u , Matrix () + // hidden properties for limit computation + row_vector_property alim hlr , Matrix () + row_vector_property clim hlr , Matrix () + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + bool_property aliminclude hlg , "on" + bool_property climinclude hlg , "on" + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" END_PROPERTIES - protected: +protected: void init (void) { xdata.add_constraint (2); @@ -4559,7 +4562,7 @@ cdata.add_constraint (dim_vector (-1, -1, 3)); } - private: +private: void update_alphadata (void) { if (alphadatamapping_is ("scaled")) @@ -4577,52 +4580,52 @@ } void update_xdata (void) - { - Matrix limits = xdata.get_limits (); - float dp = pixel_xsize (); - - limits(0) = limits(0) - dp; - limits(1) = limits(1) + dp; - set_xlim (limits); - } + { + Matrix limits = xdata.get_limits (); + float dp = pixel_xsize (); + + limits(0) = limits(0) - dp; + limits(1) = limits(1) + dp; + set_xlim (limits); + } void update_ydata (void) - { - Matrix limits = ydata.get_limits (); - float dp = pixel_ysize (); - - limits(0) = limits(0) - dp; - limits(1) = limits(1) + dp; - set_ylim (limits); - } + { + Matrix limits = ydata.get_limits (); + float dp = pixel_ysize (); + + limits(0) = limits(0) - dp; + limits(1) = limits(1) + dp; + set_ylim (limits); + } float pixel_size (octave_idx_type dim, const Matrix limits) - { - octave_idx_type l = dim - 1; - float dp; - - if (l > 0 && limits(0) != limits(1)) - dp = (limits(1) - limits(0))/(2*l); - else - { - if (limits(1) == limits(2)) - dp = 0.5; - else - dp = (limits(1) - limits(0))/2; - } - return dp; - } - - public: + { + octave_idx_type l = dim - 1; + float dp; + + if (l > 0 && limits(0) != limits(1)) + dp = (limits(1) - limits(0))/(2*l); + else + { + if (limits(1) == limits(2)) + dp = 0.5; + else + dp = (limits(1) - limits(0))/2; + } + return dp; + } + +public: float pixel_xsize (void) - { - return pixel_size ((get_cdata ().dims ())(1), xdata.get_limits ()); - } + { + return pixel_size ((get_cdata ().dims ())(1), xdata.get_limits ()); + } float pixel_ysize (void) - { - return pixel_size ((get_cdata ().dims ())(0), ydata.get_limits ()); - } + { + return pixel_size ((get_cdata ().dims ())(0), ydata.get_limits ()); + } }; private: @@ -4631,9 +4634,9 @@ public: image (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~image (void) { } @@ -4651,74 +4654,74 @@ public: class OCTINTERP_API properties : public base_properties { - public: - octave_value get_color_data (void) const; - - bool is_aliminclude (void) const - { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } - std::string get_aliminclude (void) const - { return aliminclude.current_value (); } - - bool is_climinclude (void) const - { return (climinclude.is_on () && cdatamapping.is ("scaled")); } - std::string get_climinclude (void) const - { return climinclude.current_value (); } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (patch) - radio_property alphadatamapping l , "none|{scaled}|direct" - double_property ambientstrength , 0.3 - radio_property backfacelighting , "unlit|lit|{reverselit}" - array_property cdata u , Matrix () - radio_property cdatamapping l , "{scaled}|direct" - double_property diffusestrength , 0.6 - string_property displayname , "" - double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) - color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) - radio_property edgelighting , "{none}|flat|gouraud|phong" - radio_property erasemode , "{normal}|background|xor|none" - double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp")) - color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) - radio_property facelighting , "{none}|flat|gouraud|phong" - array_property faces , Matrix () - array_property facevertexalphadata , Matrix () - array_property facevertexcdata , Matrix () - // FIXME: interpreter is not a property of a Matlab patch. - // Octave uses this for legend() with the string displayname. - radio_property interpreter , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" - color_property markeredgecolor , "none|{auto}|flat" - color_property markerfacecolor , "{none}|auto|flat" - double_property markersize , 6 - radio_property normalmode , "{auto}|manual" - double_property specularcolorreflectance , 1.0 - double_property specularexponent , 10.0 - double_property specularstrength , 0.6 - array_property vertexnormals , Matrix () - array_property vertices , Matrix () - array_property xdata u , Matrix () - array_property ydata u , Matrix () - array_property zdata u , Matrix () - - // hidden properties for limit computation - row_vector_property alim hlr , Matrix () - row_vector_property clim hlr , Matrix () - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property aliminclude hlg , "on" - bool_property climinclude hlg , "on" - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" - bool_property zliminclude hl , "on" +public: + octave_value get_color_data (void) const; + + bool is_aliminclude (void) const + { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } + std::string get_aliminclude (void) const + { return aliminclude.current_value (); } + + bool is_climinclude (void) const + { return (climinclude.is_on () && cdatamapping.is ("scaled")); } + std::string get_climinclude (void) const + { return climinclude.current_value (); } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (patch) + radio_property alphadatamapping l , "none|{scaled}|direct" + double_property ambientstrength , 0.3 + radio_property backfacelighting , "unlit|lit|{reverselit}" + array_property cdata u , Matrix () + radio_property cdatamapping l , "{scaled}|direct" + double_property diffusestrength , 0.6 + string_property displayname , "" + double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) + color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) + radio_property edgelighting , "{none}|flat|gouraud|phong" + radio_property erasemode , "{normal}|background|xor|none" + double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp")) + color_property facecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) + radio_property facelighting , "{none}|flat|gouraud|phong" + array_property faces , Matrix () + array_property facevertexalphadata , Matrix () + array_property facevertexcdata , Matrix () + // FIXME: interpreter is not a property of a Matlab patch. + // Octave uses this for legend() with the string displayname. + radio_property interpreter , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" + color_property markeredgecolor , "none|{auto}|flat" + color_property markerfacecolor , "{none}|auto|flat" + double_property markersize , 6 + radio_property normalmode , "{auto}|manual" + double_property specularcolorreflectance , 1.0 + double_property specularexponent , 10.0 + double_property specularstrength , 0.6 + array_property vertexnormals , Matrix () + array_property vertices , Matrix () + array_property xdata u , Matrix () + array_property ydata u , Matrix () + array_property zdata u , Matrix () + + // hidden properties for limit computation + row_vector_property alim hlr , Matrix () + row_vector_property clim hlr , Matrix () + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property aliminclude hlg , "on" + bool_property climinclude hlg , "on" + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" + bool_property zliminclude hl , "on" END_PROPERTIES - protected: +protected: void init (void) { xdata.add_constraint (dim_vector (-1, -1)); @@ -4733,7 +4736,7 @@ facevertexalphadata.add_constraint (dim_vector (-1, 1)); } - private: +private: void update_xdata (void) { set_xlim (xdata.get_limits ()); } void update_ydata (void) { set_ylim (ydata.get_limits ()); } void update_zdata (void) { set_zlim (zdata.get_limits ()); } @@ -4753,9 +4756,9 @@ public: patch (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~patch (void) { } @@ -4773,76 +4776,76 @@ public: class OCTINTERP_API properties : public base_properties { - public: - octave_value get_color_data (void) const; - - bool is_aliminclude (void) const - { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } - std::string get_aliminclude (void) const - { return aliminclude.current_value (); } - - bool is_climinclude (void) const - { return (climinclude.is_on () && cdatamapping.is ("scaled")); } - std::string get_climinclude (void) const - { return climinclude.current_value (); } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (surface) - array_property alphadata u , Matrix () - radio_property alphadatamapping l , "none|direct|{scaled}" - double_property ambientstrength , 0.3 - radio_property backfacelighting , "unlit|lit|{reverselit}" - array_property cdata u , Matrix () - radio_property cdatamapping al , "{scaled}|direct" - string_property cdatasource , "" - double_property diffusestrength , 0.6 - string_property displayname , "" - double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) - color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) - radio_property edgelighting , "{none}|flat|gouraud|phong" - radio_property erasemode , "{normal}|none|xor|background" - double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap")) - color_property facecolor , "none|{flat}|interp|texturemap" - radio_property facelighting , "{none}|flat|gouraud|phong" - // FIXME: interpreter is not a Matlab surface property - // Octave uses this for legend() with the string displayname. - radio_property interpreter , "{tex}|none|latex" - radio_property linestyle , "{-}|--|:|-.|none" - double_property linewidth , 0.5 - radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" - color_property markeredgecolor , "none|{auto}|flat" - color_property markerfacecolor , "{none}|auto|flat" - double_property markersize , 6 - radio_property meshstyle , "{both}|row|column" - radio_property normalmode u , "{auto}|manual" - double_property specularcolorreflectance , 1 - double_property specularexponent , 10 - double_property specularstrength , 0.9 - array_property vertexnormals u , Matrix () - array_property xdata u , Matrix () - string_property xdatasource , "" - array_property ydata u , Matrix () - string_property ydatasource , "" - array_property zdata u , Matrix () - string_property zdatasource , "" - - // hidden properties for limit computation - row_vector_property alim hlr , Matrix () - row_vector_property clim hlr , Matrix () - row_vector_property xlim hlr , Matrix () - row_vector_property ylim hlr , Matrix () - row_vector_property zlim hlr , Matrix () - bool_property aliminclude hlg , "on" - bool_property climinclude hlg , "on" - bool_property xliminclude hl , "on" - bool_property yliminclude hl , "on" - bool_property zliminclude hl , "on" +public: + octave_value get_color_data (void) const; + + bool is_aliminclude (void) const + { return (aliminclude.is_on () && alphadatamapping.is ("scaled")); } + std::string get_aliminclude (void) const + { return aliminclude.current_value (); } + + bool is_climinclude (void) const + { return (climinclude.is_on () && cdatamapping.is ("scaled")); } + std::string get_climinclude (void) const + { return climinclude.current_value (); } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (surface) + array_property alphadata u , Matrix () + radio_property alphadatamapping l , "none|direct|{scaled}" + double_property ambientstrength , 0.3 + radio_property backfacelighting , "unlit|lit|{reverselit}" + array_property cdata u , Matrix () + radio_property cdatamapping al , "{scaled}|direct" + string_property cdatasource , "" + double_property diffusestrength , 0.6 + string_property displayname , "" + double_radio_property edgealpha , double_radio_property (1.0, radio_values ("flat|interp")) + color_property edgecolor , color_property (color_values (0, 0, 0), radio_values ("none|flat|interp")) + radio_property edgelighting , "{none}|flat|gouraud|phong" + radio_property erasemode , "{normal}|none|xor|background" + double_radio_property facealpha , double_radio_property (1.0, radio_values ("flat|interp|texturemap")) + color_property facecolor , "none|{flat}|interp|texturemap" + radio_property facelighting , "{none}|flat|gouraud|phong" + // FIXME: interpreter is not a Matlab surface property + // Octave uses this for legend() with the string displayname. + radio_property interpreter , "{tex}|none|latex" + radio_property linestyle , "{-}|--|:|-.|none" + double_property linewidth , 0.5 + radio_property marker , "{none}|+|o|*|.|x|s|d|^|v|>|<|p|h" + color_property markeredgecolor , "none|{auto}|flat" + color_property markerfacecolor , "{none}|auto|flat" + double_property markersize , 6 + radio_property meshstyle , "{both}|row|column" + radio_property normalmode u , "{auto}|manual" + double_property specularcolorreflectance , 1 + double_property specularexponent , 10 + double_property specularstrength , 0.9 + array_property vertexnormals u , Matrix () + array_property xdata u , Matrix () + string_property xdatasource , "" + array_property ydata u , Matrix () + string_property ydatasource , "" + array_property zdata u , Matrix () + string_property zdatasource , "" + + // hidden properties for limit computation + row_vector_property alim hlr , Matrix () + row_vector_property clim hlr , Matrix () + row_vector_property xlim hlr , Matrix () + row_vector_property ylim hlr , Matrix () + row_vector_property zlim hlr , Matrix () + bool_property aliminclude hlg , "on" + bool_property climinclude hlg , "on" + bool_property xliminclude hl , "on" + bool_property yliminclude hl , "on" + bool_property zliminclude hl , "on" END_PROPERTIES - protected: +protected: void init (void) { xdata.add_constraint (dim_vector (-1, -1)); @@ -4860,7 +4863,7 @@ cdata.add_constraint (dim_vector (-1, -1, 3)); } - private: +private: void update_alphadata (void) { if (alphadatamapping_is ("scaled")) @@ -4910,9 +4913,9 @@ public: surface (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~surface (void) { } @@ -4930,47 +4933,47 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void remove_child (const graphics_handle& h) - { - base_properties::remove_child (h); - update_limits (); - } - - void adopt (const graphics_handle& h) - { - - base_properties::adopt (h); - update_limits (h); - } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (hggroup) - string_property displayname , "" - radio_property erasemode , "{normal}|none|xor|background" - - // hidden properties for limit computation - row_vector_property alim hr , Matrix () - row_vector_property clim hr , Matrix () - row_vector_property xlim hr , Matrix () - row_vector_property ylim hr , Matrix () - row_vector_property zlim hr , Matrix () - bool_property aliminclude h , "on" - bool_property climinclude h , "on" - bool_property xliminclude h , "on" - bool_property yliminclude h , "on" - bool_property zliminclude h , "on" +public: + void remove_child (const graphics_handle& h) + { + base_properties::remove_child (h); + update_limits (); + } + + void adopt (const graphics_handle& h) + { + + base_properties::adopt (h); + update_limits (h); + } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (hggroup) + string_property displayname , "" + radio_property erasemode , "{normal}|none|xor|background" + + // hidden properties for limit computation + row_vector_property alim hr , Matrix () + row_vector_property clim hr , Matrix () + row_vector_property xlim hr , Matrix () + row_vector_property ylim hr , Matrix () + row_vector_property zlim hr , Matrix () + bool_property aliminclude h , "on" + bool_property climinclude h , "on" + bool_property xliminclude h , "on" + bool_property yliminclude h , "on" + bool_property zliminclude h , "on" END_PROPERTIES - private: - void update_limits (void) const; - - void update_limits (const graphics_handle& h) const; - - protected: +private: + void update_limits (void) const; + + void update_limits (const graphics_handle& h) const; + +protected: void init (void) { } @@ -4982,9 +4985,9 @@ public: hggroup (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~hggroup (void) { } @@ -5008,36 +5011,36 @@ public: class OCTINTERP_API properties : public base_properties { - public: - void remove_child (const graphics_handle& h) - { - base_properties::remove_child (h); - } - - void adopt (const graphics_handle& h) - { - base_properties::adopt (h); - } - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uimenu) - any_property __object__ , Matrix () - string_property accelerator , "" - callback_property callback , Matrix () - bool_property checked , "off" - bool_property enable , "on" - color_property foregroundcolor , color_values (0, 0, 0) - string_property label , "" - double_property position , 9 - bool_property separator , "off" - // Octave-specific properties - string_property fltk_label h , "" +public: + void remove_child (const graphics_handle& h) + { + base_properties::remove_child (h); + } + + void adopt (const graphics_handle& h) + { + base_properties::adopt (h); + } + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uimenu) + any_property __object__ , Matrix () + string_property accelerator , "" + callback_property callback , Matrix () + bool_property checked , "off" + bool_property enable , "on" + color_property foregroundcolor , color_values (0, 0, 0) + string_property label , "" + double_property position , 9 + bool_property separator , "off" + // Octave-specific properties + string_property fltk_label h , "" END_PROPERTIES - protected: +protected: void init (void) { } }; @@ -5048,9 +5051,9 @@ public: uimenu (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uimenu (void) { } @@ -5069,18 +5072,18 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uicontextmenu) - any_property __object__ , Matrix () - callback_property callback , Matrix () - array_property position , Matrix (1, 2, 0.0) +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uicontextmenu) + any_property __object__ , Matrix () + callback_property callback , Matrix () + array_property position , Matrix (1, 2, 0.0) END_PROPERTIES - protected: +protected: void init (void) { position.add_constraint (dim_vector (1, 2)); @@ -5095,9 +5098,9 @@ public: uicontextmenu (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uicontextmenu (void) { } @@ -5116,49 +5119,49 @@ public: class OCTINTERP_API properties : public base_properties { - public: - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - - double get_fontsize_points (double box_pix_height = 0) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uicontrol) - any_property __object__ , Matrix () - color_property backgroundcolor , color_values (1, 1, 1) - callback_property callback , Matrix () - array_property cdata , Matrix () - bool_property clipping , "on" - radio_property enable , "{on}|inactive|off" - array_property extent rG , Matrix (1, 4, 0.0) - radio_property fontangle u , "{normal}|italic|oblique" - string_property fontname u , OCTAVE_DEFAULT_FONTNAME - double_property fontsize u , 10 - radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" - radio_property fontweight u , "light|{normal}|demi|bold" - color_property foregroundcolor , color_values (0, 0, 0) - radio_property horizontalalignment , "left|{center}|right" - callback_property keypressfcn , Matrix () - double_property listboxtop , 1 - double_property max , 1 - double_property min , 0 - array_property position , default_control_position () - array_property sliderstep , default_control_sliderstep () - string_array_property string u , "" - radio_property style S , "{pushbutton}|togglebutton|radiobutton|checkbox|edit|text|slider|frame|listbox|popupmenu" - string_property tooltipstring , "" - radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters" - row_vector_property value , Matrix (1, 1, 1.0) - radio_property verticalalignment , "top|{middle}|bottom" +public: + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + double get_fontsize_points (double box_pix_height = 0) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uicontrol) + any_property __object__ , Matrix () + color_property backgroundcolor , color_values (1, 1, 1) + callback_property callback , Matrix () + array_property cdata , Matrix () + bool_property clipping , "on" + radio_property enable , "{on}|inactive|off" + array_property extent rG , Matrix (1, 4, 0.0) + radio_property fontangle u , "{normal}|italic|oblique" + string_property fontname u , OCTAVE_DEFAULT_FONTNAME + double_property fontsize u , 10 + radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" + radio_property fontweight u , "light|{normal}|demi|bold" + color_property foregroundcolor , color_values (0, 0, 0) + radio_property horizontalalignment , "left|{center}|right" + callback_property keypressfcn , Matrix () + double_property listboxtop , 1 + double_property max , 1 + double_property min , 0 + array_property position , default_control_position () + array_property sliderstep , default_control_sliderstep () + string_array_property string u , "" + radio_property style S , "{pushbutton}|togglebutton|radiobutton|checkbox|edit|text|slider|frame|listbox|popupmenu" + string_property tooltipstring , "" + radio_property units u , "normalized|inches|centimeters|points|{pixels}|characters" + row_vector_property value , Matrix (1, 1, 1.0) + radio_property verticalalignment , "top|{middle}|bottom" END_PROPERTIES - private: +private: std::string cached_units; - protected: +protected: void init (void) { cdata.add_constraint ("double"); @@ -5169,7 +5172,7 @@ sliderstep.add_constraint (dim_vector (1, 2)); cached_units = get_units (); } - + void update_text_extent (void); void update_string (void) { update_text_extent (); } @@ -5189,9 +5192,9 @@ public: uicontrol (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uicontrol (void) { } @@ -5209,42 +5212,42 @@ public: class OCTINTERP_API properties : public base_properties { - public: - Matrix get_boundingbox (bool internal = false, - const Matrix& parent_pix_size = Matrix ()) const; - - double get_fontsize_points (double box_pix_height = 0) const; - - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uipanel) - any_property __object__ , Matrix () - color_property backgroundcolor , color_values (1, 1, 1) - radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line" - double_property borderwidth , 1 - radio_property fontangle , "{normal}|italic|oblique" - string_property fontname , OCTAVE_DEFAULT_FONTNAME - double_property fontsize , 10 - radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" - radio_property fontweight , "light|{normal}|demi|bold" - color_property foregroundcolor , color_values (0, 0, 0) - color_property highlightcolor , color_values (1, 1, 1) - array_property position , default_panel_position () - callback_property resizefcn , Matrix () - color_property shadowcolor , color_values (0, 0, 0) - string_property title , "" - radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom" - radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters" +public: + Matrix get_boundingbox (bool internal = false, + const Matrix& parent_pix_size = Matrix ()) const; + + double get_fontsize_points (double box_pix_height = 0) const; + + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uipanel) + any_property __object__ , Matrix () + color_property backgroundcolor , color_values (1, 1, 1) + radio_property bordertype , "none|{etchedin}|etchedout|beveledin|beveledout|line" + double_property borderwidth , 1 + radio_property fontangle , "{normal}|italic|oblique" + string_property fontname , OCTAVE_DEFAULT_FONTNAME + double_property fontsize , 10 + radio_property fontunits S , "inches|centimeters|normalized|{points}|pixels" + radio_property fontweight , "light|{normal}|demi|bold" + color_property foregroundcolor , color_values (0, 0, 0) + color_property highlightcolor , color_values (1, 1, 1) + array_property position , default_panel_position () + callback_property resizefcn , Matrix () + color_property shadowcolor , color_values (0, 0, 0) + string_property title , "" + radio_property titleposition , "{lefttop}|centertop|righttop|leftbottom|centerbottom|rightbottom" + radio_property units S , "{normalized}|inches|centimeters|points|pixels|characters" END_PROPERTIES - protected: +protected: void init (void) { position.add_constraint (dim_vector (1, 4)); } - + void update_units (const caseless_str& old_units); void update_fontunits (const caseless_str& old_units); @@ -5256,9 +5259,9 @@ public: uipanel (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uipanel (void) { } @@ -5276,16 +5279,16 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uitoolbar) - any_property __object__ , Matrix () +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uitoolbar) + any_property __object__ , Matrix () END_PROPERTIES - protected: +protected: void init (void) { } }; @@ -5296,55 +5299,55 @@ public: uitoolbar (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p), default_properties () - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uitoolbar (void) { } void override_defaults (base_graphics_object& obj) - { - // Allow parent (figure) to override first (properties knows how - // to find the parent object). - xproperties.override_defaults (obj); - - // Now override with our defaults. If the default_properties - // list includes the properties for all defaults (line, - // surface, etc.) then we don't have to know the type of OBJ - // here, we just call its set function and let it decide which - // properties from the list to use. - obj.set_from_list (default_properties); - } + { + // Allow parent (figure) to override first (properties knows how + // to find the parent object). + xproperties.override_defaults (obj); + + // Now override with our defaults. If the default_properties + // list includes the properties for all defaults (line, + // surface, etc.) then we don't have to know the type of OBJ + // here, we just call its set function and let it decide which + // properties from the list to use. + obj.set_from_list (default_properties); + } void set (const caseless_str& name, const octave_value& value) - { - if (name.compare ("default", 7)) - // strip "default", pass rest to function that will - // parse the remainder and add the element to the - // default_properties map. - default_properties.set (name.substr (7), value); - else - xproperties.set (name, value); - } + { + if (name.compare ("default", 7)) + // strip "default", pass rest to function that will + // parse the remainder and add the element to the + // default_properties map. + default_properties.set (name.substr (7), value); + else + xproperties.set (name, value); + } octave_value get (const caseless_str& name) const - { - octave_value retval; - - if (name.compare ("default", 7)) - retval = get_default (name.substr (7)); - else - retval = xproperties.get (name); - - return retval; - } + { + octave_value retval; + + if (name.compare ("default", 7)) + retval = get_default (name.substr (7)); + else + retval = xproperties.get (name); + + return retval; + } octave_value get_default (const caseless_str& name) const; octave_value get_defaults (void) const - { - return default_properties.as_struct ("default"); - } + { + return default_properties.as_struct ("default"); + } base_properties& get_properties (void) { return xproperties; } @@ -5365,21 +5368,21 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uipushtool) - any_property __object__ , Matrix () - array_property cdata , Matrix () - callback_property clickedcallback , Matrix () - bool_property enable , "on" - bool_property separator , "off" - string_property tooltipstring , "" +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uipushtool) + any_property __object__ , Matrix () + array_property cdata , Matrix () + callback_property clickedcallback , Matrix () + bool_property enable , "on" + bool_property separator , "off" + string_property tooltipstring , "" END_PROPERTIES - protected: +protected: void init (void) { cdata.add_constraint ("double"); @@ -5395,9 +5398,9 @@ public: uipushtool (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uipushtool (void) { } @@ -5416,24 +5419,24 @@ public: class OCTINTERP_API properties : public base_properties { - public: - // See the genprops.awk script for an explanation of the - // properties declarations. - // Programming note: Keep property list sorted if new ones are added. - - BEGIN_PROPERTIES (uitoggletool) - any_property __object__ , Matrix () - array_property cdata , Matrix () - callback_property clickedcallback , Matrix () - bool_property enable , "on" - callback_property offcallback , Matrix () - callback_property oncallback , Matrix () - bool_property separator , "off" - bool_property state , "off" - string_property tooltipstring , "" +public: + // See the genprops.awk script for an explanation of the + // properties declarations. + // Programming note: Keep property list sorted if new ones are added. + + BEGIN_PROPERTIES (uitoggletool) + any_property __object__ , Matrix () + array_property cdata , Matrix () + callback_property clickedcallback , Matrix () + bool_property enable , "on" + callback_property offcallback , Matrix () + callback_property oncallback , Matrix () + bool_property separator , "off" + bool_property state , "off" + string_property tooltipstring , "" END_PROPERTIES - protected: +protected: void init (void) { cdata.add_constraint ("double"); @@ -5449,9 +5452,9 @@ public: uitoggletool (const graphics_handle& mh, const graphics_handle& p) : base_graphics_object (), xproperties (mh, p) - { - xproperties.override_defaults (*this); - } + { + xproperties.override_defaults (*this); + } ~uitoggletool (void) { } @@ -5501,9 +5504,9 @@ graphics_event (void) : rep (0) { } graphics_event (const graphics_event& e) : rep (e.rep) - { - rep->count++; - } + { + rep->count++; + } ~graphics_event (void) { @@ -5533,22 +5536,22 @@ { return (rep != 0); } static graphics_event - create_callback_event (const graphics_handle& h, - const std::string& name, - const octave_value& data = Matrix ()); - - static graphics_event - create_callback_event (const graphics_handle& h, - const octave_value& cb, - const octave_value& data = Matrix ()); + create_callback_event (const graphics_handle& h, + const std::string& name, + const octave_value& data = Matrix ()); static graphics_event - create_function_event (event_fcn fcn, void *data = 0); + create_callback_event (const graphics_handle& h, + const octave_value& cb, + const octave_value& data = Matrix ()); static graphics_event - create_set_event (const graphics_handle& h, const std::string& name, - const octave_value& value, - bool notify_toolkit = true); + create_function_event (event_fcn fcn, void *data = 0); + + static graphics_event + create_set_event (const graphics_handle& h, const std::string& name, + const octave_value& value, + bool notify_toolkit = true); private: base_graphics_event *rep; }; @@ -5564,201 +5567,201 @@ static void create_instance (void); static bool instance_ok (void) - { - bool retval = true; - - if (! instance) - create_instance (); - - if (! instance) - { - ::error ("unable to create gh_manager!"); - - retval = false; - } - - return retval; - } + { + bool retval = true; + + if (! instance) + create_instance (); + + if (! instance) + { + ::error ("unable to create gh_manager!"); + + retval = false; + } + + return retval; + } static void cleanup_instance (void) { delete instance; instance = 0; } static graphics_handle get_handle (bool integer_figure_handle) - { - return instance_ok () - ? instance->do_get_handle (integer_figure_handle) : graphics_handle (); - } + { + return instance_ok () + ? instance->do_get_handle (integer_figure_handle) : graphics_handle (); + } static void free (const graphics_handle& h) - { - if (instance_ok ()) - instance->do_free (h); - } + { + if (instance_ok ()) + instance->do_free (h); + } static void renumber_figure (const graphics_handle& old_gh, const graphics_handle& new_gh) - { - if (instance_ok ()) - instance->do_renumber_figure (old_gh, new_gh); - } + { + if (instance_ok ()) + instance->do_renumber_figure (old_gh, new_gh); + } static graphics_handle lookup (double val) - { - return instance_ok () ? instance->do_lookup (val) : graphics_handle (); - } + { + return instance_ok () ? instance->do_lookup (val) : graphics_handle (); + } static graphics_handle lookup (const octave_value& val) - { - return val.is_real_scalar () - ? lookup (val.double_value ()) : graphics_handle (); - } + { + return val.is_real_scalar () + ? lookup (val.double_value ()) : graphics_handle (); + } static graphics_object get_object (double val) - { - return get_object (lookup (val)); - } + { + return get_object (lookup (val)); + } static graphics_object get_object (const graphics_handle& h) - { - return instance_ok () ? instance->do_get_object (h) : graphics_object (); - } + { + return instance_ok () ? instance->do_get_object (h) : graphics_object (); + } static graphics_handle - make_graphics_handle (const std::string& go_name, - const graphics_handle& parent, - bool integer_figure_handle = false, - bool do_createfcn = true, - bool do_notify_toolkit = true) - { - return instance_ok () - ? instance->do_make_graphics_handle (go_name, parent, - integer_figure_handle, - do_createfcn, do_notify_toolkit) - : graphics_handle (); - } + make_graphics_handle (const std::string& go_name, + const graphics_handle& parent, + bool integer_figure_handle = false, + bool do_createfcn = true, + bool do_notify_toolkit = true) + { + return instance_ok () + ? instance->do_make_graphics_handle (go_name, parent, + integer_figure_handle, + do_createfcn, do_notify_toolkit) + : graphics_handle (); + } static graphics_handle make_figure_handle (double val, bool do_notify_toolkit = true) - { - return instance_ok () - ? instance->do_make_figure_handle (val, do_notify_toolkit) - : graphics_handle (); - } + { + return instance_ok () + ? instance->do_make_figure_handle (val, do_notify_toolkit) + : graphics_handle (); + } static void push_figure (const graphics_handle& h) - { - if (instance_ok ()) - instance->do_push_figure (h); - } + { + if (instance_ok ()) + instance->do_push_figure (h); + } static void pop_figure (const graphics_handle& h) - { - if (instance_ok ()) - instance->do_pop_figure (h); - } + { + if (instance_ok ()) + instance->do_pop_figure (h); + } static graphics_handle current_figure (void) - { - return instance_ok () - ? instance->do_current_figure () : graphics_handle (); - } + { + return instance_ok () + ? instance->do_current_figure () : graphics_handle (); + } static Matrix handle_list (bool show_hidden = false) - { - return instance_ok () - ? instance->do_handle_list (show_hidden) : Matrix (); - } + { + return instance_ok () + ? instance->do_handle_list (show_hidden) : Matrix (); + } static void lock (void) - { - if (instance_ok ()) - instance->do_lock (); - } + { + if (instance_ok ()) + instance->do_lock (); + } static bool try_lock (void) - { - if (instance_ok ()) - return instance->do_try_lock (); - else - return false; - } + { + if (instance_ok ()) + return instance->do_try_lock (); + else + return false; + } static void unlock (void) - { - if (instance_ok ()) - instance->do_unlock (); - } - + { + if (instance_ok ()) + instance->do_unlock (); + } + static Matrix figure_handle_list (bool show_hidden = false) - { - return instance_ok () - ? instance->do_figure_handle_list (show_hidden) : Matrix (); - } + { + return instance_ok () + ? instance->do_figure_handle_list (show_hidden) : Matrix (); + } static void execute_listener (const graphics_handle& h, const octave_value& l) - { - if (instance_ok ()) - instance->do_execute_listener (h, l); - } + { + if (instance_ok ()) + instance->do_execute_listener (h, l); + } static void execute_callback (const graphics_handle& h, const std::string& name, const octave_value& data = Matrix ()) - { - octave_value cb; - - if (true) - { - gh_manager::auto_lock lock; - - graphics_object go = get_object (h); - - if (go.valid_object ()) - cb = go.get (name); - } - - if (! error_state) - execute_callback (h, cb, data); - } + { + octave_value cb; + + if (true) + { + gh_manager::auto_lock lock; + + graphics_object go = get_object (h); + + if (go.valid_object ()) + cb = go.get (name); + } + + if (! error_state) + execute_callback (h, cb, data); + } static void execute_callback (const graphics_handle& h, const octave_value& cb, const octave_value& data = Matrix ()) - { - if (instance_ok ()) - instance->do_execute_callback (h, cb, data); - } + { + if (instance_ok ()) + instance->do_execute_callback (h, cb, data); + } static void post_callback (const graphics_handle& h, const std::string& name, const octave_value& data = Matrix ()) - { - if (instance_ok ()) - instance->do_post_callback (h, name, data); - } - + { + if (instance_ok ()) + instance->do_post_callback (h, name, data); + } + static void post_function (graphics_event::event_fcn fcn, void* data = 0) - { - if (instance_ok ()) - instance->do_post_function (fcn, data); - } + { + if (instance_ok ()) + instance->do_post_function (fcn, data); + } static void post_set (const graphics_handle& h, const std::string& name, const octave_value& value, bool notify_toolkit = true) - { - if (instance_ok ()) - instance->do_post_set (h, name, value, notify_toolkit); - } + { + if (instance_ok ()) + instance->do_post_set (h, name, value, notify_toolkit); + } static int process_events (void) - { - return (instance_ok () ? instance->do_process_events () : 0); - } + { + return (instance_ok () ? instance->do_process_events () : 0); + } static int flush_events (void) - { - return (instance_ok () ? instance->do_process_events (true) : 0); - } + { + return (instance_ok () ? instance->do_process_events (true) : 0); + } static void enable_event_processing (bool enable = true) { @@ -5767,39 +5770,39 @@ } static bool is_handle_visible (const graphics_handle& h) - { - bool retval = false; - - graphics_object go = get_object (h); - - if (go.valid_object ()) - retval = go.is_handle_visible (); - - return retval; - } + { + bool retval = false; + + graphics_object go = get_object (h); + + if (go.valid_object ()) + retval = go.is_handle_visible (); + + return retval; + } static void close_all_figures (void) - { - if (instance_ok ()) - instance->do_close_all_figures (); - } + { + if (instance_ok ()) + instance->do_close_all_figures (); + } public: class auto_lock : public octave_autolock { - public: - auto_lock (bool wait = true) - : octave_autolock (instance_ok () - ? instance->graphics_lock - : octave_mutex (), - wait) +public: + auto_lock (bool wait = true) + : octave_autolock (instance_ok () + ? instance->graphics_lock + : octave_mutex (), + wait) { } - private: - - // No copying! - auto_lock (const auto_lock&); - auto_lock& operator = (const auto_lock&); +private: + + // No copying! + auto_lock (const auto_lock&); + auto_lock& operator = (const auto_lock&); }; private: @@ -5848,18 +5851,18 @@ const graphics_handle& new_gh); graphics_handle do_lookup (double val) - { - iterator p = (xisnan (val) ? handle_map.end () : handle_map.find (val)); - - return (p != handle_map.end ()) ? p->first : graphics_handle (); - } + { + iterator p = (xisnan (val) ? handle_map.end () : handle_map.find (val)); + + return (p != handle_map.end ()) ? p->first : graphics_handle (); + } graphics_object do_get_object (const graphics_handle& h) - { - iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ()); - - return (p != handle_map.end ()) ? p->second : graphics_object (); - } + { + iterator p = (h.ok () ? handle_map.find (h) : handle_map.end ()); + + return (p != handle_map.end ()) ? p->second : graphics_object (); + } graphics_handle do_make_graphics_handle (const std::string& go_name, const graphics_handle& p, @@ -5870,63 +5873,63 @@ graphics_handle do_make_figure_handle (double val, bool do_notify_toolkit); Matrix do_handle_list (bool show_hidden) - { - Matrix retval (1, handle_map.size ()); - - octave_idx_type i = 0; - for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++) - { - graphics_handle h = p->first; - - if (show_hidden || is_handle_visible (h)) - retval(i++) = h.value (); - } - - retval.resize (1, i); - - return retval; - } + { + Matrix retval (1, handle_map.size ()); + + octave_idx_type i = 0; + for (const_iterator p = handle_map.begin (); p != handle_map.end (); p++) + { + graphics_handle h = p->first; + + if (show_hidden || is_handle_visible (h)) + retval(i++) = h.value (); + } + + retval.resize (1, i); + + return retval; + } Matrix do_figure_handle_list (bool show_hidden) - { - Matrix retval (1, figure_list.size ()); - - octave_idx_type i = 0; - for (const_figure_list_iterator p = figure_list.begin (); - p != figure_list.end (); - p++) - { - graphics_handle h = *p; - - if (show_hidden || is_handle_visible (h)) - retval(i++) = h.value (); - } - - retval.resize (1, i); - - return retval; - } + { + Matrix retval (1, figure_list.size ()); + + octave_idx_type i = 0; + for (const_figure_list_iterator p = figure_list.begin (); + p != figure_list.end (); + p++) + { + graphics_handle h = *p; + + if (show_hidden || is_handle_visible (h)) + retval(i++) = h.value (); + } + + retval.resize (1, i); + + return retval; + } void do_push_figure (const graphics_handle& h); void do_pop_figure (const graphics_handle& h); graphics_handle do_current_figure (void) const - { - graphics_handle retval; - - for (const_figure_list_iterator p = figure_list.begin (); - p != figure_list.end (); - p++) - { - graphics_handle h = *p; - - if (is_handle_visible (h)) - retval = h; - } - - return retval; - } + { + graphics_handle retval; + + for (const_figure_list_iterator p = figure_list.begin (); + p != figure_list.end (); + p++) + { + graphics_handle h = *p; + + if (is_handle_visible (h)) + retval = h; + } + + return retval; + } void do_lock (void) { graphics_lock.lock (); } @@ -5941,7 +5944,7 @@ void do_post_callback (const graphics_handle& h, const std::string name, const octave_value& data); - + void do_post_function (graphics_event::event_fcn fcn, void* fcn_data); void do_post_set (const graphics_handle& h, const std::string name, @@ -5952,10 +5955,10 @@ void do_close_all_figures (void); static void restore_gcbo (void) - { - if (instance_ok ()) - instance->do_restore_gcbo (); - } + { + if (instance_ok ()) + instance->do_restore_gcbo (); + } void do_restore_gcbo (void);
--- a/libinterp/corefcn/module.mk +++ b/libinterp/corefcn/module.mk @@ -103,6 +103,8 @@ corefcn/symtab.h \ corefcn/sysdep.h \ corefcn/toplev.h \ + corefcn/txt-render.h \ + corefcn/txt-latex.h \ corefcn/txt-eng-ft.h \ corefcn/txt-eng.h \ corefcn/unwind-prot.h \ @@ -251,6 +253,8 @@ corefcn/toplev.cc \ corefcn/tril.cc \ corefcn/txt-eng.cc \ + corefcn/txt-render.cc \ + corefcn/txt-latex.cc \ corefcn/txt-eng-ft.cc \ corefcn/typecast.cc \ corefcn/unwind-prot.cc \
--- a/libinterp/corefcn/txt-eng-ft.cc +++ b/libinterp/corefcn/txt-eng-ft.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2009-2012 Michael Goffioul + Copyright (C) 2009-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -235,8 +235,8 @@ } else ::warning ("could not match any font: %s-%s-%s-%g", - name.c_str (), weight.c_str (), angle.c_str (), - size); + name.c_str (), weight.c_str (), angle.c_str (), + size); if (match) FcPatternDestroy (match); @@ -305,11 +305,12 @@ // --------------------------------------------------------------------------- -ft_render::ft_render (void) - : text_processor (), font (), bbox (1, 4, 0.0), halign (0), xoffset (0), - line_yoffset (0), yoffset (0), mode (MODE_BBOX), - color (dim_vector (1, 3), 0) +ft_render::ft_render (const caseless_str& argument) +: text_processor (), font (), bbox (1, 4, 0.0), halign (0), xoffset (0), + line_yoffset (0), yoffset (0), mode (MODE_BBOX), + color (dim_vector (1, 3), 0), interpret () { + interpret = argument; } ft_render::~ft_render (void) @@ -855,51 +856,8 @@ if (pixels.numel () > 0) { elt->accept (*this); - - switch (rotation) - { - case ROTATION_0: - break; - case ROTATION_90: - { - Array<octave_idx_type> perm (dim_vector (3, 1)); - perm(0) = 0; - perm(1) = 2; - perm(2) = 1; - pixels = pixels.permute (perm); - - Array<idx_vector> idx (dim_vector (3, 1)); - idx(0) = idx_vector (':'); - idx(1) = idx_vector (pixels.dim2 ()-1, -1, -1); - idx(2) = idx_vector (':'); - pixels = uint8NDArray (pixels.index (idx)); - } - break; - case ROTATION_180: - { - Array<idx_vector> idx (dim_vector (3, 1)); - idx(0) = idx_vector (':'); - idx(1) = idx_vector (pixels.dim2 ()-1, -1, -1); - idx(2)= idx_vector (pixels.dim3 ()-1, -1, -1); - pixels = uint8NDArray (pixels.index (idx)); - } - break; - case ROTATION_270: - { - Array<octave_idx_type> perm (dim_vector (3, 1)); - perm(0) = 0; - perm(1) = 2; - perm(2) = 1; - pixels = pixels.permute (perm); - - Array<idx_vector> idx (dim_vector (3, 1)); - idx(0) = idx_vector (':'); - idx(1) = idx_vector (':'); - idx(2) = idx_vector (pixels.dim3 ()-1, -1, -1); - pixels = uint8NDArray (pixels.index (idx)); - } - break; - } + uint8NDArray data = pixels; + pixels = rotate_data (rotation, data); } return pixels; @@ -936,43 +894,26 @@ } Matrix -ft_render::get_extent (const std::string& txt, double rotation, - const caseless_str& interpreter) +ft_render::get_extent (const std::string& txt, double rotation) { - text_element *elt = text_parser::parse (txt, interpreter); + text_element *elt = text_parser::parse (txt, interpret); Matrix extent = get_extent (elt, rotation); delete elt; return extent; } -int -ft_render::rotation_to_mode (double rotation) const -{ - if (rotation == 0.0) - return ROTATION_0; - else if (rotation == 90.0) - return ROTATION_90; - else if (rotation == 180.0) - return ROTATION_180; - else if (rotation == 270.0) - return ROTATION_270; - else - return ROTATION_0; -} - void ft_render::text_to_pixels (const std::string& txt, uint8NDArray& pixels_, Matrix& box, - int _halign, int valign, double rotation, - const caseless_str& interpreter) + int _halign, int valign, double rotation) { // FIXME: clip "rotation" between 0 and 360 int rot_mode = rotation_to_mode (rotation); halign = _halign; - text_element *elt = text_parser::parse (txt, interpreter); + text_element *elt = text_parser::parse (txt, interpret); pixels_ = render (elt, box, rot_mode); delete elt; @@ -982,43 +923,16 @@ return; } - switch (halign) - { - default: box(0) = 0; break; - case 1: box(0) = -box(2)/2; break; - case 2: box(0) = -box(2); break; - } - switch (valign) - { - default: box(1) = 0; break; - case 1: box(1) = -box(3)/2; break; - case 2: box(1) = -box(3); break; - case 3: break; - case 4: box(1) = -box(3)-box(1); break; - } + Matrix bounding_box = box; - switch (rot_mode) - { - case ROTATION_90: - std::swap (box(0), box(1)); - std::swap (box(2), box(3)); - box(0) = -box(0)-box(2); - break; - case ROTATION_180: - box(0) = -box(0)-box(2); - box(1) = -box(1)-box(3); - break; - case ROTATION_270: - std::swap (box(0), box(1)); - std::swap (box(2), box(3)); - box(1) = -box(1)-box(3); - break; - } + bounding_box = alignment (halign, valign, bounding_box); + + box = rotate_bounding_box (rot_mode, bounding_box); } ft_render::ft_font::ft_font (const ft_font& ft) - : name (ft.name), weight (ft.weight), angle (ft.angle), size (ft.size), - face (0) +: name (ft.name), weight (ft.weight), angle (ft.angle), size (ft.size), + face (0) { #if HAVE_FT_REFERENCE_FACE FT_Face ft_face = ft.get_face ();
--- a/libinterp/corefcn/txt-eng-ft.h +++ b/libinterp/corefcn/txt-eng-ft.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2009-2012 Michael Goffioul + Copyright (C) 2009-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if ! defined (txt_eng_ft_h) #define txt_eng_ft_h 1 @@ -34,10 +34,11 @@ #include <dMatrix.h> #include <uint8NDArray.h> #include "txt-eng.h" +#include "txt-render.h" class OCTINTERP_API -ft_render : public text_processor +ft_render : public base_text_render , public text_processor { public: enum { @@ -45,15 +46,8 @@ MODE_RENDER = 1 }; - enum { - ROTATION_0 = 0, - ROTATION_90 = 1, - ROTATION_180 = 2, - ROTATION_270 = 3 - }; - public: - ft_render (void); + ft_render (const caseless_str& argument); ~ft_render (void); @@ -87,8 +81,7 @@ int rotation = ROTATION_0); Matrix get_extent (text_element *elt, double rotation = 0.0); - Matrix get_extent (const std::string& txt, double rotation = 0.0, - const caseless_str& interpreter = "tex"); + Matrix get_extent (const std::string& txt, double rotation = 0.0); void set_font (const std::string& name, const std::string& weight, const std::string& angle, double size); @@ -99,12 +92,9 @@ void text_to_pixels (const std::string& txt, uint8NDArray& pixels_, Matrix& bbox, - int halign, int valign, double rotation, - const caseless_str& interpreter = "tex"); + int halign, int valign, double rotation); private: - int rotation_to_mode (double rotation) const; - // No copying! ft_render (const ft_render&); @@ -115,42 +105,42 @@ // reference to the font objects loaded by freetype. class ft_font { - public: - ft_font (void) - : name (), weight (), angle (), size (0), face (0) { } + public: + ft_font (void) + : name (), weight (), angle (), size (0), face (0) { } - ft_font (const std::string& nm, const std::string& wt, - const std::string& ang, double sz, FT_Face f = 0) - : name (nm), weight (wt), angle (ang), size (sz), face (f) { } + ft_font (const std::string& nm, const std::string& wt, + const std::string& ang, double sz, FT_Face f = 0) + : name (nm), weight (wt), angle (ang), size (sz), face (f) { } - ft_font (const ft_font& ft); + ft_font (const ft_font& ft); - ~ft_font (void) - { - if (face) - FT_Done_Face (face); - } + ~ft_font (void) + { + if (face) + FT_Done_Face (face); + } - ft_font& operator = (const ft_font& ft); + ft_font& operator = (const ft_font& ft); - bool is_valid (void) const { return get_face (); } + bool is_valid (void) const { return get_face (); } - std::string get_name (void) const { return name; } + std::string get_name (void) const { return name; } - std::string get_weight (void) const { return weight; } + std::string get_weight (void) const { return weight; } - std::string get_angle (void) const { return angle; } + std::string get_angle (void) const { return angle; } - double get_size (void) const { return size; } + double get_size (void) const { return size; } - FT_Face get_face (void) const; + FT_Face get_face (void) const; - private: - std::string name; - std::string weight; - std::string angle; - double size; - mutable FT_Face face; + private: + std::string name; + std::string weight; + std::string angle; + double size; + mutable FT_Face face; }; void push_new_line (void); @@ -201,6 +191,9 @@ // The base color of the rendered text. uint8NDArray color; + + // Current interpreter used + caseless_str interpret; }; #endif // HAVE_FREETYPE
--- a/libinterp/corefcn/txt-eng.cc +++ b/libinterp/corefcn/txt-eng.cc @@ -1,24 +1,24 @@ /* -Copyright (C) 2013 Michael Goffioul + Copyright (C) 2013 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #ifdef HAVE_CONFIG_H #include <config.h>
--- a/libinterp/corefcn/txt-eng.h +++ b/libinterp/corefcn/txt-eng.h @@ -1,24 +1,24 @@ /* -Copyright (C) 2009-2012 Michael Goffioul + Copyright (C) 2009-2012 Michael Goffioul -This file is part of Octave. + This file is part of Octave. -Octave is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 3 of the License, or (at your -option) any later version. + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. -Octave is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. -You should have received a copy of the GNU General Public License -along with Octave; see the file COPYING. If not, see -<http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. -*/ + */ #if ! defined (txt_eng_h) #define txt_eng_h 1 @@ -106,8 +106,8 @@ class OCTINTERP_API text_element_list : - public text_element, - public octave_base_list<text_element *> + public text_element, + public octave_base_list<text_element *> { public: text_element_list (void) @@ -352,7 +352,7 @@ }; #define TEXT_ELEMENT_ACCEPT(cls) \ -inline void \ + inline void \ cls::accept (text_processor& p) \ { p.visit (*this); } @@ -367,9 +367,9 @@ TEXT_ELEMENT_ACCEPT(text_element_fontsize) TEXT_ELEMENT_ACCEPT(text_element_color) -class -OCTINTERP_API -text_parser + class + OCTINTERP_API + text_parser { public: text_parser (void) { }
new file mode 100644 --- /dev/null +++ b/libinterp/corefcn/txt-latex.cc @@ -0,0 +1,419 @@ +/* + + Copyright (C) 2013 Andrej Lojdl + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <iostream> +#include <fstream> +#include <string> +#include <cstdlib> +#include <cstring> +#include <sstream> + +#ifdef ENABLE_LATEX +#include <png.h> + +#include "error.h" +#include "txt-latex.h" +#include "oct.h" +#include "dim-vector.h" +#include "file-ops.h" + + +latex_render::latex_render (void) +: bbox (1, 4, 0.0), color (dim_vector (1, 3), 0) +{ +} + +latex_render::~latex_render (void) +{ +} + +int +latex_render::check_programs (void) +{ + int cmd, ready = 1; + std::string check_latex, check_dvips, check_ghostscript; + + check_latex = "latex --version >/dev/null 2>/dev/null"; + check_dvips = "dvips --version >/dev/null 2>/dev/null"; + + #if defined (__WIN32__) && ! defined (__CYGWIN__) + check_ghostscript = "gswin32c --version >null 2>null"; + #else + check_ghostscript = "gs --version >/dev/null 2>/dev/null"; + #endif + + cmd = system (check_latex.c_str ()); + + if (cmd != 0) + { + ::error("There's no LaTeX document preparation system installed on this system. Please install it and then try again."); + ready = 0; + } + + cmd = system (check_dvips.c_str ()); + + if (cmd != 0) + { + ::error("There's no dvips converter installed on this system. Please install it and then try again."); + ready = 0; + } + + cmd = system (check_ghostscript.c_str ()); + + if (cmd != 0) + { + ::error("There's no GhostScript program for converting installed on this system. Please install it and then try again."); + ready = 0; + } + + return ready; +} + +void +latex_render::adapter (const std::string& txt) +{ + std::ofstream file; + std::string directory_name = "latex", tex; + int status; + + /* Creating unique name of directory - this function should use temporary files on every system*/ + directory_path = octave_tempnam ("", directory_name); + + /* Creating the directory */ + status = octave_mkdir (directory_path, 0700); + + /*Check if directory is created successfully. */ + if (status == 0) + { + /* Pointing to temporary directory, for creating .tex file */ + tex = file_ops::concat (directory_path, "default.tex"); + + /* Creating and writing to temporary .tex file */ + file.open (tex.c_str ()); + file << "\\documentclass[fleqn]{article} \n\\usepackage{amsmath} \n\\usepackage{color} \n\\pagestyle{empty} \n\\begin{document} \n\t\\fontsize{12pt}{12pt}\\selectfont \n\t"; + file << "\\usefont{T1}{" << font_name << "}{m}{n} \n\t\t"; + file << txt; + file << "\n\\end{document}"; + file.close (); + } + else + { + /* Printing error if directory is not created */ + ::error ("Failed to create temp directory."); + std::cout << error_state << std::endl; + } +} + +uint8NDArray +latex_render::render (void) +{ + int status; + std::stringstream ss; + std::string comment, string_font_size; + uint8NDArray data; + std::ifstream file; + std::string sfsize, tex, aux, log, dvi, eps, png, command; + + /* Check if command processor is available */ + if(system (NULL) && error_state == 0) + { + log = file_ops::concat (directory_path, "default.log"); + tex = file_ops::concat (directory_path, "default.tex"); + command = "latex -interaction=nonstopmode -output-directory=" + directory_path + " " + tex + " > " + log; + + /* .tex -> .dvi */ + status = system (command.c_str ()); + + if(status != 0) + { + data = uint8NDArray (dim_vector (4, 1, 1), static_cast<uint8_t> (0)); + + ::error ("LaTeX converting .tex to .dvi file, failed."); + + file.open (log.c_str ()); + + for(int i=0; i<33; i++) + { + std::getline (file, comment); + } + + /* Print additional info from default.log */ + comment = "Here is LaTeX description of error:"; + std::cout << comment << std::endl; + std::getline (file, comment); + std::cout << comment << std::endl; + std::getline (file, comment); + std::cout << comment << std::endl; + file.close (); + + return data; + } + + /* .dvi -> .eps */ + dvi = file_ops::concat (directory_path, "default.dvi"); + eps = file_ops::concat (directory_path, "default.eps"); + command = "dvips " + dvi + " -E -o " + eps + " -q"; + + status = system (command.c_str ()); + + if(status != 0) + { + data = uint8NDArray (dim_vector (4, 1, 1), static_cast<uint8_t> (0)); + + ::error ("dvips converting .dvi to .eps file file, failed"); + + return data; + } + + /* .eps -> .png */ + font_size = font_size * (72 / 12); + + ss << font_size; + ss >> string_font_size; + + png = file_ops::concat (directory_path, "default.png"); + + #if defined (__WIN32__) && ! defined (__CYGWIN__) + command = "gswin32c -q -dEPSCrop -dSAFER -dBATCH -dNOPAUSE -r" + string_font_size + " -dTextAlphaBits=4 -sDEVICE=pngalpha -sOutputFile=" + png + " \"" + eps + "\" "; + #else + command = "gs -q -dEPSCrop -dSAFER -dBATCH -dNOPAUSE -r" + string_font_size + " -dTextAlphaBits=4 -sDEVICE=pngalpha -sOutputFile=" + png + " \"" + eps + "\" "; + #endif + + + status = system (command.c_str ()); + + if(status != 0) + { + data = uint8NDArray (dim_vector (4, 1, 1), static_cast<uint8_t> (0)); + + ::error ("GhostScript converting .eps to .png file, failed"); + + return data; + } + + /* Read image from PNG file */ + int x; + int y; + + int width, height; + png_byte color_type; + png_byte bit_depth; + + png_structp png_ptr; + png_infop info_ptr; + int number_of_passes; + png_bytep * row_pointers; + + char header [8]; + + /* Open file and test for it being a png */ + FILE *fp = fopen (png.c_str (), "rb"); + if (!fp) + { + ::error ("File default.png could not be opened for reading"); + } + fread (header, 1, 8, fp); + + + /* Initialize stuff */ + png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!png_ptr) + { + ::error ("png_create_read_struct failed"); + } + + info_ptr = png_create_info_struct (png_ptr); + if (!info_ptr) + { + ::error ("png_create_info_struct failed"); + } + + if (setjmp (png_jmpbuf (png_ptr))) + { + ::error ("Error during init_io"); + } + + png_init_io (png_ptr, fp); + png_set_sig_bytes (png_ptr, 8); + + png_read_info (png_ptr, info_ptr); + + width = png_get_image_width (png_ptr, info_ptr); + height = png_get_image_height (png_ptr, info_ptr); + color_type = png_get_color_type(png_ptr, info_ptr); + bit_depth = png_get_bit_depth (png_ptr, info_ptr); + + number_of_passes = png_set_interlace_handling (png_ptr); + png_read_update_info (png_ptr, info_ptr); + + /* Read file */ + if (setjmp (png_jmpbuf (png_ptr))) + { + ::error ("Error during read_image"); + } + + row_pointers = (png_bytep*) malloc (sizeof (png_bytep) * height); + for (y=0; y<height; y++) + row_pointers[y] = (png_byte*) malloc (png_get_rowbytes (png_ptr, info_ptr)); + + png_read_image (png_ptr, row_pointers); + + fclose (fp); + + /* Instantise data array */ + data = uint8NDArray (dim_vector (4, width, height), static_cast<uint8_t> (0)); + + for (int i=0; i<height; i++) + { + png_byte* row = row_pointers[height - 1 - i]; + for (int j=0; j<width; j++) + { + png_byte* ptr = &(row[j * 4]); + + /* If the color of text is black we can change it, if not we render the original color. */ + if(ptr[0] < 50 && ptr[1] < 50 && ptr[2] < 50 ) + { + data(0, j, i) = color(0); + data(1, j, i) = color(1); + data(2, j, i) = color(2); + data(3, j, i) = ptr[3]; + } + else + { + data(0, j, i) = ptr[0]; + data(1, j, i) = ptr[1]; + data(2, j, i) = ptr[2]; + data(3, j, i) = ptr[3]; + } + } + } + + /* Remove the temporary directory. */ + if( !directory_path.empty ()) + status = octave_recursive_rmdir (directory_path); + } + else + { + /* It's possible that command procesor is not + available and we already made a temporary dir*/ + if( !directory_path.empty ()) + status = octave_recursive_rmdir (directory_path); + + data = uint8NDArray (dim_vector (4, 1, 1), static_cast<uint8_t> (0)); + + if(error_state == 1) + ::warning ("LaTeX interpreter can't proceed, please try again."); + else + ::warning ("Command processor not ready yet, please try again."); + } + + return data; +} + +void +latex_render::set_font (const std::string& name, const std::string& weight, + const std::string& angle, double size) +{ + font_size = size; + if(name[0] == '*') + font_name = "cmr"; + else + font_name = name; +} + +void +latex_render::set_color (Matrix c) +{ + if (c.numel () == 3) + { + color(0) = static_cast<uint8_t> (c (0) * 255); + color(1) = static_cast<uint8_t> (c (1) * 255); + color(2) = static_cast<uint8_t> (c (2) * 255); + } + else + ::warning ("latex_render::set_color: invalid color"); +} + +void +latex_render::text_to_pixels (const std::string& txt, + uint8NDArray& pixels, Matrix& bbox, + int halign, int valign, double rotation) +{ + if (check_programs () == 1) + { + adapter (txt); + pixels = render(); + } + else + { + pixels = uint8NDArray (dim_vector (4, 1, 1), static_cast<uint8_t> (0)); + } + + int rot_mode = rotation_to_mode (rotation); + + if(pixels.ndims () < 3) + ::warning ("Pixels variable not properly set."); + else + { + bbox = Matrix (1, 4, 0.0); + bbox (2) = pixels.dim2 (); + bbox (3) = pixels.dim3 (); + + Matrix bounding_box = bbox; + + bounding_box = alignment (halign, valign, bounding_box); + + bbox = rotate_bounding_box (rot_mode, bounding_box); + } + + /* Rotating pixels */ + if (pixels.numel () > 0) + { + uint8NDArray data = pixels; + pixels = rotate_data (rot_mode, data); + } +} + +Matrix +latex_render::get_extent (text_element *elt, double rotation) +{ + Matrix extent (1, 2, 0.0); + + return extent; +} + + +Matrix +latex_render::get_extent (const std::string& txt, double rotation) +{ + text_element *elt = text_parser_none ().parse (txt); + Matrix extent = get_extent (elt, rotation); + delete elt; + + return extent; +} +#endif //ENABLE_LATEX
new file mode 100644 --- /dev/null +++ b/libinterp/corefcn/txt-latex.h @@ -0,0 +1,72 @@ +/* + + Copyright (C) 2013 Andrej Lojdl + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ + +#if ! defined (txt_latex_h) +#define txt_latex_h 1 + +#ifdef ENABLE_LATEX + +#include <string> +#include <dMatrix.h> +#include <uint8NDArray.h> +#include "txt-render.h" + +class +OCTINTERP_API +latex_render : public base_text_render +{ +public: + latex_render (void); + + ~latex_render (void); + + void set_font (const std::string& name, const std::string& weight, + const std::string& angle, double size); + + void set_color (Matrix c); + + void text_to_pixels (const std::string& txt, + uint8NDArray& pixels_, Matrix& bbox, + int halign, int valign, double rotation); + + Matrix get_extent (text_element *elt, double rotation = 0.0); + Matrix get_extent (const std::string& txt, double rotation = 0.0); + + /* method that cheks if there are all required programs installed */ + int check_programs (void); + + /* method making TEX file from text (input string) */ + void adapter (const std::string& txt); + + /* method rendering text TEX -> DVI -> EPS -> PNG -> RAW */ + uint8NDArray render (void); + +private: + int font_size; + std::string font_name,directory_path; + Matrix bbox; + uint8NDArray pixels; + uint8NDArray color; + +}; +#endif +#endif //ENABLE_LATEX
new file mode 100644 --- /dev/null +++ b/libinterp/corefcn/txt-render.cc @@ -0,0 +1,195 @@ +/* + + Copyright (C) 2013 Andrej Lojdl + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <dMatrix.h> +#include <uint8NDArray.h> +#include <string> +#include "txt-render.h" +#include "txt-latex.h" +#include "txt-eng-ft.h" +#include "oct-refcount.h" + +dummy_render::dummy_render (void) + : bbox (1, 4, 0.0),red (0),green (0),blue (0) {} + dummy_render::~dummy_render (void) {} + +void +dummy_render::set_font (const std::string& name, const std::string& weight, + const std::string& angle, double size) +{} + +void +dummy_render::set_color (Matrix c) {} + +void +dummy_render::text_to_pixels (const std::string& txt, + uint8NDArray& pixels, Matrix& bbox, + int halign, int valign, double rotation) +{ + pixels = uint8NDArray (dim_vector (4, 1, 1), static_cast<uint8_t> (0)); + bbox = Matrix (1, 4, 0.0); + bbox(2) = pixels.dim2(); + bbox(3) = pixels.dim3(); +} + +Matrix +dummy_render::get_extent (text_element *elt, double rotation) {} + + +Matrix +dummy_render::get_extent (const std::string& txt, double rotation) {} + + + +base_text_render +*text_render::make_text_render (const caseless_str& s) +{ + if (s.compare ("latex")) +#if ENABLE_LATEX + rep = new latex_render (); +#else + rep = new dummy_render (); +#endif + else + { +#if HAVE_FREETYPE + rep = new ft_render (s); +#else + rep = new dummy_render (); +#endif + } + return rep; +} + +int +base_text_render::rotation_to_mode (double rotation) const +{ + if (rotation == 0.0) + return ROTATION_0; + else if (rotation == 90.0) + return ROTATION_90; + else if (rotation == 180.0) + return ROTATION_180; + else if (rotation == 270.0) + return ROTATION_270; + else + return ROTATION_0; +} + +uint8NDArray +base_text_render::rotate_data (int mode, uint8NDArray data) +{ + switch (mode) + { + case ROTATION_0: + break; + case ROTATION_90: + { + Array<octave_idx_type> perm (dim_vector (3, 1)); + perm(0) = 0; + perm(1) = 2; + perm(2) = 1; + data = data.permute (perm); + + Array<idx_vector> idx (dim_vector (3, 1)); + idx(0) = idx_vector (':'); + idx(1) = idx_vector (data.dim2 ()-1, -1, -1); + idx(2) = idx_vector (':'); + data = uint8NDArray (data.index (idx)); + } + break; + case ROTATION_180: + { + Array<idx_vector> idx (dim_vector (3, 1)); + idx(0) = idx_vector (':'); + idx(1) = idx_vector (data.dim2 ()-1, -1, -1); + idx(2)= idx_vector (data.dim3 ()-1, -1, -1); + data = uint8NDArray (data.index (idx)); + } + break; + case ROTATION_270: + { + Array<octave_idx_type> perm (dim_vector (3, 1)); + perm(0) = 0; + perm(1) = 2; + perm(2) = 1; + data = data.permute (perm); + + Array<idx_vector> idx (dim_vector (3, 1)); + idx(0) = idx_vector (':'); + idx(1) = idx_vector (':'); + idx(2) = idx_vector (data.dim3 ()-1, -1, -1); + data = uint8NDArray (data.index (idx)); + } + break; + } + return data; +} + +Matrix +base_text_render::alignment (int halign, int valign, Matrix bounding_box) +{ + switch (halign) + { + default: bounding_box (0) = 0; break; + case 1: bounding_box (0) = -bounding_box (2) / 2; break; + case 2: bounding_box (0) = -bounding_box (2); break; + } + switch (valign) + { + default: bounding_box (1) = 0; break; + case 1: bounding_box (1) = -bounding_box (3) / 2; break; + case 2: bounding_box (1) = -bounding_box (3); break; + case 3: break; + case 4: bounding_box (1) = -bounding_box (3) - bounding_box (1); break; + } + + return bounding_box; +} + +Matrix +base_text_render::rotate_bounding_box (int rotation, Matrix bounding_box) +{ + switch (rotation) + { + case ROTATION_90: + std::swap (bounding_box (0), bounding_box (1)); + std::swap (bounding_box (2), bounding_box (3)); + bounding_box (0) = -bounding_box (0) - bounding_box (2); + break; + case ROTATION_180: + bounding_box (0) = -bounding_box (0) - bounding_box (2); + bounding_box (1) = -bounding_box (1) - bounding_box (3); + break; + case ROTATION_270: + std::swap (bounding_box (0), bounding_box (1)); + std::swap (bounding_box (2), bounding_box (3)); + bounding_box (1) = -bounding_box (1) - bounding_box(3); + break; + } + + return bounding_box; +}
new file mode 100644 --- /dev/null +++ b/libinterp/corefcn/txt-render.h @@ -0,0 +1,172 @@ +/* + + Copyright (C) 2013 Andrej Lojdl + + This file is part of Octave. + + Octave is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Octave is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with Octave; see the file COPYING. If not, see + <http://www.gnu.org/licenses/>. + + */ + +#if ! defined(txt_render_h) +#define txt_render_h 1 + +#include <dMatrix.h> +#include <uint8NDArray.h> +#include <string> +#include "txt-eng.h" +#include "caseless-str.h" + + +class OCTINTERP_API text_render; + +class +OCTINTERP_API +base_text_render +{ +public: + enum { + ROTATION_0 = 0, + ROTATION_90 = 1, + ROTATION_180 = 2, + ROTATION_270 = 3 + }; + +public: + friend class text_render; + + base_text_render (void) : count(1) { } + + virtual ~base_text_render (void) { } + + virtual void set_font (const std::string& name, const std::string& weight, + const std::string& angle, double size) = 0; + + virtual void set_color (Matrix c) = 0; + + virtual void text_to_pixels (const std::string& txt, + uint8NDArray& pixels_, Matrix& bbox, + int halign, int valign, double rotation) = 0; + + virtual Matrix get_extent (text_element *elt, double rotation = 0.0) = 0; + virtual Matrix get_extent (const std::string& txt, double rotation = 0.0) = 0; + + int rotation_to_mode (double rotation) const; + uint8NDArray rotate_data (int mode, uint8NDArray data); + Matrix alignment (int halign, int valign, Matrix bounding_box); + Matrix rotate_bounding_box (int rotation, Matrix bounding_box); + +private: + octave_refcount<int> count; +}; + +/* if user don't have FREETYPE library we use this dummy class */ + +class +OCTINTERP_API +dummy_render : public base_text_render +{ +public: + dummy_render (void); + + ~dummy_render (void); + + void set_font (const std::string& name, const std::string& weight, + const std::string& angle, double size); + + void set_color (Matrix c); + + void text_to_pixels (const std::string& txt, + uint8NDArray& pixels_, Matrix& bbox, + int halign, int valign, double rotation); + + Matrix get_extent (text_element *elt, double rotation = 0.0); + Matrix get_extent (const std::string& txt, double rotation = 0.0); + +private: + Matrix bbox; + uint8NDArray pixels; + uint8_t red, green, blue; +}; + + +class +OCTINTERP_API +text_render +{ +public: + text_render (const caseless_str& s = caseless_str ()) + : rep (make_text_render(s)) { } + + text_render (const text_render& e) + : rep (e.rep) + { + rep->count++; + } + + ~text_render ( void ) + { + if( rep && --rep->count == 0 ) + { + delete rep; + } + } + + text_render& operator = (const text_render& e) + { + if (rep != e.rep) + { + if (rep && --rep->count == 0) + delete rep; + + rep = e.rep; + if (rep) + rep->count++; + } + return *this; + } + + void set_font (const std::string& name, const std::string& weight, + const std::string& angle, double size) + { + rep->set_font (name, weight, angle, size); + } + + + void set_color (Matrix c) { rep->set_color (c); } + + void text_to_pixels (const std::string& txt, + uint8NDArray& pixels_, Matrix& bbox, + int halign, int valign, double rotation) + { + rep->text_to_pixels (txt, pixels_, bbox, halign, valign, rotation); + } + + Matrix get_extent (text_element *elt, double rotation = 0.0) + { + return rep->get_extent (elt, rotation); + } + + Matrix get_extent (const std::string& txt, double rotation = 0.0) + { + return rep->get_extent (txt, rotation); + } + + +private: + base_text_render *rep; + base_text_render *make_text_render (const caseless_str& s); +}; +#endif
--- a/libinterp/link-deps.mk +++ b/libinterp/link-deps.mk @@ -10,6 +10,7 @@ $(FT2_LIBS) \ $(HDF5_LIBS) \ $(Z_LIBS) \ + $(PNG_LIBS) \ $(FFTW_XLIBS) \ $(REGEX_LIBS) \ $(OPENGL_LIBS) \ @@ -23,6 +24,7 @@ $(FT2_LDFLAGS) \ $(HDF5_LDFLAGS) \ $(Z_LDFLAGS) \ + $(PNG_LDFLAGS) \ $(REGEX_LDFLAGS) \ $(FFTW_XLDFLAGS) \ $(LLVM_LDFLAGS)