Mercurial > hg > octave-lyh
changeset 15093:a132d206a36a gui
maint: periodic merge of default to gui
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 03 Aug 2012 14:59:40 -0400 |
parents | d02b229ce693 (current diff) 6c5b6c0ab528 (diff) |
children | b9b6a310ad97 |
files | .hgsubstate configure.ac src/DLD-FUNCTIONS/__delaunayn__.cc src/DLD-FUNCTIONS/__dsearchn__.cc src/DLD-FUNCTIONS/__fltk_uigetfile__.cc src/DLD-FUNCTIONS/__glpk__.cc src/DLD-FUNCTIONS/__init_fltk__.cc src/DLD-FUNCTIONS/__init_gnuplot__.cc src/DLD-FUNCTIONS/__magick_read__.cc src/DLD-FUNCTIONS/__voronoi__.cc src/DLD-FUNCTIONS/amd.cc src/DLD-FUNCTIONS/ccolamd.cc src/DLD-FUNCTIONS/chol.cc src/DLD-FUNCTIONS/colamd.cc src/DLD-FUNCTIONS/config-module.awk src/DLD-FUNCTIONS/config-module.sh src/DLD-FUNCTIONS/convhulln.cc src/DLD-FUNCTIONS/dmperm.cc src/DLD-FUNCTIONS/eigs.cc src/DLD-FUNCTIONS/fftw.cc src/DLD-FUNCTIONS/module-files src/DLD-FUNCTIONS/oct-qhull.h src/DLD-FUNCTIONS/qr.cc src/DLD-FUNCTIONS/symbfact.cc src/DLD-FUNCTIONS/symrcm.cc src/DLD-FUNCTIONS/tsearch.cc src/DLD-FUNCTIONS/urlwrite.cc src/OPERATORS/module.mk src/OPERATORS/op-b-b.cc src/OPERATORS/op-b-bm.cc src/OPERATORS/op-b-sbm.cc src/OPERATORS/op-bm-b.cc src/OPERATORS/op-bm-bm.cc src/OPERATORS/op-bm-sbm.cc src/OPERATORS/op-cdm-cdm.cc src/OPERATORS/op-cdm-cm.cc src/OPERATORS/op-cdm-cs.cc src/OPERATORS/op-cdm-dm.cc src/OPERATORS/op-cdm-m.cc src/OPERATORS/op-cdm-s.cc src/OPERATORS/op-cell.cc src/OPERATORS/op-chm.cc src/OPERATORS/op-class.cc src/OPERATORS/op-cm-cdm.cc src/OPERATORS/op-cm-cm.cc src/OPERATORS/op-cm-cs.cc src/OPERATORS/op-cm-dm.cc src/OPERATORS/op-cm-m.cc src/OPERATORS/op-cm-pm.cc src/OPERATORS/op-cm-s.cc src/OPERATORS/op-cm-scm.cc src/OPERATORS/op-cm-sm.cc src/OPERATORS/op-cs-cm.cc src/OPERATORS/op-cs-cs.cc src/OPERATORS/op-cs-m.cc src/OPERATORS/op-cs-s.cc src/OPERATORS/op-cs-scm.cc src/OPERATORS/op-cs-sm.cc src/OPERATORS/op-dm-cdm.cc src/OPERATORS/op-dm-cm.cc src/OPERATORS/op-dm-cs.cc src/OPERATORS/op-dm-dm.cc src/OPERATORS/op-dm-m.cc src/OPERATORS/op-dm-s.cc src/OPERATORS/op-dm-scm.cc src/OPERATORS/op-dm-sm.cc src/OPERATORS/op-dm-template.cc src/OPERATORS/op-dms-template.cc src/OPERATORS/op-double-conv.cc src/OPERATORS/op-fcdm-fcdm.cc src/OPERATORS/op-fcdm-fcm.cc src/OPERATORS/op-fcdm-fcs.cc src/OPERATORS/op-fcdm-fdm.cc src/OPERATORS/op-fcdm-fm.cc src/OPERATORS/op-fcdm-fs.cc src/OPERATORS/op-fcm-fcdm.cc src/OPERATORS/op-fcm-fcm.cc src/OPERATORS/op-fcm-fcs.cc src/OPERATORS/op-fcm-fdm.cc src/OPERATORS/op-fcm-fm.cc src/OPERATORS/op-fcm-fs.cc src/OPERATORS/op-fcm-pm.cc src/OPERATORS/op-fcn.cc src/OPERATORS/op-fcs-fcm.cc src/OPERATORS/op-fcs-fcs.cc src/OPERATORS/op-fcs-fm.cc src/OPERATORS/op-fcs-fs.cc src/OPERATORS/op-fdm-fcdm.cc src/OPERATORS/op-fdm-fcm.cc src/OPERATORS/op-fdm-fcs.cc src/OPERATORS/op-fdm-fdm.cc src/OPERATORS/op-fdm-fm.cc src/OPERATORS/op-fdm-fs.cc src/OPERATORS/op-float-conv.cc src/OPERATORS/op-fm-fcdm.cc src/OPERATORS/op-fm-fcm.cc src/OPERATORS/op-fm-fcs.cc src/OPERATORS/op-fm-fdm.cc src/OPERATORS/op-fm-fm.cc src/OPERATORS/op-fm-fs.cc src/OPERATORS/op-fm-pm.cc src/OPERATORS/op-fs-fcm.cc src/OPERATORS/op-fs-fcs.cc src/OPERATORS/op-fs-fm.cc src/OPERATORS/op-fs-fs.cc src/OPERATORS/op-i16-i16.cc src/OPERATORS/op-i32-i32.cc src/OPERATORS/op-i64-i64.cc src/OPERATORS/op-i8-i8.cc src/OPERATORS/op-int-concat.cc src/OPERATORS/op-int-conv.cc src/OPERATORS/op-int.h src/OPERATORS/op-m-cdm.cc src/OPERATORS/op-m-cm.cc src/OPERATORS/op-m-cs.cc src/OPERATORS/op-m-dm.cc src/OPERATORS/op-m-m.cc src/OPERATORS/op-m-pm.cc src/OPERATORS/op-m-s.cc src/OPERATORS/op-m-scm.cc src/OPERATORS/op-m-sm.cc src/OPERATORS/op-pm-cm.cc src/OPERATORS/op-pm-fcm.cc src/OPERATORS/op-pm-fm.cc src/OPERATORS/op-pm-m.cc src/OPERATORS/op-pm-pm.cc src/OPERATORS/op-pm-scm.cc src/OPERATORS/op-pm-sm.cc src/OPERATORS/op-pm-template.cc src/OPERATORS/op-range.cc src/OPERATORS/op-s-cm.cc src/OPERATORS/op-s-cs.cc src/OPERATORS/op-s-m.cc src/OPERATORS/op-s-s.cc src/OPERATORS/op-s-scm.cc src/OPERATORS/op-s-sm.cc src/OPERATORS/op-sbm-b.cc src/OPERATORS/op-sbm-bm.cc src/OPERATORS/op-sbm-sbm.cc src/OPERATORS/op-scm-cm.cc src/OPERATORS/op-scm-cs.cc src/OPERATORS/op-scm-m.cc src/OPERATORS/op-scm-s.cc src/OPERATORS/op-scm-scm.cc src/OPERATORS/op-scm-sm.cc src/OPERATORS/op-sm-cm.cc src/OPERATORS/op-sm-cs.cc src/OPERATORS/op-sm-m.cc src/OPERATORS/op-sm-s.cc src/OPERATORS/op-sm-scm.cc src/OPERATORS/op-sm-sm.cc src/OPERATORS/op-str-m.cc src/OPERATORS/op-str-s.cc src/OPERATORS/op-str-str.cc src/OPERATORS/op-struct.cc src/OPERATORS/op-ui16-ui16.cc src/OPERATORS/op-ui32-ui32.cc src/OPERATORS/op-ui64-ui64.cc src/OPERATORS/op-ui8-ui8.cc src/TEMPLATE-INST/Array-jit.cc src/TEMPLATE-INST/Array-os.cc src/TEMPLATE-INST/Array-sym.cc src/TEMPLATE-INST/Array-tc.cc src/TEMPLATE-INST/module.mk src/bitfcns.cc src/data.cc src/data.h src/debug.cc src/debug.h src/defaults.cc src/defaults.in.h src/defun.cc src/defun.h src/dirfns.cc src/dirfns.h src/error.cc src/error.h src/file-io.cc src/file-io.h src/graphics.cc src/graphics.in.h src/help.cc src/help.h src/input.cc src/input.h src/interpfcn/symtab.h src/lex.h src/lex.ll src/load-path.cc src/load-path.h src/load-save.cc src/load-save.h src/ls-oct-ascii.cc src/ls-oct-ascii.h src/mappers.cc src/oct-hist.cc src/oct-hist.h src/oct-parse.yy src/ov-base-diag.cc src/ov-base-diag.h src/ov-base-int.cc src/ov-base-int.h src/ov-base-mat.cc src/ov-base-mat.h src/ov-base-scalar.cc src/ov-base-scalar.h src/ov-base-sparse.cc src/ov-base-sparse.h src/ov-base.cc src/ov-base.h src/ov-bool-mat.cc src/ov-bool-mat.h src/ov-bool-sparse.cc src/ov-bool-sparse.h src/ov-bool.cc src/ov-bool.h src/ov-builtin.cc src/ov-builtin.h src/ov-cell.cc src/ov-cell.h src/ov-ch-mat.cc src/ov-ch-mat.h src/ov-class.cc src/ov-class.h src/ov-colon.cc src/ov-colon.h src/ov-complex.cc src/ov-complex.h src/ov-cs-list.cc src/ov-cs-list.h src/ov-cx-diag.cc src/ov-cx-diag.h src/ov-cx-mat.cc src/ov-cx-mat.h src/ov-cx-sparse.cc src/ov-cx-sparse.h src/ov-dld-fcn.cc src/ov-dld-fcn.h src/ov-fcn-handle.cc src/ov-fcn-handle.h src/ov-fcn-inline.cc src/ov-fcn-inline.h src/ov-fcn.cc src/ov-fcn.h src/ov-float.cc src/ov-float.h src/ov-flt-complex.cc src/ov-flt-complex.h src/ov-flt-cx-diag.cc src/ov-flt-cx-diag.h src/ov-flt-cx-mat.cc src/ov-flt-cx-mat.h src/ov-flt-re-diag.cc src/ov-flt-re-diag.h src/ov-flt-re-mat.cc src/ov-flt-re-mat.h src/ov-int-traits.h src/ov-int16.cc src/ov-int16.h src/ov-int32.cc src/ov-int32.h src/ov-int64.cc src/ov-int64.h src/ov-int8.cc src/ov-int8.h src/ov-intx.h src/ov-lazy-idx.cc src/ov-lazy-idx.h src/ov-mex-fcn.cc src/ov-mex-fcn.h src/ov-null-mat.cc src/ov-null-mat.h src/ov-oncleanup.cc src/ov-oncleanup.h src/ov-perm.cc src/ov-perm.h src/ov-range.cc src/ov-range.h src/ov-re-diag.cc src/ov-re-diag.h src/ov-re-mat.cc src/ov-re-mat.h src/ov-re-sparse.cc src/ov-re-sparse.h src/ov-scalar.cc src/ov-scalar.h src/ov-str-mat.cc src/ov-str-mat.h src/ov-struct.cc src/ov-struct.h src/ov-type-conv.h src/ov-typeinfo.cc src/ov-typeinfo.h src/ov-uint16.cc src/ov-uint16.h src/ov-uint32.cc src/ov-uint32.h src/ov-uint64.cc src/ov-uint64.h src/ov-uint8.cc src/ov-uint8.h src/ov-usr-fcn.cc src/ov-usr-fcn.h src/ov.cc src/ov.h src/pager.cc src/pager.h src/parse-private.h src/parse.h src/pr-output.cc src/pr-output.h src/profiler.cc src/profiler.h src/pt-all.h src/pt-arg-list.cc src/pt-arg-list.h src/pt-assign.cc src/pt-assign.h src/pt-binop.cc src/pt-binop.h src/pt-bp.cc src/pt-bp.h src/pt-cbinop.cc src/pt-cbinop.h src/pt-cell.cc src/pt-cell.h src/pt-check.cc src/pt-check.h src/pt-cmd.cc src/pt-cmd.h src/pt-colon.cc src/pt-colon.h src/pt-const.cc src/pt-const.h src/pt-decl.cc src/pt-decl.h src/pt-eval.cc src/pt-eval.h src/pt-except.cc src/pt-except.h src/pt-exp.cc src/pt-exp.h src/pt-fcn-handle.cc src/pt-fcn-handle.h src/pt-id.cc src/pt-id.h src/pt-idx.cc src/pt-idx.h src/pt-jump.cc src/pt-jump.h src/pt-loop.cc src/pt-loop.h src/pt-mat.cc src/pt-mat.h src/pt-misc.cc src/pt-misc.h src/pt-pr-code.cc src/pt-pr-code.h src/pt-select.cc src/pt-select.h src/pt-stmt.cc src/pt-stmt.h src/pt-unop.cc src/pt-unop.h src/pt-walk.h src/pt.cc src/pt.h src/sighandlers.cc src/sighandlers.h src/sparse.cc src/strfns.cc src/symtab.cc src/symtab.h src/syscalls.cc src/sysdep.cc src/sysdep.h src/toplev.cc src/toplev.h src/utils.cc src/utils.h src/variables.cc src/variables.h |
diffstat | 407 files changed, 1554 insertions(+), 818 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgsubstate +++ b/.hgsubstate @@ -1,2 +1,2 @@ -33f823397dbb0edb57503f2f6dad2362456bc6a9 gnulib +0e3af50c9e20938bd1cea0182bf749ce61cb6782 gnulib f91e00f96bc29f7f6395f08c828e09599f945511 gui/qterminal
--- a/autogen.sh +++ b/autogen.sh @@ -30,9 +30,9 @@ (cd doc/interpreter; ./config-images.sh) -echo "generating src/DLD-FUNCTIONS/module.mk..." +echo "generating src/dldfcn/module.mk..." -(cd src/DLD-FUNCTIONS; ./config-module.sh) +(cd src/dldfcn; ./config-module.sh) echo "bootstrapping..."
--- a/build-aux/bootstrap.conf +++ b/build-aux/bootstrap.conf @@ -18,6 +18,7 @@ # gnulib modules used by this package. gnulib_modules=" + base64 c-strcase copysign copysignf @@ -60,7 +61,6 @@ signal sigprocmask sleep - sleep stat stdint stdio
--- a/configure.ac +++ b/configure.ac @@ -44,7 +44,7 @@ AC_REVISION($Revision: 1.603 $) AC_PREREQ([2.62]) AC_CONFIG_SRCDIR([src/octave.cc]) -AC_CONFIG_HEADER([config.h]) +AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) @@ -52,9 +52,11 @@ OCTAVE_HOST_TYPE -AC_DEFINE(OCTAVE_SOURCE, 1, [Define if this is Octave.]) +AC_DEFINE(OCTAVE_SOURCE, 1, [Define to 1 if this is Octave.]) -dnl FIXME -- we should probably only generate this file if it is missing. +dnl FIXME: Can this MSVC test be moved down to the section on finding a +dnl a C compiler which already has an MSVC exception test? +dnl FIXME: We should probably only generate this file if it is missing. ### Produce unistd.h for MSVC target, this simplifies changes in ### Octave source tree and avoid problems with lex-generated code. case "$canonical_host_type" in @@ -72,24 +74,8 @@ AC_USE_SYSTEM_EXTENSIONS -### Check for MSVC -have_msvc=no -case "$canonical_host_type" 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 - ### Path separator. + sepchar=: AC_ARG_WITH(sepchar, [AS_HELP_STRING([--with-sepchar=<char>], @@ -113,7 +99,7 @@ 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 the path separator, as a string.]) -### some defaults +### Set default file locations OCTAVE_SET_DEFAULT(man1dir, '$(mandir)/man1') OCTAVE_SET_DEFAULT(man1ext, '.1') @@ -155,9 +141,9 @@ config_opts=$ac_configure_args AC_SUBST(config_opts) -### Make it possible to have Octave's array and matrix classes do bounds -### checking on element references. This slows some operations down a -### bit, so it is turned off by default. +### 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=false AC_ARG_ENABLE(bounds-check, @@ -165,29 +151,37 @@ [bounds checking for indexing in internal array classes (default is no)])], [if test "$enableval" = yes; then BOUNDS_CHECKING=true; fi], []) if $BOUNDS_CHECKING; then - AC_DEFINE(BOUNDS_CHECKING, 1, [Define to use internal bounds checking.]) + 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=false 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. (default is no)])], [if test "$enableval" = yes; then USE_OCTAVE_ALLOCATOR=true; fi], []) if $USE_OCTAVE_ALLOCATOR; then - AC_DEFINE(USE_OCTAVE_ALLOCATOR, 1, [Define to use octave_allocator class.]) + 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=false 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. (default is no)])], + [use atomic operations for internal reference counting. This is required for thread-safe behavior. (default is no)])], [if test "$enableval" = yes; then USE_ATOMIC_REFCOUNT=true; fi], []) if $USE_ATOMIC_REFCOUNT; then - AC_DEFINE(USE_ATOMIC_REFCOUNT, 1, [Define to use atomic operations for reference counting.]) + AC_DEFINE(USE_ATOMIC_REFCOUNT, 1, [Define to 1 to use atomic operations for reference counting.]) fi -### Make it possible to disable running Make in the doc directory. -### Useful for building on systems without TeX, for example. +### 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([--enable-docs], [build documentation (default is yes)])], @@ -215,23 +209,23 @@ OCTAVE_IDX_TYPE=int elif test $ac_cv_sizeof_long -eq 8; then OCTAVE_IDX_TYPE=long - AC_DEFINE(IDX_TYPE_LONG, 1, [Define to 1 if octave index type is long]) + AC_DEFINE(IDX_TYPE_LONG, 1, [Define to 1 if octave index type is long.]) else warn_64_bit="no suitable type found for octave_idx_type so disabling 64-bit features" OCTAVE_CONFIGURE_WARNING([warn_64_bit]) USE_64_BIT_IDX_T=false fi else - warn_64_bit="pointers are not 64-bits wide so disabling 64-bit features" + warn_64_bit="pointers are not 64-bits wide; disabling 64-bit features" OCTAVE_CONFIGURE_WARNING([warn_64_bit]) USE_64_BIT_IDX_T=false 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)]) + [Define to the type of octave_idx_type (64 or 32 bit signed integer).]) if $USE_64_BIT_IDX_T; then - AC_DEFINE(USE_64_BIT_IDX_T, 1, [Define if using 64-bit integers for array dimensions and indexing]) + 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) @@ -240,14 +234,14 @@ ### GNU libc, just disable them for all platforms. AC_MSG_NOTICE([defining __NO_MATH_INLINES avoids buggy GNU libc exp function]) -AC_DEFINE(__NO_MATH_INLINES, 1, [Define if your version of GNU libc has buggy inline assembly code for math functions like exp.]) - -### See which C++ compiler to use (we expect to find g++). +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.]) + +### Determine which C++ compiler to use (we expect to find g++). AC_PROG_CXX AC_PROG_CXXCPP -### Do special things for g++. +### Check version number when using g++. gxx_version=`$CXX -v 2>&1 | grep "^.*g.. version" | \ sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//' -e 's/ .*//'` @@ -269,18 +263,35 @@ OCTAVE_CXX_ISO_COMPLIANT_LIBRARY OCTAVE_CXX_BROKEN_REINTERPRET_CAST -### See which C compiler to use (we expect to find gcc). +### Determine which C compiler to use (we expect to find gcc). AC_PROG_CC AC_PROG_CPP AC_PROG_GCC_TRADITIONAL -### gnulib +## Check for MSVC +have_msvc=no +case "$canonical_host_type" 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 gl_EARLY gl_INIT -### Do special things for gcc. +### Check version number when using gcc. gcc_version=`$CC -v 2>&1 | grep "^.*gcc version" | \ sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//'` @@ -297,9 +308,9 @@ fi AC_SUBST(CC_VERSION) -### The flag to create dependency varies depending on the compier. - -# Assume GCC. +### Determine the compiler flag necessary to create dependencies + +## Assume GCC. INCLUDE_DEPS=true DEPEND_FLAGS="-M" DEPEND_EXTRA_SED_PATTERN="" @@ -327,40 +338,14 @@ AC_SUBST(DEPEND_FLAGS) AC_SUBST(DEPEND_EXTRA_SED_PATTERN) +### Check for pthread library + AX_PTHREAD -### Include pthread libs and flags here in case other tests need them. -### They seem to be required for the OpenGL tests on Debian systems. +## Include pthread libs and flags here 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" -AC_PATH_X -if test "$have_x" = "yes"; then - AC_DEFINE(HAVE_X_WINDOWS, 1, [Define 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 - -### On MacOSX system the Carbon framework is used to determine ScreenSize -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 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 - ### When compiling math for x87, problems may arise in some code comparing ### floating-point intermediate results. ### Generally, it helps to store the result in a local volatile variable, @@ -376,12 +361,14 @@ ac_float_truncate=) AC_DEFINE_UNQUOTED(FLOAT_TRUNCATE, $ac_float_truncate, - [Define to volatile if you need truncating intermediate FP results]) - -### On Intel systems with gcc, we may need to compile with -mieee-fp -### and -ffloat-store to get full support for IEEE floating point. -### -### On Alpha/OSF systems, we need -mieee. + [Define to volatile if you need to truncate intermediate FP results.]) + +### Determine extra CFLAGS that may be necessary for Octave. + +## On Intel systems with gcc, we may need to compile with -mieee-fp +## and -ffloat-store to get full support for IEEE floating point. +## +## On Alpha/OSF systems, we need -mieee. ieee_fp_flag= case "$canonical_host_type" in @@ -394,10 +381,10 @@ XTRA_CFLAGS="$XTRA_CFLAGS -mieee-fp" AC_MSG_NOTICE([adding -mieee-fp to XTRA_CFLAGS])]) -### OCTAVE_CC_FLAG(-ffloat-store, [ -### float_store_flag=-ffloat-store -### XTRA_CFLAGS="$XTRA_CFLAGS -ffloat-store" -### AC_MSG_RESULT([adding -ffloat-store to XTRA_CFLAGS])]) +## OCTAVE_CC_FLAG(-ffloat-store, [ +## float_store_flag=-ffloat-store +## XTRA_CFLAGS="$XTRA_CFLAGS -ffloat-store" +## AC_MSG_RESULT([adding -ffloat-store to XTRA_CFLAGS])]) fi if test "$GXX" = yes; then OCTAVE_CXX_FLAG(-mieee-fp, [ @@ -405,10 +392,10 @@ XTRA_CXXFLAGS="$XTRA_CXXFLAGS -mieee-fp" AC_MSG_NOTICE([adding -mieee-fp to XTRA_CXXFLAGS])]) -### OCTAVE_CXX_FLAG(-ffloat-store, [ -### float_store_flag=-ffloat-store -### XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ffloat-store" -### AC_MSG_RESULT([adding -ffloat-store to XTRA_CXXFLAGS])]) +## OCTAVE_CXX_FLAG(-ffloat-store, [ +## float_store_flag=-ffloat-store +## XTRA_CXXFLAGS="$XTRA_CXXFLAGS -ffloat-store" +## AC_MSG_RESULT([adding -ffloat-store to XTRA_CXXFLAGS])]) fi ;; alpha*-*-*) @@ -444,8 +431,12 @@ ;; esac -## Test whether the compiler supports OpenMP. Experimental so disable by -## default. Enable it with the flag --enable-openmp +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=false AC_ARG_ENABLE(openmp, [AS_HELP_STRING([--enable-openmp], @@ -457,21 +448,15 @@ OCTAVE_CHECK_OPENMP(-fopenmp) ;; *-*-msdosmsvc) - ## FIXME is this the right flag for MSVC? + ## FIXME: is this the right flag for MSVC? OCTAVE_CHECK_OPENMP(-openmp) ;; ## Add other compilers supporting OpenMP here esac fi -AC_SUBST(XTRA_CFLAGS) -AC_SUBST(XTRA_CXXFLAGS) - -## Avoid #define of min/max from windows.h header -if test "$have_msvc" = "yes"; then - AC_DEFINE(NOMINMAX, 1, [Define if you want to avoid min/max macro definition in Windows headers]) -fi - +dnl FIXME: This is OS-specific tests. Can this be moved further down in +dnl configure.ac to reside with other similar tests? ### Use -static if compiling on Alpha OSF/1 1.3 systems. case "$canonical_host_type" in @@ -502,15 +487,18 @@ BUILD_CXX='$(CXX)' BUILD_CXXFLAGS='$(CXXFLAGS)' BUILD_LDFLAGS='$(LDFLAGS)' - case "$canonical_host_type" in - sparc-sun-solaris2*) - if test "$GCC" != yes; then - ## The Sun C++ compiler never seems to complete compiling - ## gendoc.cc unless we reduce the optimization level... - BUILD_CXXFLAGS="-g -O1" - fi - ;; - esac + ## 2012/07/31: Commented out special build requirements + ## for Sun compiler now that gendoc.cc is no longer part of build. + ################################################################## + #case "$canonical_host_type" in + # sparc-sun-solaris2*) + # if test "$GCC" != yes; then + # ## The Sun C++ compiler never seems to complete compiling + # ## gendoc.cc unless we reduce the optimization level... + # ## BUILD_CXXFLAGS="-g -O1" + # fi + # ;; + #esac BUILD_EXEEXT='$(EXEEXT)' fi @@ -536,6 +524,8 @@ ;; esac +### Determine the Fortran compiler and how to invoke it + ## Default FFLAGS is -O. if test "x$FFLAGS" = x; then FFLAGS="-O" @@ -590,13 +580,13 @@ 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.]) + 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_FORTRAN_HAVE_ISNAN F77_ISNAN_MACRO= if test "x$octave_cv_fortran_have_isnan" = xno; then - AC_MSG_NOTICE([substituting ISNAN(X) with X.NE.X in fortran sources]) + 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) @@ -631,7 +621,7 @@ OCTAVE_CHECK_FORTRAN_INTEGER_SIZE fi if test "x$octave_cv_fortran_integer_size" = xno; 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.]) + 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.]) @@ -648,15 +638,15 @@ AC_SUBST(F77_FLOAT_STORE_FLAG) ]) +### Check that C compiler and libraries support IEEE754 data format. OCTAVE_IEEE754_DATA_FORMAT +### Check C++ library for various capabilities. OCTAVE_CXX_BITWISE_OP_TEMPLATES OCTAVE_CXX_COMPLEX_SETTERS OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS -OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL - -### Check for the QHull library +### Check for the Qhull library OCTAVE_CHECK_LIBRARY(qhull, QHull, [Qhull library not found -- this will result in loss of functionality of some geometry functions.], @@ -664,10 +654,10 @@ [warn_qhull= OCTAVE_CHECK_QHULL_VERSION OCTAVE_CHECK_QHULL_OK([TEXINFO_QHULL="@set HAVE_QHULL" - AC_DEFINE(HAVE_QHULL, 1, [Define if QHull is available.])], [ - warn_qhull="Qhull library found, but seems not 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. + 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= @@ -715,26 +705,25 @@ [ZLIB library not found. Octave will not be able to save or load compressed data files or HDF5 files.], [zlib.h], [gzclearerr]) -### Check for the llvm library -dnl +### Check for the LLVM library dnl -dnl llvm is odd and has its own pkg-config like script. We should probably check -dnl for existance and +dnl LLVM is odd and has its own pkg-config like script. We should probably +dnl check for existence and ???. dnl save_CPPFLAGS="$CPPFLAGS" save_CXXFLAGS="$CXXFLAGS" save_LIBS="$LIBS" save_LDFLAGS="$LDFLAGS" -warn_llvm="LLVM library fails tests. JIT compilation will be disabled." +warn_llvm="LLVM library fails tests. JIT compilation will be disabled." AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config utility]) AC_ARG_ENABLE([jit-debug], - AS_HELP_STRING([--enable-jit-debug], [Enable debug printing of jit IRs])) + AS_HELP_STRING([--enable-jit-debug], [Enable debug printing of JIT IRs])) AS_IF([test "x$enable_jit_debug" = "xyes"], [ - AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define for jit debug printing]) + AC_DEFINE(OCTAVE_JIT_DEBUG, 1, [Define to 1 for JIT debug printing.]) ]) LLVM_CXXFLAGS= @@ -743,7 +732,7 @@ LLVM_LIBS= if test "x$ac_cv_env_LLVM_CONFIG_set" = "xset"; then - # We use -isystem if avaiable because we do not want to see warnings in llvm + ## We use -isystem if available because we do not want to see warnings in LLVM LLVM_INCLUDE_FLAG=-I OCTAVE_CC_FLAG(-isystem ., [ LLVM_INCLUDE_FLAG=-isystem @@ -756,8 +745,8 @@ LLVM_CXXFLAGS= dnl - dnl We define some extra flags that llvm requires in order to include headers. - dnl Idealy we should get these from llvm-config, but llvm-config isn't very + dnl We 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 very dnl helpful. dnl CPPFLAGS="-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS $LLVM_CPPFLAGS $CPPFLAGS" @@ -782,11 +771,11 @@ AC_LANG_POP(C++) else - warn_llvm="LLVM_CONFIG not set. JIT compilation will be disabled." + warn_llvm="LLVM_CONFIG not set. JIT compilation will be disabled." fi if test -z "$warn_llvm"; then - AC_DEFINE(HAVE_LLVM, 1, [Define if LLVM is available]) + AC_DEFINE(HAVE_LLVM, 1, [Define to 1 if LLVM is available.]) else LLVM_CXXFLAGS= LLVM_CPPFLAGS= @@ -817,7 +806,7 @@ [warn_hdf5= OCTAVE_HDF5_HAS_ENFORCED_16_API TEXINFO_HDF5="@set HAVE_HDF5" - AC_DEFINE(HAVE_HDF5, 1, [Define if HDF5 is available and newer than version 1.6.]) + 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_HDF5_DLL fi @@ -825,12 +814,6 @@ CPPFLAGS="$save_CPPFLAGS" LIBS="$save_LIBS" - -# Subdirectory of libcruft to build if fftw is not found: - -FFT_DIR="fftpack" -AC_SUBST(FFT_DIR) - dnl @synopsis BNV_HAVE_QT [--with-Qt-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB] dnl @synopsis BNV_HAVE_QT [--with-Qt-include-dir=DIR] [--with-Qt-bin-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB] dnl @@ -1345,8 +1328,9 @@ fi dnl Done setting up for non-traditional Trolltech installation ]) -# Checks for FFTW header and library. - +### Check for FFTW library. Default to Fortran FFTPACK if it is not available. + +## Check for FFTW header and library. OCTAVE_CHECK_LIBRARY(fftw3, FFTW3, [FFTW3 library not found. The slower FFTPACK library will be used instead.], [fftw3.h], [fftw_plan_dft_1d]) @@ -1358,7 +1342,11 @@ AM_CONDITIONAL([AMCOND_HAVE_FFTW], [test -n "$FFTW3_LIBS" && test -n "$FFTW3F_LIBS"]) -# Checks for GLPK header and library. +## Subdirectory of libcruft to build if FFTW is not found: +FFT_DIR="fftpack" +AC_SUBST(FFT_DIR) + +### Check for GLPK library and header. save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" @@ -1370,7 +1358,7 @@ LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS" -# Checks for CURL header and library. +### Checks for cURL header and library. save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$Z_CPPFLAGS $CPPFLAGS" @@ -1382,7 +1370,7 @@ LIBS="$save_LIBS" CPPFLAGS="$save_CPPFLAGS" -### Graphics/ImageMagick++ +### Check for either of Graphics/ImageMagick++ libraries AC_ARG_WITH([magick], [AS_HELP_STRING([--with-magick=LIB], @@ -1414,12 +1402,17 @@ AC_LANG_PUSH(C++) AC_CHECK_HEADER([Magick++.h], [ AC_MSG_CHECKING([for Magick::ColorRGB in Magick++.h]) - AC_TRY_LINK([#include <Magick++.h>], [Magick::ColorRGB c;], [ - AC_MSG_RESULT(yes) - warn_magick= - ], [ - AC_MSG_RESULT(no) - ]) + AC_PREPROC_IFELSE( + [AC_LANG_SOURCE( + [[#include <Magick++.h>]], + [[Magick::ColorRGB c;]]) + ], [ + AC_MSG_RESULT(yes) + warn_magick= + ], [ + AC_MSG_RESULT(no) + ] + ) ]) AC_LANG_POP(C++) CPPFLAGS="$save_CPPFLAGS" @@ -1427,7 +1420,7 @@ ]) if test -z "$warn_magick"; then - AC_DEFINE(HAVE_MAGICK, 1, [Define if Graphics/ImageMagick++ is available.]) + AC_DEFINE(HAVE_MAGICK, 1, [Define to 1 if Graphics/ImageMagick++ is available.]) else MAGICK_CPPFLAGS= MAGICK_LDFLAGS= @@ -1437,9 +1430,37 @@ AC_SUBST(MAGICK_LDFLAGS) AC_SUBST(MAGICK_LIBS) -# --------------------------------------------------------------------- - -## libraries needed for native graphics renderer +### 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 + +### 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 + +### Check for list of libraries needed for native graphics renderer. warn_freetype="" native_graphics=true @@ -1456,6 +1477,7 @@ fi], [check_opengl=true]) +## Check for OpenGL library if $check_opengl; then OCTAVE_OPENGL fi @@ -1465,18 +1487,18 @@ if test -z "$OPENGL_LIBS"; then if $check_opengl; then - warn_fltk_opengl="OpenGL libs (GL and GLU) not found. Native graphics will be disabled." + warn_fltk_opengl="OpenGL libs (GL and GLU) not found. Native graphics will be disabled." OCTAVE_CONFIGURE_WARNING([warn_fltk_opengl]) native_graphics=false fi fi if test -n "$OPENGL_LIBS"; then - AC_DEFINE(HAVE_OPENGL, 1, [Define if OpenGL is available]) - - ## freetype 2 - - AC_CHECK_FT2([9.0.3], [AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have Freetype library.]) + AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.]) + + ## Check for FreeType 2 library + + AC_CHECK_FT2([9.0.3], [AC_DEFINE(HAVE_FREETYPE, 1, [Define to 1 if you have FreeType library.]) XTRA_CXXFLAGS="$XTRA_CXXFLAGS $FT2_CFLAGS"], [warn_freetype="FreeType library not found. Native graphics will be disabled."]) @@ -1485,7 +1507,7 @@ native_graphics=false fi - ## fontconfig library + ## Check for fontconfig library warn_fontconfig="" if test -z "$warn_freetype"; then @@ -1493,7 +1515,7 @@ 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])], [ + 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 @@ -1503,7 +1525,7 @@ native_graphics=false fi - ## fltk (www.fltk.org) + ## Check for FLTK (www.fltk.org) library AC_ARG_WITH([fltk-prefix], [ AS_HELP_STRING([--with-fltk-prefix=PFX], @@ -1559,7 +1581,7 @@ AC_MSG_RESULT([no]) warn_fltk_opengl="FLTK does not have OpenGL support. Native graphics will be disabled." ],[ - AC_DEFINE(HAVE_FLTK, 1, [Define if FLTK is available]) + AC_DEFINE(HAVE_FLTK, 1, [Define to 1 if FLTK is available.]) AC_MSG_RESULT([yes]) ]) @@ -1577,7 +1599,7 @@ AC_SUBST(GRAPHICS_CFLAGS) AC_SUBST(GRAPHICS_LIBS) -# ---------------------------------------------------------------------- +### Start determination of shared vs. static libraries OCTAVE_PROG_AR @@ -1608,7 +1630,7 @@ fi AC_SUBST(XTRA_CRUFT_SH_LDFLAGS) -### Checks for BLAS and LAPACK libraries: +### Check for BLAS and LAPACK libraries: ## Need to adjust FFLAGS to include correct integer size. save_FFLAGS="$FFLAGS" @@ -1672,7 +1694,7 @@ else ## wrapper in libcruft, remove from BLAS_LIBS BLAS_LIBS="`echo $BLAS_LIBS | sed -e 's/blaswrap.[[^ ]]* //g'`" - AC_DEFINE(USE_BLASWRAP, [1], [Define this if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).]) + AC_DEFINE(USE_BLASWRAP, 1, [Define to 1 if BLAS functions need to be wrapped (potentially needed for 64-bit OSX only).]) fi ;; esac @@ -1681,20 +1703,20 @@ if test "x$ax_blas_f77_func_ok" = "xno"; then if $USE_64_BIT_IDX_T && 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.]) + 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 x$ax_blas_ok = xno || test x$ax_lapack_ok = xno; then - AC_MSG_ERROR([You are required to have BLAS and LAPACK libraries]) + 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_LIBRARY(qrupdate, qrupdate, @@ -1712,13 +1734,13 @@ [octave_qrupdate_luu=yes]) AC_MSG_RESULT([$octave_qrupdate_luu]) if test "$octave_qrupdate_luu" = yes; then - AC_DEFINE(HAVE_QRUPDATE_LUU, [1], [Define if qrupdate supports LU updates]) + AC_DEFINE(HAVE_QRUPDATE_LUU, 1, [Define to 1 if qrupdate supports LU updates.]) fi AC_LANG_POP([Fortran 77]) fi LIBS="$save_LIBS" -# Check for AMD library +### Check for AMD library OCTAVE_CHECK_LIBRARY(amd, AMD, [AMD library not found. This will result in some lack of functionality for sparse matrices.], @@ -1726,7 +1748,7 @@ [amd_postorder], [], [don't use AMD library, disable some sparse matrix functionality]) -# Check for CAMD library +### Check for CAMD library OCTAVE_CHECK_LIBRARY(camd, CAMD, [CAMD library not found. This will result in some lack of functionality for sparse matrices.], @@ -1734,7 +1756,7 @@ [camd_postorder], [], [don't use CAMD library, disable some sparse matrix functionality]) -# Check for COLAMD library +### Check for COLAMD library OCTAVE_CHECK_LIBRARY(colamd, COLAMD, [COLAMD library not found. This will result in some lack of functionality for sparse matrices.], @@ -1742,7 +1764,7 @@ [colamd], [], [don't use COLAMD library, disable some sparse matrix functionality]) -# Check for CCOLAMD library +### Check for CCOLAMD library OCTAVE_CHECK_LIBRARY(ccolamd, CCOLAMD, [CCOLAMD library not found. This will result in some lack of functionality for sparse matrices.], @@ -1750,8 +1772,8 @@ [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". +### 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" @@ -1762,7 +1784,7 @@ [], [don't use CHOLMOD library, disable some sparse matrix functionality]) LIBS="$save_LIBS" -# Check for CXSparse library +### Check for CXSparse library OCTAVE_CHECK_LIBRARY(cxsparse, CXSparse, [CXSparse library not found. This will result in some lack of functionality for sparse matrices.], @@ -1770,7 +1792,7 @@ [cs_di_sqr], [C++], [don't use CXSparse library, disable some sparse matrix functionality]) -# Check for UMFPACK library. +### Check for UMFPACK library. save_LIBS="$LIBS" save_CPPFLAGS="$CPPFLAGS" @@ -1807,6 +1829,8 @@ LIBS="$save_LIBS" fi +### Check for ARPACK library. + save_LIBS="$LIBS" LIBS="$LAPACK_LIBS $BLAS_LIBS $FLIBS $LIBS" OCTAVE_CHECK_LIBRARY(arpack, ARPACK, @@ -1816,10 +1840,14 @@ [Fortran 77], [don't use the ARPACK library, disable eigs function], [warn_arpack= OCTAVE_CHECK_ARPACK_OK([ - AC_DEFINE(HAVE_ARPACK, 1, [Define if ARPACK is available.])], [ - warn_arpack="ARPACK library found, but seems not to work properly -- disabling eigs function"])]) + 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 + ### 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 @@ -2223,8 +2251,8 @@ AC_MSG_CHECKING([whether unordered_map requires tr1 namespace]) unordered_map_requires_tr1_namespace=no if test "$ac_cv_header_unordered_map" = "yes"; then - ### Have <unordered_map>, but still have to check whether - ### tr1 namespace is required (like MSVC, for instance). + ## Have <unordered_map>, but still have to check whether + ## tr1 namespace is required (like MSVC, for instance). AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ #include <unordered_map> @@ -2235,7 +2263,7 @@ unordered_map_requires_tr1_namespace=yes fi if test "$unordered_map_requires_tr1_namespace" = "yes"; then - AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Defines whether unordered_map requires the use of tr1 namespace.]) + AC_DEFINE(USE_UNORDERED_MAP_WITH_TR1, 1, [Define to 1 if unordered_map requires the use of tr1 namespace.]) fi AC_MSG_RESULT([$unordered_map_requires_tr1_namespace]) AC_LANG_POP(C++) @@ -2255,6 +2283,11 @@ 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 + ### Checks for functions and variables. AC_CHECK_FUNCS(basename canonicalize_file_name \ @@ -2304,7 +2337,7 @@ )], [AC_MSG_RESULT(yes) HAVE_MKSTEMPS=yes - AC_DEFINE(HAVE_MKSTEMPS, 1, [Define if mkstemps is available in libiberty.]) + AC_DEFINE(HAVE_MKSTEMPS, 1, [Define to 1 if mkstemps is available in libiberty.]) ], [AC_MSG_RESULT(no) HAVE_MKSTEMPS=no @@ -2324,21 +2357,24 @@ #error "Wrong version" #endif]], [])], AC_MSG_RESULT([none]), [ - AC_DEFINE(_WIN32_WINNT, 0x0403, [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount]) + AC_DEFINE(_WIN32_WINNT, 0x0403, [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.]) AC_MSG_RESULT([0x0403])]) AC_MSG_CHECKING([whether _USE_MATH_DEFINES needs to be defined]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[int x = M_LN2;]])], AC_MSG_RESULT([no]), [ - AC_DEFINE(_USE_MATH_DEFINES, 1, [Define if your system needs it to define math constants like M_LN2]) + AC_DEFINE(_USE_MATH_DEFINES, 1, [Define to 1 if your system needs to define math constants like M_LN2.]) AC_MSG_RESULT([yes])]) ;; esac +## Check for CGDisplayBitsPerPixel function on Mac OSX systems with Carbon +OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL + ### Dynamic linking is now enabled only if we are building shared ### libs and some API for dynamic linking is detected. -## FIXME -- a lot of the following duplicates the functionality of +## FIXME: A lot of the following duplicates the functionality of ## code generated by the dlopen option for LT_INIT. LD_CXX='$(CXX)' @@ -2355,23 +2391,23 @@ dlopen) dlopen_api=true DL_API_MSG="(dlopen)" - AC_DEFINE(HAVE_DLOPEN_API, 1, [Define if your system has dlopen, dlsym, dlerror, and dlclose for dynamic linking]) + 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=true DL_API_MSG="(shl_load)" - AC_DEFINE(HAVE_SHL_LOAD_API, 1, [Define if your system has shl_load and shl_findsym for dynamic linking]) + 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=true DL_API_MSG="(LoadLibrary)" - AC_DEFINE(HAVE_LOADLIBRARY_API, 1, [Define if your system has LoadLibrary for dynamic linking]) + AC_DEFINE(HAVE_LOADLIBRARY_API, 1, [Define to 1 if your system has LoadLibrary for dynamic linking.]) ;; dyld) dyld_api=true DL_API_MSG="(dyld)" - AC_DEFINE(HAVE_DYLD_API, 1, [Define if your system has dyld for dynamic linking]) + AC_DEFINE(HAVE_DYLD_API, 1, [Define to 1 if your system has dyld for dynamic linking.]) ;; esac @@ -2387,7 +2423,7 @@ fi if $ENABLE_DYNAMIC_LINKING; then - AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define if using dynamic linking]) + AC_DEFINE(ENABLE_DYNAMIC_LINKING, 1, [Define to 1 if using dynamic linking.]) fi AM_CONDITIONAL([AMCOND_ENABLE_DYNAMIC_LINKING], @@ -2468,14 +2504,13 @@ fi AC_SUBST(TERM_LIBS) -OCTAVE_ENABLE_READLINE - +### Return type of matherr() AC_MSG_CHECKING([for struct exception in math.h]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]], [[struct exception *x; x->type; x->name;]])], [AC_MSG_RESULT(yes) AC_DEFINE(EXCEPTION_IN_MATH, 1, - [Define if your math.h declares struct exception for matherr().])], + [Define to 1 if your math.h declares struct exception for matherr().])], [AC_MSG_RESULT(no)]) ### Signal stuff. @@ -2488,17 +2523,17 @@ #endif ]) -### A system dependent kluge or two. +### A system dependent kludge or two. AC_CHECK_FUNCS(getrusage) case "$canonical_host_type" in *-*-cygwin*) - AC_DEFINE(RUSAGE_TIMES_ONLY, 1, [Define if your struct rusage only has time information.]) + AC_DEFINE(RUSAGE_TIMES_ONLY, 1, [Define to 1 if your struct rusage only has time information.]) ;; esac -### Checks for other programs used for building, testing, installing, -### and running Octave. +### Checks for other programs used in building, testing, installing, and +### running Octave. AC_PROG_AWK OCTAVE_PROG_FIND @@ -2668,7 +2703,7 @@ #define OCTAVE_HAVE_POSIX_FILESYSTEM 1 #endif -/* Define if we expect to have <windows.h>, Sleep, etc. */ +/* Define to 1 if we expect to have <windows.h>, Sleep, etc. */ #if defined (__WIN32__) && ! defined (__CYGWIN__) #define OCTAVE_USE_WINDOWS_API 1 #endif @@ -2698,7 +2733,7 @@ /* To be able to use long doubles for 64-bit mixed arithmetics, we need them at least 80 bits wide and we need roundl declared in math.h. - FIXME -- maybe substitute this by a more precise check in the future. */ + FIXME: Maybe substitute this by a more precise check in the future? */ #if (SIZEOF_LONG_DOUBLE >= 10) && defined (HAVE_ROUNDL) #define OCTAVE_INT_USE_LONG_DOUBLE #endif @@ -2706,7 +2741,7 @@ #define OCTAVE_EMPTY_CPP_ARG /* Octave is currently unable to use FFTW unless both float - and double versions are both available. */ + and double versions are available. */ #if defined (HAVE_FFTW3) && defined (HAVE_FFTW3F) #define HAVE_FFTW #endif @@ -2761,7 +2796,7 @@ #include <stdint.h> -/* Tag indicating octave config.h has been included */ +/* Tag indicating Octave config.h has been included */ #define OCTAVE_CONFIG_INCLUDED 1 ]) @@ -2846,16 +2881,16 @@ GLPK libraries: $GLPK_LIBS graphics CFLAGS: $GRAPHICS_CFLAGS graphics libraries: $GRAPHICS_LIBS - Magick++ CPPFLAGS: $MAGICK_CPPFLAGS - Magick++ LDFLAGS: $MAGICK_LDFLAGS - Magick++ libraries: $MAGICK_LIBS - LLVM CPPFLAGS: $LLVM_CPPFLAGS - LLVM LDFLAGS: $LLVM_LDFLAGS - LLVM libraries: $LLVM_LIBS HDF5 CPPFLAGS: $HDF5_CPPFLAGS HDF5 LDFLAGS: $HDF5_LDFLAGS HDF5 libraries: $HDF5_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 @@ -2922,7 +2957,7 @@ 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([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([]) @@ -2969,9 +3004,9 @@ if $USE_ATOMIC_REFCOUNT; then AC_MSG_WARN([]) AC_MSG_WARN([Using atomic reference counting.]) - AC_MSG_WARN([This feature allows to access 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([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 $USE_OCTAVE_ALLOCATOR; then
--- a/liboctave/lo-specfun.cc +++ b/liboctave/lo-specfun.cc @@ -2137,15 +2137,6 @@ } static void -gripe_betainc_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2, octave_idx_type r3, - octave_idx_type c3) -{ - (*current_liboctave_error_handler) - ("betainc: nonconformant arguments (x is %dx%d, a is %dx%d, b is %dx%d)", - r1, c1, r2, c2, r3, c3); -} - -static void gripe_betainc_nonconformant (const dim_vector& d1, const dim_vector& d2, const dim_vector& d3) { @@ -2159,15 +2150,6 @@ } static void -gripe_betaincinv_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2, octave_idx_type r3, - octave_idx_type c3) -{ - (*current_liboctave_error_handler) - ("betaincinv: nonconformant arguments (x is %dx%d, a is %dx%d, b is %dx%d)", - r1, c1, r2, c2, r3, c3); -} - -static void gripe_betaincinv_nonconformant (const dim_vector& d1, const dim_vector& d2, const dim_vector& d3) {
--- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -85,7 +85,7 @@ [[operator delete((void *)0, (void *)0);]])], octave_cv_placement_delete=yes, octave_cv_placement_delete=no)]) if test $octave_cv_placement_delete = yes; then -AC_DEFINE(HAVE_PLACEMENT_DELETE,1,[Define if C++ supports operator delete(void *, void *)]) +AC_DEFINE(HAVE_PLACEMENT_DELETE,1,[Define to 1 if C++ supports operator delete(void *, void *).]) fi AC_LANG_POP(C++) ]) @@ -100,7 +100,7 @@ [[void test(char *); int length(); char x[length()]; test(x);]])], octave_cv_dynamic_auto_arrays=yes, octave_cv_dynamic_auto_arrays=no)]) if test $octave_cv_dynamic_auto_arrays = yes; then -AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS,1,[Define if C++ supports dynamic auto arrays]) +AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS,1,[Define to 1 if C++ supports dynamic auto arrays.]) fi AC_LANG_POP(C++) ]) @@ -120,7 +120,7 @@ int z3 = std::bit_xor<int>() (x, y);]])], octave_cv_cxx_bitwise_op_templates=yes, octave_cv_cxx_bitwise_op_templates=no)]) if test $octave_cv_cxx_bitwise_op_templates = yes; then -AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES,1,[Define if C++ library has templated bitwise operators]) +AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES,1,[Define to 1 if C++ library has templated bitwise operators.]) fi AC_LANG_POP(C++) ]) @@ -137,7 +137,7 @@ [[std::complex<double> x; x.real (1.0); x.imag (2.0);]])], octave_cv_cxx_complex_setters=yes, octave_cv_cxx_complex_setters=no)]) if test $octave_cv_cxx_complex_setters = yes; then -AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS,1,[Define if C++ complex class has void real (T) and void imag (T) methods]) +AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS,1,[Define to 1 if C++ complex class has void real (T) and void imag (T) methods.]) fi AC_LANG_POP(C++) ]) @@ -153,7 +153,7 @@ [[std::complex<double> x; x.real () = 1.0; x.imag () = 1.0;]])], octave_cv_cxx_complex_reference_accessors=yes, octave_cv_cxx_complex_reference_accessors=no)]) if test $octave_cv_cxx_complex_reference_accessors = yes; then -AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS,1,[Define if C++ complex class has T& real (void) and T& imag (void) methods]) +AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS,1,[Define to 1 if C++ complex class has T& real (void) and T& imag (void) methods.]) fi AC_LANG_POP(C++) ]) @@ -172,7 +172,7 @@ ]])], octave_cv_carbon_cgdisplaybitsperpixel=yes, octave_cv_carbon_cgdisplaybitsperpixel=no)]) if test $octave_cv_carbon_cgdisplaybitsperpixel = yes; then -AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL,1,[Define if Carbon Framework has CGDisplayBitsPerPixel]) +AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL,1,[Define to 1 if Carbon Framework has CGDisplayBitsPerPixel.]) fi AC_LANG_POP(C++) ]) @@ -275,7 +275,7 @@ ]) AC_MSG_RESULT([$octave_cv_cxx_new_friend_template_decl]) if test $octave_cv_cxx_new_friend_template_decl = yes; then - AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL,1,[Define if your compiler supports `<>' stuff for template friends.]) + AC_DEFINE(CXX_NEW_FRIEND_TEMPLATE_DECL,1,[Define to 1 if your compiler supports `<>' stuff for template friends.]) fi ]) dnl @@ -528,7 +528,7 @@ m4_ifblank([$8], [ warn_$1= AC_DEFINE([HAVE_]m4_toupper([$1]), 1, - [Define if $2 is available.]) + [Define to 1 if $2 is available.]) [TEXINFO_]m4_toupper([$1])="@set [HAVE_]m4_toupper([$1])"], [$8]) fi LIBS="$octave_check_library_save_LIBS" @@ -761,7 +761,7 @@ ]) AC_MSG_RESULT([$octave_cv_cxx_iso_compliant_library]) if test $octave_cv_cxx_iso_compliant_library = yes; then - AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define if your C++ runtime library is ISO compliant.]) + AC_DEFINE(CXX_ISO_COMPLIANT_LIBRARY, 1, [Define to 1 if your C++ runtime library is ISO compliant.]) fi ]) dnl @@ -783,7 +783,7 @@ LIBS="$TERM_LIBS" AC_CHECK_LIB(readline, rl_set_keyboard_input_timeout, [ READLINE_LIBS="-lreadline" - AC_DEFINE(USE_READLINE, 1, [Define to use the readline library.]) + AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.]) ], [ AC_MSG_WARN([I need GNU Readline 4.2 or later]) AC_MSG_ERROR([this is fatal unless you specify --disable-readline]) @@ -810,7 +810,7 @@ octave_cv_cxx_broken_reinterpret_cast=no, octave_cv_cxx_broken_reinterpret_cast=yes)]) if test $octave_cv_cxx_broken_reinterpret_cast = yes ; then - AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1, [Define if C++ reinterpret_cast fails for function pointers.]) + AC_DEFINE(CXX_BROKEN_REINTERPRET_CAST, 1, [Define to 1 if C++ reinterpret_cast fails for function pointers.]) fi AC_LANG_POP(C++)]) dnl @@ -938,7 +938,7 @@ AC_MSG_RESULT([$octave_cv_ieee754_data_format]) fi if test "$octave_cv_ieee754_data_format" = yes; then - AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, [Define if your system uses IEEE 754 data format.]) + AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1, [Define to 1 if your system uses IEEE 754 data format.]) else ## If the format is unknown, then you will probably not have a ## useful system, so we will abort here. Anyone wishing to @@ -1001,7 +1001,7 @@ AC_MSG_RESULT([$octave_cv_umfpack_seperate_split]) fi if test "$octave_cv_umfpack_seperate_split" = yes; then - AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, [Define if the UMFPACK Complex solver allow matrix and RHS to be split independently]) + AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1, [Define to 1 if the UMFPACK Complex solver allow matrix and RHS to be split independently.]) fi ]) dnl @@ -1023,7 +1023,7 @@ CFLAGS="$save_CFLAGS" LIBS="$save_LIBS"])]) if test "$octave_cv_hdf5_dll" = yes; then - AC_DEFINE(_HDF5USEDLL_, 1, [Define if using HDF5 dll (Win32)]) + AC_DEFINE(_HDF5USEDLL_, 1, [Define to 1 if using HDF5 dll (Win32).]) fi]) dnl dnl Check whether HDF5 library has version 1.6 API functions. @@ -1038,11 +1038,11 @@ octave_cv_hdf5_has_enforced_16_api=yes], [ octave_cv_hdf5_has_enforced_16_api=no])]) if test "$octave_cv_hdf5_has_enforced_16_api" != "yes"; then - AC_DEFINE(HAVE_HDF5_18, 1, [Define if >=HDF5-1.8 is available.]) + AC_DEFINE(HAVE_HDF5_18, 1, [Define to 1 if >=HDF5-1.8 is available.]) fi ]) dnl -dnl Check for the QHull version. +dnl Check for the Qhull version. dnl AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [AC_CACHE_CHECK([for qh_version in $QHULL_LIBS], @@ -1081,11 +1081,11 @@ ]])], [octave_cv_lib_qhull_version=yes], [octave_cv_lib_qhull_version=no])]) if test "$octave_cv_lib_qhull_version" = no; then AC_DEFINE(NEED_QHULL_VERSION, 1, - [Define if the QHull library needs a qh_version variable defined.]) + [Define to 1 if the Qhull library needs a qh_version variable defined.]) fi ]) dnl -dnl Check whether QHull works (does not crash) +dnl Check whether Qhull works (does not crash) dnl AC_DEFUN([OCTAVE_CHECK_QHULL_OK], [AC_CACHE_CHECK([whether the qhull library works], @@ -1291,10 +1291,10 @@ dnl dnl Check for OpenGL. If found, define OPENGL_LIBS dnl -dnl FIXME -- the following tests should probably check for the +dnl FIXME: The following tests should probably check for the dnl libraries separately. dnl -dnl FIXME -- should we allow a way to specify a directory for OpenGL +dnl FIXME: Should we allow a way to specify a directory for OpenGL dnl libraries and header files? dnl AC_DEFUN([OCTAVE_OPENGL], [ @@ -1307,7 +1307,7 @@ [have_framework_opengl="yes"], [have_framework_opengl="no"]) if test $have_framework_opengl = "yes"; then - AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, [Define if framework OPENGL is available.]) + AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1, [Define to 1 if framework OPENGL is available.]) OPENGL_LIBS="-Wl,-framework -Wl,OpenGL" AC_MSG_NOTICE([adding -Wl,-framework -Wl,OpenGL to OPENGL_LIBS]) OCTAVE_GLUTESSCALLBACK_THREEDOTS @@ -1382,7 +1382,7 @@ AC_LANG_POP(C++) if test $octave_cv_glutesscallback_threedots = "yes"; then AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1, - [Define if gluTessCallback is called with (...)]) + [Define to 1 if gluTessCallback is called with (...).]) fi ]) dnl @@ -1408,7 +1408,7 @@ ]])],octave_cv_openmp=yes, octave_cv_openmmp=no, octave_cv_openmp=no)]) AC_MSG_RESULT($octave_cv_openmp) if test "$octave_cv_openmp" = yes; then - AC_DEFINE(HAVE_OPENMP,1,[Define if compiler supports OpenMP]) + AC_DEFINE(HAVE_OPENMP,1,[Define to 1 if compiler supports OpenMP.]) CXXFLAGS="$CXXFLAGS $1" else CFLAGS="$XCFLAGS" @@ -1627,7 +1627,7 @@ take_func(std::$1); ]])], [AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1),1,[Define if <cmath> provides $1])], + AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1),1,[Define to 1 if <cmath> provides $1.])], [AC_MSG_RESULT([no])]) AC_MSG_CHECKING([for std::$1 (float variant) in <cmath>]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -1640,13 +1640,13 @@ take_func(std::$1); ]])], [AC_MSG_RESULT([yes]) - AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1)F,1,[Define if <cmath> provides float variant of $1])], + AC_DEFINE(HAVE_CMATH_[]AS_TR_CPP($1)F,1,[Define to 1 if <cmath> provides float variant of $1.])], [AC_MSG_RESULT([no])]) AC_LANG_POP(C++) ]) dnl Check whether fast signed integer arithmetics using bit tricks -dnl can be used in oct-inttypes.h. Defines HAVE_FAST_INT_OPS if +dnl can be used in oct-inttypes.h. Defines HAVE_FAST_INT_OPS if dnl the following conditions hold: dnl 1. Signed numbers are represented by twos complement dnl (see <http://en.wikipedia.org/wiki/Two%27s_complement>) @@ -1711,7 +1711,7 @@ AC_LANG_POP(C++)]) if test $octave_cv_fast_int_ops = yes; then AC_DEFINE(HAVE_FAST_INT_OPS, 1, - [Define if signed integers use two's complement]) + [Define to 1 if signed integers use two's complement.]) fi ]) dnl @@ -1719,7 +1719,7 @@ dnl "-framework $1" for the given prologue $2 and the given body $3 of dnl a source file. Arguments 2 and 3 optionally can also be empty. dnl Add options (lower case letters $1) "--with-framework-$1" and -dnl "--without-framework-$1". If this test is successful then perform +dnl "--without-framework-$1". If this test is successful then perform dnl $4, otherwise do $5. dnl dnl OCTAVE_HAVE_FRAMEWORK
--- a/scripts/image/image.m +++ b/scripts/image/image.m @@ -72,6 +72,11 @@ firstnonnumeric = 4; endif + if (iscomplex (img)) + warning ("image: only showing real part of complex image"); + img = real (img); + endif + oldax = gca (); unwind_protect axes (ax); @@ -241,3 +246,6 @@ %! hold off; %! title ("line, image, line, image, line"); +## Test input validation +%!error <can not be complex> image (1+i) +%!error <matrix is empty> image ([])
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -428,7 +428,7 @@ endif warning ("creating the directory %s\n", prefix); endif - local_packages = prefix = canonicalize_filename (prefix); + local_packages = prefix = canonicalize_file_name (prefix); user_prefix = true; if (length (files) >= 2 && ischar (files{2})) archprefix = files{2};
--- a/scripts/plot/gtext.m +++ b/scripts/plot/gtext.m @@ -18,16 +18,24 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} gtext (@var{s}) +## @deftypefnx {Function File} {} gtext (@{@var{s1}, @var{s2}, @dots{}@}) ## @deftypefnx {Function File} {} gtext (@{@var{s1}; @var{s2}; @dots{}@}) ## @deftypefnx {Function File} {} gtext (@dots{}, @var{prop}, @var{val}) +## @deftypefnx {Function File} {@var{h} =} gtext (@dots{}) ## Place text on the current figure using the mouse. The text is defined -## by the string @var{s}. If @var{s} is a cell array, each element of the cell -## array is written to a separate line. Additional arguments are passed to -## the underlying text object as properties. +## by the string @var{s}. If @var{s} is a cell string organized as a row +## vector then each string of the cell array is written to a separate line. +## If @var{s} is organized as a column vector then one string element of the +## cell array is placed for every mouse click. Additional inputs besides a +## string or cellstr are passed to the underlying text object as Property-value +## pairs. +## +## The optional return value @var{h} is a graphics handle to the created +## text object. ## @seealso{ginput, text} ## @end deftypefn -function gtext (s, varargin) +function h = gtext (s, varargin) if (nargin < 1) print_usage (); @@ -37,9 +45,21 @@ error ("gtext: S must be a string or cell array of strings"); endif + htmp = -1; if (! isempty (s)) - [x, y] = ginput (1); - text (x, y, s, varargin{:}); + if (ischar (s) || isrow (s)) + [x, y] = ginput (1); + htmp = text (x, y, s, varargin{:}); + else + for i = 1:numel (s) + [x, y] = ginput (1); + htmp = text (x, y, s{i}, varargin{:}); + endfor + endif + endif + + if (nargout > 0) + h = htmp; endif endfunction
--- a/scripts/polynomial/splinefit.m +++ b/scripts/polynomial/splinefit.m @@ -221,19 +221,19 @@ pp = __splinefit__ (x, y, breaks, args{:}); endfunction + %!shared xb, yb, x %! xb = 0:2:10; -%! yb = randn (size (xb)); +%! yb = 2*rand (size (xb)) - 1; %! x = 0:0.1:10; %!test %! y = interp1 (xb, yb, x, "linear"); -%! assert (ppval (splinefit (x, y, xb, "order", 1), x), y, 10 * eps ()); +%! assert (ppval (splinefit (x, y, xb, "order", 1), x), y, 15 * eps ()); %!test %! y = interp1 (xb, yb, x, "spline"); -%! assert (ppval (splinefit (x, y, xb, "order", 3), x), y, 10 * eps ()); +%! assert (ppval (splinefit (x, y, xb, "order", 3), x), y, 15 * eps ()); %!test %! y = interp1 (xb, yb, x, "spline"); -%! assert (ppval (splinefit (x, y, xb), x), y, 10 * eps ()); +%! assert (ppval (splinefit (x, y, xb), x), y, 15 * eps ()); -
--- a/scripts/testfun/demo.m +++ b/scripts/testfun/demo.m @@ -123,19 +123,11 @@ ## Process each demo without failing try block = code(idx(doidx(i)):idx(doidx(i)+1)-1); - ## FIXME: need to check for embedded test functions, which cause - ## segfaults, until issues with subfunctions in functions are resolved. - embed_func = regexp (block, '^\s*function ', 'once', 'lineanchors'); - if (isempty (embed_func)) - ## Use an environment without variables - eval (cstrcat ("function __demo__ ()\n", block, "\nendfunction")); - ## Display the code that will be executed before executing it - printf ("%s example %d:%s\n\n", name, doidx(i), block); - __demo__; - else - error (["Functions embedded in %!demo blocks are not allowed.\n", ... - "Use the %!function/%!endfunction syntax instead to define shared functions for testing.\n"]); - endif + ## Use an environment without variables + eval (cstrcat ("function __demo__ ()\n", block, "\nendfunction")); + ## Display the code that will be executed before executing it + printf ("%s example %d:%s\n\n", name, doidx(i), block); + __demo__; catch ## Let the programmer know which demo failed. printf ("%s example %d: failed\n%s\n", name, doidx(i), lasterr ());
--- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,11 +22,14 @@ ## Search local directories before those specified by the user. AM_CPPFLAGS = \ - -I../libgnu -I$(top_srcdir)/libgnu \ -I$(top_srcdir)/libcruft/misc \ -I../liboctave -I$(top_srcdir)/liboctave \ - -Icorefcn -I$(srcdir)/corefcn \ + -Iinterpfcn -I$(srcdir)/interpfcn \ + -Icorefcn \ + -Ioctave-value -I$(srcdir)/octave-value \ + -Iparse-tree -I$(srcdir)/parse-tree \ -I. -I$(srcdir) \ + -I../libgnu -I$(top_srcdir)/libgnu \ @CPPFLAGS@ AUTOMAKE_OPTIONS = subdir-objects @@ -64,28 +67,28 @@ ## (except builtins.cc) to be available. BUILT_SOURCES = \ $(BUILT_SOURCES_EXTRA) \ - defaults.h \ - graphics.h \ - graphics-props.cc \ - lex.cc \ + interpfcn/defaults.h \ + interpfcn/graphics.h \ + interpfcn/graphics-props.cc \ + parse-tree/lex.cc \ mxarray.h \ oct-conf.h \ oct-errno.cc \ oct-gperf.h \ - oct-parse.cc \ + parse-tree/oct-parse.cc \ ops.cc \ version.h \ builtins.cc BUILT_DISTFILES = \ oct-gperf.h \ - oct-parse.h + parse-tree/oct-parse.h ## Files that are created during build process and installed, ## BUT not distributed in tarball. BUILT_NODISTFILES = \ - defaults.h \ - graphics.h \ + interpfcn/defaults.h \ + interpfcn/graphics.h \ oct-conf.h \ oct-errno.cc \ ops.cc \ @@ -121,117 +124,6 @@ version.in.h \ $(BUILT_DISTFILES) -OPT_HANDLERS = \ - DASPK-opts.cc \ - DASRT-opts.cc \ - DASSL-opts.cc \ - LSODE-opts.cc \ - Quad-opts.cc - -OPT_INC = \ - ../liboctave/DASPK-opts.h \ - ../liboctave/DASRT-opts.h \ - ../liboctave/DASSL-opts.h \ - ../liboctave/LSODE-opts.h \ - ../liboctave/Quad-opts.h - -OV_INTTYPE_INC = \ - ov-base-int.h \ - ov-base-int.cc \ - ov-int-traits.h \ - ov-int16.h \ - ov-int32.h \ - ov-int64.h \ - ov-int8.h \ - ov-intx.h \ - ov-uint16.h \ - ov-uint32.h \ - ov-uint64.h \ - ov-uint8.h - -OV_INCLUDES = \ - ov-base-diag.h \ - ov-base-diag.cc \ - ov-base-mat.h \ - ov-base-mat.cc \ - ov-base-scalar.h \ - ov-base-scalar.cc \ - ov-base.h \ - ov-bool-mat.h \ - ov-bool-mat.cc \ - ov-bool.h \ - ov-builtin.h \ - ov-cell.h \ - ov-ch-mat.h \ - ov-class.h \ - ov-colon.h \ - ov-complex.h \ - ov-cs-list.h \ - ov-cx-diag.h \ - ov-cx-mat.h \ - ov-dld-fcn.h \ - ov-fcn-handle.h \ - ov-fcn-inline.h \ - ov-fcn.h \ - ov-float.h \ - ov-flt-complex.h \ - ov-flt-cx-diag.h \ - ov-flt-cx-mat.h \ - ov-flt-re-diag.h \ - ov-flt-re-mat.h \ - ov-lazy-idx.h \ - ov-mex-fcn.h \ - ov-null-mat.h \ - ov-oncleanup.h \ - ov-perm.h \ - ov-range.h \ - ov-re-diag.h \ - ov-re-mat.h \ - ov-scalar.h \ - ov-str-mat.h \ - ov-struct.h \ - ov-type-conv.h \ - ov-typeinfo.h \ - ov-usr-fcn.h \ - ov.h \ - $(OV_INTTYPE_INC) - -OV_SPARSE_INCLUDES = \ - ov-base-sparse.h \ - ov-bool-sparse.h \ - ov-cx-sparse.h \ - ov-re-sparse.h - -PT_INCLUDES = \ - pt-all.h \ - pt-arg-list.h \ - pt-assign.h \ - pt-binop.h \ - pt-bp.h \ - pt-cbinop.h \ - pt-cell.h \ - pt-check.h \ - pt-cmd.h \ - pt-colon.h \ - pt-const.h \ - pt-decl.h \ - pt-eval.h \ - pt-except.h \ - pt-exp.h \ - pt-fcn-handle.h \ - pt-id.h \ - pt-idx.h \ - pt-jump.h \ - pt-loop.h \ - pt-mat.h \ - pt-misc.h \ - pt-pr-code.h \ - pt-select.h \ - pt-stmt.h \ - pt-unop.h \ - pt-walk.h \ - pt.h - JIT_INCLUDES = \ jit-util.h \ jit-typeinfo.h \ @@ -244,32 +136,20 @@ c-file-ptr-stream.h \ comment-list.h \ cutils.h \ - data.h \ - debug.h \ defun-dld.h \ defun-int.h \ - defun.h \ - dirfns.h \ display.h \ dynamic-ld.h \ - error.h \ - file-io.h \ gl-render.h \ gl2ps.h \ gl2ps-renderer.h \ - graphics-props.cc \ + interpfcn/graphics-props.cc \ gripes.h \ - help.h \ - input.h \ - lex.h \ - load-path.h \ - load-save.h \ ls-ascii-helper.h \ ls-hdf5.h \ ls-mat-ascii.h \ ls-mat4.h \ ls-mat5.h \ - ls-oct-ascii.h \ ls-oct-binary.h \ ls-utils.h \ mex.h \ @@ -278,7 +158,6 @@ oct-fstrm.h \ oct-gperf.h \ oct-hdf5.h \ - oct-hist.h \ oct-iostrm.h \ oct-lvalue.h \ oct-map.h \ @@ -291,25 +170,14 @@ oct.h \ octave.h \ ops.h \ - pager.h \ - parse.h \ - parse-private.h \ - pr-output.h \ procstream.h \ - profiler.h \ - sighandlers.h \ siglist.h \ sparse-xdiv.h \ sparse-xpow.h \ - symtab.h \ - sysdep.h \ token.h \ - toplev.h \ txt-eng-ft.h \ txt-eng.h \ unwind-prot.h \ - utils.h \ - variables.h \ xdiv.h \ xnorm.h \ xpow.h \ @@ -317,199 +185,85 @@ $(OV_INCLUDES) \ $(OV_SPARSE_INCLUDES) \ $(PT_INCLUDES) \ + $(INTERPFCN_INCLUDES) \ $(JIT_INCLUDES) nodist_octinclude_HEADERS = \ - defaults.h \ - graphics.h \ + interpfcn/defaults.h \ + interpfcn/graphics.h \ oct-conf.h \ mxarray.h \ version.h -OV_INTTYPE_SRC = \ - ov-int16.cc \ - ov-int32.cc \ - ov-int64.cc \ - ov-int8.cc \ - ov-uint16.cc \ - ov-uint32.cc \ - ov-uint64.cc \ - ov-uint8.cc - -OV_SPARSE_SRC = \ - ov-base-sparse.cc \ - ov-bool-sparse.cc \ - ov-cx-sparse.cc \ - ov-re-sparse.cc - -OV_SRC = \ - ov-base.cc \ - ov-bool-mat.cc \ - ov-bool.cc \ - ov-builtin.cc \ - ov-cell.cc \ - ov-ch-mat.cc \ - ov-class.cc \ - ov-colon.cc \ - ov-complex.cc \ - ov-cs-list.cc \ - ov-cx-diag.cc \ - ov-cx-mat.cc \ - ov-dld-fcn.cc \ - ov-fcn-handle.cc \ - ov-fcn-inline.cc \ - ov-fcn.cc \ - ov-float.cc \ - ov-flt-complex.cc \ - ov-flt-cx-diag.cc \ - ov-flt-cx-mat.cc \ - ov-flt-re-diag.cc \ - ov-flt-re-mat.cc \ - ov-lazy-idx.cc \ - ov-mex-fcn.cc \ - ov-null-mat.cc \ - ov-oncleanup.cc \ - ov-perm.cc \ - ov-range.cc \ - ov-re-diag.cc \ - ov-re-mat.cc \ - ov-scalar.cc \ - ov-str-mat.cc \ - ov-struct.cc \ - ov-typeinfo.cc \ - ov-usr-fcn.cc \ - ov.cc \ - $(OV_INTTYPE_SRC) \ - $(OV_SPARSE_SRC) - -PT_SRC = \ - pt-arg-list.cc \ - pt-assign.cc \ - pt-binop.cc \ - pt-bp.cc \ - pt-cbinop.cc \ - pt-cell.cc \ - pt-check.cc \ - pt-cmd.cc \ - pt-colon.cc \ - pt-const.cc \ - pt-decl.cc \ - pt-eval.cc \ - pt-except.cc \ - pt-exp.cc \ - pt-fcn-handle.cc \ - pt-id.cc \ - pt-idx.cc \ - pt-jump.cc \ - pt-loop.cc \ - pt-mat.cc \ - pt-misc.cc \ - pt-pr-code.cc \ - pt-select.cc \ - pt-stmt.cc \ - pt-unop.cc \ - pt.cc - JIT_SRC = \ jit-util.cc \ jit-typeinfo.cc \ jit-ir.cc \ pt-jit.cc -#noinst_LTLIBRARIES = -# -#include corefcn/module.mk -# DIST_SRC = \ Cell.cc \ - bitfcns.cc \ c-file-ptr-stream.cc \ comment-list.cc \ cutils.c \ - data.cc \ - debug.cc \ - defaults.cc \ - defun.cc \ - dirfns.cc \ display.cc \ dynamic-ld.cc \ - error.cc \ - file-io.cc \ gl-render.cc \ gl2ps-renderer.cc \ - graphics.cc \ gripes.cc \ - help.cc \ - input.cc \ - lex.ll \ - load-path.cc \ - load-save.cc \ ls-ascii-helper.cc \ ls-hdf5.cc \ ls-mat-ascii.cc \ ls-mat4.cc \ ls-mat5.cc \ - ls-oct-ascii.cc \ ls-oct-binary.cc \ ls-utils.cc \ - mappers.cc \ matherr.c \ mex.cc \ oct-fstrm.cc \ - oct-hist.cc \ oct-iostrm.cc \ oct-lvalue.cc \ oct-map.cc \ oct-obj.cc \ - oct-parse.yy \ oct-prcstrm.cc \ oct-procbuf.cc \ oct-stream.cc \ oct-strstrm.cc \ octave.cc \ - pager.cc \ - pr-output.cc \ procstream.cc \ - profiler.cc \ - sighandlers.cc \ siglist.c \ - sparse.cc \ sparse-xdiv.cc \ sparse-xpow.cc \ - strfns.cc \ - symtab.cc \ - syscalls.cc \ - sysdep.cc \ token.cc \ - toplev.cc \ txt-eng-ft.cc \ unwind-prot.cc \ - utils.cc \ - variables.cc \ xdiv.cc \ xgl2ps.c \ xnorm.cc \ xpow.cc \ zfstream.cc \ - $(corefcn_SRC) \ - $(OV_SRC) \ - $(PT_SRC) \ - $(JIT_SRC) + $(OCTAVE_VALUE_SRC) \ + $(PARSE_TREE_SRC) \ + $(JIT_SRC) \ + $(INTERPFCN_SRC) \ + $(COREFCN_SRC) noinst_LTLIBRARIES = +include parse-tree/module.mk +include octave-value/module.mk +include operators/module.mk +include template-inst/module.mk +include interpfcn/module.mk include corefcn/module.mk -include DLD-FUNCTIONS/module.mk +include dldfcn/module.mk -$(srcdir)/DLD-FUNCTIONS/module.mk: $(srcdir)/DLD-FUNCTIONS/config-module.sh $(srcdir)/DLD-FUNCTIONS/config-module.awk $(srcdir)/DLD-FUNCTIONS/module-files - $(srcdir)/DLD-FUNCTIONS/config-module.sh $(top_srcdir) - -include OPERATORS/module.mk -include TEMPLATE-INST/module.mk +$(srcdir)/dldfcn/module.mk: $(srcdir)/dldfcn/config-module.sh $(srcdir)/dldfcn/config-module.awk $(srcdir)/dldfcn/module-files + $(srcdir)/dldfcn/config-module.sh $(top_srcdir) if AMCOND_ENABLE_DYNAMIC_LINKING - OCT_FILES = $(DLD_FUNCTIONS_LIBS:.la=.oct) - OCT_STAMP_FILES = $(subst DLD-FUNCTIONS/,DLD-FUNCTIONS/$(am__leading_dot),$(DLD_FUNCTIONS_LIBS:.la=.oct-stamp)) + OCT_FILES = $(DLDFCN_LIBS:.la=.oct) + OCT_STAMP_FILES = $(subst dldfcn/,dldfcn/$(am__leading_dot),$(DLDFCN_LIBS:.la=.oct-stamp)) DLD_LIBOCTINTERP_LIBADD = liboctinterp.la else OCT_FILES = @@ -524,8 +278,8 @@ nodist_liboctinterp_la_SOURCES = \ builtins.cc \ - defaults.h \ - graphics.h \ + interpfcn/defaults.h \ + interpfcn/graphics.h \ mxarray.h \ oct-conf.h \ oct-errno.cc \ @@ -575,17 +329,17 @@ ## Section for defining and creating DEF_FILES SRC_DEF_FILES := $(shell $(srcdir)/find-defun-files.sh "$(srcdir)" $(DIST_SRC)) -DLD_FUNCTIONS_DEF_FILES = $(DLD_FUNCTIONS_SRC:.cc=.df) +DLDFCN_DEF_FILES = $(DLDFCN_SRC:.cc=.df) ## builtins.cc depends on $(DEF_FILES), so DEF_FILES should only include ## .df files that correspond to sources included in liboctave. if AMCOND_ENABLE_DYNAMIC_LINKING DEF_FILES = $(SRC_DEF_FILES) else - DEF_FILES = $(SRC_DEF_FILES) $(DLD_FUNCTIONS_DEF_FILES) + DEF_FILES = $(SRC_DEF_FILES) $(DLDFCN_DEF_FILES) endif -ALL_DEF_FILES = $(SRC_DEF_FILES) $(DLD_FUNCTIONS_DEF_FILES) +ALL_DEF_FILES = $(SRC_DEF_FILES) $(DLDFCN_DEF_FILES) $(SRC_DEF_FILES): mkdefs Makefile @@ -607,13 +361,6 @@ ## defaults.h and oct-conf.h must depend on Makefile. Calling configure ## may change default/config values. However, calling configure will also ## regenerate the Makefiles from Makefile.am and trigger the rules below. -defaults.h: defaults.in.h Makefile - @$(do_subst_default_vals) - -graphics.h: graphics.in.h genprops.awk Makefile - $(AWK) -f $(srcdir)/genprops.awk $< > $@-t - mv $@-t $@ - oct-conf.h: oct-conf.in.h Makefile @$(do_subst_config_vals) @@ -645,10 +392,6 @@ $(srcdir)/mkbuiltins $(DEF_FILES) > $@-t mv $@-t $@ -graphics-props.cc: graphics.in.h genprops.awk Makefile - $(AWK) -v emit_graphics_props=1 -f $(srcdir)/genprops.awk $< > $@-t - mv $@-t $@ - ops.cc: $(OPERATORS_SRC) mkops $(srcdir)/mkops $(OPERATORS_SRC) > $@-t mv $@-t $@ @@ -663,24 +406,14 @@ fi mv $@-t $@ -$(OPT_HANDLERS) : %.cc : $(top_srcdir)/liboctave/%.in $(top_srcdir)/build-aux/mk-opts.pl - $(PERL) $(top_srcdir)/build-aux/mk-opts.pl --opt-handler-fcns $< > $@-t - mv $@-t $@ +if AMCOND_ENABLE_DYNAMIC_LINKING +DLDFCN_PKG_ADD_FILE = dldfcn/PKG_ADD -$(OPT_INC) : %.h : %.in - $(MAKE) -C $(@D) $(@F) - -if AMCOND_ENABLE_DYNAMIC_LINKING -DLD_FUNCTIONS_PKG_ADD_FILE = DLD-FUNCTIONS/PKG_ADD - -DLD-FUNCTIONS/PKG_ADD: $(DLD_FUNCTIONS_DEF_FILES) mk-pkg-add - $(srcdir)/mk-pkg-add $(DLD_FUNCTIONS_DEF_FILES) > $@-t +dldfcn/PKG_ADD: $(DLDFCN_DEF_FILES) mk-pkg-add + $(srcdir)/mk-pkg-add $(DLDFCN_DEF_FILES) > $@-t mv $@-t $@ endif -lex.lo lex.o oct-parse.lo oct-parse.o: \ - AM_CXXFLAGS := $(filter-out -Wold-style-cast, $(AM_CXXFLAGS)) - __fltk_uigetfile__.lo __fltk_uigetfile__.o: \ AM_CXXFLAGS := $(filter-out $(DLL_CXXDEFS), $(AM_CXXFLAGS) $(GRAPHICS_CFLAGS)) @@ -698,9 +431,9 @@ $(top_srcdir)/build-aux/move-if-change $@ DOCSTRINGS touch $@ -all-local: $(OCT_STAMP_FILES) $(DLD_FUNCTIONS_PKG_ADD_FILE) .DOCSTRINGS +all-local: $(OCT_STAMP_FILES) $(DLDFCN_PKG_ADD_FILE) .DOCSTRINGS else -all-local: $(OCT_STAMP_FILES) $(DLD_FUNCTIONS_PKG_ADD_FILE) +all-local: $(OCT_STAMP_FILES) $(DLDFCN_PKG_ADD_FILE) endif if AMCOND_BUILD_COMPILED_AUX_PROGRAMS @@ -754,11 +487,11 @@ if AMCOND_ENABLE_DYNAMIC_LINKING install-oct: $(top_srcdir)/build-aux/mkinstalldirs $(DESTDIR)$(octfiledir) - if [ -n "`cat $(DLD_FUNCTIONS_PKG_ADD_FILE)`" ]; then \ - $(INSTALL_DATA) $(DLD_FUNCTIONS_PKG_ADD_FILE) $(DESTDIR)$(octfiledir)/PKG_ADD; \ + if [ -n "`cat $(DLDFCN_PKG_ADD_FILE)`" ]; then \ + $(INSTALL_DATA) $(DLDFCN_PKG_ADD_FILE) $(DESTDIR)$(octfiledir)/PKG_ADD; \ fi cd $(DESTDIR)$(octlibdir) && \ - for ltlib in $(DLD_FUNCTIONS_LIBS); do \ + for ltlib in $(DLDFCN_LIBS); do \ f=`echo $$ltlib | $(SED) 's,.*/,,'`; \ dl=`$(SED) -n -e "s/dlname='\([^']*\)'/\1/p" < $$f`; \ if [ -n "$$dl" ]; then \ @@ -783,9 +516,9 @@ CLEANFILES = \ $(bin_SCRIPTS) \ - $(DLD_FUNCTIONS_PKG_ADD_FILE) \ - graphics-props.cc \ - oct-parse.output + $(DLDFCN_PKG_ADD_FILE) \ + interpfcn/graphics-props.cc \ + parse-tree/oct-parse.output DISTCLEANFILES = \ .DOCSTRINGS \
--- a/src/corefcn/module.mk +++ b/src/corefcn/module.mk @@ -1,7 +1,30 @@ EXTRA_DIST += \ corefcn/module.mk -corefcn_SRC = \ +## Options functions for Fortran packages like LSODE, DASPK. +## These are generated automagically by configure and Perl. +OPT_HANDLERS = \ + corefcn/DASPK-opts.cc \ + corefcn/DASRT-opts.cc \ + corefcn/DASSL-opts.cc \ + corefcn/LSODE-opts.cc \ + corefcn/Quad-opts.cc + +OPT_INC = \ + $(top_builddir)/liboctave/DASPK-opts.h \ + $(top_builddir)/liboctave/DASRT-opts.h \ + $(top_builddir)/liboctave/DASSL-opts.h \ + $(top_builddir)/liboctave/LSODE-opts.h \ + $(top_builddir)/liboctave/Quad-opts.h + +$(OPT_HANDLERS): corefcn/%.cc : $(top_builddir)/liboctave/%.in + $(PERL) $(top_srcdir)/build-aux/mk-opts.pl --opt-handler-fcns $< > $@-t + mv $@-t $@ + +$(OPT_INC) : %.h : %.in + $(MAKE) -C $(top_builddir)/liboctave $(@F) + +COREFCN_SRC = \ corefcn/__contourc__.cc \ corefcn/__dispatch__.cc \ corefcn/__lin_interpn__.cc \ @@ -10,6 +33,7 @@ corefcn/balance.cc \ corefcn/besselj.cc \ corefcn/betainc.cc \ + corefcn/bitfcns.cc \ corefcn/bsxfun.cc \ corefcn/cellfun.cc \ corefcn/colloc.cc \ @@ -40,6 +64,7 @@ corefcn/lsode.cc \ corefcn/lu.cc \ corefcn/luinc.cc \ + corefcn/mappers.cc \ corefcn/matrix_type.cc \ corefcn/max.cc \ corefcn/md5sum.cc \ @@ -53,18 +78,21 @@ corefcn/rcond.cc \ corefcn/regexp.cc \ corefcn/schur.cc \ + corefcn/sparse.cc \ corefcn/spparms.cc \ corefcn/sqrtm.cc \ corefcn/str2double.cc \ corefcn/strfind.cc \ + corefcn/strfns.cc \ corefcn/sub2ind.cc \ corefcn/svd.cc \ corefcn/syl.cc \ + corefcn/syscalls.cc \ corefcn/time.cc \ corefcn/tril.cc \ corefcn/typecast.cc noinst_LTLIBRARIES += corefcn/libcorefcn.la -corefcn_libcorefcn_la_SOURCES = $(corefcn_SRC) +corefcn_libcorefcn_la_SOURCES = $(COREFCN_SRC)
rename from src/syscalls.cc rename to src/corefcn/syscalls.cc --- a/src/syscalls.cc +++ b/src/corefcn/syscalls.cc @@ -936,7 +936,7 @@ @end table\n\ \n\ If the call is successful @var{err} is 0 and @var{msg} is an empty\n\ -string. If the file does not exist, or some other error occurs, @var{s}\n\ +string. If the file does not exist, or some other error occurs, @var{info}\n\ is an empty matrix, @var{err} is @minus{}1, and @var{msg} contains the\n\ corresponding system error message.\n\ \n\ @@ -947,8 +947,8 @@ For example:\n\ \n\ @example\n\ -[s, err, msg] = stat (\"/vmlinuz\")\n\ - @result{} s =\n\ +[info, err, msg] = stat (\"/vmlinuz\")\n\ + @result{} info =\n\ @{\n\ atime = 855399756\n\ rdev = 0\n\
rename from src/DLD-FUNCTIONS/config-module.awk rename to src/dldfcn/config-module.awk --- a/src/DLD-FUNCTIONS/config-module.awk +++ b/src/dldfcn/config-module.awk @@ -5,10 +5,10 @@ print "## DO NOT EDIT -- generated from module-files by config-module.awk"; print "" print "EXTRA_DIST += \\" - print " DLD-FUNCTIONS/config-module.sh \\" - print " DLD-FUNCTIONS/config-module.awk \\" - print " DLD-FUNCTIONS/module-files \\" - print " DLD-FUNCTIONS/oct-qhull.h" + print " dldfcn/config-module.sh \\" + print " dldfcn/config-module.awk \\" + print " dldfcn/module-files \\" + print " dldfcn/oct-qhull.h" print "" } /^#.*/ { next; } @@ -20,20 +20,20 @@ libraries[nfiles] = $4; } END { sep = " \\\n"; - print "DLD_FUNCTIONS_SRC = \\"; + print "DLDFCN_SRC = \\"; for (i = 1; i <= nfiles; i++) { if (i == nfiles) sep = "\n"; - printf (" DLD-FUNCTIONS/%s%s", files[i], sep); + printf (" dldfcn/%s%s", files[i], sep); } print ""; sep = " \\\n"; - print "DLD_FUNCTIONS_LIBS = $(DLD_FUNCTIONS_SRC:.cc=.la)"; + print "DLDFCN_LIBS = $(DLDFCN_SRC:.cc=.la)"; print ""; print "if AMCOND_ENABLE_DYNAMIC_LINKING"; print ""; - print "octlib_LTLIBRARIES += $(DLD_FUNCTIONS_LIBS)"; + print "octlib_LTLIBRARIES += $(DLDFCN_LIBS)"; print ""; print "## Use stamp files to avoid problems with checking timestamps"; print "## of symbolic links"; @@ -41,18 +41,18 @@ for (i = 1; i <= nfiles; i++) { basename = files[i]; sub (/\.cc$/, "", basename); - printf ("DLD-FUNCTIONS/$(am__leading_dot)%s.oct-stamp: DLD-FUNCTIONS/%s.la\n", basename, basename); + printf ("dldfcn/$(am__leading_dot)%s.oct-stamp: dldfcn/%s.la\n", basename, basename); print "\trm -f $(<:.la=.oct)"; print "\tla=$(<F) && \\"; print "\t of=$(<F:.la=.oct) && \\"; - print "\t cd DLD-FUNCTIONS && \\"; + print "\t cd dldfcn && \\"; print "\t $(LN_S) .libs/`$(SED) -n -e \"s/dlname='\\([^']*\\)'/\\1/p\" < $$la` $$of && \\"; print "\t touch $(@F)"; print ""; } print "else"; print ""; - print "noinst_LTLIBRARIES += $(DLD_FUNCTIONS_LIBS)"; + print "noinst_LTLIBRARIES += $(DLDFCN_LIBS)"; print ""; print "endif"; @@ -60,18 +60,18 @@ basename = files[i]; sub (/\.cc$/, "", basename); print ""; - printf ("DLD_FUNCTIONS_%s_la_SOURCES = DLD-FUNCTIONS/%s\n", + printf ("dldfcn_%s_la_SOURCES = dldfcn/%s\n", basename, files[i]); if (cppflags[i]) { - printf ("DLD-FUNCTIONS/%s.df: CPPFLAGS += %s\n", + printf ("dldfcn/%s.df: CPPFLAGS += %s\n", basename, cppflags[i]); - printf ("DLD_FUNCTIONS_%s_la_CPPFLAGS = $(AM_CPPFLAGS) %s\n", + printf ("dldfcn_%s_la_CPPFLAGS = $(AM_CPPFLAGS) %s\n", basename, cppflags[i]); } - printf ("DLD_FUNCTIONS_%s_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) %s $(OCT_LINK_OPTS)\n", + printf ("dldfcn_%s_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED_LDFLAG) %s $(OCT_LINK_OPTS)\n", basename, ldflags[i]); - printf ("DLD_FUNCTIONS_%s_la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) ../liboctave/liboctave.la ../libcruft/libcruft.la %s $(OCT_LINK_DEPS)\n", + printf ("dldfcn_%s_la_LIBADD = $(DLD_LIBOCTINTERP_LIBADD) ../liboctave/liboctave.la ../libcruft/libcruft.la %s $(OCT_LINK_DEPS)\n", basename, libraries[i]); } }
rename from src/DLD-FUNCTIONS/config-module.sh rename to src/dldfcn/config-module.sh --- a/src/DLD-FUNCTIONS/config-module.sh +++ b/src/dldfcn/config-module.sh @@ -12,7 +12,7 @@ move_if_change="$top_srcdir/build-aux/move-if-change" -dld_dir=$top_srcdir/src/DLD-FUNCTIONS +dld_dir=$top_srcdir/src/dldfcn $AWK -f $dld_dir/config-module.awk < $dld_dir/module-files > $dld_dir/module.mk-t
rename from src/DLD-FUNCTIONS/module-files rename to src/dldfcn/module-files --- a/src/DLD-FUNCTIONS/module-files +++ b/src/dldfcn/module-files @@ -1,5 +1,4 @@ # FILE|CPPFLAGS|LDFLAGS|LIBRARIES -chol.cc __delaunayn__.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS) __dsearchn__.cc __fltk_uigetfile__.cc|$(GRAPHICS_CFLAGS) $(FT2_CPPFLAGS)|$(GRAPHICS_LDFLAGS) $(FT2_LDFLAGS)|$(GRAPHICS_LIBS) $(FT2_LIBS) @@ -10,6 +9,7 @@ __voronoi__.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS) amd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS) ccolamd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS) +chol.cc colamd.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS) convhulln.cc|$(QHULL_CPPFLAGS)|$(QHULL_LDFLAGS)|$(QHULL_LIBS) dmperm.cc|$(SPARSE_XCPPFLAGS)|$(SPARSE_XLDFLAGS)|$(SPARSE_XLIBS)
--- a/src/gl-render.cc +++ b/src/gl-render.cc @@ -2488,6 +2488,10 @@ Matrix x = props.get_xdata ().matrix_value (); Matrix y = props.get_ydata ().matrix_value (); + // Someone wants us to draw an empty image? No way. + if (x.is_empty () || y.is_empty ()) + return; + if (w > 1 && x(1) == x(0)) x(1) = x(1) + (w-1);
rename from src/data.cc rename to src/interpfcn/data.cc --- a/src/data.cc +++ b/src/interpfcn/data.cc @@ -3,6 +3,7 @@ Copyright (C) 1994-2012 John W. Eaton Copyright (C) 2009 Jaroslav Hajek Copyright (C) 2009-2010 VZLU Prague +Copyright (C) 2012 Carlo de Falco This file is part of Octave. @@ -37,6 +38,10 @@ #include <ctime> #include <string> +extern "C" +{ +#include <base64.h> +} #include "lo-ieee.h" #include "lo-math.h" @@ -7227,3 +7232,139 @@ return retval; } + +DEFUN (base64_encode, args, , "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {@var{s} =} base64_encode (@var{x})\n\ +Encode a double matrix or array @var{x} into the base64 format string\n\ +@var{s}.\n\ +\n\ +@strong{Warning:} Encoding different numeric types, such as single or\n\ +integer, is not currently supported. Any non-double input will be converted\n\ +to type double before encoding.\n\ +@seealso{base64_decode}\n\ +@end deftypefn") +{ + octave_value_list retval; + + int nargin = args.length (); + + if (nargin != 1) + print_usage (); + else + { + const Array<double> in = args(0).array_value (); + if (! error_state) + { + const char* inc = reinterpret_cast<const char*> (in.data ()); + size_t inlen = in.numel () * sizeof (double) / sizeof (char); + char* out; + size_t outlen = base64_encode_alloc (inc, inlen, &out); + + if (! out && outlen == 0 && inlen != 0) + error ("base64_encode: input array too large"); + else if (! out) + error ("base64_encode: memory allocation error"); + else + retval(0) = octave_value (out); + } + } + + return retval; +} + +/* +%!assert (base64_encode (single (pi)), "AAAAYPshCUA=") +%!assert (base64_encode (uint8 (pi)), base64_encode (double (uint8 (pi)))) + +%!error base64_encode () +%!error base64_encode (1,2) +%!error base64_encode ("A string") +*/ + +DEFUN (base64_decode, args, , "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {@var{x} =} base64_decode (@var{s})\n\ +@deftypefnx {Built-in Function} {@var{x} =} base64_decode (@var{s}, @var{dims})\n\ +Decode the double matrix or array @var{x} from the base64 format string\n\ +@var{s}. The optional input parameter @var{dims} should be a vector\n\ +containing the dimensions of the decoded array.\n\ +@seealso{base64_encode}\n\ +@end deftypefn") +{ + octave_value_list retval; + + int nargin = args.length (); + + if (nargin < 1 || nargin > 2) + print_usage (); + else + { + dim_vector new_dims; + Array<double> res; + + if (nargin > 1) + { + const Array<octave_idx_type> new_size = + args(1).octave_idx_type_vector_value (); + if (! error_state) + { + new_dims = dim_vector::alloc (new_size.length ()); + for (octave_idx_type i = 0; i < new_size.length (); i++) + new_dims(i) = new_size(i); + } + } + + const std::string in = args(0).string_value (); + + if (! error_state) + { + const char *inc = &(in[0]); + char *out; + size_t inlen = in.length (), outlen; + + bool ok = base64_decode_alloc (inc, inlen, &out, &outlen); + + if (! ok) + error ("base64_decode: input was not valid base64"); + else if (! out) + error ("base64_decode: memory allocation error"); + else + { + if ((outlen % (sizeof (double) / sizeof (char))) != 0) + error ("base64_decode: incorrect input size"); + else + { + octave_idx_type l; + l = (outlen * sizeof (char)) / sizeof (double); + res.resize1 (l); + double *dout = reinterpret_cast<double*> (out); + std::copy (dout, dout + l, res.fortran_vec ()); + + if (nargin > 1) + retval(0) = octave_value (res).reshape (new_dims); + else + retval(0) = octave_value (res); + } + } + } + } + + return retval; +} + +/* +%!assert (base64_decode (base64_encode (pi)), pi) +%! +%!test +%! in = randn (10); +%! outv = base64_decode (base64_encode (in)); +%! outm = base64_decode (base64_encode (in), size (in)); +%! assert (outv, in(:).'); +%! assert (outm, in); + +%!error base64_decode () +%!error base64_decode (1,2,3) +%!error base64_decode (1, "this is not a valid set of dimensions") +%!error <input was not valid base64> base64_decode (1) +%!error <input was not valid base64> base64_decode ("AQ=") +%!error <incorrect input size> base64_decode ("AQ==") +*/
rename from src/defaults.in.h rename to src/interpfcn/defaults.in.h --- a/src/defaults.in.h +++ b/src/interpfcn/defaults.in.h @@ -1,4 +1,4 @@ -// defaults.h.in +// DO NOT EDIT! Generated automatically from defaults.in.h by configure /* Copyright (C) 1993-2012 John W. Eaton
rename from src/dirfns.h rename to src/interpfcn/dirfns.h --- a/src/dirfns.h +++ b/src/interpfcn/dirfns.h @@ -29,11 +29,6 @@ #include "oct-time.h" -extern std::string polite_directory_format (const std::string&); -extern std::string base_pathname (const std::string&); -extern std::string make_absolute (const std::string&, const std::string&); -extern std::string get_working_directory (const std::string&); - // The time we last time we changed directories. extern octave_time Vlast_chdir_time;
rename from src/graphics.cc rename to src/interpfcn/graphics.cc --- a/src/graphics.cc +++ b/src/interpfcn/graphics.cc @@ -1201,10 +1201,14 @@ // check value type if (type_constraints.size () > 0) { - for (std::list<std::string>::const_iterator it = type_constraints.begin (); - ! xok && it != type_constraints.end (); ++it) - if ((*it) == v.class_name ()) - xok = true; + if(type_constraints.find (v.class_name()) != type_constraints.end()) + xok = true; + + // check if complex is allowed (it's also of class "double", so + // checking that alone is not enough to ensure real type) + if (type_constraints.find ("real") != type_constraints.end () + && v.is_complex_type ()) + xok = false; } else xok = v.is_numeric_type ();
rename from src/graphics.in.h rename to src/interpfcn/graphics.in.h --- a/src/graphics.in.h +++ b/src/interpfcn/graphics.in.h @@ -1413,7 +1413,7 @@ octave_value get (void) const { return data; } void add_constraint (const std::string& type) - { type_constraints.push_back (type); } + { type_constraints.insert (type); } void add_constraint (const dim_vector& dims) { size_constraints.push_back (dims); } @@ -1486,7 +1486,7 @@ double xmax; double xminp; double xmaxp; - std::list<std::string> type_constraints; + std::set<std::string> type_constraints; std::list<dim_vector> size_constraints; }; @@ -4432,6 +4432,7 @@ cdata.add_constraint ("uint8"); cdata.add_constraint ("uint16"); cdata.add_constraint ("int16"); + cdata.add_constraint ("real"); cdata.add_constraint (dim_vector (-1, -1)); cdata.add_constraint (dim_vector (-1, -1, 3)); }
new file mode 100644 --- /dev/null +++ b/src/interpfcn/module.mk @@ -0,0 +1,65 @@ +EXTRA_DIST += \ + interpfcn/module.mk + +INTERPFCN_INCLUDES = \ + interpfcn/data.h \ + interpfcn/debug.h \ + interpfcn/defun.h \ + interpfcn/dirfns.h \ + interpfcn/error.h \ + interpfcn/file-io.h \ + interpfcn/help.h \ + interpfcn/input.h \ + interpfcn/load-path.h \ + interpfcn/load-save.h \ + interpfcn/ls-oct-ascii.h \ + interpfcn/oct-hist.h \ + interpfcn/pager.h \ + interpfcn/pr-output.h \ + interpfcn/profiler.h \ + interpfcn/sighandlers.h \ + interpfcn/symtab.h \ + interpfcn/sysdep.h \ + interpfcn/toplev.h \ + interpfcn/utils.h \ + interpfcn/variables.h + +INTERPFCN_SRC = \ + interpfcn/data.cc \ + interpfcn/debug.cc \ + interpfcn/defaults.cc \ + interpfcn/defun.cc \ + interpfcn/dirfns.cc \ + interpfcn/error.cc \ + interpfcn/file-io.cc \ + interpfcn/graphics.cc \ + interpfcn/help.cc \ + interpfcn/input.cc \ + interpfcn/load-path.cc \ + interpfcn/load-save.cc \ + interpfcn/ls-oct-ascii.cc \ + interpfcn/oct-hist.cc \ + interpfcn/pager.cc \ + interpfcn/pr-output.cc \ + interpfcn/profiler.cc \ + interpfcn/sighandlers.cc \ + interpfcn/symtab.cc \ + interpfcn/sysdep.cc \ + interpfcn/toplev.cc \ + interpfcn/utils.cc \ + interpfcn/variables.cc + +## defaults.h and graphics.h must depend on Makefile. Calling configure +## may change default/config values. However, calling configure will also +## regenerate the Makefiles from Makefile.am and trigger the rules below. +interpfcn/defaults.h: interpfcn/defaults.in.h Makefile + @$(do_subst_default_vals) + +interpfcn/graphics.h: interpfcn/graphics.in.h genprops.awk Makefile + $(AWK) -f $(srcdir)/genprops.awk $< > $@-t + mv $@-t $@ + +interpfcn/graphics-props.cc: interpfcn/graphics.in.h genprops.awk Makefile + $(AWK) -v emit_graphics_props=1 -f $(srcdir)/genprops.awk $< > $@-t + mv $@-t $@ +
--- a/src/jit-ir.cc +++ b/src/jit-ir.cc @@ -598,4 +598,52 @@ return false; } +// -------------------- jit_magic_end -------------------- +jit_magic_end::jit_magic_end (const std::vector<context>& full_context) +{ + // for now we only support end in 1 dimensional indexing + resize_arguments (full_context.size ()); + + size_t i; + std::vector<context>::const_iterator iter; + for (iter = full_context.begin (), i = 0; iter != full_context.end (); ++iter, + ++i) + { + if (iter->count != 1) + throw jit_fail_exception ("end is only supported in linear contexts"); + stash_argument (i, iter->value); + } +} + +const jit_function& +jit_magic_end::overload () const +{ + jit_value *ctx = resolve_context (); + if (ctx) + return jit_typeinfo::end (ctx->type ()); + + static jit_function null_ret; + return null_ret; +} + +jit_value * +jit_magic_end::resolve_context (void) const +{ + // FIXME: We need to have a way of marking functions so we can skip them here + return argument_count () ? argument (0) : 0; +} + +bool +jit_magic_end::infer (void) +{ + jit_type *new_type = overload ().result (); + if (new_type != type ()) + { + stash_type (new_type); + return true; + } + + return false; +} + #endif
--- a/src/jit-ir.h +++ b/src/jit-ir.h @@ -46,7 +46,8 @@ JIT_METH(variable); \ JIT_METH(error_check); \ JIT_METH(assign) \ - JIT_METH(argument) + JIT_METH(argument) \ + JIT_METH(magic_end) #define JIT_VISIT_IR_CONST \ JIT_METH(const_bool); \ @@ -256,6 +257,14 @@ #undef STASH_ARG #undef JIT_INSTRUCTION_CTOR + jit_instruction (const std::vector<jit_value *>& aarguments) + : already_infered (aarguments.size ()), marguments (aarguments.size ()), + mid (next_id ()), mparent (0) + { + for (size_t i = 0; i < aarguments.size (); ++i) + stash_argument (i, aarguments[i]); + } + static void reset_ids (void) { next_id (true); @@ -1065,6 +1074,10 @@ #undef JIT_CALL_CONST + jit_call (const jit_operation& aoperation, + const std::vector<jit_value *>& args) + : jit_instruction (args), moperation (aoperation) + {} const jit_operation& operation (void) const { return moperation; } @@ -1137,6 +1150,48 @@ } }; +// for now only handles the 1D case +class +jit_magic_end : public jit_instruction +{ +public: + class + context + { + public: + context (void) : value (0), index (0), count (0) + {} + + context (jit_value *avalue, size_t aindex, size_t acount) + : value (avalue), index (aindex), count (acount) + {} + + jit_value *value; + size_t index; + size_t count; + }; + + jit_magic_end (const std::vector<context>& full_context); + + const jit_function& overload () const; + + jit_value *resolve_context (void) const; + + virtual bool infer (void); + + virtual std::ostream& short_print (std::ostream& os) const + { + return os << "magic_end"; + } + + virtual std::ostream& print (std::ostream& os, size_t indent = 0) const + { + return short_print (print_indent (os, indent)); + } + + JIT_VALUE_ACCEPT; +}; + class jit_extract_argument : public jit_assign_base {
--- a/src/jit-typeinfo.cc +++ b/src/jit-typeinfo.cc @@ -243,6 +243,57 @@ *ret = *mat; } +static void +make_indices (double *indices, octave_idx_type idx_count, + Array<idx_vector>& result) +{ + result.resize (dim_vector (1, idx_count)); + for (octave_idx_type i = 0; i < idx_count; ++i) + result(i) = idx_vector (indices[i]); +} + +extern "C" double +octave_jit_paren_scalar (jit_matrix *mat, double *indicies, + octave_idx_type idx_count) +{ + // FIXME: Replace this with a more optimal version + try + { + Array<idx_vector> idx; + make_indices (indicies, idx_count, idx); + + Array<double> ret = mat->array->index (idx); + return ret.xelem (0); + } + catch (const octave_execution_exception&) + { + gripe_library_execution_error (); + return 0; + } +} + +extern "C" void +octave_jit_paren_scalar_subsasgn (jit_matrix *ret, jit_matrix *mat, + double *indices, octave_idx_type idx_count, + double value) +{ + // FIXME: Replace this with a more optimal version + try + { + Array<idx_vector> idx; + make_indices (indices, idx_count, idx); + + Matrix temp (1, 1); + temp.xelem(0) = value; + mat->array->assign (idx, temp); + ret->update (mat->array); + } + catch (const octave_execution_exception&) + { + gripe_library_execution_error (); + } +} + extern "C" void octave_jit_paren_subsasgn_matrix_range (jit_matrix *result, jit_matrix *mat, jit_range *index, double value) @@ -522,8 +573,10 @@ jit_function::call (llvm::IRBuilderD& builder, const std::vector<jit_value *>& in_args) const { + if (! valid ()) + throw jit_fail_exception ("Call not implemented"); + assert (in_args.size () == args.size ()); - std::vector<llvm::Value *> llvm_args (args.size ()); for (size_t i = 0; i < in_args.size (); ++i) llvm_args[i] = in_args[i]->to_llvm (); @@ -535,7 +588,9 @@ jit_function::call (llvm::IRBuilderD& builder, const std::vector<llvm::Value *>& in_args) const { - assert (valid ()); + if (! valid ()) + throw jit_fail_exception ("Call not implemented"); + assert (in_args.size () == args.size ()); llvm::Function *stacksave = llvm::Intrinsic::getDeclaration (module, llvm::Intrinsic::stacksave); @@ -653,6 +708,16 @@ } // -------------------- jit_operation -------------------- +jit_operation::~jit_operation (void) +{ + for (generated_map::iterator iter = generated.begin (); + iter != generated.end (); ++iter) + { + delete iter->first; + delete iter->second; + } +} + void jit_operation::add_overload (const jit_function& func, const std::vector<jit_type*>& args) @@ -687,23 +752,26 @@ const jit_function& jit_operation::overload (const std::vector<jit_type*>& types) const { - // FIXME: We should search for the next best overload on failure static jit_function null_overload; - if (types.size () >= overloads.size ()) - return null_overload; - for (size_t i =0; i < types.size (); ++i) if (! types[i]) return null_overload; + if (types.size () >= overloads.size ()) + return do_generate (types); + const Array<jit_function>& over = overloads[types.size ()]; dim_vector dv (over.dims ()); Array<octave_idx_type> idx = to_idx (types); for (octave_idx_type i = 0; i < dv.length (); ++i) if (idx(i) >= dv(i)) - return null_overload; + return do_generate (types); - return over(idx); + const jit_function& ret = over(idx); + if (! ret.valid ()) + return do_generate (types); + + return ret; } Array<octave_idx_type> @@ -727,6 +795,175 @@ return idx; } +const jit_function& +jit_operation::do_generate (const signature_vec& types) const +{ + static jit_function null_overload; + generated_map::const_iterator find = generated.find (&types); + if (find != generated.end ()) + { + if (find->second) + return *find->second; + else + return null_overload; + } + + jit_function *ret = generate (types); + generated[new signature_vec (types)] = ret; + return ret ? *ret : null_overload; +} + +jit_function * +jit_operation::generate (const signature_vec& types) const +{ + return 0; +} + +bool +jit_operation::signature_cmp +::operator() (const signature_vec *lhs, const signature_vec *rhs) +{ + const signature_vec& l = *lhs; + const signature_vec& r = *rhs; + + if (l.size () < r.size ()) + return true; + else if (l.size () > r.size ()) + return false; + + for (size_t i = 0; i < l.size (); ++i) + { + if (l[i]->type_id () < r[i]->type_id ()) + return true; + else if (l[i]->type_id () > r[i]->type_id ()) + return false; + } + + return false; +} + +// -------------------- jit_index_operation -------------------- +jit_function * +jit_index_operation::generate (const signature_vec& types) const +{ + if (types.size () > 2 && types[0] == jit_typeinfo::get_matrix ()) + { + // indexing a matrix with scalars + jit_type *scalar = jit_typeinfo::get_scalar (); + for (size_t i = 1; i < types.size (); ++i) + if (types[i] != scalar) + return 0; + + return generate_matrix (types); + } + + return 0; +} + +llvm::Value * +jit_index_operation::create_arg_array (llvm::IRBuilderD& builder, + const jit_function &fn, size_t start_idx, + size_t end_idx) const +{ + size_t n = end_idx - start_idx; + llvm::Type *scalar_t = jit_typeinfo::get_scalar_llvm (); + llvm::ArrayType *array_t = llvm::ArrayType::get (scalar_t, n); + llvm::Value *array = llvm::UndefValue::get (array_t); + for (size_t i = start_idx; i < end_idx; ++i) + { + llvm::Value *idx = fn.argument (builder, i); + array = builder.CreateInsertValue (array, idx, i - start_idx); + } + + llvm::Value *array_mem = builder.CreateAlloca (array_t); + builder.CreateStore (array, array_mem); + return builder.CreateBitCast (array_mem, scalar_t->getPointerTo ()); +} + +// -------------------- jit_paren_subsref -------------------- +jit_function * +jit_paren_subsref::generate_matrix (const signature_vec& types) const +{ + std::stringstream ss; + ss << "jit_paren_subsref_matrix_scalar" << (types.size () - 1); + + jit_type *scalar = jit_typeinfo::get_scalar (); + jit_function *fn = new jit_function (module, jit_convention::internal, + ss.str (), scalar, types); + fn->mark_can_error (); + llvm::BasicBlock *body = fn->new_block (); + llvm::IRBuilder<> builder (body); + + llvm::Value *array = create_arg_array (builder, *fn, 1, types.size ()); + jit_type *index = jit_typeinfo::get_index (); + llvm::Value *nelem = llvm::ConstantInt::get (index->to_llvm (), + types.size () - 1); + llvm::Value *mat = fn->argument (builder, 0); + llvm::Value *ret = paren_scalar.call (builder, mat, array, nelem); + fn->do_return (builder, ret); + return fn; +} + +void +jit_paren_subsref::do_initialize (void) +{ + std::vector<jit_type *> types (3); + types[0] = jit_typeinfo::get_matrix (); + types[1] = jit_typeinfo::get_scalar_ptr (); + types[2] = jit_typeinfo::get_index (); + + jit_type *scalar = jit_typeinfo::get_scalar (); + paren_scalar = jit_function (module, jit_convention::external, + "octave_jit_paren_scalar", scalar, types); + paren_scalar.add_mapping (engine, &octave_jit_paren_scalar); + paren_scalar.mark_can_error (); +} + +// -------------------- jit_paren_subsasgn -------------------- +jit_function * +jit_paren_subsasgn::generate_matrix (const signature_vec& types) const +{ + std::stringstream ss; + ss << "jit_paren_subsasgn_matrix_scalar" << (types.size () - 2); + + jit_type *matrix = jit_typeinfo::get_matrix (); + jit_function *fn = new jit_function (module, jit_convention::internal, + ss.str (), matrix, types); + fn->mark_can_error (); + llvm::BasicBlock *body = fn->new_block (); + llvm::IRBuilder<> builder (body); + + llvm::Value *array = create_arg_array (builder, *fn, 1, types.size () - 1); + jit_type *index = jit_typeinfo::get_index (); + llvm::Value *nelem = llvm::ConstantInt::get (index->to_llvm (), + types.size () - 2); + + llvm::Value *mat = fn->argument (builder, 0); + llvm::Value *value = fn->argument (builder, types.size () - 1); + llvm::Value *ret = paren_scalar.call (builder, mat, array, nelem, value); + fn->do_return (builder, ret); + return fn; +} + +void +jit_paren_subsasgn::do_initialize (void) +{ + if (paren_scalar.valid ()) + return; + + jit_type *matrix = jit_typeinfo::get_matrix (); + std::vector<jit_type *> types (4); + types[0] = matrix; + types[1] = jit_typeinfo::get_scalar_ptr (); + types[2] = jit_typeinfo::get_index (); + types[3] = jit_typeinfo::get_scalar (); + + paren_scalar = jit_function (module, jit_convention::external, + "octave_jit_paren_scalar", matrix, types); + paren_scalar.add_mapping (engine, &octave_jit_paren_scalar_subsasgn); + paren_scalar.mark_can_error (); +} + // -------------------- jit_typeinfo -------------------- void jit_typeinfo::initialize (llvm::Module *m, llvm::ExecutionEngine *e) @@ -780,6 +1017,7 @@ matrix = new_type ("matrix", any, matrix_t); complex = new_type ("complex", any, complex_t); scalar = new_type ("scalar", complex, scalar_t); + scalar_ptr = new_type ("scalar_ptr", 0, scalar_t->getPointerTo ()); range = new_type ("range", any, range_t); string = new_type ("string", any, string_t); boolean = new_type ("bool", any, bool_t); @@ -809,6 +1047,9 @@ if (sizeof (void *) == 4) complex->mark_sret (); + paren_subsref_fn.initialize (module, engine); + paren_subsasgn_fn.initialize (module, engine); + // bind global variables lerror_state = new llvm::GlobalVariable (*module, bool_t, false, llvm::GlobalValue::ExternalLinkage, @@ -1342,8 +1583,7 @@ builder.CreateBr (done); builder.SetInsertPoint (normal); - llvm::Value *len = builder.CreateExtractValue (mat, - llvm::ArrayRef<unsigned> (2)); + llvm::Value *len = builder.CreateExtractValue (mat, 2); cond0 = builder.CreateICmpSGT (int_idx, len); llvm::Value *rcount = builder.CreateExtractValue (mat, 0); @@ -1386,6 +1626,18 @@ fn.mark_can_error (); paren_subsasgn_fn.add_overload (fn); + end_fn.stash_name ("end"); + fn = create_function (jit_convention::internal, "octave_jit_end_matrix", + scalar, matrix); + body = fn.new_block (); + builder.SetInsertPoint (body); + { + llvm::Value *mat = fn.argument (builder, 0); + llvm::Value *ret = builder.CreateExtractValue (mat, 2); + fn.do_return (builder, builder.CreateSIToFP (ret, scalar_t)); + } + end_fn.add_overload (fn); + casts[any->type_id ()].stash_name ("(any)"); casts[scalar->type_id ()].stash_name ("(scalar)"); casts[complex->type_id ()].stash_name ("(complex)");
--- a/src/jit-typeinfo.h +++ b/src/jit-typeinfo.h @@ -314,17 +314,22 @@ jit_operation { public: + // type signature vector + typedef std::vector<jit_type *> signature_vec; + + virtual ~jit_operation (void); + void add_overload (const jit_function& func) { add_overload (func, func.arguments ()); } void add_overload (const jit_function& func, - const std::vector<jit_type*>& args); + const signature_vec& args); - const jit_function& overload (const std::vector<jit_type *>& types) const; + const jit_function& overload (const signature_vec& types) const; - jit_type *result (const std::vector<jit_type *>& types) const + jit_type *result (const signature_vec& types) const { const jit_function& temp = overload (types); return temp.result (); @@ -346,14 +351,79 @@ const std::string& name (void) const { return mname; } void stash_name (const std::string& aname) { mname = aname; } +protected: + virtual jit_function *generate (const signature_vec& types) const; private: - Array<octave_idx_type> to_idx (const std::vector<jit_type*>& types) const; + Array<octave_idx_type> to_idx (const signature_vec& types) const; + + const jit_function& do_generate (const signature_vec& types) const; + + struct signature_cmp + { + bool operator() (const signature_vec *lhs, const signature_vec *rhs); + }; + + typedef std::map<const signature_vec *, jit_function *, signature_cmp> + generated_map; + + mutable generated_map generated; std::vector<Array<jit_function> > overloads; std::string mname; }; +class +jit_index_operation : public jit_operation +{ +public: + jit_index_operation (void) : module (0), engine (0) {} + + void initialize (llvm::Module *amodule, llvm::ExecutionEngine *aengine) + { + module = amodule; + engine = aengine; + do_initialize (); + } +protected: + virtual jit_function *generate (const signature_vec& types) const; + + virtual jit_function *generate_matrix (const signature_vec& types) const = 0; + + virtual void do_initialize (void) = 0; + + // helper functions + // [start_idx, end_idx). + llvm::Value *create_arg_array (llvm::IRBuilderD& builder, + const jit_function &fn, size_t start_idx, + size_t end_idx) const; + + llvm::Module *module; + llvm::ExecutionEngine *engine; +}; + +class +jit_paren_subsref : public jit_index_operation +{ +protected: + virtual jit_function *generate_matrix (const signature_vec& types) const; + + virtual void do_initialize (void); +private: + jit_function paren_scalar; +}; + +class +jit_paren_subsasgn : public jit_index_operation +{ +protected: + jit_function *generate_matrix (const signature_vec& types) const; + + virtual void do_initialize (void); +private: + jit_function paren_scalar; +}; + // A singleton class which handles the construction of jit_types and // jit_operations. class @@ -376,6 +446,8 @@ static llvm::Type *get_scalar_llvm (void) { return instance->scalar->to_llvm (); } + static jit_type *get_scalar_ptr (void) { return instance->scalar_ptr; } + static jit_type *get_range (void) { return instance->range; } static jit_type *get_string (void) { return instance->string; } @@ -471,6 +543,16 @@ { return instance->do_insert_error_check (bld); } + + static const jit_operation& end (void) + { + return instance->end_fn; + } + + static const jit_function& end (jit_type *ty) + { + return instance->end_fn.overload (ty); + } private: jit_typeinfo (llvm::Module *m, llvm::ExecutionEngine *e); @@ -633,6 +715,7 @@ jit_type *any; jit_type *matrix; jit_type *scalar; + jit_type *scalar_ptr; // a fake type for interfacing with C++ jit_type *range; jit_type *string; jit_type *boolean; @@ -653,8 +736,9 @@ jit_operation for_index_fn; jit_operation logically_true_fn; jit_operation make_range_fn; - jit_operation paren_subsref_fn; - jit_operation paren_subsasgn_fn; + jit_paren_subsref paren_subsref_fn; + jit_paren_subsasgn paren_subsasgn_fn; + jit_operation end_fn; // type id -> cast function TO that type std::vector<jit_operation> casts;
--- a/src/link-deps.mk +++ b/src/link-deps.mk @@ -3,7 +3,7 @@ if AMCOND_ENABLE_DYNAMIC_LINKING LIBOCTINTERP_LINK_DEPS = else - LIBOCTINTERP_LINK_DEPS = $(DLD_FUNCTIONS_LIBS) + LIBOCTINTERP_LINK_DEPS = $(DLDFCN_LIBS) endif LIBOCTINTERP_LINK_DEPS += \ @@ -16,7 +16,8 @@ $(OPENGL_LIBS) \ $(X11_LIBS) \ $(CARBON_LIBS) \ - $(LLVM_LIBS) + $(LLVM_LIBS) \ + $(LAPACK_LIBS) LIBOCTINTERP_LINK_OPTS = \ $(GRAPHICS_LDFLAGS) \
--- a/src/mkops +++ b/src/mkops @@ -21,7 +21,7 @@ SED=${SED:-'sed'} cat << \EOF -// DO NOT EDIT! Generated automatically by mkbuiltins. +// DO NOT EDIT! Generated automatically by mkops. #ifdef HAVE_CONFIG_H #include "config.h" @@ -32,7 +32,7 @@ EOF for file in "$@"; do - f=`echo $file | $SED 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'` + f=`echo $file | $SED 's,^\./,,; s%^operators/op-%%; s%\.cc%%; s%-%_%g'` echo "extern void install_${f}_ops (void);" done @@ -46,7 +46,7 @@ EOF for file in "$@"; do - f=`echo $file | $SED 's,^\./,,; s%^OPERATORS/op-%%; s%\.cc%%; s%-%_%g'` + f=`echo $file | $SED 's,^\./,,; s%^operators/op-%%; s%\.cc%%; s%-%_%g'` echo " install_${f}_ops ();" done
--- a/src/mxarray.in.h +++ b/src/mxarray.in.h @@ -1,3 +1,4 @@ +// DO NOT EDIT! Generated automatically from mxarray.in.h by configure /* Copyright (C) 2001-2012 Paul Kienzle
--- a/src/oct-conf.in.h +++ b/src/oct-conf.in.h @@ -1,4 +1,4 @@ -// oct-conf.h.in +// DO NOT EDIT! Generated automatically from oct-conf.in.h by configure /* Copyright (C) 1996-2012 John W. Eaton
new file mode 100644 --- /dev/null +++ b/src/octave-value/module.mk @@ -0,0 +1,126 @@ +EXTRA_DIST += \ + octave-value/module.mk + +OV_INTTYPE_INCLUDES = \ + octave-value/ov-base-int.h \ + octave-value/ov-base-int.cc \ + octave-value/ov-int-traits.h \ + octave-value/ov-int16.h \ + octave-value/ov-int32.h \ + octave-value/ov-int64.h \ + octave-value/ov-int8.h \ + octave-value/ov-intx.h \ + octave-value/ov-uint16.h \ + octave-value/ov-uint32.h \ + octave-value/ov-uint64.h \ + octave-value/ov-uint8.h + +OV_SPARSE_INCLUDES = \ + octave-value/ov-base-sparse.h \ + octave-value/ov-bool-sparse.h \ + octave-value/ov-cx-sparse.h \ + octave-value/ov-re-sparse.h + +OV_INCLUDES = \ + octave-value/ov-base-diag.h \ + octave-value/ov-base-diag.cc \ + octave-value/ov-base-mat.h \ + octave-value/ov-base-mat.cc \ + octave-value/ov-base-scalar.h \ + octave-value/ov-base-scalar.cc \ + octave-value/ov-base.h \ + octave-value/ov-bool-mat.h \ + octave-value/ov-bool-mat.cc \ + octave-value/ov-bool.h \ + octave-value/ov-builtin.h \ + octave-value/ov-cell.h \ + octave-value/ov-ch-mat.h \ + octave-value/ov-class.h \ + octave-value/ov-colon.h \ + octave-value/ov-complex.h \ + octave-value/ov-cs-list.h \ + octave-value/ov-cx-diag.h \ + octave-value/ov-cx-mat.h \ + octave-value/ov-dld-fcn.h \ + octave-value/ov-fcn-handle.h \ + octave-value/ov-fcn-inline.h \ + octave-value/ov-fcn.h \ + octave-value/ov-float.h \ + octave-value/ov-flt-complex.h \ + octave-value/ov-flt-cx-diag.h \ + octave-value/ov-flt-cx-mat.h \ + octave-value/ov-flt-re-diag.h \ + octave-value/ov-flt-re-mat.h \ + octave-value/ov-lazy-idx.h \ + octave-value/ov-mex-fcn.h \ + octave-value/ov-null-mat.h \ + octave-value/ov-oncleanup.h \ + octave-value/ov-perm.h \ + octave-value/ov-range.h \ + octave-value/ov-re-diag.h \ + octave-value/ov-re-mat.h \ + octave-value/ov-scalar.h \ + octave-value/ov-str-mat.h \ + octave-value/ov-struct.h \ + octave-value/ov-type-conv.h \ + octave-value/ov-typeinfo.h \ + octave-value/ov-usr-fcn.h \ + octave-value/ov.h \ + $(OV_INTTYPE_INCLUDES) + +OV_INTTYPE_SRC = \ + octave-value/ov-int16.cc \ + octave-value/ov-int32.cc \ + octave-value/ov-int64.cc \ + octave-value/ov-int8.cc \ + octave-value/ov-uint16.cc \ + octave-value/ov-uint32.cc \ + octave-value/ov-uint64.cc \ + octave-value/ov-uint8.cc + +OV_SPARSE_SRC = \ + octave-value/ov-base-sparse.cc \ + octave-value/ov-bool-sparse.cc \ + octave-value/ov-cx-sparse.cc \ + octave-value/ov-re-sparse.cc + +OCTAVE_VALUE_SRC = \ + octave-value/ov-base.cc \ + octave-value/ov-bool-mat.cc \ + octave-value/ov-bool.cc \ + octave-value/ov-builtin.cc \ + octave-value/ov-cell.cc \ + octave-value/ov-ch-mat.cc \ + octave-value/ov-class.cc \ + octave-value/ov-colon.cc \ + octave-value/ov-complex.cc \ + octave-value/ov-cs-list.cc \ + octave-value/ov-cx-diag.cc \ + octave-value/ov-cx-mat.cc \ + octave-value/ov-dld-fcn.cc \ + octave-value/ov-fcn-handle.cc \ + octave-value/ov-fcn-inline.cc \ + octave-value/ov-fcn.cc \ + octave-value/ov-float.cc \ + octave-value/ov-flt-complex.cc \ + octave-value/ov-flt-cx-diag.cc \ + octave-value/ov-flt-cx-mat.cc \ + octave-value/ov-flt-re-diag.cc \ + octave-value/ov-flt-re-mat.cc \ + octave-value/ov-lazy-idx.cc \ + octave-value/ov-mex-fcn.cc \ + octave-value/ov-null-mat.cc \ + octave-value/ov-oncleanup.cc \ + octave-value/ov-perm.cc \ + octave-value/ov-range.cc \ + octave-value/ov-re-diag.cc \ + octave-value/ov-re-mat.cc \ + octave-value/ov-scalar.cc \ + octave-value/ov-str-mat.cc \ + octave-value/ov-struct.cc \ + octave-value/ov-typeinfo.cc \ + octave-value/ov-usr-fcn.cc \ + octave-value/ov.cc \ + $(OV_INTTYPE_SRC) \ + $(OV_SPARSE_SRC) +
rename from src/OPERATORS/module.mk rename to src/operators/module.mk --- a/src/OPERATORS/module.mk +++ b/src/operators/module.mk @@ -1,136 +1,136 @@ -EXTRA_DIST += OPERATORS/module.mk +EXTRA_DIST += operators/module.mk OPERATORS_SRC = \ - OPERATORS/op-b-b.cc \ - OPERATORS/op-b-bm.cc \ - OPERATORS/op-b-sbm.cc \ - OPERATORS/op-bm-b.cc \ - OPERATORS/op-bm-bm.cc \ - OPERATORS/op-bm-sbm.cc \ - OPERATORS/op-cdm-cdm.cc \ - OPERATORS/op-cdm-cm.cc \ - OPERATORS/op-cdm-cs.cc \ - OPERATORS/op-cdm-dm.cc \ - OPERATORS/op-cdm-m.cc \ - OPERATORS/op-cdm-s.cc \ - OPERATORS/op-cell.cc \ - OPERATORS/op-chm.cc \ - OPERATORS/op-class.cc \ - OPERATORS/op-cm-cdm.cc \ - OPERATORS/op-cm-cm.cc \ - OPERATORS/op-cm-cs.cc \ - OPERATORS/op-cm-dm.cc \ - OPERATORS/op-cm-m.cc \ - OPERATORS/op-cm-pm.cc \ - OPERATORS/op-cm-s.cc \ - OPERATORS/op-cm-scm.cc \ - OPERATORS/op-cm-sm.cc \ - OPERATORS/op-cs-cm.cc \ - OPERATORS/op-cs-cs.cc \ - OPERATORS/op-cs-m.cc \ - OPERATORS/op-cs-s.cc \ - OPERATORS/op-cs-scm.cc \ - OPERATORS/op-cs-sm.cc \ - OPERATORS/op-dm-cdm.cc \ - OPERATORS/op-dm-cm.cc \ - OPERATORS/op-dm-cs.cc \ - OPERATORS/op-dm-dm.cc \ - OPERATORS/op-dm-m.cc \ - OPERATORS/op-dm-s.cc \ - OPERATORS/op-dm-scm.cc \ - OPERATORS/op-dm-sm.cc \ - OPERATORS/op-double-conv.cc \ - OPERATORS/op-fcdm-fcdm.cc \ - OPERATORS/op-fcdm-fcm.cc \ - OPERATORS/op-fcdm-fcs.cc \ - OPERATORS/op-fcdm-fdm.cc \ - OPERATORS/op-fcdm-fm.cc \ - OPERATORS/op-fcdm-fs.cc \ - OPERATORS/op-fcm-fcdm.cc \ - OPERATORS/op-fcm-fcm.cc \ - OPERATORS/op-fcm-fcs.cc \ - OPERATORS/op-fcm-fdm.cc \ - OPERATORS/op-fcm-fm.cc \ - OPERATORS/op-fcm-fs.cc \ - OPERATORS/op-fcm-pm.cc \ - OPERATORS/op-fcn.cc \ - OPERATORS/op-fcs-fcm.cc \ - OPERATORS/op-fcs-fcs.cc \ - OPERATORS/op-fcs-fm.cc \ - OPERATORS/op-fcs-fs.cc \ - OPERATORS/op-fdm-fcdm.cc \ - OPERATORS/op-fdm-fcm.cc \ - OPERATORS/op-fdm-fcs.cc \ - OPERATORS/op-fdm-fdm.cc \ - OPERATORS/op-fdm-fm.cc \ - OPERATORS/op-fdm-fs.cc \ - OPERATORS/op-float-conv.cc \ - OPERATORS/op-fm-fcdm.cc \ - OPERATORS/op-fm-fcm.cc \ - OPERATORS/op-fm-fcs.cc \ - OPERATORS/op-fm-fdm.cc \ - OPERATORS/op-fm-fm.cc \ - OPERATORS/op-fm-fs.cc \ - OPERATORS/op-fm-pm.cc \ - OPERATORS/op-fs-fcm.cc \ - OPERATORS/op-fs-fcs.cc \ - OPERATORS/op-fs-fm.cc \ - OPERATORS/op-fs-fs.cc \ - OPERATORS/op-i16-i16.cc \ - OPERATORS/op-i32-i32.cc \ - OPERATORS/op-i64-i64.cc \ - OPERATORS/op-i8-i8.cc \ - OPERATORS/op-int-concat.cc \ - OPERATORS/op-int-conv.cc \ - OPERATORS/op-m-cdm.cc \ - OPERATORS/op-m-cm.cc \ - OPERATORS/op-m-cs.cc \ - OPERATORS/op-m-dm.cc \ - OPERATORS/op-m-m.cc \ - OPERATORS/op-m-pm.cc \ - OPERATORS/op-m-s.cc \ - OPERATORS/op-m-scm.cc \ - OPERATORS/op-m-sm.cc \ - OPERATORS/op-pm-cm.cc \ - OPERATORS/op-pm-fcm.cc \ - OPERATORS/op-pm-fm.cc \ - OPERATORS/op-pm-m.cc \ - OPERATORS/op-pm-pm.cc \ - OPERATORS/op-pm-scm.cc \ - OPERATORS/op-pm-sm.cc \ - OPERATORS/op-range.cc \ - OPERATORS/op-s-cm.cc \ - OPERATORS/op-s-cs.cc \ - OPERATORS/op-s-m.cc \ - OPERATORS/op-s-s.cc \ - OPERATORS/op-s-scm.cc \ - OPERATORS/op-s-sm.cc \ - OPERATORS/op-sbm-b.cc \ - OPERATORS/op-sbm-bm.cc \ - OPERATORS/op-sbm-sbm.cc \ - OPERATORS/op-scm-cm.cc \ - OPERATORS/op-scm-cs.cc \ - OPERATORS/op-scm-m.cc \ - OPERATORS/op-scm-s.cc \ - OPERATORS/op-scm-scm.cc \ - OPERATORS/op-scm-sm.cc \ - OPERATORS/op-sm-cm.cc \ - OPERATORS/op-sm-cs.cc \ - OPERATORS/op-sm-m.cc \ - OPERATORS/op-sm-s.cc \ - OPERATORS/op-sm-scm.cc \ - OPERATORS/op-sm-sm.cc \ - OPERATORS/op-str-m.cc \ - OPERATORS/op-str-s.cc \ - OPERATORS/op-str-str.cc \ - OPERATORS/op-struct.cc \ - OPERATORS/op-ui16-ui16.cc \ - OPERATORS/op-ui32-ui32.cc \ - OPERATORS/op-ui64-ui64.cc \ - OPERATORS/op-ui8-ui8.cc + operators/op-b-b.cc \ + operators/op-b-bm.cc \ + operators/op-b-sbm.cc \ + operators/op-bm-b.cc \ + operators/op-bm-bm.cc \ + operators/op-bm-sbm.cc \ + operators/op-cdm-cdm.cc \ + operators/op-cdm-cm.cc \ + operators/op-cdm-cs.cc \ + operators/op-cdm-dm.cc \ + operators/op-cdm-m.cc \ + operators/op-cdm-s.cc \ + operators/op-cell.cc \ + operators/op-chm.cc \ + operators/op-class.cc \ + operators/op-cm-cdm.cc \ + operators/op-cm-cm.cc \ + operators/op-cm-cs.cc \ + operators/op-cm-dm.cc \ + operators/op-cm-m.cc \ + operators/op-cm-pm.cc \ + operators/op-cm-s.cc \ + operators/op-cm-scm.cc \ + operators/op-cm-sm.cc \ + operators/op-cs-cm.cc \ + operators/op-cs-cs.cc \ + operators/op-cs-m.cc \ + operators/op-cs-s.cc \ + operators/op-cs-scm.cc \ + operators/op-cs-sm.cc \ + operators/op-dm-cdm.cc \ + operators/op-dm-cm.cc \ + operators/op-dm-cs.cc \ + operators/op-dm-dm.cc \ + operators/op-dm-m.cc \ + operators/op-dm-s.cc \ + operators/op-dm-scm.cc \ + operators/op-dm-sm.cc \ + operators/op-double-conv.cc \ + operators/op-fcdm-fcdm.cc \ + operators/op-fcdm-fcm.cc \ + operators/op-fcdm-fcs.cc \ + operators/op-fcdm-fdm.cc \ + operators/op-fcdm-fm.cc \ + operators/op-fcdm-fs.cc \ + operators/op-fcm-fcdm.cc \ + operators/op-fcm-fcm.cc \ + operators/op-fcm-fcs.cc \ + operators/op-fcm-fdm.cc \ + operators/op-fcm-fm.cc \ + operators/op-fcm-fs.cc \ + operators/op-fcm-pm.cc \ + operators/op-fcn.cc \ + operators/op-fcs-fcm.cc \ + operators/op-fcs-fcs.cc \ + operators/op-fcs-fm.cc \ + operators/op-fcs-fs.cc \ + operators/op-fdm-fcdm.cc \ + operators/op-fdm-fcm.cc \ + operators/op-fdm-fcs.cc \ + operators/op-fdm-fdm.cc \ + operators/op-fdm-fm.cc \ + operators/op-fdm-fs.cc \ + operators/op-float-conv.cc \ + operators/op-fm-fcdm.cc \ + operators/op-fm-fcm.cc \ + operators/op-fm-fcs.cc \ + operators/op-fm-fdm.cc \ + operators/op-fm-fm.cc \ + operators/op-fm-fs.cc \ + operators/op-fm-pm.cc \ + operators/op-fs-fcm.cc \ + operators/op-fs-fcs.cc \ + operators/op-fs-fm.cc \ + operators/op-fs-fs.cc \ + operators/op-i16-i16.cc \ + operators/op-i32-i32.cc \ + operators/op-i64-i64.cc \ + operators/op-i8-i8.cc \ + operators/op-int-concat.cc \ + operators/op-int-conv.cc \ + operators/op-m-cdm.cc \ + operators/op-m-cm.cc \ + operators/op-m-cs.cc \ + operators/op-m-dm.cc \ + operators/op-m-m.cc \ + operators/op-m-pm.cc \ + operators/op-m-s.cc \ + operators/op-m-scm.cc \ + operators/op-m-sm.cc \ + operators/op-pm-cm.cc \ + operators/op-pm-fcm.cc \ + operators/op-pm-fm.cc \ + operators/op-pm-m.cc \ + operators/op-pm-pm.cc \ + operators/op-pm-scm.cc \ + operators/op-pm-sm.cc \ + operators/op-range.cc \ + operators/op-s-cm.cc \ + operators/op-s-cs.cc \ + operators/op-s-m.cc \ + operators/op-s-s.cc \ + operators/op-s-scm.cc \ + operators/op-s-sm.cc \ + operators/op-sbm-b.cc \ + operators/op-sbm-bm.cc \ + operators/op-sbm-sbm.cc \ + operators/op-scm-cm.cc \ + operators/op-scm-cs.cc \ + operators/op-scm-m.cc \ + operators/op-scm-s.cc \ + operators/op-scm-scm.cc \ + operators/op-scm-sm.cc \ + operators/op-sm-cm.cc \ + operators/op-sm-cs.cc \ + operators/op-sm-m.cc \ + operators/op-sm-s.cc \ + operators/op-sm-scm.cc \ + operators/op-sm-sm.cc \ + operators/op-str-m.cc \ + operators/op-str-s.cc \ + operators/op-str-str.cc \ + operators/op-struct.cc \ + operators/op-ui16-ui16.cc \ + operators/op-ui32-ui32.cc \ + operators/op-ui64-ui64.cc \ + operators/op-ui8-ui8.cc octinclude_HEADERS += \ - OPERATORS/op-dm-template.cc \ - OPERATORS/op-dms-template.cc \ - OPERATORS/op-int.h \ - OPERATORS/op-pm-template.cc + operators/op-dm-template.cc \ + operators/op-dms-template.cc \ + operators/op-int.h \ + operators/op-pm-template.cc
new file mode 100644 --- /dev/null +++ b/src/parse-tree/module.mk @@ -0,0 +1,75 @@ +EXTRA_DIST += \ + parse-tree/module.mk + +PARSER_INCLUDES = \ + parse-tree/lex.h \ + parse-tree/parse.h \ + parse-tree/parse-private.h + +PARSER_SRC = \ + parse-tree/lex.ll \ + parse-tree/oct-parse.yy + +lex.lo lex.o oct-parse.lo oct-parse.o: \ + AM_CXXFLAGS := $(filter-out -Wold-style-cast, $(AM_CXXFLAGS)) + +PT_INCLUDES = \ + parse-tree/pt-all.h \ + parse-tree/pt-arg-list.h \ + parse-tree/pt-assign.h \ + parse-tree/pt-binop.h \ + parse-tree/pt-bp.h \ + parse-tree/pt-cbinop.h \ + parse-tree/pt-cell.h \ + parse-tree/pt-check.h \ + parse-tree/pt-cmd.h \ + parse-tree/pt-colon.h \ + parse-tree/pt-const.h \ + parse-tree/pt-decl.h \ + parse-tree/pt-eval.h \ + parse-tree/pt-except.h \ + parse-tree/pt-exp.h \ + parse-tree/pt-fcn-handle.h \ + parse-tree/pt-id.h \ + parse-tree/pt-idx.h \ + parse-tree/pt-jump.h \ + parse-tree/pt-loop.h \ + parse-tree/pt-mat.h \ + parse-tree/pt-misc.h \ + parse-tree/pt-pr-code.h \ + parse-tree/pt-select.h \ + parse-tree/pt-stmt.h \ + parse-tree/pt-unop.h \ + parse-tree/pt-walk.h \ + parse-tree/pt.h \ + $(PARSER_INCLUDES) + +PARSE_TREE_SRC = \ + parse-tree/pt-arg-list.cc \ + parse-tree/pt-assign.cc \ + parse-tree/pt-binop.cc \ + parse-tree/pt-bp.cc \ + parse-tree/pt-cbinop.cc \ + parse-tree/pt-cell.cc \ + parse-tree/pt-check.cc \ + parse-tree/pt-cmd.cc \ + parse-tree/pt-colon.cc \ + parse-tree/pt-const.cc \ + parse-tree/pt-decl.cc \ + parse-tree/pt-eval.cc \ + parse-tree/pt-except.cc \ + parse-tree/pt-exp.cc \ + parse-tree/pt-fcn-handle.cc \ + parse-tree/pt-id.cc \ + parse-tree/pt-idx.cc \ + parse-tree/pt-jump.cc \ + parse-tree/pt-loop.cc \ + parse-tree/pt-mat.cc \ + parse-tree/pt-misc.cc \ + parse-tree/pt-pr-code.cc \ + parse-tree/pt-select.cc \ + parse-tree/pt-stmt.cc \ + parse-tree/pt-unop.cc \ + parse-tree/pt.cc \ + $(PARSER_SRC) +
--- a/src/pt-jit.cc +++ b/src/pt-jit.cc @@ -412,7 +412,14 @@ void jit_convert::visit_identifier (tree_identifier& ti) { - result = get_variable (ti.name ()); + if (ti.has_magic_end ()) + { + if (!end_context.size ()) + throw jit_fail_exception ("Illegal end"); + result = block->append (create<jit_magic_end> (end_context)); + } + else + result = get_variable (ti.name ()); } void @@ -511,11 +518,7 @@ void jit_convert::visit_index_expression (tree_index_expression& exp) { - std::pair<jit_value *, jit_value *> res = resolve (exp); - jit_value *object = res.first; - jit_value *index = res.second; - - result = create_checked (jit_typeinfo::paren_subsref, object, index); + result = resolve (jit_typeinfo::paren_subsref (), exp); } void @@ -806,8 +809,9 @@ return ss.str (); } -std::pair<jit_value *, jit_value *> -jit_convert::resolve (tree_index_expression& exp) +jit_instruction * +jit_convert::resolve (const jit_operation& fres, tree_index_expression& exp, + jit_value *extra_arg) { std::string type = exp.type_tags (); if (! (type.size () == 1 && type[0] == '(')) @@ -821,15 +825,31 @@ if (! arg_list) throw jit_fail_exception ("null argument list"); - if (arg_list->size () != 1) - throw jit_fail_exception ("Bad number of arguments in arg_list"); + if (arg_list->size () < 1) + throw jit_fail_exception ("Empty arg_list"); tree_expression *tree_object = exp.expression (); jit_value *object = visit (tree_object); - tree_expression *arg0 = arg_list->front (); - jit_value *index = visit (arg0); + + size_t narg = arg_list->size (); + tree_argument_list::iterator iter = arg_list->begin (); + bool have_extra = extra_arg; + std::vector<jit_value *> call_args (narg + 1 + have_extra); + call_args[0] = object; - return std::make_pair (object, index); + for (size_t idx = 0; iter != arg_list->end (); ++idx, ++iter) + { + unwind_protect prot; + prot.add_method (&end_context, + &std::vector<jit_magic_end::context>::pop_back); + end_context.push_back (jit_magic_end::context (object, idx, narg)); + call_args[idx + 1] = visit (*iter); + } + + if (extra_arg) + call_args[call_args.size () - 1] = extra_arg; + + return create_checked (fres, call_args); } jit_value * @@ -843,14 +863,9 @@ else if (tree_index_expression *idx = dynamic_cast<tree_index_expression *> (exp)) { - std::pair<jit_value *, jit_value *> res = resolve (*idx); - jit_value *object = res.first; - jit_value *index = res.second; - jit_call *new_object = create<jit_call> (&jit_typeinfo::paren_subsasgn, - object, index, rhs); - block->append (new_object); + jit_value *new_object = resolve (jit_typeinfo::paren_subsasgn (), *idx, + rhs); do_assign (idx->expression (), new_object, true); - create_check (new_object); // FIXME: Will not work for values that must be release/grabed return rhs; @@ -1479,6 +1494,14 @@ jit_convert::convert_llvm::visit (jit_argument&) {} +void +jit_convert::convert_llvm::visit (jit_magic_end& me) +{ + const jit_function& ol = me.overload (); + llvm::Value *ret = ol.call (builder, me.resolve_context ()); + me.stash_llvm (ret); +} + // -------------------- tree_jit -------------------- tree_jit::tree_jit (void) : module (0), engine (0) @@ -1823,4 +1846,62 @@ %! endwhile %! assert (i == niter); +%!test +%! niter = 1001; +%! result = 0; +%! m = [5 10]; +%! for i=1:niter +%! result = result + m(end); +%! endfor +%! assert (result == m(end) * niter); + +%!test +%! ndim = 100; +%! result = 0; +%! m = zeros (ndim); +%! m(:) = 1:ndim^2; +%! i = 1; +%! while (i <= ndim) +%! for j = 1:ndim +%! result = result + m(i, j); +%! endfor +%! i = i + 1; +%! endwhile +%! assert (result == sum (sum (m))); + +%!test +%! ndim = 100; +%! m = zeros (ndim); +%! i = 1; +%! while (i <= ndim) +%! for j = 1:ndim +%! m(i, j) = (j - 1) * ndim + i; +%! endfor +%! i = i + 1; +%! endwhile +%! m2 = zeros (ndim); +%! m2(:) = 1:(ndim^2); +%! assert (all (m == m2)); + +%!test +%! ndim = 2; +%! m = zeros (ndim, ndim, ndim, ndim); +%! result = 0; +%! i0 = 1; +%! while (i0 <= ndim) +%! for i1 = 1:ndim +%! for i2 = 1:ndim +%! for i3 = 1:ndim +%! m(i0, i1, i2, i3) = 1; +%! m(i0, i1, i2, i3, 1, 1, 1, 1, 1, 1) = 1; +%! result = result + m(i0, i1, i2, i3); +%! endfor +%! endfor +%! endfor +%! i0 = i0 + 1; +%! endwhile +%! expected = ones (ndim, ndim, ndim, ndim); +%! assert (all (m == expected)); +%! assert (result == sum (expected (:))); + */
--- a/src/pt-jit.h +++ b/src/pt-jit.h @@ -244,6 +244,8 @@ std::list<jit_value *> all_values; + std::vector<jit_magic_end::context> end_context; + size_t iterator_count; size_t for_bounds_count; size_t short_count; @@ -294,7 +296,9 @@ std::string next_name (const char *prefix, size_t& count, bool inc); - std::pair<jit_value *, jit_value *> resolve (tree_index_expression& exp); + jit_instruction *resolve (const jit_operation& fres, + tree_index_expression& exp, + jit_value *extra_arg = 0); jit_value *do_assign (tree_expression *exp, jit_value *rhs, bool artificial = false);
rename from src/TEMPLATE-INST/module.mk rename to src/template-inst/module.mk --- a/src/TEMPLATE-INST/module.mk +++ b/src/template-inst/module.mk @@ -1,6 +1,6 @@ -EXTRA_DIST += TEMPLATE-INST/module.mk +EXTRA_DIST += template-inst/module.mk TEMPLATE_INST_SRC = \ - TEMPLATE-INST/Array-os.cc \ - TEMPLATE-INST/Array-tc.cc \ - TEMPLATE-INST/Array-jit.cc + template-inst/Array-os.cc \ + template-inst/Array-tc.cc \ + template-inst/Array-jit.cc