# HG changeset patch # User jwe # Date 1153934350 0 # Node ID 80d3933fb8b63aa4cd670e4cb95ecf0e96fc1032 # Parent 11bb9bf343a05658607fafdb763c375544519709 [project @ 2006-07-26 17:19:10 by jwe] diff -r 11bb9bf343a0 -r 80d3933fb8b6 ChangeLog --- a/ChangeLog Wed Jul 26 03:36:33 2006 +0000 +++ b/ChangeLog Wed Jul 26 17:19:10 2006 +0000 @@ -1,3 +1,9 @@ +2006-07-26 John W. Eaton + + * mkoctfile.in (Options): Accept -g. + + * configure.in: Check for exp2 and log2. + 2006-07-25 David Bateman * mysparse.c: New file. diff -r 11bb9bf343a0 -r 80d3933fb8b6 configure.in --- a/configure.in Wed Jul 26 03:36:33 2006 +0000 +++ b/configure.in Wed Jul 26 17:19:10 2006 +0000 @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.515 $) +AC_REVISION($Revision: 1.516 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -1412,7 +1412,7 @@ ### Check for nonstandard but common math functions that we need. -AC_CHECK_FUNCS(acosh asinh atanh erf erfc) +AC_CHECK_FUNCS(acosh asinh atanh erf erfc, exp2, log2) ### Checks for OS specific cruft. diff -r 11bb9bf343a0 -r 80d3933fb8b6 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Jul 26 03:36:33 2006 +0000 +++ b/liboctave/ChangeLog Wed Jul 26 17:19:10 2006 +0000 @@ -1,3 +1,21 @@ +2006-07-26 John W. Eaton + + * dbleDET.cc (DET::initialize10, DET::value_will_underflow, + DET::value_will_overflow): Use xlog2 instead of log2. + (DET::initialize2, DET::initialize10): Use xround instead of round. + (DET::initialize2, DET::value): Use xexp2 instead of exp2. + * CmplxDET.cc (ComplexDET::initialize10, + ComplexDET::value_will_underflow, + ComplexDET::value_will_overflow): Use xlog2 instead of log2. + (ComplexDET::initialize2, ComplexDET::initialize10): + Use xround instead of round. + (ComplexDET::initialize2, ComplexDET::value): + Use xexp2 instead of exp2. + + * lo-mappers.cc (M_LOG10E): Delete unused macro. + (xlog2, xexp2): New functions. + * lo-mappers.h: Provide decls. + 2006-07-22 John W. Eaton * Sparse.h (Sparse::mex_get_data, Sparse::mex_get_ir, diff -r 11bb9bf343a0 -r 80d3933fb8b6 liboctave/CmplxDET.cc --- a/liboctave/CmplxDET.cc Wed Jul 26 03:36:33 2006 +0000 +++ b/liboctave/CmplxDET.cc Wed Jul 26 17:19:10 2006 +0000 @@ -37,7 +37,7 @@ ComplexDET::value_will_overflow (void) const { return base2 - ? (e2 + 1 > log2 (DBL_MAX) ? 1 : 0) + ? (e2 + 1 > xlog2 (DBL_MAX) ? 1 : 0) : (e10 + 1 > log10 (DBL_MAX) ? 1 : 0); } @@ -45,7 +45,7 @@ ComplexDET::value_will_underflow (void) const { return base2 - ? (e2 - 1 < log2 (DBL_MIN) ? 1 : 0) + ? (e2 - 1 < xlog2 (DBL_MIN) ? 1 : 0) : (e10 - 1 < log10 (DBL_MIN) ? 1 : 0); } @@ -54,8 +54,8 @@ { if (c2 != 0.0) { - double etmp = e2 / log2 (10); - e10 = static_cast (round (etmp)); + double etmp = e2 / xlog2 (10); + e10 = static_cast (xround (etmp)); etmp -= e10; c10 = c2 * pow (10.0, etmp); } @@ -67,16 +67,16 @@ if (c10 != 0.0) { double etmp = e10 / log10 (2); - e2 = static_cast (round (etmp)); + e2 = static_cast (xround (etmp)); etmp -= e2; - c2 = c10 * exp2 (etmp); + c2 = c10 * xexp2 (etmp); } } Complex ComplexDET::value (void) const { - return base2 ? c2 * exp2 (e2) : c10 * pow (10.0, e10); + return base2 ? c2 * xexp2 (e2) : c10 * pow (10.0, e10); } /* diff -r 11bb9bf343a0 -r 80d3933fb8b6 liboctave/dbleDET.cc --- a/liboctave/dbleDET.cc Wed Jul 26 03:36:33 2006 +0000 +++ b/liboctave/dbleDET.cc Wed Jul 26 17:19:10 2006 +0000 @@ -29,12 +29,13 @@ #include #include "dbleDET.h" +#include "lo-mappers.h" bool DET::value_will_overflow (void) const { return base2 - ? (e2 + 1 > log2 (DBL_MAX) ? 1 : 0) + ? (e2 + 1 > xlog2 (DBL_MAX) ? 1 : 0) : (e10 + 1 > log10 (DBL_MAX) ? 1 : 0); } @@ -42,7 +43,7 @@ DET::value_will_underflow (void) const { return base2 - ? (e2 - 1 < log2 (DBL_MIN) ? 1 : 0) + ? (e2 - 1 < xlog2 (DBL_MIN) ? 1 : 0) : (e10 - 1 < log10 (DBL_MIN) ? 1 : 0); } @@ -51,8 +52,8 @@ { if (c2 != 0.0) { - double etmp = e2 / log2 (10); - e10 = static_cast (round (etmp)); + double etmp = e2 / xlog2 (10); + e10 = static_cast (xround (etmp)); etmp -= e10; c10 = c2 * pow (10.0, etmp); } @@ -64,16 +65,16 @@ if (c10 != 0.0) { double etmp = e10 / log10 (2); - e2 = static_cast (round (etmp)); + e2 = static_cast (xround (etmp)); etmp -= e2; - c2 = c10 * exp2 (etmp); + c2 = c10 * xexp2 (etmp); } } double DET::value (void) const { - return base2 ? c2 * exp2 (e2) : c10 * pow (10.0, e10); + return base2 ? c2 * xexp2 (e2) : c10 * pow (10.0, e10); } /* diff -r 11bb9bf343a0 -r 80d3933fb8b6 liboctave/lo-mappers.cc --- a/liboctave/lo-mappers.cc Wed Jul 26 03:36:33 2006 +0000 +++ b/liboctave/lo-mappers.cc Wed Jul 26 17:19:10 2006 +0000 @@ -41,10 +41,6 @@ #include "f77-fcn.h" -#ifndef M_LOG10E -#define M_LOG10E 0.43429448190325182765 -#endif - // double -> double mappers. double @@ -100,6 +96,38 @@ return xisnan (x) ? octave_NaN : tmp; } +double +xlog2 (double x) +{ +#if defined (HAVE_LOG2) + return log2 (x); +#else +#if defined (M_LN2) + static double ln2 = M_LN2; +#else + static double ln2 = log2 (2); +#endif + + return log (x) / ln2; +#endif +} + +double +xexp2 (double x) +{ +#if defined (HAVE_EXP2) + return exp2 (x); +#else +#if defined (M_LN2) + static double ln2 = M_LN2; +#else + static double ln2 = log2 (2); +#endif + + return exp (x * ln2); +#endif +} + // double -> bool mappers. bool diff -r 11bb9bf343a0 -r 80d3933fb8b6 liboctave/lo-mappers.h --- a/liboctave/lo-mappers.h Wed Jul 26 03:36:33 2006 +0000 +++ b/liboctave/lo-mappers.h Wed Jul 26 17:19:10 2006 +0000 @@ -33,6 +33,8 @@ extern double real (double x); extern double xround (double x); extern double signum (double x); +extern double xlog2 (double x); +extern double xexp2 (double x); extern bool xisnan (double x); extern bool xfinite (double x); diff -r 11bb9bf343a0 -r 80d3933fb8b6 mkoctfile.in --- a/mkoctfile.in Wed Jul 26 03:36:33 2006 +0000 +++ b/mkoctfile.in Wed Jul 26 17:19:10 2006 +0000 @@ -154,6 +154,8 @@ (or .mex if --mex is specified) unless linking a stand-alone executable. + -g Enable debugging options for compilers. + -p VAR, --print VAR Print configuration variable VAR. Recognized variables are: @@ -249,6 +251,11 @@ -c | --compile) link=false ;; + -g) + ALL_CFLAGS="$ALL_CFLAGS -g" + ALL_CXXFLAGS="$ALL_CXXFLAGS -g" + ALL_FFLAGS="$ALL_FFLAGS -g" + ;; --link-stand-alone) link_stand_alone=true ;; diff -r 11bb9bf343a0 -r 80d3933fb8b6 scripts/ChangeLog --- a/scripts/ChangeLog Wed Jul 26 03:36:33 2006 +0000 +++ b/scripts/ChangeLog Wed Jul 26 17:19:10 2006 +0000 @@ -1,3 +1,7 @@ +2006-07-26 John W. Eaton + + * miscellaneous/mex.m: New function. + 2006-07-22 John W. Eaton * special-matrix/hadamard.m: Coerce bool matrix to double. diff -r 11bb9bf343a0 -r 80d3933fb8b6 scripts/miscellaneous/mex.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/miscellaneous/mex.m Wed Jul 26 17:19:10 2006 +0000 @@ -0,0 +1,32 @@ +## Copyright (C) 2006 David Bateman +## +## This file is part of Octave. +## +## Octave is free software; you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## Octave is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with Octave; see the file COPYING. If not, write to the Free +## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +## 02110-1301, USA. + +## -*- texinfo -*- +## @deftypefn {Function File} {} mex [options] file ... +## Compile source code written in C, C++, or Fortran, to a MEX file. +## This is equivalent to @code {mkoctfile --mex [options] file}. +## @seealso{mkoctfile} +## @end deftypefn + +## PKG_ADD: mark_as_command mex + +function mex (varargin) + args = {"--mex", varargin{:}}; + mkoctfile (args{:}); +endfunction diff -r 11bb9bf343a0 -r 80d3933fb8b6 scripts/miscellaneous/mkoctfile.m --- a/scripts/miscellaneous/mkoctfile.m Wed Jul 26 03:36:33 2006 +0000 +++ b/scripts/miscellaneous/mkoctfile.m Wed Jul 26 17:19:10 2006 +0000 @@ -50,8 +50,13 @@ ## @item -c ## Compile but do not link. ## -## @item -o FILE|--output FILE -## Output file name; by default extension is .oct. +## @item -g +## Enable debugging options for compilers. +## +## @item -o FILE|--output FILE +## Output file name. Default extension is .oct +## (or .mex if --mex is specified) unless linking +## a stand-alone executable. ## ## @item -p VAR|--print VAR ## Print the configuration variable VAR. Recognized variables are: @@ -82,6 +87,10 @@ ## @item --link-stand-alone ## Link a stand-alone executable file. ## +## @item --mex +## Assume we are creating a MEX file. Set the default output extension +## to ".mex". +## ## @item -s|--strip ## Strip the output file. ## diff -r 11bb9bf343a0 -r 80d3933fb8b6 src/ChangeLog --- a/src/ChangeLog Wed Jul 26 03:36:33 2006 +0000 +++ b/src/ChangeLog Wed Jul 26 17:19:10 2006 +0000 @@ -1,3 +1,10 @@ +2006-07-26 John W. Eaton + + * octave.cc (maximum_braindamage): Use disable_warning instead of + bind_internal_variable to disable function-name-clash warning. + * error.cc (disable_warning): No longer static. + * error.h: Provide decl. + 2006-07-25 David Bateman * mex.cc (mxArray_octave_value::get_class_id): Handle sparse. diff -r 11bb9bf343a0 -r 80d3933fb8b6 src/error.cc --- a/src/error.cc Wed Jul 26 03:36:33 2006 +0000 +++ b/src/error.cc Wed Jul 26 17:19:10 2006 +0000 @@ -1076,7 +1076,7 @@ return retval; } -static void +void disable_warning (const std::string& id) { octave_value_list args; diff -r 11bb9bf343a0 -r 80d3933fb8b6 src/error.h --- a/src/error.h Wed Jul 26 03:36:33 2006 +0000 +++ b/src/error.h Wed Jul 26 17:19:10 2006 +0000 @@ -60,6 +60,7 @@ // Helper function for print_usage defined in defun.cc. extern void defun_usage_message (const std::string& msg); +extern void disable_warning (const std::string& id); extern void initialize_default_warning_state (void); // Current error state. diff -r 11bb9bf343a0 -r 80d3933fb8b6 src/octave.cc --- a/src/octave.cc Wed Jul 26 03:36:33 2006 +0000 +++ b/src/octave.cc Wed Jul 26 17:19:10 2006 +0000 @@ -492,7 +492,8 @@ "%%-- %D %I:%M %p --%%"); bind_internal_variable ("page_screen_output", false); bind_internal_variable ("print_empty_dimensions", false); - bind_internal_variable ("warn_function_name_clash", false); + + disable_warning ("Octave:function-name-clash"); } // You guessed it.