Mercurial > hg > octave-max
changeset 5781:faafc2d98b8d
[project @ 2006-05-02 19:40:19 by jwe]
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-05-02 John W. Eaton <jwe@octave.org> + + * NEWS: New contents for 3.0. + * NEWS.2: Move contents of NEWS here. + +2006-04-29 John W. Eaton <jwe@octave.org> + + * run-octave.in: Execute $builddir/src/octave, not src/octave. + 2006-04-26 Thomas Weber <thomas.weber.mail@gmail.com> * configure.in: Fix apiversion vs. api_version typo.
--- a/NEWS +++ b/NEWS @@ -1,1036 +1,47 @@ -Summary of changes for version 2.1.x: ------------------------------------- - - * Given a matrix, X, and a boolean index, idx, of the same shape as - X, X(idx) and X(idx) = RHS now work no matter what the value of - do_fortran_indexing is. - - * If you are using GNU Emacs 19.34 or earlier, you will need to add - the following code to your ~/.emacs file in order to use Emacs - Octave mode: - - ;; Set up the custom library. - ;; taken from http://www.dina.kvl.dk/~abraham/custom/ - (eval-and-compile - (condition-case () - (require 'custom) - (error nil)) - (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) - nil ;; We've got what we needed - ;; We have the old custom-library, hack around it! - (defmacro defgroup (&rest args) - nil) - (defmacro defcustom (var value doc &rest args) - (` (defvar (, var) (, value) (, doc)))))) - - * When `format +' is in effect, Octave uses the following symbols to - provide more information about the values in a matrix: - - + postive real - - negative real - i pure imaginary - c complex - blank zero - - * The ++ and -- operators now work for indexed matrices, and the - following operators now work: - - +=, -=, *=, /=, \=, <<=, >>=, .*=, ./=, .\=, &=, |= - - These operators are currently implemented using a relatively - inefficient brute-force method but hey, they work. - - * The built-in variable argv is now a list of strings instead of a - string vector. - - * The value of LOADPATH set by the environment variable - OCTAVE_PATH, the -p or --path command line options, or on the - command line is no longer modified to include the default path. - Instead it is left as specified. Its default value is now ":", - which tells Octave to search the default path, and the new - built-in variable DEFAULT_LOADPATH contains the default list of - directories to search. - - * The function file_in_path no longer does any special processing of - its PATH argument. To search LOADPATH for files, it is now - generally better to use the new function file_in_loadpath. - - * If fread is given a skip parameter, the skip is performed after - the read instead of before (for compatibility with Matlab). - - * The new built-in variable `crash_dumps_octave_core' controls - whether Octave writes user variables to the file `octave-core' - when it crashes or is killed by a signal. The default value is 1 - (0 if you use --traditional). - - * If LOADPATH contains a doubled colon, the default path is inserted - in its place. This is similar to the substitution that also takes - place for leading or trailing colons in the LOADPATH. - - * Loops of the form `for i = STRING ... endfor' are now allowed. - - * It is now possible to set the iteration limit for lsode using - lsode_options ("step limit", N). - - * New functions: - - is_complex -- tell whether a variable is complex - rehash -- re-initialize the cache of directories in LOADPATH - graw -- send a string to the gnuplot subprocess - - * New functions from Kurt Hornik's Octave-ci package: - - In finance (new directory): - - fv -- future value of an investment - fvl -- future value of an initial lump sum investment - irr -- internal rate of return of an investment - nper -- number of payments needed for amortizing a loan - npv -- net present value of a series of payments - pmt -- amount of periodic payment needed to amortize a loan - pv -- present value of an investment - pvl -- present value of an investment that pays off at the end - rate -- rate of return of an investment - vol -- volatility of financial time series data - - In linear-algebra: - - dmult -- rescale the rows of a matrix - - In signal: - - arch_fit -- fit an ARCH regression model - arch_rnd -- simulate an ARCH process - arch_test -- test for conditional heteroscedascity - arma_rnd -- simulate an ARMA process - autocor -- compute autocorrelations - autocov -- compute autocovariances - autoreg_matrix -- design matrix for autoregressions - bartlett -- coefficients of the Bartlett (triangular) window - blackman -- coefficients of the Blackman window - diffpara -- estimate the fractional differencing parameter - durbinlevinson -- perform one step of the Durbin-Levinson algorithm - fractdiff -- compute fractional differences - hamming -- coefficients of the Hamming window - hanning -- coefficients of the Hanning window - hurst -- estimate the Hurst parameter - periodogram -- compute the periodogram - rectangle_lw -- rectangular lag window - rectangle_sw -- rectangular spectral window - sinetone -- compute a sine tone - sinewave -- compute a sine wave - spectral_adf -- spectral density estimation - spectral_xdf -- spectral density estimation - spencer -- apply Spencer's 15-point MA filter - stft -- short-term Fourier transform - synthesis -- recover a signal from its short-term Fourier transform - triangle_lw -- triangular lag window - triangle_sw -- triangular spectral window - yulewalker -- fit AR model by Yule-Walker method - - In statistics/base (new directory): - - center -- center by subtracting means - cloglog -- complementary log-log function - cor -- compute correlations - cov -- compute covariances - cut -- cut data into intervals - iqr -- interquartile range - kendall -- kendall's rank correlation tau - logit -- logit transformation - mean -- compute arithmetic, geometric, and harmonic mean - meansq -- compute mean square - moment -- compute moments - ppplot -- perform a PP-plot (probability plot) - probit -- probit transformation - qqplot -- perform a QQ-plot (quantile plot) - range -- compute range - ranks -- compute ranks - run_count -- count upward runs - spearman -- spearman's rank correlation rho - statistics -- compute basic statistics - studentize -- subtract mean and divide by standard deviation - table -- cross tabulation - values -- extract unique elements - var -- compute variance - - In statistics/distributions (new directory): - - beta_cdf -- CDF of the Beta distribution - beta_inv -- Quantile function of the Beta distribution - beta_pdf -- PDF of the Beta distribution - beta_rnd -- Random deviates from the Beta distribution - - binomial_cdf -- CDF of the binomial distribution - binomial_inv -- Quantile function of the binomial distribution - binomial_pdf -- PDF of the binomial distribution - binomial_rnd -- Random deviates from the binomial distribution - - cauchy_cdf -- CDF of the Cauchy distribution - cauchy_inv -- Quantile function of the Cauchy distribution - cauchy_pdf -- PDF of the Cauchy distribution - cauchy_rnd -- Random deviates from the Cauchy distribution - - chisquare_cdf -- CDF of the chi-square distribution - chisquare_inv -- Quantile function of the chi-square distribution - chisquare_pdf -- PDF of the chi-sqaure distribution - chisquare_rnd -- Random deviates from the chi-square distribution - - discrete_cdf -- CDF of a discrete distribution - discrete_inv -- Quantile function of a discrete distribution - discrete_pdf -- PDF of a discrete distribution - discrete_rnd -- Random deviates from a discrete distribution - - empirical_cdf -- CDF of the empirical distribution - empirical_inv -- Quantile function of the empirical distribution - empirical_pdf -- PDF of the empirical distribution - empirical_rnd -- Bootstrap samples from the empirical distribution - - exponential_cdf -- CDF of the exponential distribution - exponential_inv -- Quantile function of the exponential distribution - exponential_pdf -- PDF of the exponential distribution - exponential_rnd -- Random deviates from the exponential distribution - - f_cdf -- CDF of the F distribution - f_inv -- Quantile function of the F distribution - f_pdf -- PDF of the F distribution - f_rnd -- Random deviates from the F distribution - - gamma_cdf -- CDF of the Gamma distribution - gamma_inv -- Quantile function of the Gamma distribution - gamma_pdf -- PDF of the Gamma distribution - gamma_rnd -- Random deviates from the Gamma distribution - - geometric_cdf -- CDF of the geometric distribution - geometric_inv -- Quantile function of the geometric distribution - geometric_pdf -- PDF of the geometric distribution - geometric_rnd -- Random deviates from the geometric distribution - - hypergeometric_cdf -- CDF of the hypergeometric distribution - hypergeometric_inv -- Random deviates from hypergeometric distribution - hypergeometric_pdf -- PDF of the hypergeometric distribution - hypergeometric_rnd -- Random deviates from hypergeometric distribution - - kolmogorov_smirnov_cdf -- CDF of the Kolmogorov-Smirnov distribution - - laplace_cdf -- CDF of the Laplace distribution - laplace_inv -- Quantile function of the Laplace distribution - laplace_pdf -- PDF of the Laplace distribution - laplace_rnd -- Random deviates from the Laplace distribution - - logistic_cdf -- CDF of the logistic distribution - logistic_inv -- Quantile function of the logistic distribution - logistic_pdf -- PDF of the logistic distribution - logistic_rnd -- Random deviates from the logistic distribution - - lognormal_cdf -- CDF of the log normal distribution - lognormal_inv -- Quantile function of the log normal distribution - lognormal_pdf -- PDF of the log normal distribution - lognormal_rnd -- Random deviates from the log normal distribution - - normal_cdf -- CDF of the normal distribution - normal_inv -- Quantile function of the normal distribution - normal_pdf -- PDF of the normal distribution - normal_rnd -- Random deviates from the normal distribution - - pascal_cdf -- CDF of the Pascal (negative binomial) distribution - pascal_inv -- Quantile function of the Pascal distribution - pascal_pdf -- PDF of the Pascal (negative binomial) distribution - pascal_rnd -- Random deviates from the Pascal distribution - - poisson_cdf -- CDF of the Poisson distribution - poisson_inv -- Quantile function of the Poisson distribution - poisson_pdf -- PDF of the Poisson distribution - poisson_rnd -- Random deviates from the Poisson distribution - - stdnormal_cdf -- CDF of the standard normal distribution - stdnormal_inv -- Quantile function of standard normal distribution - stdnormal_pdf -- PDF of the standard normal distribution - stdnormal_rnd -- Random deviates from standard normal distribution - - t_cdf -- CDF of the t distribution - t_inv -- Quantile function of the t distribution - t_pdf -- PDF of the t distribution - t_rnd -- Random deviates from the t distribution - - uniform_cdf -- CDF of the uniform distribution - uniform_inv -- Quantile function of the uniform distribution - uniform_pdf -- PDF of the uniform distribution - uniform_rnd -- Random deviates from the uniform distribution - - weibull_cdf -- CDF of the Weibull distribution - weibull_inv -- Quantile function of the Weibull distribution - weibull_pdf -- PDF of the Weibull distribution - weibull_rnd -- Random deviates from the Weibull distribution - - wiener_rnd -- Simulate a Wiener process - - In statistics/models (new directory): - - logistic_regression -- ordinal logistic regression - logistic_regression_derivatives -- derivates of log-likelihood - in logistic regression - logistic_regression_likelihood -- likelihood in logistic regression - - In statistics/tests (new directory): - - anova -- one-way analysis of variance - bartlett_test -- bartlett test for homogeneity of variances - chisquare_test_homogeneity -- chi-square test for homogeneity - chisquare_test_independence -- chi-square test for independence - cor_test -- test for zero correlation - f_test_regression -- test linear hypotheses in linear - regression model - hotelling_test -- test for mean of a multivariate normal - hotelling_test_2 -- compare means of two multivariate normals - kolmogorov_smirnov_test -- one-sample Kolmogorov-Smirnov test - kolmogorov_smirnov_test_2 -- two-sample Kolmogorov-Smirnov test - kruskal_wallis_test -- kruskal-Wallis test - manova -- one-way multivariate analysis of variance - mcnemar_test -- mcnemar's test for symmetry - prop_test_2 -- compare two proportions - run_test -- run test for independence - sign_test -- sign test - t_test -- student's one-sample t test - t_test_2 -- student's two-sample t test - t_test_regression -- test one linear hypothesis in linear - regression model - u_test -- mann-Whitney U-test - var_test -- f test to compare two variances - welch_test -- welch two-sample t test - wilcoxon_test -- wilcoxon signed-rank test - z_test -- test for mean of a normal sample with - known variance - z_test_2 -- compare means of two normal samples with - known variances - - * The save command now accepts the option -append to save the - variables at the end of the file, leaving the existing contents. - - * New command-line option --no-history (also available using the - single character option -H) inhibits saving command history. - - * The mkoctfile script now accepts -DDEF options and passes them on - to the C and C++ compilers. - - * Running `make check' should work now before you run `make install', - even if you build a copy of Octave that depends on shared versions - of the Octave libraries. - - * For matrices, x(:) now works and returns a column vector no matter - what the value of do_fortran_indexing is. - - * New keywords __FILE__ and __LINE__ expand to the name of the file - that is being read and the current input line number, respectively. - - * Octave's expression parser is more general and consistent. It is - now possible to access structure elements and index arbitrary - values. For example, expressions like - - my_home_dir = getpwuid (getuid ()) . dir; - - and - - svd (x) (1:5) - - now work. - - * New built-in variable `print_rhs_assign_val' controls what is - printed when an assignment expression is evaluated. If it is - zero, the value of the variable on the left hand side (after the - assignment) is printed. If it is nonzero, the value of the right - hand side (i.e., the result of the expression) is printed. The - default value of is zero, so the behavior is the same as in - previous versions of Octave. - - * tmpnam now takes two optional arguments, DIR, and PREFIX. For - example, tmpnam ("/foo", "bar-") returns a file name like - "/foo/bar-10773baa". If DIR is omitted or empty, the value of the - environment variable TMPDIR, or /tmp is used. If PREFIX is - omitted, "oct-" is used. - - * The built-in variable `PWD' has been removed. If you need to get - the value of the current working directory, use the pwd() function - instead. - - * New operators. Octave's parser now recognizes the following - operators: << >> += -= *= /= .+= .-= .*= ./= &= |= <<= >>=. So - far, there are only a few operations defined that actually use - them (this should change before 2.1 is released). - - * New built-in data types: - - logical: - - A true value is represented by 1, and false value by 0. - Comparison operations like <, <=, ==, >, >=, and != now return - logical values. Indexing operations that use zero-one style - indexing must now use logical values. You can use the new - function logical() to convert a numeric value to a logical - value. This avoids the need for the built-in variable - `prefer_zero_one_indexing', so it has been removed. Logical - values are automatically converted to numeric values where - appropriate. - - file: - - A file object represents an open Octave stream object. The - fopen function now returns a file object instead of an integer. - File objects can be converted to integers automatically, and the - other functions that work with file ids still work with - integers, so this change should be backward compatible. - - The binary left-shift operator `<<' has been defined to work as - in C++ for file objects and built-in types. For example, - - my_stream = fopen ("foo", "w"); - my_stream << "x = " << pi << " marks the spot\n"; - - writes `x = 3.1416 marks the spot' in the file foo. - - The built-in variables stdin, stdout, and stderr are now also - file objects instead of integers. - - list: - - A list is an array of Octave objects. It can be indexed using - the normal indexing operator. For example, - - x = list ([1,2;3,4], 1, "foo"); - stdout << x(2) << "\n" - 1 - stdout << x; - ( - [1] = - - 1 2 - 3 4 - - [2] = 1 - [3] = foo - ) - - There is currently no special syntax for creating lists; you - must use the list function. - - * Commas in global statements are no longer special. They are now - treated as command separators. This removes a conflict in the - grammar and is consistent with the way Matlab behaves. The - variable `warn_comma_in_global_decl' has been eliminated. - - * It is now possible to declare static variables that retain their - values across function calls. For example, - - function ncall = f () static n = 0; ncall = ++n; endfunction - - defines a function that returns the number of times that it has - been called. - - * Within user-defined functions, the new automatic variable `argn' - contains the names of the arguments that were passed to the - function. For example, - - function f (...) - for i = 1:nargin - stdout << "argn(" << i << ") = `" << deblank (argn(i,:)) \ - << "' and its value is " << va_arg () << "\n"; - endfor - endfunction - f (1+2, "foo", sin (pi/2)) - - prints - - argn(1) = `1 + 2' and its value is 3 - argn(2) = `"foo"' and its value is foo - argn(3) = `sin (pi)' and its value is 1 - - on the standard output stream. If nargin is zero, argn is not defined. - * Functions like quad, fsolve, and lsode can take either a function - name or a simple function body as a string. For example, - - quad ("sqrt (x)", 0, 1) - - is equivalent to - - function y = f (x) y = sqrt (x); endfunction - quad ("f", 0, 1) - - * If the argument to eig() is symmetric, Octave uses the specialized - Lapack subroutine for symmetric matrices for a significant - increase in performance. - - * If the argument to lsode that names the user-supplied function is - a 2-element string array, the second element is taken as the name - of the Jacobian function. The named function should have the - following form: - - JAC = f (X, T) - - where JAC is the Jacobian matrix of partial derivatives of the - right-hand-side functions that define the set of differential - equations with respect to the state vector X. - - * Global variables are now initialized to the empty matrix, for - compatibility with Matlab. - - * Explicit initialization of global variables only happens once. - For example, after the following statements are evaluated, g still - has the value 1. - - global g = 1 - global g = 2 - - This is useful for initializing global variables that are used to - maintain state information that is shared among several functions. - - * Structure elements completion on the command line actually works - now. - - * The new built-in variable `fixed_point_format' controls whether - Octave uses a scaled fixed-point format for displaying matrices. - The default value is 0 unless you use --traditional. - - * The function sumsq now computes sum (x .* conj (x)) for complex values. - - * The new built-in variable max_recursion_depth allows you to - prevent Octave from attempting infinite recursion. The default - value is 256. - - * Octave now uses kpathsea 3.2. - - * New configure option, --enable-readline. - - * New configure option, --enable-static. - -Summary of changes for version 2.0.7: ------------------------------------- - - This is a bug-fixing release. There are no new user-visible features. - -Summary of changes for version 2.0.6: ------------------------------------- - - This is primarily a bug-fixing release. There are only a few new - user-visible features. - - * The new built-in variable default_eval_print_flag controls whether - Octave prints the results of commands executed by eval() that do - not end with semicolons. The default is 1. - - * The new built-in constant OCTAVE_HOME specifies the top-level - directory where Octave is installed. - - * Octave no longer includes functions to work with NPSOL or QPSOL, - because they are not free software. - - * The new built-in variable called kluge_procbuf_delay specifies the - number of microseconds to delay in the parent process after - forking. By default on gnu-win32 systems, it's set to 500000 (1/2 - second). On other systems, the default value is 0. Delaying for - a short time in the parent after forking seems to avoid problems - in which communicating with subprocesses via pipes would sometimes - cause Octave to hang. I doubt that the delay is really the right - solution. If anyone has a better idea, I'd love to hear it. - -Summary of changes for version 2.0.5: ------------------------------------- - - * A `switch' statement is now available. See the Statements chapter - in the manual for details. - - * Commands like ls, save, and cd may now also be used as formal - parameters for functions. - - * More tests. - -Summary of changes for version 2.0.4: ------------------------------------- - - * It is now possible to use commands like ls, save, and cd as simple - variable names. They still cannot be used as formal parameters - for functions, or as the names of structure variables. Failed - assignments leave them undefined (you can recover the orginal - function definition using clear). - - * Is is now possible to invoke commands like ls, save, and cd as - normal functions (for example, load ("foo", "x", "y", "z")). - -Summary of changes for version 2.0.3: ------------------------------------- - - * The manual has been completely revised and now corresponds much - more closely to the features of the current version. - - * The return value for assignment expressions is now the RHS since - that is more consistent with the way other programming languages - work. However, Octave still prints the entire LHS value so that - - x = zeros (1, 2); - x(2) = 1 - - still prints - - x = - - 0 1 - - but an assignment like - - z = x(2) = 1 - - sets z to 1 (not [ 0, 1 ] as in previous versions of Octave). - - * It is now much easier to make binary distributions. See the - Binary Distributions section of the manual for more details. - -Summary of changes for version 2.0.2: ------------------------------------- - - * Octave now stops executing commands from a script file if an error - is encountered. - - * The return, and break commands now cause Octave to quit executing - commands from script files. When used in invalid contexts, the - break, continue, and return commands are now simply ignored - instead of producing parse errors. - - * size ("") is now [0, 0]. - - * New functions: - - sleep -- pause execution for a specified number of seconds - usleep -- pause execution for a specified number of microseconds - -Summary of changes for version 2.0: +Summary of changes for version 3.0: ---------------------------------- - * The set and show commands for setting and displaying gnuplot - parameters have been replaced by gset and gshow. This change will - probably break lots of things, but it is necessary to allow for - compatibility with the Matlab graphics and GUI commands in a - future version of Octave. (For now, the old set and show commands - do work, but they print an annoying warning message to try to get - people to switch to using gset.) - - * Octave has been mostly ported to Windows NT and Windows 95 using - the beta 17 release of the Cygnus GNU-WIN32 tools. Not everything - works, but it is usable. See the file README.WINDOWS for more - information. - - * Dynamic linking works on more systems using dlopen() and friends - (most modern Unix systems) or shl_load() and friends (HP/UX - systems). A simple example is provided in examples/hello.cc. - For this feature to work, you must configure Octave with - --enable-shared. You may also need to have a shared-library - version of libg++ and libstdc++. - - * New data types can be added to Octave by writing a C++ class. On - systems that support dynamic linking, new data types can be added - to an already running Octave binary. A simple example appears in - the file examples/make_int.cc. Other examples are the standard - Octave data types defined in the files src/ov*.{h,cc} and - src/op-*.cc. - - * The configure option --enable-bounds-check turns on bounds - checking on element references for Octave's internal array and - matrix classes. It's enabled by default. To disable this - feature, configure Octave with --disable-bounds-check. - - * The C-style I/O functions (fopen, fprintf, etc.) have been - rewritten to be more compatible with Matlab. The fputs function - has also been added. Usage of the *printf functions that was - allowed in previous versions of Octave should still work. - However, there is no way to make the new versions of the *scanf - functions compatible with Matlab *and* previous versions of - Octave. An optional argument to the *scanf functions is now - available to make them behave in a way that is compatible with - previous versions of Octave. - - * Octave can now read files that contain columns of numbers only, - with no header information. The name of the loaded variable is - constructed from the file name. Each line in the file must have - the same number of elements. + * Previous versions of Octave had a number of built-in variables to + control warnings (for example, warn_divide_by_zero). These + variables have been replaced by warning identifiers that are used + with the warning function to control the state of warnings. Now, + instead of writing - * The interface to the pager has changed. The new built-in variable - `page_output_immediately' controls when Octave sends output to the - pager. If it is nonzero, Octave sends output to the pager as soon - as it is available. Otherwise, Octave buffers its output and - waits until just before the prompt is printed to flush it to the - pager. - - * Expressions of the form - - A(i,j) = x - - where X is a scalar and the indices i and j define a matrix of - elements now work as you would expect rather than giving an error. - I am told that this is how Matlab 5.0 will behave when it is - released. - - * Indexing of character strings now works. - - * The echo command has been implemented. - - * The document command is now a regular function. - - * New method for handling errors: + warn_divide_by_zero = false; - try - BODY - catch - CLEANUP - end_try_catch - - Where BODY and CLEANUP are both optional and may contain any - Octave expressions or commands. The statements in CLEANUP are - only executed if an error occurs in BODY. - - No warnings or error messages are printed while BODY is - executing. If an error does occur during the execution of BODY, - CLEANUP can access the text of the message that would have been - printed in the builtin constant __error_text__. This is the same - as eval (TRY, CATCH) (which may now also use __error_text__) but - it is more efficient since the commands do not need to be parsed - each time the TRY and CATCH statements are evaluated. - - * Octave no longer parses the help command by grabbing everything - after the keyword `help' until a newline character is read. To - get help for `;' or `,', now, you need to use the command - `help semicolon' or `help comma'. - - * Octave's parser now does some simple constant folding. This means - that expressions like 3*i are now evaluated only once, when a - function is compiled, and the right hand side of expressions like - a = [1,2;3,4] are treated as true matrix constants rather than - lists of elements which must be evaluated each time they are - needed. + to disable divide-by-zero warnings, you should write - * Built-in variables that can take values of "true" and "false" can - now also be set to any nonzero scalar value to indicate "true", - and 0 to indicate "false". - - * New built-in variables `history_file', `history_size', and - `saving_history'. - - * New built-in variable `string_fill_char' specifies the character - to fill with when creating arrays of strings. - - * If the new built-in variable `gnuplot_has_frames' is nonzero, - Octave assumes that your copy of gnuplot includes support for - multiple plot windows when using X11. - - If the new built-in variable `gnuplot_has_multiplot' is nonzero, - Octave assumes that your copy of gnuplot has the multiplot support - that is included in recent 3.6beta releases. - - The initial values of these variables are determined by configure, - but can be changed in your startup script or at the command line - in case configure got it wrong, or if you upgrade your gnuplot - installation. + warning ("off", "Octave:divide-by-zero"); - * The new plot function `figure' allows multiple plot windows when - using newer versions of gnuplot with X11. - - * Octave now notices when the plotter has exited unexpectedly. - - * New built-in variable `warn_missing_semicolon'. If nonzero, Octave - will warn when statements in function definitions don't end in - semicolons. The default value is 0. - - * Octave now attempts to continue after floating point exceptions - or out-of-memory errors. - - * If Octave crashes, it now attempts to save all user-defined - variables in a file named `octave-core' in the current directory - before exiting. - - * It is now possible to get the values of individual option settings - for the dassl, fsolve, lsode, npsol, qpsol, and quad functions - using commands like - - dassl_reltol = dassl_options ("relative tolerance"); - - * The svd() function no longer computes the left and right singular - matrices unnecessarily. This can significantly improve - performance for large matrices if you are just looking for the - singular values. + You may use the same technique in your own code to control + warnings. For example, you can use - * The filter() function is now a built-in function. - - * New function randn() returns a pseudo-random number from a normal - distribution. The rand() and randn() functions have separate - seeds and generators. - - * Octave's command-line arguments are now available in the built-in - variable `argv'. The program name is also available in the - variables `program_invocation_name' and `program_name'. If - executing a script from the command line (e.g., octave foo.m) or - using the `#! /bin/octave' hack, the program name is set to the - name of the script. - - * New built-in variable `completion_append_char' used as the - character to append to successful command-line completion - attempts. The default is " " (a single space). - - * Octave now uses a modified copy of the readline library from - version 1.14.5 of GNU bash. - - * In prompt strings, `\H' expands to the whole host name. - - * New built-in variable `beep_on_error'. If nonzero, Octave will try - to ring your terminal's bell before printing an error message. - The default value is 0. + warning ("My-package:phase-of-the-moon", + "the phase of the moon could cause trouble today"); - * For functions defined from files, the type command now prints the - text of the file. You can still get the text reconstructed from - the parse tree by using the new option -t (-transformed). - - * New command-line argument --traditional sets the following - preference variables for compatibility with Matlab: - - PS1 = ">> " - PS2 = "" - beep_on_error = 1 - default_save_format = "mat-binary" - define_all_return_values = 1 - do_fortran_indexing = 1 - empty_list_elements_ok = 1 - implicit_str_to_num_ok = 1 - ok_to_lose_imaginary_part = 1 - page_screen_output = 0 - prefer_column_vectors = 0 - prefer_zero_one_indexing = 1 - print_empty_dimensions = 0 - treat_neg_dim_as_zero = 1 - warn_function_name_clash = 0 - whitespace_in_literal_matrix = "traditional" - - * New functions: + to allow users to control this warning using the + "My-package:phase-of-the-moon" warning identifier. - readdir -- returns names of files in directory as array of strings - mkdir -- create a directory - rmdir -- remove a directory - rename -- rename a file - unlink -- delete a file - umask -- set permission mask for file creation - stat -- get information about a file - lstat -- get information about a symbolic link - glob -- perform filename globbing - fnmatch -- match strings with filename globbing patterns - more -- turn the pager on or off - gammaln -- alias for lgamma - - * New audio functions from Andreas Weingessel - <Andreas.Weingessel@ci.tuwien.ac.at>. - - lin2mu -- linear to mu-law encoding - loadaudio -- load an audio file to a vector - mu2lin -- mu-law to linear encoding - playaudio -- play an audio file - record -- record sound and store in vector - saveaudio -- save a vector as an audio file - setaudio -- executes mixer shell command - - * New plotting functions from Vinayak Dutt. Ones dealing with - multiple plots on one page require features from gnuplot 3.6beta - (or later). - - bottom_title -- put title at the bottom of the plot - mplot -- multiplot version of plot - multiplot -- switch multiple-plot mode on or off - oneplot -- return to one plot per page - plot_border -- put a border around plots - subplot -- position multiple plots on a single page - subwindow -- set subwindow position for next plot - top_title -- put title at the top of the plot - zlabel -- put a label on the z-axis - - * New string functions - - bin2dec -- convert a string of ones and zeros to an integer - blanks -- create a string of blanks - deblank -- delete trailing blanks - dec2bin -- convert an integer to a string of ones and zeros - dec2hex -- convert an integer to a hexadecimal string - findstr -- locate occurrences of one string in another - hex2dec -- convert a hexadecimal string to an integer - index -- return position of first occurrence a string in another - rindex -- return position of last occurrence a string in another - split -- divide one string into pieces separated by another - str2mat -- create a string matrix from a list of strings - strrep -- replace substrings in a string - substr -- extract a substring + You may also enable or disable all warnings, or turn them into + errors: - The following functions return a matrix of ones and zeros. - Elements that are nonzero indicate that the condition was true for - the corresponding character in the string array. - - isalnum -- letter or a digit - isalpha -- letter - isascii -- ascii - iscntrl -- control character - isdigit -- digit - isgraph -- printable (but not space character) - islower -- lower case - isprint -- printable (including space character) - ispunct -- punctuation - isspace -- whitespace - isupper -- upper case - isxdigit -- hexadecimal digit - - These functions return new strings. - - tolower -- convert to lower case - toupper -- convert to upper case - - * New function, fgetl. Both fgetl and fgets accept an optional - second argument that specifies a maximum number of characters to - read, and the function fgets is now compatible with Matlab. + warning ("on", "all"); + warning ("off", "all"); + warning ("error", "Octave:divide-by-zero"); + warning ("error", "all"); - * Printing in hexadecimal format now works (format hex). It is also - possible to print the internal bit representation of a value - (format bit). Note that these formats are only implemented for - numeric values. - - * Additional structure features: - - -- Name completion now works for structures. - - -- Values and names of structure elements are now printed by - default. The new built-in variable `struct_levels_to_print' - controls the depth of nested structures to print. The default - value is 2. - - -- New functions: - - struct_contains (S, NAME) -- returns 1 if S is a structure with - element NAME; otherwise returns 0. - - struct_elements (S) -- returns the names of all elements - of structure S in an array of strings. - - * New io/subprocess functions: - - fputs -- write a string to a file with no formatting - popen2 -- start a subprocess with 2-way communication - mkfifo -- create a FIFO special file - popen -- open a pipe to a subprocess - pclose -- close a pipe from a subprocess - waitpid -- check the status of or wait for subprocesses - - * New time functions: + You can query the state of current warnings using - asctime -- format time structure according to local format - ctime -- equivalent to `asctime (localtime (TMSTRUCT))' - gmtime -- return time structure corresponding to UTC - localtime -- return time structure corresponding to local time zone - strftime -- print given time structure using specified format - time -- return current time - - The `clock' and `date' functions are now implemented in M-files - using these basic functions. - - * Access to additional Unix system calls: - - dup2 -- duplicate a file descriptor - exec -- replace current process with a new process - fcntl -- control open file descriptors - fork -- create a copy of the current process - getpgrp -- return the process group id of the current process - getpid -- return the process id of the current process - getppid -- return the process id of the parent process - getuid -- return the real user id of the current process - getgid -- return the real group id of the current process - geteuid -- return the effective user id of the current process - getegid -- return the effective group id of the current process - pipe -- create an interprocess channel - - * Other new functions: + warning ("query", ID) + warning ("query") - commutation_matrix -- compute special matrix form - duplication_matrix -- compute special matrix form - common_size.m -- bring arguments to a common size - completion_matches -- perform command completion on string - tilde_expand -- perform tilde expansion on string - - meshgrid -- compatible with Matlab's meshgrid function - tmpnam -- replaces octave_tmp_file_name - atexit -- register functions to be called when Octave exits - putenv -- define an environment variable - bincoeff -- compute binomial coefficients - nextpow2 -- compute the next power of 2 greater than a number - detrend -- remove a best fit polynomial from data - erfinv -- inverse error function - shift -- perform a circular shift on the elements of a matrix - pow2 -- compute 2 .^ x - log2 -- compute base 2 logarithms - diff -- compute differences of matrix elements - vech -- stack columns of a matrix below the diagonal - vec -- stack columns of a matrix to form a vector - xor -- compute exclusive or - - * Functions for getting info from the password database on Unix systems: - - getpwent -- read entry from password-file stream, opening if necessary - getpwuid -- search for password entry with matching user ID - getpwnam -- search for password entry with matching username - setpwent -- rewind the password-file stream - endpwent -- close the password-file stream + (only those warning IDs which have been explicitly set are + returned). - * Functions for getting info from the group database on Unix systems: - - getgrent -- read entry from group-file stream, opening if necessary - getgrgid -- search for group entry with matching group ID - getgrnam -- search for group entry with matching group name - setgrent -- rewind the pgroup-file stream - endgrent -- close the group-file stream - - * The New function octave_config_info returns a structure containing - information about how Octave was configured and compiled. - - * New function getrusage returns a structure containing system - resource usage statistics. The `cputime' function is now defined - in an M-file using getrusage. - - * The info reader is now a separate binary that runs as a - subprocess. You still need the info reader distributed with - Octave though, because there are some new command-line arguments - that are not yet available in the public release of Info. - - * There is a new built-in variable, INFO_PROGRAM, which is used as - the name of the info program to run. Its initial value is - $OCTAVE_HOME/lib/octave/VERSION/exec/ARCH/info, but that value can - be overridden by the environment variable OCTAVE_INFO_PROGRAM, or - the command line argument --info-program NAME, or by setting the - value of INFO_PROGRAM in a startup script. + A partial list and description of warning identifiers is available + using - * There is a new built-in variable, EXEC_PATH, which is used as - the list of directories to search when executing subprograms. Its - initial value is taken from the environment variable - OCTAVE_EXEC_PATH (if it exists) or PATH, but that value can be - overridden by the the command line argument --exec-path PATH, or - by setting the value of EXEC_PATH in a startup script. If the - EXEC_PATH begins (ends) with a colon, the directories - $OCTAVE_HOME/lib/octave/VERSION/exec/ARCH and $OCTAVE_HOME/bin are - prepended (appended) to EXEC_PATH (if you don't specify a value - for EXEC_PATH explicitly, these special directories are prepended - to your PATH). + help warning_ids - * If it is present, Octave will now use an `ls-R' database file to - speed up recursive path searching. Octave looks for a file called - ls-R in the directory specified by the environment variable - OCTAVE_DB_DIR. If that is not set but the environment variable - OCTAVE_HOME is set, Octave looks in $OCTAVE_HOME/lib/octave. - Otherwise, Octave looks in the directory $datadir/octave (normally - /usr/local/lib/octave). - * New examples directory. - - * There is a new script, mkoctfile, that can be used to create .oct - files suitable for dynamic linking. - - * Many more bug fixes. - - * ChangeLogs are now kept in each subdirectory. - -See NEWS.1 for old news. +See NEWS.2 for old news.
new file mode 100644 --- /dev/null +++ b/NEWS.2 @@ -0,0 +1,1036 @@ +Summary of changes for version 2.1.x: +------------------------------------ + + * Given a matrix, X, and a boolean index, idx, of the same shape as + X, X(idx) and X(idx) = RHS now work no matter what the value of + do_fortran_indexing is. + + * If you are using GNU Emacs 19.34 or earlier, you will need to add + the following code to your ~/.emacs file in order to use Emacs + Octave mode: + + ;; Set up the custom library. + ;; taken from http://www.dina.kvl.dk/~abraham/custom/ + (eval-and-compile + (condition-case () + (require 'custom) + (error nil)) + (if (and (featurep 'custom) (fboundp 'custom-declare-variable)) + nil ;; We've got what we needed + ;; We have the old custom-library, hack around it! + (defmacro defgroup (&rest args) + nil) + (defmacro defcustom (var value doc &rest args) + (` (defvar (, var) (, value) (, doc)))))) + + * When `format +' is in effect, Octave uses the following symbols to + provide more information about the values in a matrix: + + + postive real + - negative real + i pure imaginary + c complex + blank zero + + * The ++ and -- operators now work for indexed matrices, and the + following operators now work: + + +=, -=, *=, /=, \=, <<=, >>=, .*=, ./=, .\=, &=, |= + + These operators are currently implemented using a relatively + inefficient brute-force method but hey, they work. + + * The built-in variable argv is now a list of strings instead of a + string vector. + + * The value of LOADPATH set by the environment variable + OCTAVE_PATH, the -p or --path command line options, or on the + command line is no longer modified to include the default path. + Instead it is left as specified. Its default value is now ":", + which tells Octave to search the default path, and the new + built-in variable DEFAULT_LOADPATH contains the default list of + directories to search. + + * The function file_in_path no longer does any special processing of + its PATH argument. To search LOADPATH for files, it is now + generally better to use the new function file_in_loadpath. + + * If fread is given a skip parameter, the skip is performed after + the read instead of before (for compatibility with Matlab). + + * The new built-in variable `crash_dumps_octave_core' controls + whether Octave writes user variables to the file `octave-core' + when it crashes or is killed by a signal. The default value is 1 + (0 if you use --traditional). + + * If LOADPATH contains a doubled colon, the default path is inserted + in its place. This is similar to the substitution that also takes + place for leading or trailing colons in the LOADPATH. + + * Loops of the form `for i = STRING ... endfor' are now allowed. + + * It is now possible to set the iteration limit for lsode using + lsode_options ("step limit", N). + + * New functions: + + is_complex -- tell whether a variable is complex + rehash -- re-initialize the cache of directories in LOADPATH + graw -- send a string to the gnuplot subprocess + + * New functions from Kurt Hornik's Octave-ci package: + + In finance (new directory): + + fv -- future value of an investment + fvl -- future value of an initial lump sum investment + irr -- internal rate of return of an investment + nper -- number of payments needed for amortizing a loan + npv -- net present value of a series of payments + pmt -- amount of periodic payment needed to amortize a loan + pv -- present value of an investment + pvl -- present value of an investment that pays off at the end + rate -- rate of return of an investment + vol -- volatility of financial time series data + + In linear-algebra: + + dmult -- rescale the rows of a matrix + + In signal: + + arch_fit -- fit an ARCH regression model + arch_rnd -- simulate an ARCH process + arch_test -- test for conditional heteroscedascity + arma_rnd -- simulate an ARMA process + autocor -- compute autocorrelations + autocov -- compute autocovariances + autoreg_matrix -- design matrix for autoregressions + bartlett -- coefficients of the Bartlett (triangular) window + blackman -- coefficients of the Blackman window + diffpara -- estimate the fractional differencing parameter + durbinlevinson -- perform one step of the Durbin-Levinson algorithm + fractdiff -- compute fractional differences + hamming -- coefficients of the Hamming window + hanning -- coefficients of the Hanning window + hurst -- estimate the Hurst parameter + periodogram -- compute the periodogram + rectangle_lw -- rectangular lag window + rectangle_sw -- rectangular spectral window + sinetone -- compute a sine tone + sinewave -- compute a sine wave + spectral_adf -- spectral density estimation + spectral_xdf -- spectral density estimation + spencer -- apply Spencer's 15-point MA filter + stft -- short-term Fourier transform + synthesis -- recover a signal from its short-term Fourier transform + triangle_lw -- triangular lag window + triangle_sw -- triangular spectral window + yulewalker -- fit AR model by Yule-Walker method + + In statistics/base (new directory): + + center -- center by subtracting means + cloglog -- complementary log-log function + cor -- compute correlations + cov -- compute covariances + cut -- cut data into intervals + iqr -- interquartile range + kendall -- kendall's rank correlation tau + logit -- logit transformation + mean -- compute arithmetic, geometric, and harmonic mean + meansq -- compute mean square + moment -- compute moments + ppplot -- perform a PP-plot (probability plot) + probit -- probit transformation + qqplot -- perform a QQ-plot (quantile plot) + range -- compute range + ranks -- compute ranks + run_count -- count upward runs + spearman -- spearman's rank correlation rho + statistics -- compute basic statistics + studentize -- subtract mean and divide by standard deviation + table -- cross tabulation + values -- extract unique elements + var -- compute variance + + In statistics/distributions (new directory): + + beta_cdf -- CDF of the Beta distribution + beta_inv -- Quantile function of the Beta distribution + beta_pdf -- PDF of the Beta distribution + beta_rnd -- Random deviates from the Beta distribution + + binomial_cdf -- CDF of the binomial distribution + binomial_inv -- Quantile function of the binomial distribution + binomial_pdf -- PDF of the binomial distribution + binomial_rnd -- Random deviates from the binomial distribution + + cauchy_cdf -- CDF of the Cauchy distribution + cauchy_inv -- Quantile function of the Cauchy distribution + cauchy_pdf -- PDF of the Cauchy distribution + cauchy_rnd -- Random deviates from the Cauchy distribution + + chisquare_cdf -- CDF of the chi-square distribution + chisquare_inv -- Quantile function of the chi-square distribution + chisquare_pdf -- PDF of the chi-sqaure distribution + chisquare_rnd -- Random deviates from the chi-square distribution + + discrete_cdf -- CDF of a discrete distribution + discrete_inv -- Quantile function of a discrete distribution + discrete_pdf -- PDF of a discrete distribution + discrete_rnd -- Random deviates from a discrete distribution + + empirical_cdf -- CDF of the empirical distribution + empirical_inv -- Quantile function of the empirical distribution + empirical_pdf -- PDF of the empirical distribution + empirical_rnd -- Bootstrap samples from the empirical distribution + + exponential_cdf -- CDF of the exponential distribution + exponential_inv -- Quantile function of the exponential distribution + exponential_pdf -- PDF of the exponential distribution + exponential_rnd -- Random deviates from the exponential distribution + + f_cdf -- CDF of the F distribution + f_inv -- Quantile function of the F distribution + f_pdf -- PDF of the F distribution + f_rnd -- Random deviates from the F distribution + + gamma_cdf -- CDF of the Gamma distribution + gamma_inv -- Quantile function of the Gamma distribution + gamma_pdf -- PDF of the Gamma distribution + gamma_rnd -- Random deviates from the Gamma distribution + + geometric_cdf -- CDF of the geometric distribution + geometric_inv -- Quantile function of the geometric distribution + geometric_pdf -- PDF of the geometric distribution + geometric_rnd -- Random deviates from the geometric distribution + + hypergeometric_cdf -- CDF of the hypergeometric distribution + hypergeometric_inv -- Random deviates from hypergeometric distribution + hypergeometric_pdf -- PDF of the hypergeometric distribution + hypergeometric_rnd -- Random deviates from hypergeometric distribution + + kolmogorov_smirnov_cdf -- CDF of the Kolmogorov-Smirnov distribution + + laplace_cdf -- CDF of the Laplace distribution + laplace_inv -- Quantile function of the Laplace distribution + laplace_pdf -- PDF of the Laplace distribution + laplace_rnd -- Random deviates from the Laplace distribution + + logistic_cdf -- CDF of the logistic distribution + logistic_inv -- Quantile function of the logistic distribution + logistic_pdf -- PDF of the logistic distribution + logistic_rnd -- Random deviates from the logistic distribution + + lognormal_cdf -- CDF of the log normal distribution + lognormal_inv -- Quantile function of the log normal distribution + lognormal_pdf -- PDF of the log normal distribution + lognormal_rnd -- Random deviates from the log normal distribution + + normal_cdf -- CDF of the normal distribution + normal_inv -- Quantile function of the normal distribution + normal_pdf -- PDF of the normal distribution + normal_rnd -- Random deviates from the normal distribution + + pascal_cdf -- CDF of the Pascal (negative binomial) distribution + pascal_inv -- Quantile function of the Pascal distribution + pascal_pdf -- PDF of the Pascal (negative binomial) distribution + pascal_rnd -- Random deviates from the Pascal distribution + + poisson_cdf -- CDF of the Poisson distribution + poisson_inv -- Quantile function of the Poisson distribution + poisson_pdf -- PDF of the Poisson distribution + poisson_rnd -- Random deviates from the Poisson distribution + + stdnormal_cdf -- CDF of the standard normal distribution + stdnormal_inv -- Quantile function of standard normal distribution + stdnormal_pdf -- PDF of the standard normal distribution + stdnormal_rnd -- Random deviates from standard normal distribution + + t_cdf -- CDF of the t distribution + t_inv -- Quantile function of the t distribution + t_pdf -- PDF of the t distribution + t_rnd -- Random deviates from the t distribution + + uniform_cdf -- CDF of the uniform distribution + uniform_inv -- Quantile function of the uniform distribution + uniform_pdf -- PDF of the uniform distribution + uniform_rnd -- Random deviates from the uniform distribution + + weibull_cdf -- CDF of the Weibull distribution + weibull_inv -- Quantile function of the Weibull distribution + weibull_pdf -- PDF of the Weibull distribution + weibull_rnd -- Random deviates from the Weibull distribution + + wiener_rnd -- Simulate a Wiener process + + In statistics/models (new directory): + + logistic_regression -- ordinal logistic regression + logistic_regression_derivatives -- derivates of log-likelihood + in logistic regression + logistic_regression_likelihood -- likelihood in logistic regression + + In statistics/tests (new directory): + + anova -- one-way analysis of variance + bartlett_test -- bartlett test for homogeneity of variances + chisquare_test_homogeneity -- chi-square test for homogeneity + chisquare_test_independence -- chi-square test for independence + cor_test -- test for zero correlation + f_test_regression -- test linear hypotheses in linear + regression model + hotelling_test -- test for mean of a multivariate normal + hotelling_test_2 -- compare means of two multivariate normals + kolmogorov_smirnov_test -- one-sample Kolmogorov-Smirnov test + kolmogorov_smirnov_test_2 -- two-sample Kolmogorov-Smirnov test + kruskal_wallis_test -- kruskal-Wallis test + manova -- one-way multivariate analysis of variance + mcnemar_test -- mcnemar's test for symmetry + prop_test_2 -- compare two proportions + run_test -- run test for independence + sign_test -- sign test + t_test -- student's one-sample t test + t_test_2 -- student's two-sample t test + t_test_regression -- test one linear hypothesis in linear + regression model + u_test -- mann-Whitney U-test + var_test -- f test to compare two variances + welch_test -- welch two-sample t test + wilcoxon_test -- wilcoxon signed-rank test + z_test -- test for mean of a normal sample with + known variance + z_test_2 -- compare means of two normal samples with + known variances + + * The save command now accepts the option -append to save the + variables at the end of the file, leaving the existing contents. + + * New command-line option --no-history (also available using the + single character option -H) inhibits saving command history. + + * The mkoctfile script now accepts -DDEF options and passes them on + to the C and C++ compilers. + + * Running `make check' should work now before you run `make install', + even if you build a copy of Octave that depends on shared versions + of the Octave libraries. + + * For matrices, x(:) now works and returns a column vector no matter + what the value of do_fortran_indexing is. + + * New keywords __FILE__ and __LINE__ expand to the name of the file + that is being read and the current input line number, respectively. + + * Octave's expression parser is more general and consistent. It is + now possible to access structure elements and index arbitrary + values. For example, expressions like + + my_home_dir = getpwuid (getuid ()) . dir; + + and + + svd (x) (1:5) + + now work. + + * New built-in variable `print_rhs_assign_val' controls what is + printed when an assignment expression is evaluated. If it is + zero, the value of the variable on the left hand side (after the + assignment) is printed. If it is nonzero, the value of the right + hand side (i.e., the result of the expression) is printed. The + default value of is zero, so the behavior is the same as in + previous versions of Octave. + + * tmpnam now takes two optional arguments, DIR, and PREFIX. For + example, tmpnam ("/foo", "bar-") returns a file name like + "/foo/bar-10773baa". If DIR is omitted or empty, the value of the + environment variable TMPDIR, or /tmp is used. If PREFIX is + omitted, "oct-" is used. + + * The built-in variable `PWD' has been removed. If you need to get + the value of the current working directory, use the pwd() function + instead. + + * New operators. Octave's parser now recognizes the following + operators: << >> += -= *= /= .+= .-= .*= ./= &= |= <<= >>=. So + far, there are only a few operations defined that actually use + them (this should change before 2.1 is released). + + * New built-in data types: + + logical: + + A true value is represented by 1, and false value by 0. + Comparison operations like <, <=, ==, >, >=, and != now return + logical values. Indexing operations that use zero-one style + indexing must now use logical values. You can use the new + function logical() to convert a numeric value to a logical + value. This avoids the need for the built-in variable + `prefer_zero_one_indexing', so it has been removed. Logical + values are automatically converted to numeric values where + appropriate. + + file: + + A file object represents an open Octave stream object. The + fopen function now returns a file object instead of an integer. + File objects can be converted to integers automatically, and the + other functions that work with file ids still work with + integers, so this change should be backward compatible. + + The binary left-shift operator `<<' has been defined to work as + in C++ for file objects and built-in types. For example, + + my_stream = fopen ("foo", "w"); + my_stream << "x = " << pi << " marks the spot\n"; + + writes `x = 3.1416 marks the spot' in the file foo. + + The built-in variables stdin, stdout, and stderr are now also + file objects instead of integers. + + list: + + A list is an array of Octave objects. It can be indexed using + the normal indexing operator. For example, + + x = list ([1,2;3,4], 1, "foo"); + stdout << x(2) << "\n" + 1 + stdout << x; + ( + [1] = + + 1 2 + 3 4 + + [2] = 1 + [3] = foo + ) + + There is currently no special syntax for creating lists; you + must use the list function. + + * Commas in global statements are no longer special. They are now + treated as command separators. This removes a conflict in the + grammar and is consistent with the way Matlab behaves. The + variable `warn_comma_in_global_decl' has been eliminated. + + * It is now possible to declare static variables that retain their + values across function calls. For example, + + function ncall = f () static n = 0; ncall = ++n; endfunction + + defines a function that returns the number of times that it has + been called. + + * Within user-defined functions, the new automatic variable `argn' + contains the names of the arguments that were passed to the + function. For example, + + function f (...) + for i = 1:nargin + stdout << "argn(" << i << ") = `" << deblank (argn(i,:)) \ + << "' and its value is " << va_arg () << "\n"; + endfor + endfunction + f (1+2, "foo", sin (pi/2)) + + prints + + argn(1) = `1 + 2' and its value is 3 + argn(2) = `"foo"' and its value is foo + argn(3) = `sin (pi)' and its value is 1 + + on the standard output stream. If nargin is zero, argn is not defined. + * Functions like quad, fsolve, and lsode can take either a function + name or a simple function body as a string. For example, + + quad ("sqrt (x)", 0, 1) + + is equivalent to + + function y = f (x) y = sqrt (x); endfunction + quad ("f", 0, 1) + + * If the argument to eig() is symmetric, Octave uses the specialized + Lapack subroutine for symmetric matrices for a significant + increase in performance. + + * If the argument to lsode that names the user-supplied function is + a 2-element string array, the second element is taken as the name + of the Jacobian function. The named function should have the + following form: + + JAC = f (X, T) + + where JAC is the Jacobian matrix of partial derivatives of the + right-hand-side functions that define the set of differential + equations with respect to the state vector X. + + * Global variables are now initialized to the empty matrix, for + compatibility with Matlab. + + * Explicit initialization of global variables only happens once. + For example, after the following statements are evaluated, g still + has the value 1. + + global g = 1 + global g = 2 + + This is useful for initializing global variables that are used to + maintain state information that is shared among several functions. + + * Structure elements completion on the command line actually works + now. + + * The new built-in variable `fixed_point_format' controls whether + Octave uses a scaled fixed-point format for displaying matrices. + The default value is 0 unless you use --traditional. + + * The function sumsq now computes sum (x .* conj (x)) for complex values. + + * The new built-in variable max_recursion_depth allows you to + prevent Octave from attempting infinite recursion. The default + value is 256. + + * Octave now uses kpathsea 3.2. + + * New configure option, --enable-readline. + + * New configure option, --enable-static. + +Summary of changes for version 2.0.7: +------------------------------------ + + This is a bug-fixing release. There are no new user-visible features. + +Summary of changes for version 2.0.6: +------------------------------------ + + This is primarily a bug-fixing release. There are only a few new + user-visible features. + + * The new built-in variable default_eval_print_flag controls whether + Octave prints the results of commands executed by eval() that do + not end with semicolons. The default is 1. + + * The new built-in constant OCTAVE_HOME specifies the top-level + directory where Octave is installed. + + * Octave no longer includes functions to work with NPSOL or QPSOL, + because they are not free software. + + * The new built-in variable called kluge_procbuf_delay specifies the + number of microseconds to delay in the parent process after + forking. By default on gnu-win32 systems, it's set to 500000 (1/2 + second). On other systems, the default value is 0. Delaying for + a short time in the parent after forking seems to avoid problems + in which communicating with subprocesses via pipes would sometimes + cause Octave to hang. I doubt that the delay is really the right + solution. If anyone has a better idea, I'd love to hear it. + +Summary of changes for version 2.0.5: +------------------------------------ + + * A `switch' statement is now available. See the Statements chapter + in the manual for details. + + * Commands like ls, save, and cd may now also be used as formal + parameters for functions. + + * More tests. + +Summary of changes for version 2.0.4: +------------------------------------ + + * It is now possible to use commands like ls, save, and cd as simple + variable names. They still cannot be used as formal parameters + for functions, or as the names of structure variables. Failed + assignments leave them undefined (you can recover the orginal + function definition using clear). + + * Is is now possible to invoke commands like ls, save, and cd as + normal functions (for example, load ("foo", "x", "y", "z")). + +Summary of changes for version 2.0.3: +------------------------------------ + + * The manual has been completely revised and now corresponds much + more closely to the features of the current version. + + * The return value for assignment expressions is now the RHS since + that is more consistent with the way other programming languages + work. However, Octave still prints the entire LHS value so that + + x = zeros (1, 2); + x(2) = 1 + + still prints + + x = + + 0 1 + + but an assignment like + + z = x(2) = 1 + + sets z to 1 (not [ 0, 1 ] as in previous versions of Octave). + + * It is now much easier to make binary distributions. See the + Binary Distributions section of the manual for more details. + +Summary of changes for version 2.0.2: +------------------------------------ + + * Octave now stops executing commands from a script file if an error + is encountered. + + * The return, and break commands now cause Octave to quit executing + commands from script files. When used in invalid contexts, the + break, continue, and return commands are now simply ignored + instead of producing parse errors. + + * size ("") is now [0, 0]. + + * New functions: + + sleep -- pause execution for a specified number of seconds + usleep -- pause execution for a specified number of microseconds + +Summary of changes for version 2.0: +---------------------------------- + + * The set and show commands for setting and displaying gnuplot + parameters have been replaced by gset and gshow. This change will + probably break lots of things, but it is necessary to allow for + compatibility with the Matlab graphics and GUI commands in a + future version of Octave. (For now, the old set and show commands + do work, but they print an annoying warning message to try to get + people to switch to using gset.) + + * Octave has been mostly ported to Windows NT and Windows 95 using + the beta 17 release of the Cygnus GNU-WIN32 tools. Not everything + works, but it is usable. See the file README.WINDOWS for more + information. + + * Dynamic linking works on more systems using dlopen() and friends + (most modern Unix systems) or shl_load() and friends (HP/UX + systems). A simple example is provided in examples/hello.cc. + For this feature to work, you must configure Octave with + --enable-shared. You may also need to have a shared-library + version of libg++ and libstdc++. + + * New data types can be added to Octave by writing a C++ class. On + systems that support dynamic linking, new data types can be added + to an already running Octave binary. A simple example appears in + the file examples/make_int.cc. Other examples are the standard + Octave data types defined in the files src/ov*.{h,cc} and + src/op-*.cc. + + * The configure option --enable-bounds-check turns on bounds + checking on element references for Octave's internal array and + matrix classes. It's enabled by default. To disable this + feature, configure Octave with --disable-bounds-check. + + * The C-style I/O functions (fopen, fprintf, etc.) have been + rewritten to be more compatible with Matlab. The fputs function + has also been added. Usage of the *printf functions that was + allowed in previous versions of Octave should still work. + However, there is no way to make the new versions of the *scanf + functions compatible with Matlab *and* previous versions of + Octave. An optional argument to the *scanf functions is now + available to make them behave in a way that is compatible with + previous versions of Octave. + + * Octave can now read files that contain columns of numbers only, + with no header information. The name of the loaded variable is + constructed from the file name. Each line in the file must have + the same number of elements. + + * The interface to the pager has changed. The new built-in variable + `page_output_immediately' controls when Octave sends output to the + pager. If it is nonzero, Octave sends output to the pager as soon + as it is available. Otherwise, Octave buffers its output and + waits until just before the prompt is printed to flush it to the + pager. + + * Expressions of the form + + A(i,j) = x + + where X is a scalar and the indices i and j define a matrix of + elements now work as you would expect rather than giving an error. + I am told that this is how Matlab 5.0 will behave when it is + released. + + * Indexing of character strings now works. + + * The echo command has been implemented. + + * The document command is now a regular function. + + * New method for handling errors: + + try + BODY + catch + CLEANUP + end_try_catch + + Where BODY and CLEANUP are both optional and may contain any + Octave expressions or commands. The statements in CLEANUP are + only executed if an error occurs in BODY. + + No warnings or error messages are printed while BODY is + executing. If an error does occur during the execution of BODY, + CLEANUP can access the text of the message that would have been + printed in the builtin constant __error_text__. This is the same + as eval (TRY, CATCH) (which may now also use __error_text__) but + it is more efficient since the commands do not need to be parsed + each time the TRY and CATCH statements are evaluated. + + * Octave no longer parses the help command by grabbing everything + after the keyword `help' until a newline character is read. To + get help for `;' or `,', now, you need to use the command + `help semicolon' or `help comma'. + + * Octave's parser now does some simple constant folding. This means + that expressions like 3*i are now evaluated only once, when a + function is compiled, and the right hand side of expressions like + a = [1,2;3,4] are treated as true matrix constants rather than + lists of elements which must be evaluated each time they are + needed. + + * Built-in variables that can take values of "true" and "false" can + now also be set to any nonzero scalar value to indicate "true", + and 0 to indicate "false". + + * New built-in variables `history_file', `history_size', and + `saving_history'. + + * New built-in variable `string_fill_char' specifies the character + to fill with when creating arrays of strings. + + * If the new built-in variable `gnuplot_has_frames' is nonzero, + Octave assumes that your copy of gnuplot includes support for + multiple plot windows when using X11. + + If the new built-in variable `gnuplot_has_multiplot' is nonzero, + Octave assumes that your copy of gnuplot has the multiplot support + that is included in recent 3.6beta releases. + + The initial values of these variables are determined by configure, + but can be changed in your startup script or at the command line + in case configure got it wrong, or if you upgrade your gnuplot + installation. + + * The new plot function `figure' allows multiple plot windows when + using newer versions of gnuplot with X11. + + * Octave now notices when the plotter has exited unexpectedly. + + * New built-in variable `warn_missing_semicolon'. If nonzero, Octave + will warn when statements in function definitions don't end in + semicolons. The default value is 0. + + * Octave now attempts to continue after floating point exceptions + or out-of-memory errors. + + * If Octave crashes, it now attempts to save all user-defined + variables in a file named `octave-core' in the current directory + before exiting. + + * It is now possible to get the values of individual option settings + for the dassl, fsolve, lsode, npsol, qpsol, and quad functions + using commands like + + dassl_reltol = dassl_options ("relative tolerance"); + + * The svd() function no longer computes the left and right singular + matrices unnecessarily. This can significantly improve + performance for large matrices if you are just looking for the + singular values. + + * The filter() function is now a built-in function. + + * New function randn() returns a pseudo-random number from a normal + distribution. The rand() and randn() functions have separate + seeds and generators. + + * Octave's command-line arguments are now available in the built-in + variable `argv'. The program name is also available in the + variables `program_invocation_name' and `program_name'. If + executing a script from the command line (e.g., octave foo.m) or + using the `#! /bin/octave' hack, the program name is set to the + name of the script. + + * New built-in variable `completion_append_char' used as the + character to append to successful command-line completion + attempts. The default is " " (a single space). + + * Octave now uses a modified copy of the readline library from + version 1.14.5 of GNU bash. + + * In prompt strings, `\H' expands to the whole host name. + + * New built-in variable `beep_on_error'. If nonzero, Octave will try + to ring your terminal's bell before printing an error message. + The default value is 0. + + * For functions defined from files, the type command now prints the + text of the file. You can still get the text reconstructed from + the parse tree by using the new option -t (-transformed). + + * New command-line argument --traditional sets the following + preference variables for compatibility with Matlab: + + PS1 = ">> " + PS2 = "" + beep_on_error = 1 + default_save_format = "mat-binary" + define_all_return_values = 1 + do_fortran_indexing = 1 + empty_list_elements_ok = 1 + implicit_str_to_num_ok = 1 + ok_to_lose_imaginary_part = 1 + page_screen_output = 0 + prefer_column_vectors = 0 + prefer_zero_one_indexing = 1 + print_empty_dimensions = 0 + treat_neg_dim_as_zero = 1 + warn_function_name_clash = 0 + whitespace_in_literal_matrix = "traditional" + + * New functions: + + readdir -- returns names of files in directory as array of strings + mkdir -- create a directory + rmdir -- remove a directory + rename -- rename a file + unlink -- delete a file + umask -- set permission mask for file creation + stat -- get information about a file + lstat -- get information about a symbolic link + glob -- perform filename globbing + fnmatch -- match strings with filename globbing patterns + more -- turn the pager on or off + gammaln -- alias for lgamma + + * New audio functions from Andreas Weingessel + <Andreas.Weingessel@ci.tuwien.ac.at>. + + lin2mu -- linear to mu-law encoding + loadaudio -- load an audio file to a vector + mu2lin -- mu-law to linear encoding + playaudio -- play an audio file + record -- record sound and store in vector + saveaudio -- save a vector as an audio file + setaudio -- executes mixer shell command + + * New plotting functions from Vinayak Dutt. Ones dealing with + multiple plots on one page require features from gnuplot 3.6beta + (or later). + + bottom_title -- put title at the bottom of the plot + mplot -- multiplot version of plot + multiplot -- switch multiple-plot mode on or off + oneplot -- return to one plot per page + plot_border -- put a border around plots + subplot -- position multiple plots on a single page + subwindow -- set subwindow position for next plot + top_title -- put title at the top of the plot + zlabel -- put a label on the z-axis + + * New string functions + + bin2dec -- convert a string of ones and zeros to an integer + blanks -- create a string of blanks + deblank -- delete trailing blanks + dec2bin -- convert an integer to a string of ones and zeros + dec2hex -- convert an integer to a hexadecimal string + findstr -- locate occurrences of one string in another + hex2dec -- convert a hexadecimal string to an integer + index -- return position of first occurrence a string in another + rindex -- return position of last occurrence a string in another + split -- divide one string into pieces separated by another + str2mat -- create a string matrix from a list of strings + strrep -- replace substrings in a string + substr -- extract a substring + + The following functions return a matrix of ones and zeros. + Elements that are nonzero indicate that the condition was true for + the corresponding character in the string array. + + isalnum -- letter or a digit + isalpha -- letter + isascii -- ascii + iscntrl -- control character + isdigit -- digit + isgraph -- printable (but not space character) + islower -- lower case + isprint -- printable (including space character) + ispunct -- punctuation + isspace -- whitespace + isupper -- upper case + isxdigit -- hexadecimal digit + + These functions return new strings. + + tolower -- convert to lower case + toupper -- convert to upper case + + * New function, fgetl. Both fgetl and fgets accept an optional + second argument that specifies a maximum number of characters to + read, and the function fgets is now compatible with Matlab. + + * Printing in hexadecimal format now works (format hex). It is also + possible to print the internal bit representation of a value + (format bit). Note that these formats are only implemented for + numeric values. + + * Additional structure features: + + -- Name completion now works for structures. + + -- Values and names of structure elements are now printed by + default. The new built-in variable `struct_levels_to_print' + controls the depth of nested structures to print. The default + value is 2. + + -- New functions: + + struct_contains (S, NAME) -- returns 1 if S is a structure with + element NAME; otherwise returns 0. + + struct_elements (S) -- returns the names of all elements + of structure S in an array of strings. + + * New io/subprocess functions: + + fputs -- write a string to a file with no formatting + popen2 -- start a subprocess with 2-way communication + mkfifo -- create a FIFO special file + popen -- open a pipe to a subprocess + pclose -- close a pipe from a subprocess + waitpid -- check the status of or wait for subprocesses + + * New time functions: + + asctime -- format time structure according to local format + ctime -- equivalent to `asctime (localtime (TMSTRUCT))' + gmtime -- return time structure corresponding to UTC + localtime -- return time structure corresponding to local time zone + strftime -- print given time structure using specified format + time -- return current time + + The `clock' and `date' functions are now implemented in M-files + using these basic functions. + + * Access to additional Unix system calls: + + dup2 -- duplicate a file descriptor + exec -- replace current process with a new process + fcntl -- control open file descriptors + fork -- create a copy of the current process + getpgrp -- return the process group id of the current process + getpid -- return the process id of the current process + getppid -- return the process id of the parent process + getuid -- return the real user id of the current process + getgid -- return the real group id of the current process + geteuid -- return the effective user id of the current process + getegid -- return the effective group id of the current process + pipe -- create an interprocess channel + + * Other new functions: + + commutation_matrix -- compute special matrix form + duplication_matrix -- compute special matrix form + common_size.m -- bring arguments to a common size + completion_matches -- perform command completion on string + tilde_expand -- perform tilde expansion on string + + meshgrid -- compatible with Matlab's meshgrid function + tmpnam -- replaces octave_tmp_file_name + atexit -- register functions to be called when Octave exits + putenv -- define an environment variable + bincoeff -- compute binomial coefficients + nextpow2 -- compute the next power of 2 greater than a number + detrend -- remove a best fit polynomial from data + erfinv -- inverse error function + shift -- perform a circular shift on the elements of a matrix + pow2 -- compute 2 .^ x + log2 -- compute base 2 logarithms + diff -- compute differences of matrix elements + vech -- stack columns of a matrix below the diagonal + vec -- stack columns of a matrix to form a vector + xor -- compute exclusive or + + * Functions for getting info from the password database on Unix systems: + + getpwent -- read entry from password-file stream, opening if necessary + getpwuid -- search for password entry with matching user ID + getpwnam -- search for password entry with matching username + setpwent -- rewind the password-file stream + endpwent -- close the password-file stream + + * Functions for getting info from the group database on Unix systems: + + getgrent -- read entry from group-file stream, opening if necessary + getgrgid -- search for group entry with matching group ID + getgrnam -- search for group entry with matching group name + setgrent -- rewind the pgroup-file stream + endgrent -- close the group-file stream + + * The New function octave_config_info returns a structure containing + information about how Octave was configured and compiled. + + * New function getrusage returns a structure containing system + resource usage statistics. The `cputime' function is now defined + in an M-file using getrusage. + + * The info reader is now a separate binary that runs as a + subprocess. You still need the info reader distributed with + Octave though, because there are some new command-line arguments + that are not yet available in the public release of Info. + + * There is a new built-in variable, INFO_PROGRAM, which is used as + the name of the info program to run. Its initial value is + $OCTAVE_HOME/lib/octave/VERSION/exec/ARCH/info, but that value can + be overridden by the environment variable OCTAVE_INFO_PROGRAM, or + the command line argument --info-program NAME, or by setting the + value of INFO_PROGRAM in a startup script. + + * There is a new built-in variable, EXEC_PATH, which is used as + the list of directories to search when executing subprograms. Its + initial value is taken from the environment variable + OCTAVE_EXEC_PATH (if it exists) or PATH, but that value can be + overridden by the the command line argument --exec-path PATH, or + by setting the value of EXEC_PATH in a startup script. If the + EXEC_PATH begins (ends) with a colon, the directories + $OCTAVE_HOME/lib/octave/VERSION/exec/ARCH and $OCTAVE_HOME/bin are + prepended (appended) to EXEC_PATH (if you don't specify a value + for EXEC_PATH explicitly, these special directories are prepended + to your PATH). + + * If it is present, Octave will now use an `ls-R' database file to + speed up recursive path searching. Octave looks for a file called + ls-R in the directory specified by the environment variable + OCTAVE_DB_DIR. If that is not set but the environment variable + OCTAVE_HOME is set, Octave looks in $OCTAVE_HOME/lib/octave. + Otherwise, Octave looks in the directory $datadir/octave (normally + /usr/local/lib/octave). + + * New examples directory. + + * There is a new script, mkoctfile, that can be used to create .oct + files suitable for dynamic linking. + + * Many more bug fixes. + + * ChangeLogs are now kept in each subdirectory. + +See NEWS.1 for old news.
--- a/libcruft/ChangeLog +++ b/libcruft/ChangeLog @@ -1,3 +1,12 @@ +2006-04-29 John W. Eaton <jwe@octave.org> + + * misc/lo-error.c (set_liboctave_warning_with_id_handler, + liboctave_warning_with_id): New functions. + (current_liboctave_warning_with_id_handler): New variable. + * misc/lo-error.h (liboctave_warning_with_id_handler): New typedef. + (current_liboctave_warning_with_id_handler, liboctave_warning_with_id + set_liboctave_warning_with_id_handler): Provide decls. + 2006-04-18 John W. Eaton <jwe@octave.org> * misc/f77-fcn.h (F77_XFCN): Move decls to beginning of blocks for C.
--- a/libcruft/misc/lo-error.c +++ b/libcruft/misc/lo-error.c @@ -40,7 +40,11 @@ /* Pointer to the current warning handler. */ liboctave_warning_handler current_liboctave_warning_handler - = liboctave_warning; + = liboctave_warning; + +/* Pointer to the current warning_with_id handler. */ +liboctave_warning_with_id_handler current_liboctave_warning_with_id_handler + = liboctave_warning_with_id; static void verror (const char *name, const char *fmt, va_list args) @@ -72,6 +76,15 @@ } void +set_liboctave_warning_with_id_handler (liboctave_warning_with_id_handler f) +{ + if (f) + current_liboctave_warning_with_id_handler = f; + else + current_liboctave_warning_with_id_handler = liboctave_warning_with_id; +} + +void liboctave_fatal (const char *fmt, ...) { va_list args; @@ -91,6 +104,15 @@ va_end (args); } +void +liboctave_warning_with_id (const char *id, const char *fmt, ...) +{ + va_list args; + va_start (args, fmt); + verror ("warning", fmt, args); + va_end (args); +} + /* ;;; Local Variables: *** ;;; mode: C ***
--- a/libcruft/misc/lo-error.h +++ b/libcruft/misc/lo-error.h @@ -32,20 +32,28 @@ extern void liboctave_warning (const char *fmt, ...); +extern void liboctave_warning_with_id (const char *id, const char *fmt, ...); + typedef void (*liboctave_error_handler) (const char *, ...); typedef void (*liboctave_warning_handler) (const char *, ...); +typedef void (*liboctave_warning_with_id_handler) (const char *, const char *, ...); + /* Would be nice to make these pointers private, but we want to share them among all the liboctave classes. */ extern liboctave_error_handler current_liboctave_error_handler; extern liboctave_warning_handler current_liboctave_warning_handler; +extern liboctave_warning_with_id_handler current_liboctave_warning_with_id_handler; + extern void set_liboctave_error_handler (liboctave_error_handler f); extern void set_liboctave_warning_handler (liboctave_warning_handler f); +extern void set_liboctave_warning_with_id_handler (liboctave_warning_with_id_handler f); + #ifdef __cplusplus } #endif
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -34,7 +34,6 @@ #include <vector> #include "Array.h" -#include "Array-flags.h" #include "Array-util.h" #include "Range.h" #include "idx-vector.h" @@ -1792,9 +1791,10 @@ { // Collapse dimensions beyond last index. - if (liboctave_wfi_flag && ! (ra_idx(n_idx-1).is_colon ())) - (*current_liboctave_warning_handler) - ("fewer indices than dimensions for N-d array"); + if (! (ra_idx(n_idx-1).is_colon ())) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", + "fewer indices than dimensions for N-d array"); for (octave_idx_type i = n_idx; i < n_lhs_dims; i++) lhs_dims(n_idx-1) *= lhs_dims(i); @@ -1945,7 +1945,7 @@ idx_vector idx_vec = ra_idx(0); - idx_vec.freeze (lhs_numel, 0, true, liboctave_wrore_flag); + idx_vec.freeze (lhs_numel, 0, true); idx_vec.sort (true); @@ -2172,11 +2172,11 @@ } else { - if (liboctave_wfi_flag - && ! (idx_arg.one_zero_only () - && idx_orig_rows == nr - && idx_orig_columns == nc)) - (*current_liboctave_warning_handler) ("single index used for matrix"); + if (! (idx_arg.one_zero_only () + && idx_orig_rows == nr + && idx_orig_columns == nc)) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", "single index used for matrix"); // This code is only for indexing matrices. The vector // cases are handled above. @@ -2244,11 +2244,10 @@ bool vec_equiv = vector_equivalent (dv); if (! vec_equiv - && liboctave_wfi_flag && ! (ra_idx.is_colon () || (ra_idx.one_zero_only () && idx_orig_dims == dv))) - (*current_liboctave_warning_handler) - ("single index used for N-d array"); + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", "single index used for N-d array"); octave_idx_type frozen_len = ra_idx.freeze (orig_len, "nd-array", resize_ok); @@ -2512,7 +2511,7 @@ octave_idx_type lhs_len = lhs.length (); octave_idx_type rhs_len = rhs.length (); - octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true, liboctave_wrore_flag); + octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true); if (n != 0) { @@ -2644,9 +2643,9 @@ if (n_idx == 2) { - octave_idx_type n = idx_i.freeze (lhs_nr, "row", true, liboctave_wrore_flag); - - octave_idx_type m = idx_j.freeze (lhs_nc, "column", true, liboctave_wrore_flag); + octave_idx_type n = idx_i.freeze (lhs_nr, "row", true); + + octave_idx_type m = idx_j.freeze (lhs_nc, "column", true); int idx_i_is_colon = idx_i.is_colon (); int idx_j_is_colon = idx_j.is_colon (); @@ -2738,7 +2737,7 @@ { octave_idx_type lhs_len = lhs.length (); - octave_idx_type n = idx_i.freeze (lhs_len, 0, true, liboctave_wrore_flag); + octave_idx_type n = idx_i.freeze (lhs_len, 0, true); if (idx_i) { @@ -2749,24 +2748,23 @@ } else { - if (liboctave_wfi_flag) + if (lhs_is_empty + && idx_i.is_colon () + && ! (rhs_nr == 1 || rhs_nc == 1)) { - if (lhs_is_empty - && idx_i.is_colon () - && ! (rhs_nr == 1 || rhs_nc == 1)) - { - (*current_liboctave_warning_handler) - ("A(:) = X: X is not a vector or scalar"); - } - else - { - octave_idx_type idx_nr = idx_i.orig_rows (); - octave_idx_type idx_nc = idx_i.orig_columns (); - - if (! (rhs_nr == idx_nr && rhs_nc == idx_nc)) - (*current_liboctave_warning_handler) - ("A(I) = X: X does not have same shape as I"); - } + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", + "A(:) = X: X is not a vector or scalar"); + } + else + { + octave_idx_type idx_nr = idx_i.orig_rows (); + octave_idx_type idx_nc = idx_i.orig_columns (); + + if (! (rhs_nr == idx_nr && rhs_nc == idx_nc)) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", + "A(I) = X: X does not have same shape as I"); } if (assign1 (lhs, xrhs, rfv)) @@ -2792,7 +2790,7 @@ } else if (lhs_nr == 1) { - idx_i.freeze (lhs_nc, "vector", true, liboctave_wrore_flag); + idx_i.freeze (lhs_nc, "vector", true); if (idx_i) { @@ -2810,7 +2808,7 @@ } else if (lhs_nc == 1) { - idx_i.freeze (lhs_nr, "vector", true, liboctave_wrore_flag); + idx_i.freeze (lhs_nr, "vector", true); if (idx_i) { @@ -2828,13 +2826,12 @@ } else { - if (liboctave_wfi_flag - && ! (idx_i.is_colon () - || (idx_i.one_zero_only () - && idx_i.orig_rows () == lhs_nr - && idx_i.orig_columns () == lhs_nc))) - (*current_liboctave_warning_handler) - ("single index used for matrix"); + if (! (idx_i.is_colon () + || (idx_i.one_zero_only () + && idx_i.orig_rows () == lhs_nr + && idx_i.orig_columns () == lhs_nc))) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", "single index used for matrix"); octave_idx_type len = idx_i.freeze (lhs_nr * lhs_nc, "matrix"); @@ -2930,12 +2927,11 @@ { idx_vector iidx = idx(0); - if (liboctave_wfi_flag - && ! (iidx.is_colon () - || (iidx.one_zero_only () - && iidx.orig_dimensions () == lhs.dims ()))) - (*current_liboctave_warning_handler) - ("single index used for N-d array"); + if (! (iidx.is_colon () + || (iidx.one_zero_only () + && iidx.orig_dimensions () == lhs.dims ()))) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", "single index used for N-d array"); octave_idx_type lhs_len = lhs.length (); @@ -3006,9 +3002,10 @@ // delay resizing LHS until we know that the assignment will // succeed. - if (liboctave_wfi_flag && ! (idx(n_idx-1).is_colon ())) - (*current_liboctave_warning_handler) - ("fewer indices than dimensions for N-d array"); + if (! (idx(n_idx-1).is_colon ())) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", + "fewer indices than dimensions for N-d array"); for (int i = n_idx; i < lhs_dims_len; i++) lhs_dims(n_idx-1) *= lhs_dims(i);
--- a/liboctave/ArrayN-idx.h +++ b/liboctave/ArrayN-idx.h @@ -22,7 +22,6 @@ */ -#include "Array-flags.h" #include "Range.h" #include "idx-vector.h" #include "lo-error.h"
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,30 @@ +2006-05-01 John W. Eaton <jwe@octave.org> + + * oct-shlib.h (octave_shlib::octave_shlib, octave_shlib::open): + Delete WARN_FUTURE arg. Change all uses. + * oct-shlib.cc (octave_base_shlib::stamp_time): Delete arg. + Change all uses. Use current_liboctave_warning_with_id_handler. + (octave_base_shlib::open): Delete arg. Change all derived classes + and uses. + +2006-04-29 John W. Eaton <jwe@octave.org> + + * Array-flags.cc, Array-flags.h: Delete. + * Makefile.in (MATRIX_SRC): Remove Array-flags.cc from the list. + (MATRIX_INC): Remove Array-flags.h from the list. + + * idx-vector.cc (IDX_VEC_REP::freeze): Delete warn_resize arg. + Use current_liboctave_warning_with_id_handler + with warning ID Octave:resize-on-range-error. + * idx-vector.h: Fix decl. + * Array.cc, Sparse.cc: Change all callers. + + * Array.cc (Array<T>::maybe_delete_elements, Array<T>::index2, + assign2, assignN): Use current_liboctave_warning_with_id_handler + with warning ID Octave:fortran-indexing instead of + liboctave_wfi_flag. + * Sparse.cc (assign, Sparse<T>::index): Likewise. + 2006-04-26 John W. Eaton <jwe@octave.org> * pathsearch.cc (dir_path::path_sep_char, dir_path::path_sep_str):
--- a/liboctave/Makefile.in +++ b/liboctave/Makefile.in @@ -25,7 +25,7 @@ $(BLAS_LIBS) $(FFTW_LIBS) $(LIBREADLINE) $(LIBGLOB) $(LIBS) $(FLIBS) MATRIX_INC := Array.h Array2.h Array3.h ArrayN.h DiagArray2.h \ - Array-flags.h Array-util.h ArrayN-idx.h MArray-defs.h \ + Array-util.h ArrayN-idx.h MArray-defs.h \ MArray.h MArray2.h MDiagArray2.h Matrix.h MArrayN.h \ base-lu.h dim-vector.h mx-base.h mx-op-defs.h mx-ops.h \ mx-defs.h mx-ext.h CColVector.h CDiagMatrix.h CMatrix.h \ @@ -90,7 +90,7 @@ MSparse-C.cc MSparse-d.cc Sparse-C.cc Sparse-b.cc Sparse-d.cc \ oct-inttypes.cc -MATRIX_SRC := Array-flags.cc Array-util.cc CColVector.cc \ +MATRIX_SRC := Array-util.cc CColVector.cc \ CDiagMatrix.cc CMatrix.cc CNDArray.cc CRowVector.cc \ CmplxAEPBAL.cc CmplxCHOL.cc CmplxDET.cc CmplxHESS.cc \ CmplxLU.cc CmplxQR.cc CmplxQRP.cc CmplxSCHUR.cc CmplxSVD.cc \
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -33,7 +33,6 @@ #include <vector> #include "Array.h" -#include "Array-flags.h" #include "Array-util.h" #include "Range.h" #include "idx-vector.h" @@ -1725,12 +1724,11 @@ } else { - if (liboctave_wfi_flag - && ! (idx_arg.one_zero_only () - && idx_orig_rows == nr - && idx_orig_columns == nc)) - (*current_liboctave_warning_handler) - ("single index used for sparse matrix"); + if (! (idx_arg.one_zero_only () + && idx_orig_rows == nr + && idx_orig_columns == nc)) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", "single index used for sparse matrix"); // This code is only for indexing matrices. The vector // cases are handled above. @@ -2037,8 +2035,7 @@ octave_idx_type nc = lhs.cols (); octave_idx_type nz = lhs.nnz (); - octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true, - liboctave_wrore_flag); + octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true); if (n != 0) { @@ -2401,10 +2398,8 @@ if (n_idx == 2) { - octave_idx_type n = idx_i.freeze (lhs_nr, "row", true, - liboctave_wrore_flag); - octave_idx_type m = idx_j.freeze (lhs_nc, "column", true, - liboctave_wrore_flag); + octave_idx_type n = idx_i.freeze (lhs_nr, "row", true); + octave_idx_type m = idx_j.freeze (lhs_nc, "column", true); int idx_i_is_colon = idx_i.is_colon (); int idx_j_is_colon = idx_j.is_colon (); @@ -2721,8 +2716,7 @@ { octave_idx_type lhs_len = lhs.length (); - octave_idx_type n = idx_i.freeze (lhs_len, 0, true, - liboctave_wrore_flag); + octave_idx_type n = idx_i.freeze (lhs_len, 0, true); if (idx_i) { @@ -2733,24 +2727,23 @@ } else { - if (liboctave_wfi_flag) + if (lhs_is_empty + && idx_i.is_colon () + && ! (rhs_nr == 1 || rhs_nc == 1)) { - if (lhs_is_empty - && idx_i.is_colon () - && ! (rhs_nr == 1 || rhs_nc == 1)) - { - (*current_liboctave_warning_handler) - ("A(:) = X: X is not a vector or scalar"); - } - else - { - octave_idx_type idx_nr = idx_i.orig_rows (); - octave_idx_type idx_nc = idx_i.orig_columns (); - - if (! (rhs_nr == idx_nr && rhs_nc == idx_nc)) - (*current_liboctave_warning_handler) - ("A(I) = X: X does not have same shape as I"); - } + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", + "A(:) = X: X is not a vector or scalar"); + } + else + { + octave_idx_type idx_nr = idx_i.orig_rows (); + octave_idx_type idx_nc = idx_i.orig_columns (); + + if (! (rhs_nr == idx_nr && rhs_nc == idx_nc)) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", + "A(I) = X: X does not have same shape as I"); } if (! assign1 (lhs, rhs)) @@ -2761,7 +2754,7 @@ } else if (lhs_nr == 1) { - idx_i.freeze (lhs_nc, "vector", true, liboctave_wrore_flag); + idx_i.freeze (lhs_nc, "vector", true); if (idx_i) { @@ -2774,7 +2767,7 @@ } else if (lhs_nc == 1) { - idx_i.freeze (lhs_nr, "vector", true, liboctave_wrore_flag); + idx_i.freeze (lhs_nr, "vector", true); if (idx_i) { @@ -2787,13 +2780,12 @@ } else { - if (liboctave_wfi_flag - && ! (idx_i.is_colon () - || (idx_i.one_zero_only () - && idx_i.orig_rows () == lhs_nr - && idx_i.orig_columns () == lhs_nc))) - (*current_liboctave_warning_handler) - ("single index used for matrix"); + if (! (idx_i.is_colon () + || (idx_i.one_zero_only () + && idx_i.orig_rows () == lhs_nr + && idx_i.orig_columns () == lhs_nc))) + (*current_liboctave_warning_with_id_handler) + ("Octave:fortran-indexing", "single index used for matrix"); octave_idx_type lhs_len = lhs.length ();
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -538,8 +538,7 @@ } octave_idx_type -IDX_VEC_REP::freeze (octave_idx_type z_len, const char *tag, bool resize_ok, - bool warn_resize) +IDX_VEC_REP::freeze (octave_idx_type z_len, const char *tag, bool resize_ok) { if (frozen) return frozen_len; @@ -583,15 +582,17 @@ } else { - if (warn_resize && max_val >= z_len) + if (max_val >= z_len) { if (tag) - (*current_liboctave_warning_handler) - ("resizing object with %s index = %d out of bounds", + (*current_liboctave_warning_with_id_handler) + ("Octave:resize-on-range-error", + "resizing object with %s index = %d out of bounds", tag, max_val+1); else - (*current_liboctave_warning_handler) - ("resizing object with index = %d out of bounds", + (*current_liboctave_warning_with_id_handler) + ("Octave:resize-on-range-error", + "resizing object with index = %d out of bounds", max_val+1); }
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -148,7 +148,7 @@ void shorten (octave_idx_type n); // Unsafe. Avoid at all cost. - octave_idx_type freeze (octave_idx_type z_len, const char *tag, bool resize_ok, bool warn_resize); + octave_idx_type freeze (octave_idx_type z_len, const char *tag, bool resize_ok); // i/o @@ -269,9 +269,8 @@ // i/o - octave_idx_type freeze (octave_idx_type z_len, const char *tag, bool resize_ok = false, - bool warn_resize = false) - { return rep->freeze (z_len, tag, resize_ok, warn_resize); } + octave_idx_type freeze (octave_idx_type z_len, const char *tag, bool resize_ok = false) + { return rep->freeze (z_len, tag, resize_ok); } std::ostream& print (std::ostream& os) const { return rep->print (os); }
--- a/liboctave/oct-shlib.cc +++ b/liboctave/oct-shlib.cc @@ -74,7 +74,7 @@ ~octave_base_shlib (void) { } - void open (const std::string&, bool = false) { } + void open (const std::string&) { } void *search (const std::string&, name_mangler = 0) { return 0; } @@ -100,7 +100,7 @@ octave_time tm_loaded; - void stamp_time (bool warn_future = false); + void stamp_time (void); void add_to_fcn_names (const std::string& name); @@ -150,18 +150,16 @@ } void -octave_base_shlib::stamp_time (bool warn_future) +octave_base_shlib::stamp_time (void) { tm_loaded.stamp (); - if (warn_future) - { - file_stat fs (file); + file_stat fs (file); - if (fs.is_newer (tm_loaded)) - (*current_liboctave_warning_handler) - ("timestamp on file %s is in the future", file.c_str ()); - } + if (fs.is_newer (tm_loaded)) + (*current_liboctave_warning_with_id_handler) + ("Octave:warn-future-time-stamp", + "timestamp on file %s is in the future", file.c_str ()); } void @@ -208,7 +206,7 @@ ~octave_dlopen_shlib (void); - void open (const std::string& f, bool warn_future = false); + void open (const std::string& f); void *search (const std::string& name, name_mangler mangler = 0); @@ -238,7 +236,7 @@ } void -octave_dlopen_shlib::open (const std::string& f, bool warn_future) +octave_dlopen_shlib::open (const std::string& f) { if (! is_open ()) { @@ -257,7 +255,7 @@ library = dlopen (file.c_str (), flags); if (library) - stamp_time (warn_future); + stamp_time (); else { const char *msg = dlerror (); @@ -322,7 +320,7 @@ ~octave_shl_load_shlib (void); - void open (const std::string& f, bool warn_future = false); + void open (const std::string& f); void *search (const std::string& name, name_mangler mangler = 0); @@ -352,7 +350,7 @@ } void -octave_shl_load_shlib::open (const std::string& f, bool warn_future) +octave_shl_load_shlib::open (const std::string& f) { if (! is_open ()) { @@ -361,7 +359,7 @@ library = shl_load (file.c_str (), BIND_DEFERRED, 0L); if (library) - stamp_time (warn_future); + stamp_time (); else { using namespace std; @@ -425,7 +423,7 @@ ~octave_w32_shlib (void); - void open (const std::string& f, bool warn_future = false); + void open (const std::string& f); void *search (const std::string& name, name_mangler mangler = 0); @@ -455,7 +453,7 @@ } void -octave_w32_shlib::open (const std::string& f, bool warn_future) +octave_w32_shlib::open (const std::string& f) { if (! is_open ()) { @@ -464,7 +462,7 @@ handle = LoadLibrary (file.c_str ()); if (handle != NULL) - stamp_time (warn_future); + stamp_time (); else { DWORD lastError = GetLastError (); @@ -553,7 +551,7 @@ ~octave_dyld_shlib (void); - void open (const std::string& f, bool warn_future = false); + void open (const std::string& f); void *search (const std::string& name, name_mangler mangler = 0); @@ -585,7 +583,7 @@ } void -octave_dyld_shlib::open (const std::string& f, bool warn_future) +octave_dyld_shlib::open (const std::string& f) { int returnCode; @@ -602,7 +600,7 @@ | NSLINKMODULE_OPTION_PRIVATE)); if (handle) { - stamp_time (warn_future); + stamp_time (); isOpen = true; } else
--- a/liboctave/oct-shlib.h +++ b/liboctave/oct-shlib.h @@ -50,11 +50,7 @@ octave_shlib (void) : rep (make_shlib ()) { } - octave_shlib (const std::string& f, bool warn_future) - : rep (make_shlib ()) - { - open (f, warn_future); - } + octave_shlib (const std::string& f) : rep (make_shlib ()) { open (f); } virtual ~octave_shlib (void) { @@ -90,8 +86,7 @@ operator bool () const { return is_open (); } - virtual void open (const std::string& f, bool warn_future = false) - { rep->open (f, warn_future); } + virtual void open (const std::string& f) { rep->open (f); } virtual void *search (const std::string& nm, name_mangler mangler = 0) { return rep->search (nm, mangler); }
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2006-04-29 John W. Eaton <jwe@octave.org> + + * startup/main-rcfile: Disable some warnings. + 2006-04-14 Bill Denney <denney@seas.upenn.edu> * strings/strcmpi.m: Return false instead of error if args are not
new file mode 100644 --- /dev/null +++ b/scripts/miscellaneous/warning_ids.m @@ -0,0 +1,212 @@ +## -*- texinfo -*- +## @table @code +## @item Octave:array-to-scalar +## If the @code{Octave:array-to-scalar} warning is enabled, Octave will +## warn when an implicit conversion from an array to a scalar value is +## attempted. By default, the @code{Octave:array-to-scalar} warning is +## disabled. +## +## @item Octave:array-to-vector +## If the @code{Octave:array-to-vector} warning is enabled, Octave will +## warn when an implicit conversion from an array to a vector value is +## attempted. By default, the @code{Octave:array-to-vector} warning is +## disabled. +## +## @item Octave:assign-as-truth-value +## If the @code{Octave:assign-as-truth-value} warning is +## enabled, a warning is issued for statements like +## +## @example +## if (s = t) +## ... +## @end example +## +## @noindent +## since such statements are not common, and it is likely that the intent +## was to write +## +## @example +## if (s == t) +## ... +## @end example +## +## @noindent +## instead. +## +## There are times when it is useful to write code that contains +## assignments within the condition of a @code{while} or @code{if} +## statement. For example, statements like +## +## @example +## while (c = getc()) +## ... +## @end example +## +## @noindent +## are common in C programming. +## +## It is possible to avoid all warnings about such statements by +## disabling the @code{Octave:assign-as-truth-value} warning, +## but that may also let real errors like +## +## @example +## if (x = 1) # intended to test (x == 1)! +## ... +## @end example +## +## @noindent +## slip by. +## +## In such cases, it is possible suppress errors for specific statements by +## writing them with an extra set of parentheses. For example, writing the +## previous example as +## +## @example +## while ((c = getc())) +## ... +## @end example +## +## @noindent +## will prevent the warning from being printed for this statement, while +## allowing Octave to warn about other assignments used in conditional +## contexts. +## +## By default, the @code{Octave:assign-as-truth-value} warning is enabled. +## +## @item Octave:associativity-change +## If the @code{Octave:associativity-change} warning is +## enabled, Octave will warn about possible changes in the meaning of +## some code due to changes in associativity for some operators. +## Associativity changes have typically been made for Matlab +## compatibility. By default, the @code{Octave:associativity-change} +## warning is enabled. +## +## @item Octave:divide-by-zero +## If the @code{Octave:divide-by-zero} warning is enabled, a +## warning is issued when Octave encounters a division by zero. By +## default, the @code{Octave:divide-by-zero} warning is enabled. +## +## @item Octave:empty-list-elements +## If the @code{Octave:empty-list-elements} warning is enabled, a +## warning is issued when an empty matrix is found in a matrix list. +## For example, +## +## @example +## a = [1, [], 3, [], 5] +## @end example +## +## @noindent +## By default, the @code{Octave:empty-list-elements} warning is enabled. +## +## @item Octave:fortran-indexing +## If the @code{Octave:fortran-indexing} warning is enabled, a warning is +## printed for expressions which select elements of a two-dimensional matrix +## using a single index. By default, the @code{Octave:fortran-indexing} +## warning is disabled. +## +## @item Octave:function-name-clash +## If the @code{Octave:function-name-clash} warning is enabled, a +## warning is issued when Octave finds that the name of a function +## defined in a function file differs from the name of the file. (If +## the names disagree, the name declared inside the file is ignored.) +## By default, the @code{Octave:function-name-clash} warning is enabled. +## +## @item Octave:future-time-stamp +## If the @code{Octave:future-time-stamp} warning is enabled, Octave +## will print a warning if it finds a function file with a time stamp +## that is in the future. By default, the +## @code{Octave:future-time-stamp} warning is enabled. +## +## @item Octave:imag-to-real +## If the @code{Octave:imag-to-real} warning is enabled, a warning is +## printed for implicit conversions of complex numbers to real numbers. +## By default, the @code{Octave:imag-to-real} warning is disabled. +## +## @item Octave:missing-semicolon +## If the @code{Octave:missing-semicolon} warning is enabled, Octave +## will warn when statements in function definitions don't end in +## semicolons. By default the @code{Octave:missing-semicolon} warning +## is disabled. +## +## @item Octave:neg-dim-as-zero +## If the @code{Octave:neg-dim-as-zero} warning is enabled, print a warning +## for expressions like +## +## @example +## eye (-1) +## @end example +## +## @noindent +## By default, the @code{Octave:neg-dim-as-zero} warning is disabled. +## +## @item Octave:num-to-str +## If the @code{Octave:num-to-str} warning is enable, a warning is +## printed for implicit conversions of numbers to their ASCII character +## equivalents when strings are constructed using a mixture of strings and +## numbers in matrix notation. For example, +## +## @example +## @group +## [ "f", 111, 111 ] +## @result{} "foo" +## @end group +## @end example +## elicits a warning if the @code{Octave:num-to-str} warning is +## enabled. By default, the @code{Octave:num-to-str} warning is enabled. +## +## @item Octave:precedence-change +## If the @code{Octave:precedence-change} warning is enabled, Octave +## will warn about possible changes in the meaning of some code due to +## changes in precedence for some operators. Precedence changes have +## typically been made for Matlab compatibility. By default, the +## @code{Octave:precedence-change} warning is enabled. +## +## @item Octave:reload-forces-clear +## If several functions have been loaded from the same file, Octave must +## clear all the functions before any one of them can be reloaded. If +## the @code{Octave:reload-forces-clear} warning is enabled, Octave will +## warn you when this happens, and print a list of the additional +## functions that it is forced to clear. By default, the +## @code{Octave:reload-forces-clear} warning is enabled. +## +## @item Octave:resize-on-range-error +## If the @code{Octave:resize-on-range-error} warning is enabled, print a +## warning when a matrix is resized by an indexed assignment with +## indices outside the current bounds. By default, the +## @code{Octave:resize-on-range-error} warning is disabled. +## +## @item Octave:str-to-num +## If the @code{Octave:str-to-num} warning is enabled, a warning is printed +## for implicit conversions of strings to their numeric ASCII equivalents. +## For example, +## @example +## @group +## "abc" + 0 +## @result{} 97 98 99 +## @end group +## @end example +## elicits a warning if the @code{Octave:str-to-num} warning is enabled. +## By default, the @code{Octave:str-to-num} warning is disabled. +## +## @item Octave:string-concat +## If the @code{Octave:string-concat} warning is enabled, print a +## warning when concatenating a mixture of double and single quoted strings. +## By default, the @code{Octave:string-concat} warning is disabled. +## +## @item Octave:undefined-return-values +## If the @code{Octave:undefined-return-values} warning is disabled, +## print a warning if a function does not define all the values in +## the return list which are expected. By default, the +## @code{Octave:undefined-return-values} warning is enabled. +## +## @item Octave:variable-switch-label +## If the @code{Octave:variable-switch-label} warning is enabled, Octave +## will print a warning if a switch label is not a constant or constant +## expression. By default, the @code{Octave:variable-switch-label} +## warning is disabled. +## @end table + +## FIXME -- we should be able to get formatted help for empty scripts, +## not just functions. +function warning_ids () +endfunction
--- a/scripts/special-matrix/toeplitz.m +++ b/scripts/special-matrix/toeplitz.m @@ -51,7 +51,7 @@ ## @end group ## @end example ## @end ifinfo -## @seealso{hankel, vander, sylvester_matrix, hilb, invhib} +## @seealso{hankel, vander, sylvester_matrix, hilb, invhilb} ## @end deftypefn ## Author: jwe
--- a/scripts/startup/main-rcfile +++ b/scripts/startup/main-rcfile @@ -3,6 +3,21 @@ ## This file should contain any commands that should be executed each ## time Octave starts for every user at this site. +## Default state for warnings is "on", but most people will want to +## have these disabled. + +warning ("off", "Octave:array-to-scalar"); +warning ("off", "Octave:array-to-vector"); +warning ("off", "Octave:empty-list-elements"); +warning ("off", "Octave:fortran-indexing"); +warning ("off", "Octave:imag-to-real"); +warning ("off", "Octave:missing-semicolon"); +warning ("off", "Octave:neg-dim-as-zero"); +warning ("off", "Octave:resize-on-range-error"); +warning ("off", "Octave:str-to-num"); +warning ("off", "Octave:string-concat"); +warning ("off", "Octave:variable-switch-label"); + ## Configure readline using the file inputrc in the Octave startup ## directory.
--- a/scripts/testfun/test.m +++ b/scripts/testfun/test.m @@ -610,7 +610,7 @@ %!test %! lastwarn(); # clear last warning just in case -%!warning <warning message> warning('warning message') +%!warning <warning message> warning('warning message'); %!## test of shared variables %!shared a # create a shared variable
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,130 @@ +2006-05-01 John W. Eaton <jwe@octave.org> + + * error.h (Vwarning_option): Delete. + * variables.cc (looks_like_struct): Remove use from commented code. + + * gripes.cc, gripes.h (gripe_implicit_conversion): New arg, ID. + Change all uses. + + * defaults.cc (set_local_site_defaults_file, set_site_defaults_file): + Allow filenames to be set from the environment. + + * oct-map.cc (octave_map::resize): No longer const. + * ov-struct.h (octave_struct::resize): Deal with it. + + * octave.cc (initialize_error_handlers): Also call + set_liboctave_warning_with_id_handler. + (execute_startup_files): Check that home_rc is not an empty string. + (F__version_info__): Resize vinfo before assigining elements. + + * ov-base.cc (warn_num_to_str, warn_resize_on_range_error): + Delete functions. + (symbols_of_ov_base): Delete DEFVARS. + (Vwarn_num_to_str, Vwarn_resize_on_range_error): Delete variables. + (value::convert_to_str): Check state of warning ID + Octave:num-to-str instead of using Vwarn_num_to_str. + * OPERATORS/op-chm.cc: Likewise. + * ov-base.h (Vwarn_num_to_str, Vwarn_resize_on_range_error): + Delete decls. + + * ov-list.cc (octave_list::assign): Call warning_with_id instead + of warning. + + * parse.y (warn_assign_as_truth_value, warn_associativity_change, + warn_function_name_clash, warn_future_time_stamp, + warn_missing_semicolon, warn_precedence_change, + warn_variable_switch_label, symbols_of_parse): + Delete DEFVARs and functions. + (Vwarn_assign_as_truth_value, Vwarn_associativity_change, + Vwarn_function_name_clash, Vwarn_future_time_stamp, + Vwarn_missing_semicolon, Vwarn_precedence_change, + Vwarn_variable_switch_label): Delete variables. + * parse.h (Vwarn_future_time_stamp): Delete decl. + * parse.y (fold): Check state of warning ID + Octave:associativity-change and Octave:precedence-change instead + of using Vwarn_associativity_change and Vwarn_precedence_change. + (maybe_warn_associativity_change, maybe_warn_missing_semi, + maybe_warn_assign_as_truth_value, make_binary_op, make_boolean_op, + frob_function): Call warning_with_id instead of warning. + * dynamic-ld.cc (octave_dynamic_loader::do_load): Likewise. + + * ov.cc (warn_fortran_indexing, warn_imag_to_real, symbols_of_ov): + Delete DEFVARs and functions. + (Vwarn_fortran_indexing, Vwarn_imag_to_real): Delete variables. + + * ov.cc (octave_value::vector_value, octave_value::int_vector_value, + octave_value::complex_vector_value): Check state of warning ID + Octave:fortran-indexing instead of using Vwarn_fortran_indexing. + * ov-cx-sparse.cc (octave_sparse_complex_matrix::double_value, + octave_sparse_complex_matrix::complex_value): Likewise. + * ov-cx-mat.cc (octave_complex_matrix::matrix_value, + octave_complex_matrix::complex_value): Likewise. + * ov-re-mat.cc (octave_matrix::complex_value, + octave_matrix::double_value): Likewise. + * ov-streamoff.cc (octave_streamoff::streamoff_value): Likewise. + * ov-re-sparse.cc (octave_sparse_matrix::complex_value, + octave_sparse_matrix::double_value): Likewise. + * ov-range.cc (octave_range::complex_value, + octave_range::double_value): Likewise. + * ov-ch-mat.cc (octave_char_matrix::complex_value, + octave_char_matrix::double_value): Likewise. + * ov-bool-sparse.cc (octave_sparse_bool_matrix::complex_value, + octave_sparse_bool_matrix::double_value): Likewise. + * ov-bool-mat.cc (octave_bool_matrix::complex_value, + octave_bool_matrix::double_value): Likewise. + + * ov-cx-sparse.cc (octave_sparse_complex_matrix::double_value, + octave_sparse_complex_matrix::matrix_value, + octave_sparse_complex_matrix::sparse_matrix_value): Check state of + warning ID Octave:imag-to-real instead of using Vwarn_imag_to_real. + * ov-cx-mat.cc (octave_complex_matrix::double_value, + octave_complex_matrix::matrix_value, + octave_complex_matrix::complex_value, + octave_complex_matrix::sparse_matrix_value): Likewise. + * ov-complex.cc (octave_complex::double_value, + octave_complex::matrix_value, octave_complex::array_value): Likewise. + + * ov.h (Vwarn_fortran_indexing, Vwarn_imag_to_real): Delete decls. + + * pt-mat.cc (warn_empty_list_elements, warn_string_concat): + Delete functions. + (symbols_of_pt_mat): Delete DEFVARs. + (Vwarn_empty_list_elements, Vwarn_string_concat): Delete variables. + (tm_row_const::tm_row_const_rep::eval_warning, tm_const::init, + maybe_warn_string_concat): Call warning_with_id instead of warning. + + * ov-str-mat.cc (warn_str_to_num, symbols_of_ov_str_mat): + Delete DEFVAR and functions. + (Vwarn_str_to_num): Delete variable. + (CHAR_MATRIX_CONV): Call warning_with_id instead of warning. + + * utils.cc (warn_neg_dim_as_zero, symbols_of_utils): + Delete DEFVAR and functions. + (Vwarn_neg_dim_as_zero): Delete variable. + (check_dimensions): Call warning_with_id instead of warning. + + * pt-misc.cc (warn_undefined_return_values, symbols_of_pt_misc): + Delete DEFVAR and functions. + (Vwarn_undefined_return_values): Delete variable. + (tree_parameter_list::initialize_undefined_elements): + Call warning_with_id instead of warning. + + * dynamic-ld.cc (warn_reload_forces_clear, symbols_of_dynamic_ld): + Delete DEFVAR and functions. + (Vwarn_reload_forces_clear): Delete variable. + (do_clear_function, octave_dynamic_loader::do_load): + Call warning_with_id instead of warning. + * error.cc (warning_enabled): Now extern. + (Fwarning): If specific id is not found, return state of "all". + + * error.h: Provide decl. + + * gripes.cc (warn_divide_by_zero, symbols_of_gripes): + Delete DEFVAR and functions. + (gripe_divide_by_zero): Check whether warning is enabled, then + call warning_with_id instead of warning. + (Vwarn_divide_by_zero): Delete variable. + 2006-04-27 John W. Eaton <jwe@octave.org> * variables.cc (Fexist): Fix doc string.
--- a/src/OPERATORS/op-chm.cc +++ b/src/OPERATORS/op-chm.cc @@ -52,8 +52,8 @@ { CAST_BINOP_ARGS (octave_char_matrix&, const octave_scalar&); - if (Vwarn_num_to_str) - gripe_implicit_conversion (v2.type_name (), v1.type_name ()); + gripe_implicit_conversion ("Octave:num-to-str", + v2.type_name (), v1.type_name ()); return octave_value (v1.char_array_value (). concat(v2.array_value (), ra_idx)); @@ -63,8 +63,8 @@ { CAST_BINOP_ARGS (octave_char_matrix&, const octave_matrix&); - if (Vwarn_num_to_str) - gripe_implicit_conversion (v2.type_name (), v1.type_name ()); + gripe_implicit_conversion ("Octave:num-to-str", + v2.type_name (), v1.type_name ()); return octave_value (v1.char_array_value (). concat (v2.array_value (), ra_idx)); @@ -74,8 +74,8 @@ { CAST_BINOP_ARGS (octave_scalar&, const octave_char_matrix&); - if (Vwarn_num_to_str) - gripe_implicit_conversion (v1.type_name (), v2.type_name ()); + gripe_implicit_conversion ("Octave:num-to-str", + v1.type_name (), v2.type_name ()); return octave_value (v1.array_value (). concat (v2.char_array_value (), ra_idx)); @@ -85,8 +85,8 @@ { CAST_BINOP_ARGS (octave_matrix&, const octave_char_matrix&); - if (Vwarn_num_to_str) - gripe_implicit_conversion (v1.type_name (), v2.type_name ()); + gripe_implicit_conversion ("Octave:num-to-str", + v1.type_name (), v2.type_name ()); return octave_value (v1.array_value (). concat (v2.char_array_value (), ra_idx));
--- a/src/defaults.cc +++ b/src/defaults.cc @@ -347,15 +347,29 @@ static void set_local_site_defaults_file (void) { - Vlocal_site_defaults_file = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR); - Vlocal_site_defaults_file.append ("/octaverc"); + std::string lsf = octave_env::getenv ("OCTAVE_LOCAL_SITE_INITFILE"); + + if (lsf.empty ()) + { + Vlocal_site_defaults_file = subst_octave_home (OCTAVE_LOCALSTARTUPFILEDIR); + Vlocal_site_defaults_file.append ("/octaverc"); + } + else + Vlocal_site_defaults_file = lsf; } static void set_site_defaults_file (void) { - Vsite_defaults_file = subst_octave_home (OCTAVE_STARTUPFILEDIR); - Vsite_defaults_file.append ("/octaverc"); + std::string sf = octave_env::getenv ("OCTAVE_SITE_INITFILE"); + + if (sf.empty ()) + { + Vsite_defaults_file = subst_octave_home (OCTAVE_STARTUPFILEDIR); + Vsite_defaults_file.append ("/octaverc"); + } + else + Vsite_defaults_file = sf; } std::string
--- a/src/dynamic-ld.cc +++ b/src/dynamic-ld.cc @@ -39,10 +39,6 @@ #include "utils.h" #include "variables.h" -// TRUE means we print a warning if reloading a .oct file forces other -// functions to be cleared. -static bool Vwarn_reload_forces_clear; - class octave_shlib_list { @@ -198,8 +194,7 @@ static void do_clear_function (const std::string& fcn_name) { - if (Vwarn_reload_forces_clear) - warning (" %s", fcn_name.c_str ()); + warning_with_id ("Octave:reload-forces-clear", " %s", fcn_name.c_str ()); curr_sym_tab->clear (fcn_name); @@ -232,9 +227,10 @@ { int n = oct_file.number_of_functions_loaded (); - if (n > 0 && Vwarn_reload_forces_clear) - warning ("reloading %s clears the following functions:", - oct_file.file_name().c_str ()); + if (n > 0) + warning_with_id ("Octave:reload-forces-clear", + "reloading %s clears the following functions:", + oct_file.file_name().c_str ()); oct_file.close (do_clear_function); @@ -248,7 +244,7 @@ if (! oct_file_name.empty ()) { - oct_file.open (oct_file_name, Vwarn_future_time_stamp); + oct_file.open (oct_file_name); if (! error_state) { @@ -331,27 +327,6 @@ return retval; } -static int -warn_reload_forces_clear (void) -{ - Vwarn_reload_forces_clear = check_preference ("warn_reload_forces_clear"); - - return 0; -} - -void -symbols_of_dynamic_ld (void) -{ - DEFVAR (warn_reload_forces_clear, true, warn_reload_forces_clear, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_reload_forces_clear\n\ -If several functions have been loaded from the same file, Octave must\n\ -clear all the functions before any one of them can be reloaded. If\n\ -@code{warn_reload_forces_clear}, Octave will warn you when this happens,\n\ -and print a list of the additional functions that it is forced to clear.\n\ -@end defvr"); -} - /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/error.cc +++ b/src/error.cc @@ -450,7 +450,7 @@ // For given warning ID, return 0 if warnings are disabled, 1 if // enabled, and 2 if this ID should be an error instead of a warning. -static int +int warning_enabled (const std::string& id) { int retval = 0; @@ -492,7 +492,6 @@ if (all_found && id_found) break; } - } if (all_state == -1) @@ -725,11 +724,11 @@ DEFUN (error, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} error (@var{template}, @dots{})\n\ -The @code{error} function formats the optional arguments under the\n\ -control of the template string @var{template} using the same rules as\n\ -the @code{printf} family of functions (@pxref{Formatted Output}).\n\ -The resulting message is prefixed by the string @samp{error: } and\n\ -printed on the @code{stderr} stream.\n\ +Format the optional arguments under the control of the template string\n\ +@var{template} using the same rules as the @code{printf} family of\n\ +functions (@pxref{Formatted Output}) and print the resulting message\n\ +on the @code{stderr} stream. The message is prefixed by the character\n\ +string @samp{error: }.\n\ \n\ Calling @code{error} also sets Octave's internal error state such that\n\ control will return to the top level without evaluating any more\n\ @@ -788,12 +787,30 @@ DEFCMD (warning, args, nargout, "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} warning (@var{msg})\n\ -Print a warning message @var{msg} prefixed by the string @samp{warning: }. \n\ -After printing the warning message, Octave will continue to execute\n\ -commands. You should use this function when you want to notify the user\n\ +@deftypefn {Built-in Function} {} warning (@var{template}, @dots{})\n\ +@deftypefnx {Built-in Function} {} warning (@var{id}, @var{template})\n\ +Format the optional arguments under the control of the template string\n\ +@var{template} using the same rules as the @code{printf} family of\n\ +functions (@pxref{Formatted Output}) and print the resulting message\n\ +on the @code{stderr} stream. The message is prefixed by the character\n\ +string @samp{warning: }.\n\ +You should use this function when you want to notify the user\n\ of an unusual condition, but only when it makes sense for your program\n\ to go on.\n\ +\n\ +The optional message identifier allows users to enable or disable\n\ +warnings tagged by @var{id}. The special identifier @samp{\"all\"} may\n\ +be used to set the state of all warnings.\n\ +\n\ +@deftypefnx {Built-in Function} {} warning (\"on\", @var{id})\n\ +@deftypefnx {Built-in Function} {} warning (\"off\", @var{id})\n\ +@deftypefnx {Built-in Function} {} warning (\"error\", @var{id})\n\ +@deftypefnx {Built-in Function} {} warning (\"query\", @var{id})\n\ +Set or query the the state of a particular warning using the identifier\n\ +@var{id}. If the identifier is omitted, a value of @samp{\"all\"} is\n\ +assumed. If you set the state of a warning to @samp{\"error\"}, the\n\ +warning named by @var{id} is handled as if it were an error instead.\n\ +@seealso{warning_ids}.\n\ @end deftypefn") { octave_value retval; @@ -961,6 +978,19 @@ } } + if (! found) + { + for (octave_idx_type i = 0; i < nel; i++) + { + if (ident(i).string_value () == "all") + { + val = state(i).string_value (); + found = true; + break; + } + } + } + if (found) { Octave_map tmp; @@ -971,7 +1001,7 @@ retval = tmp; } else - error ("warning: invalid warning tag `%s'", arg2.c_str ()); + error ("warning: unable to find default warning state!"); } done = true;
--- a/src/error.h +++ b/src/error.h @@ -32,6 +32,8 @@ extern void reset_error_handler (void); +extern int warning_enabled (const std::string& id); + extern void message (const char *name, const char *fmt, ...); extern void usage (const char *fmt, ...); extern void warning (const char *fmt, ...); @@ -75,10 +77,6 @@ // TRUE means warning messages are turned off. extern bool discard_warning_messages; -// The current warning state. Valid values are "on", "off", -// "backtrace", or "debug". -extern std::string Vwarning_option; - #endif /*
--- a/src/gripes.cc +++ b/src/gripes.cc @@ -31,9 +31,6 @@ #include "oct-obj.h" #include "utils.h" -// Allow divide by zero errors to be suppressed. -static bool Vwarn_divide_by_zero; - void gripe_not_supported (const char *fcn) { @@ -167,42 +164,24 @@ } void -gripe_implicit_conversion (const char *from, const char *to) +gripe_implicit_conversion (const char *id, const char *from, const char *to) { - warning ("implicit conversion from %s to %s", from, to); + warning_with_id (id, "implicit conversion from %s to %s", from, to); } void -gripe_implicit_conversion (const std::string& from, const std::string& to) +gripe_implicit_conversion (const std::string& id, + const std::string& from, const std::string& to) { - warning ("implicit conversion from %s to %s", from.c_str (), to.c_str ()); + warning_with_id (id.c_str (), + "implicit conversion from %s to %s", + from.c_str (), to.c_str ()); } void gripe_divide_by_zero (void) { - if (Vwarn_divide_by_zero) - warning ("division by zero"); -} - -static int -warn_divide_by_zero (void) -{ - Vwarn_divide_by_zero = check_preference ("warn_divide_by_zero"); - - return 0; -} - -void -symbols_of_gripes (void) -{ - DEFVAR (warn_divide_by_zero, true, warn_divide_by_zero, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_divide_by_zero\n\ -If the value of @code{warn_divide_by_zero} is nonzero, a warning\n\ -is issued when Octave encounters a division by zero. If the value is\n\ -0, the warning is omitted. The default value is 1.\n\ -@end defvr"); + warning_with_id ("Octave:divide-by-zero", "division by zero"); } /*
--- a/src/gripes.h +++ b/src/gripes.h @@ -94,10 +94,11 @@ gripe_wrong_type_arg_for_binary_op (const octave_value& op); extern void -gripe_implicit_conversion (const char *from, const char *to); +gripe_implicit_conversion (const char *id, const char *from, const char *to); extern void -gripe_implicit_conversion (const std::string& from, const std::string& to); +gripe_implicit_conversion (const std::string& id, const std::string& from, + const std::string& to); extern void gripe_divide_by_zero (void);
--- a/src/oct-map.cc +++ b/src/oct-map.cc @@ -140,30 +140,25 @@ return retval; } -Octave_map -Octave_map::resize (const dim_vector& dv, bool fill) const +void +Octave_map::resize (const dim_vector& dv, bool fill) { - Octave_map retval; - if (dv != dims ()) { for (const_iterator p = begin (); p != end (); p++) { Cell tmp = contents(p); + if (fill) tmp.resize(dv, Cell::resize_fill_value ()); else tmp.resize(dv); - retval.assign (key(p), tmp); + + dimensions = dv; + + assign (key(p), tmp); } - - retval.dimensions = dv; } - else - retval = *this; - - - return retval; } Octave_map
--- a/src/oct-map.h +++ b/src/oct-map.h @@ -127,7 +127,7 @@ Octave_map reshape (const dim_vector& new_dims) const; - Octave_map resize (const dim_vector& dv, bool fill = false) const; + void resize (const dim_vector& dv, bool fill = false); octave_idx_type numel (void) const;
--- a/src/octave.cc +++ b/src/octave.cc @@ -224,12 +224,26 @@ if (nargin == 4) { - octave_value idx (vinfo.numel () + 1); + if (vinfo.empty ()) + { + vinfo.assign ("Name", args (0)); + vinfo.assign ("Version", args (1)); + vinfo.assign ("Release", args (2)); + vinfo.assign ("Date", args (3)); + } + else + { + octave_idx_type n = vinfo.numel () + 1; - vinfo.assign (idx, "Name", Cell (octave_value (args (0)))); - vinfo.assign (idx, "Version", Cell (octave_value (args (1)))); - vinfo.assign (idx, "Release", Cell (octave_value (args (2)))); - vinfo.assign (idx, "Date", Cell (octave_value (args (3)))); + vinfo.resize (dim_vector (n, 1)); + + octave_value idx (n); + + vinfo.assign (idx, "Name", Cell (octave_value (args (0)))); + vinfo.assign (idx, "Version", Cell (octave_value (args (1)))); + vinfo.assign (idx, "Release", Cell (octave_value (args (2)))); + vinfo.assign (idx, "Date", Cell (octave_value (args (3)))); + } } else if (nargin == 0) retval = vinfo; @@ -296,7 +310,7 @@ std::string local_rc; - if (! home_dir.empty ()) + if (! home_rc.empty ()) { parse_and_execute (home_rc, verbose); @@ -454,6 +468,7 @@ { set_liboctave_error_handler (error); set_liboctave_warning_handler (warning); + set_liboctave_warning_with_id_handler (warning_with_id); } // What happens on --traditional.
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -66,14 +66,6 @@ // semicolon has been appended to each statement). static bool Vsilent_functions; -// Should we print a warning when converting `[97, 98, 99, "123"]' -// to a character string? -bool Vwarn_num_to_str; - -// If TRUE, print a warning when a matrix is resized by an indexed -// assignment with indices outside the current bounds. -bool Vwarn_resize_on_range_error; - octave_value octave_base_value::squeeze (void) const { @@ -275,8 +267,9 @@ { octave_value retval = convert_to_str_internal (pad, force, type); - if (! force && is_numeric_type () && Vwarn_num_to_str) - gripe_implicit_conversion (type_name (), retval.type_name ()); + if (! force && is_numeric_type ()) + gripe_implicit_conversion ("Octave:num-to-str", + type_name (), retval.type_name ()); return retval; } @@ -1105,25 +1098,6 @@ return 0; } -static int -warn_num_to_str (void) -{ - Vwarn_num_to_str = check_preference ("warn_num_to_str"); - - return 0; -} - -static int -warn_resize_on_range_error (void) -{ - Vwarn_resize_on_range_error - = check_preference ("warn_resize_on_range_error"); - - liboctave_wrore_flag = Vwarn_resize_on_range_error; - - return 0; -} - void symbols_of_ov_base (void) { @@ -1155,32 +1129,6 @@ is executed, Octave will either print @samp{ans = 4} or nothing\n\ depending on the value of @code{silent_functions}.\n\ @end defvr"); - - DEFVAR (warn_num_to_str, true, warn_num_to_str, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_num_to_str\n\ -If the value of @code{warn_num_to_str} is nonzero, a warning is\n\ -printed for implicit conversions of numbers to their ASCII character\n\ -equivalents when strings are constructed using a mixture of strings and\n\ -numbers in matrix notation. For example,\n\ -\n\ -@example\n\ -@group\n\ -[ \"f\", 111, 111 ]\n\ - @result{} \"foo\"\n\ -@end group\n\ -@end example\n\ -elicits a warning if @code{warn_num_to_str} is nonzero. The default\n\ -value is 1.\n\ -@end defvr"); - - DEFVAR (warn_resize_on_range_error, false, warn_resize_on_range_error, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_resize_on_range_error\n\ -If the value of @code{warn_resize_on_range_error} is nonzero, print a\n\ -warning when a matrix is resized by an indexed assignment with\n\ -indices outside the current bounds. The default value is 0.\n\ -@end defvr"); } /*
--- a/src/ov-base.h +++ b/src/ov-base.h @@ -91,14 +91,6 @@ octave_value (new t ())); \ } -// Should we print a warning when converting `[97, 98, 99, "123"]' -// to a character string? -extern bool Vwarn_num_to_str; - -// If TRUE, print a warning when a matrix is resized by an indexed -// assignment with indices outside the current bounds. -extern bool Vwarn_resize_on_range_error; - // A base value type, so that derived types only have to redefine what // they need (if they are derived from octave_base_value instead of // octave_value).
--- a/src/ov-bool-mat.cc +++ b/src/ov-bool-mat.cc @@ -99,12 +99,10 @@ { double retval = lo_ieee_nan_value (); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("bool matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "bool matrix", "real scalar"); retval = matrix (0, 0); } @@ -121,12 +119,10 @@ Complex retval (tmp, tmp); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("bool matrix", "complex scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "bool matrix", "complex scalar"); retval = matrix (0, 0); }
--- a/src/ov-bool-sparse.cc +++ b/src/ov-bool-sparse.cc @@ -100,9 +100,8 @@ if (numel () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("bool sparse matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "bool sparse matrix", "real scalar"); retval = matrix (0, 0); } @@ -119,12 +118,10 @@ Complex retval (tmp, tmp); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("bool sparse matrix", "complex scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "bool sparse matrix", "complex scalar"); retval = matrix (0, 0); }
--- a/src/ov-ch-mat.cc +++ b/src/ov-ch-mat.cc @@ -57,12 +57,10 @@ { double retval = lo_ieee_nan_value (); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("character matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "character matrix", "real scalar"); retval = matrix (0, 0); } @@ -79,12 +77,10 @@ Complex retval (tmp, tmp); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("character matrix", "complex scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "character matrix", "complex scalar"); retval = matrix (0, 0); }
--- a/src/ov-complex.cc +++ b/src/ov-complex.cc @@ -96,8 +96,9 @@ { double retval = lo_ieee_nan_value (); - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex scalar", "real scalar"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex scalar", "real scalar"); retval = std::real (scalar); @@ -109,8 +110,9 @@ { Matrix retval; - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex scalar", "real matrix"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex scalar", "real matrix"); retval = Matrix (1, 1, std::real (scalar)); @@ -122,8 +124,9 @@ { NDArray retval; - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex scalar", "real matrix"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex scalar", "real matrix"); retval = NDArray (dim_vector (1, 1), std::real (scalar));
--- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -123,15 +123,14 @@ { double retval = lo_ieee_nan_value (); - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex matrix", "real scalar"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex matrix", "real scalar"); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("complex matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "complex matrix", "real scalar"); retval = std::real (matrix (0, 0)); } @@ -146,8 +145,9 @@ { Matrix retval; - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex matrix", "real matrix"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex matrix", "real matrix"); retval = ::real (matrix.matrix_value ()); @@ -161,12 +161,10 @@ Complex retval (tmp, tmp); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("complex matrix", "complex scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "complex matrix", "complex scalar"); retval = matrix (0, 0); } @@ -187,8 +185,9 @@ { SparseMatrix retval; - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex matrix", "real matrix"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex matrix", "real matrix"); retval = SparseMatrix (::real (matrix.matrix_value ()));
--- a/src/ov-cx-sparse.cc +++ b/src/ov-cx-sparse.cc @@ -119,15 +119,15 @@ { double retval = lo_ieee_nan_value (); - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex sparse matrix", "real scalar"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex sparse matrix", "real scalar"); // FIXME -- maybe this should be a function, valid_as_scalar() if (numel () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("complex sparse matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "complex sparse matrix", "real scalar"); retval = std::real (matrix (0, 0)); } @@ -142,8 +142,9 @@ { Matrix retval; - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex sparse matrix", "real matrix"); + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex sparse matrix", "real matrix"); retval = ::real (matrix.matrix_value ()); @@ -160,9 +161,8 @@ // FIXME -- maybe this should be a function, valid_as_scalar() if (numel () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("complex sparse matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "complex sparse matrix", "real scalar"); retval = matrix (0, 0); } @@ -189,8 +189,9 @@ { SparseMatrix retval; - if (! force_conversion && Vwarn_imag_to_real) - gripe_implicit_conversion ("complex sparse matrix", + if (! force_conversion) + gripe_implicit_conversion ("Octave:imag-to-real", + "complex sparse matrix", "real sparse matrix"); retval = ::real (matrix);
--- a/src/ov-intx.h +++ b/src/ov-intx.h @@ -89,9 +89,8 @@ if (numel () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion (type_name (), "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + type_name (), "real scalar"); retval = double (matrix(0)); }
--- a/src/ov-list.cc +++ b/src/ov-list.cc @@ -247,8 +247,9 @@ if (i > 0) { - if (Vwarn_resize_on_range_error && i > n) - warning ("list index = %d out of range", i); + if (i > n) + warning_with_id ("Octave:resize-on-range-error", + "list index = %d out of range", i); data(i-1) = rhs; }
--- a/src/ov-range.cc +++ b/src/ov-range.cc @@ -136,9 +136,8 @@ if (nel > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("range", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "range", "real scalar"); retval = range.base (); } @@ -196,9 +195,8 @@ if (nel > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("range", "complex scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "range", "complex scalar"); retval = range.base (); }
--- a/src/ov-re-mat.cc +++ b/src/ov-re-mat.cc @@ -92,9 +92,8 @@ if (numel () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("real matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "real matrix", "real scalar"); retval = matrix (0, 0); } @@ -119,12 +118,10 @@ Complex retval (tmp, tmp); - // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("real matrix", "complex scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "real matrix", "complex scalar"); retval = matrix (0, 0); }
--- a/src/ov-re-sparse.cc +++ b/src/ov-re-sparse.cc @@ -98,9 +98,8 @@ if (numel () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("real sparse matrix", "real scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "real sparse matrix", "real scalar"); retval = matrix (0, 0); } @@ -120,9 +119,8 @@ // FIXME -- maybe this should be a function, valid_as_scalar() if (rows () > 0 && columns () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("real sparse matrix", "complex scalar"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "real sparse matrix", "complex scalar"); retval = matrix (0, 0); }
--- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -55,13 +55,6 @@ DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_str, "string", "char"); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_char_matrix_sq_str, "sq_string", "char"); -// If TRUE, warn for operations like -// -// octave> 'abc' + 0 -// 97 98 99 -// -static int Vwarn_str_to_num; - static octave_base_value * default_numeric_conversion_function (const octave_base_value& a) { @@ -183,8 +176,9 @@ gripe_invalid_conversion ("string", TNAME); \ else \ { \ - if (Vwarn_str_to_num) \ - gripe_implicit_conversion ("string", TNAME); \ + warning_with_id ("Octave:warn-str-to-num", \ + "implicit conversion from %s to %s", \ + "string", TNAME); \ \ retval = octave_char_matrix::FCN (); \ } \ @@ -762,34 +756,6 @@ #endif -static int -warn_str_to_num (void) -{ - Vwarn_str_to_num = check_preference ("warn_str_to_num"); - - return 0; -} - -void -symbols_of_ov_str_mat (void) -{ - DEFVAR (warn_str_to_num, false, warn_str_to_num, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_str_to_num\n\ -If the value of @code{warn_str_to_num} is nonzero, a warning is printed\n\ -for implicit conversions of strings to their numeric ASCII equivalents.\n\ -For example,\n\ -@example\n\ -@group\n\ -\"abc\" + 0\n\ - @result{} 97 98 99\n\ -@end group\n\ -@end example\n\ -elicits a warning if @code{warn_str_to_num} is nonzero. The default\n\ -value is 0.\n\ -@end defvr"); -} - /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/ov-streamoff.cc +++ b/src/ov-streamoff.cc @@ -52,9 +52,8 @@ if (numel () > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (Vwarn_fortran_indexing) - gripe_implicit_conversion ("streamoff array", "scalar streamoff"); + gripe_implicit_conversion ("Octave:array-as-scalar", + "streamoff array", "scalar streamoff"); retval = matrix (0, 0); }
--- a/src/ov-struct.h +++ b/src/ov-struct.h @@ -38,7 +38,6 @@ #include "ov-base.h" #include "ov-typeinfo.h" -class Octave_map; class octave_value_list; class tree_walker; @@ -92,7 +91,7 @@ { return map.reshape (new_dims); } octave_value resize (const dim_vector& dv) const - { return map.resize (dv); } + { Octave_map tmap = map; tmap.resize (dv); return tmap; } bool is_defined (void) const { return true; }
--- a/src/ov.cc +++ b/src/ov.cc @@ -82,16 +82,6 @@ // make the grow_size large. DEFINE_OCTAVE_ALLOCATOR2(octave_value, 1024); -// If TRUE, print a warning for assignments like -// -// octave> A(1) = 3; A(2) = 5 -// -// for A already defined and a matrix type. -bool Vwarn_fortran_indexing; - -// Should we warn about conversions from complex to real? -int Vwarn_imag_to_real; - // FIXME // Octave's value type. @@ -1142,9 +1132,9 @@ } else if (nr > 0 && nc > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (! force_vector_conversion && Vwarn_fortran_indexing) - gripe_implicit_conversion (type_name (), "real vector"); + if (! force_vector_conversion) + gripe_implicit_conversion ("Octave:array-as-vector", + type_name (), "real vector"); retval.resize (nr * nc); octave_idx_type k = 0; @@ -1217,9 +1207,9 @@ } else if (nr > 0 && nc > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (! force_vector_conversion && Vwarn_fortran_indexing) - gripe_implicit_conversion (type_name (), "real vector"); + if (! force_vector_conversion) + gripe_implicit_conversion ("Octave:array-as-vector", + type_name (), "real vector"); retval.resize (nr * nc); octave_idx_type k = 0; @@ -1284,9 +1274,9 @@ } else if (nr > 0 && nc > 0) { - // FIXME -- is warn_fortran_indexing the right variable here? - if (! force_vector_conversion && Vwarn_fortran_indexing) - gripe_implicit_conversion (type_name (), "complex vector"); + if (! force_vector_conversion) + gripe_implicit_conversion ("Octave:array-as-vector", + type_name (), "complex vector"); retval.resize (nr * nc); octave_idx_type k = 0; @@ -1898,44 +1888,6 @@ return retval; } -static int -warn_fortran_indexing (void) -{ - Vwarn_fortran_indexing = check_preference ("warn_fortran_indexing"); - - liboctave_wfi_flag = Vwarn_fortran_indexing; - - return 0; -} - -static int -warn_imag_to_real (void) -{ - Vwarn_imag_to_real = check_preference ("warn_imag_to_real"); - - return 0; -} - -void -symbols_of_ov (void) -{ - DEFVAR (warn_fortran_indexing, false, warn_fortran_indexing, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_fortran_indexing\n\ -If the value of @code{warn_fortran_indexing} is nonzero, a warning is\n\ -printed for expressions which select elements of a two-dimensional matrix\n\ -using a single index. The default value is 0.\n\ -@end defvr"); - - DEFVAR (warn_imag_to_real, false, warn_imag_to_real, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_imag_to_real\n\ -If the value of @code{warn_imag_to_real} is nonzero, a warning is\n\ -printed for implicit conversions of complex numbers to real numbers.\n\ -The default value is 0.\n\ -@end defvr"); -} - /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/ov.h +++ b/src/ov.h @@ -861,16 +861,6 @@ OV_BINOP_FN (op_struct_ref) -// If TRUE, print a warning for assignments like -// -// octave> A(1) = 3; A(2) = 5 -// -// for A already defined and a matrix type. -extern bool Vwarn_fortran_indexing; - -// Should we warn about conversions from complex to real? -extern int Vwarn_imag_to_real; - extern void install_types (void); // FIXME -- these trait classes probably belong somehwere else...
--- a/src/parse.h +++ b/src/parse.h @@ -79,9 +79,6 @@ // contain nested functions. extern std::string parent_function_name; -// TRUE means warn about function files that have time stamps in the future. -extern bool Vwarn_future_time_stamp; - // Keep a count of how many END tokens we expect. extern int end_tokens_expected;
--- a/src/parse.y +++ b/src/parse.y @@ -74,41 +74,6 @@ #include "utils.h" #include "variables.h" -// If TRUE, generate a warning for the assignment in things like -// -// octave> if (a = 2 < n) -// -// but not -// -// octave> if ((a = 2) < n) -// -static bool Vwarn_assign_as_truth_value; - -// If TRUE, generate warning about the meaning of code changing due to -// changes in associativity for various ops (typically for Matlab -// compatibility). -static bool Vwarn_associativity_change; - -// If TRUE, generate warning if declared function name disagrees with -// the name of the file in which it is defined. -static bool Vwarn_function_name_clash; - -// TRUE means warn about function files that have time stamps in the future. -bool Vwarn_future_time_stamp; - -// If TRUE, generate warning if a statement in a function is not -// terminated with a semicolon. Useful for checking functions that -// should only produce output using explicit printing statements. -static bool Vwarn_missing_semicolon; - -// If TRUE, generate warning about the meaning of code changing due to -// changes in precedence levels for various ops (typically for Matlab -// compatibility). -static bool Vwarn_precedence_change; - -// If TRUE, generate a warning for variable switch labels. -static bool Vwarn_variable_switch_label; - // Temporary symbol table pointer used to cope with bogus function syntax. symbol_table *tmp_local_sym_tab = 0; @@ -1560,11 +1525,12 @@ static void maybe_warn_assign_as_truth_value (tree_expression *expr) { - if (Vwarn_assign_as_truth_value - && expr->is_assignment_expression () + if (expr->is_assignment_expression () && expr->paren_count () < 2) { - warning ("suggest parenthesis around assignment used as truth value"); + warning_with_id + ("Octave:assign-as-truth-value", + "suggest parenthesis around assignment used as truth value"); } } @@ -1573,10 +1539,9 @@ static void maybe_warn_variable_switch_label (tree_expression *expr) { - if (Vwarn_variable_switch_label && ! expr->is_constant ()) - { - warning ("variable switch label"); - } + if (! expr->is_constant ()) + warning_with_id ("Octave:warn-variable-switch-label", + "variable switch label"); } static tree_expression * @@ -1601,9 +1566,9 @@ octave_value::binary_op op_type = e->op_type (); if (op1->is_constant () && op2->is_constant () - && (! ((Vwarn_associativity_change + && (! ((warning_enabled ("Octave:associativity-change") && (op_type == POW || op_type == EPOW)) - || (Vwarn_precedence_change + || (warning_enabled ("Octave:precedence-change") && (op_type == EXPR_OR || op_type == EXPR_OR_OR))))) { octave_value tmp = e->rvalue (); @@ -1856,8 +1821,7 @@ static void maybe_warn_associativity_change (tree_expression *op) { - if (Vwarn_associativity_change - && op->paren_count () == 0 && op->is_binary_expression ()) + if (op->paren_count () == 0 && op->is_binary_expression ()) { tree_binary_expression *e = dynamic_cast<tree_binary_expression *> (op); @@ -1869,7 +1833,9 @@ { std::string op_str = octave_value::binary_op_as_string (op_type); - warning ("meaning may have changed due to change in associativity for %s operator", op_str.c_str ()); + warning_with_id + ("Octave:associativity-change", + "meaning may have changed due to change in associativity for %s operator", op_str.c_str ()); } } } @@ -1964,14 +1930,15 @@ case EXPR_OR: t = octave_value::op_el_or; - if (Vwarn_precedence_change - && op2->paren_count () == 0 && op2->is_binary_expression ()) + if (op2->paren_count () == 0 && op2->is_binary_expression ()) { tree_binary_expression *e = dynamic_cast<tree_binary_expression *> (op2); if (e->op_type () == octave_value::op_el_and) - warning ("meaning may have changed due to change in precedence for & and | operators"); + warning_with_id + ("Octave:precedence-change", + "meaning may have changed due to change in precedence for & and | operators"); } break; @@ -2005,14 +1972,15 @@ case EXPR_OR_OR: t = tree_boolean_expression::bool_or; - if (Vwarn_precedence_change - && op2->paren_count () == 0 && op2->is_boolean_expression ()) + if (op2->paren_count () == 0 && op2->is_boolean_expression ()) { tree_boolean_expression *e = dynamic_cast<tree_boolean_expression *> (op2); if (e->op_type () == tree_boolean_expression::bool_and) - warning ("meaning may have changed due to change in precedence for && and || operators"); + warning_with_id + ("Octave:precedence-change", + "meaning may have changed due to change in precedence for && and || operators"); } break; @@ -2508,9 +2476,10 @@ if (! (lexer_flags.parsing_nested_function || autoloading) && curr_fcn_file_name != id_name) { - if (Vwarn_function_name_clash) - warning ("function name `%s' does not agree with function\ - file name `%s'", id_name.c_str (), curr_fcn_file_full_name.c_str ()); + warning_with_id + ("Octave:function-name-clash", + "function name `%s' does not agree with function file name `%s'", + id_name.c_str (), curr_fcn_file_full_name.c_str ()); id_name = curr_fcn_file_name; } @@ -2521,15 +2490,13 @@ fcn->stash_fcn_file_time (now); fcn->mark_as_system_fcn_file (); - if (Vwarn_future_time_stamp) - { - std::string nm = fcn->fcn_file_name (); - - file_stat fs (nm); - - if (fs && fs.is_newer (now)) - warning ("time stamp for `%s' is in the future", nm.c_str ()); - } + std::string nm = fcn->fcn_file_name (); + + file_stat fs (nm); + + if (fs && fs.is_newer (now)) + warning_with_id ("Octave:future-time-stamp", + "time stamp for `%s' is in the future", nm.c_str ()); } else if (! (input_from_tmp_history_file || input_from_startup_file) && reading_script_file @@ -2838,14 +2805,15 @@ static void maybe_warn_missing_semi (tree_statement_list *t) { - if (lexer_flags.defining_func && Vwarn_missing_semicolon) + if (lexer_flags.defining_func) { tree_statement *tmp = t->back(); if (tmp->is_expression ()) - warning ("missing semicolon near line %d, column %d in file `%s'", - tmp->line (), tmp->column (), - curr_fcn_file_full_name.c_str ()); + warning_with_id + ("Octave:missing-semicolon", + "missing semicolon near line %d, column %d in file `%s'", + tmp->line (), tmp->column (), curr_fcn_file_full_name.c_str ()); } } @@ -4097,183 +4065,6 @@ return retval; } -static int -warn_assign_as_truth_value (void) -{ - Vwarn_assign_as_truth_value - = check_preference ("warn_assign_as_truth_value"); - - return 0; -} - -static int -warn_associativity_change (void) -{ - Vwarn_associativity_change = check_preference ("warn_associativity_change"); - - return 0; -} - -static int -warn_function_name_clash (void) -{ - Vwarn_function_name_clash = check_preference ("warn_function_name_clash"); - - return 0; -} - -static int -warn_future_time_stamp (void) -{ - Vwarn_future_time_stamp = check_preference ("warn_future_time_stamp"); - - return 0; -} - -static int -warn_missing_semicolon (void) -{ - Vwarn_missing_semicolon = check_preference ("warn_missing_semicolon"); - - return 0; -} - -static int -warn_precedence_change (void) -{ - Vwarn_precedence_change = check_preference ("warn_precedence_change"); - - return 0; -} - -static int -warn_variable_switch_label (void) -{ - Vwarn_variable_switch_label - = check_preference ("warn_variable_switch_label"); - - return 0; -} - -void -symbols_of_parse (void) -{ - DEFVAR (warn_assign_as_truth_value, true, warn_assign_as_truth_value, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_assign_as_truth_value\n\ -If the value of @code{warn_assign_as_truth_value} is nonzero, a\n\ -warning is issued for statements like\n\ -\n\ -@example\n\ -if (s = t)\n\ - ...\n\ -@end example\n\ -\n\ -@noindent\n\ -since such statements are not common, and it is likely that the intent\n\ -was to write\n\ -\n\ -@example\n\ -if (s == t)\n\ - ...\n\ -@end example\n\ -\n\ -@noindent\n\ -instead.\n\ -\n\ -There are times when it is useful to write code that contains\n\ -assignments within the condition of a @code{while} or @code{if}\n\ -statement. For example, statements like\n\ -\n\ -@example\n\ -while (c = getc())\n\ - ...\n\ -@end example\n\ -\n\ -@noindent\n\ -are common in C programming.\n\ -\n\ -It is possible to avoid all warnings about such statements by setting\n\ -@code{warn_assign_as_truth_value} to 0, but that may also\n\ -let real errors like\n\ -\n\ -@example\n\ -if (x = 1) # intended to test (x == 1)!\n\ - ...\n\ -@end example\n\ -\n\ -@noindent\n\ -slip by.\n\ -\n\ -In such cases, it is possible suppress errors for specific statements by\n\ -writing them with an extra set of parentheses. For example, writing the\n\ -previous example as\n\ -\n\ -@example\n\ -while ((c = getc()))\n\ - ...\n\ -@end example\n\ -\n\ -@noindent\n\ -will prevent the warning from being printed for this statement, while\n\ -allowing Octave to warn about other assignments used in conditional\n\ -contexts.\n\ -\n\ -The default value of @code{warn_assign_as_truth_value} is 1.\n\ -@end defvr"); - - DEFVAR (warn_associativity_change, true, warn_associativity_change, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_associativity_change\n\ -If the value of this variable is nonzero, Octave will warn about\n\ -possible changes in the meaning of some code due to changes in\n\ -associativity for some operators. Associativity changes have typically\n\ -been made for Matlab compatibility. The default value is 1.\n\ -@end defvr"); - - DEFVAR (warn_function_name_clash, true, warn_function_name_clash, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_function_name_clash\n\ -If the value of @code{warn_function_name_clash} is nonzero, a warning is\n\ -issued when Octave finds that the name of a function defined in a\n\ -function file differs from the name of the file. (If the names\n\ -disagree, the name declared inside the file is ignored.) If the value\n\ -is 0, the warning is omitted. The default value is 1.\n\ -@end defvr"); - - DEFVAR (warn_future_time_stamp, true, warn_future_time_stamp, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_future_time_stamp\n\ -If the value of this variable is nonzero, Octave will print a warning\n\ -if it finds a function file with a time stamp that is in the future.\n\ -@end defvr"); - - DEFVAR (warn_missing_semicolon, false, warn_missing_semicolon, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_missing_semicolon\n\ -If the value of this variable is nonzero, Octave will warn when\n\ -statements in function definitions don't end in semicolons. The default\n\ -value is 0.\n\ -@end defvr"); - - DEFVAR (warn_precedence_change, true, warn_precedence_change, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_precedence_change\n\ -If the value of this variable is nonzero, Octave will warn about\n\ -possible changes in the meaning of some code due to changes in\n\ -precedence for some operators. Precedence changes have typically\n\ -been made for Matlab compatibility. The default value is 1.\n\ -@end defvr"); - - DEFVAR (warn_variable_switch_label, false, warn_variable_switch_label, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_variable_switch_label\n\ -If the value of this variable is nonzero, Octave will print a warning if\n\ -a switch label is not a constant or constant expression\n\ -@end defvr"); - -} - /* ;;; Local Variables: *** ;;; mode: text ***
--- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -44,15 +44,9 @@ #include "ov-re-sparse.h" #include "ov-cx-sparse.h" -// If TRUE, print a warning message for empty elements in a matrix list. -static bool Vwarn_empty_list_elements; - // The character to fill with when creating string arrays. char Vstring_fill_char = ' '; -// Warn if concatenating double and single quoted strings. -char Vwarn_string_concat = false; - // General matrices. This list type is much more work to handle than // constant matrices, but it allows us to construct matrices from // other matrices, variables, and functions. @@ -322,7 +316,7 @@ dv.elem (1) = dv.elem (1) + this_elt_nc; } - else if (Vwarn_empty_list_elements) + else eval_warning ("empty matrix found in matrix list", elt->line (), elt->column ()); @@ -428,9 +422,10 @@ int c) const { if (l == -1 && c == -1) - ::warning ("%s", msg); + warning_with_id ("Octave:empty-list-elements", "%s", msg); else - ::warning ("%s near line %d, column %d", msg, l, c); + warning_with_id ("Octave:empty-list-elements", + "%s near line %d, column %d", msg, l, c); } class @@ -636,8 +631,9 @@ } dv.elem (0) = dv.elem (0) + this_elt_nr; } - else if (Vwarn_empty_list_elements) - warning ("empty matrix found in matrix list"); + else + warning_with_id ("Octave:empty-list-elements", + "empty matrix found in matrix list"); } } @@ -704,8 +700,9 @@ static void maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p) { - if (Vwarn_string_concat && ! (all_dq_strings_p || all_sq_strings_p)) - ::warning ("concatenation of different character string types may have unintended consequences"); + if (! (all_dq_strings_p || all_sq_strings_p)) + warning_with_id ("Octave:string-concat", + "concatenation of different character string types may have unintended consequences"); } #define SINGLE_TYPE_CONCAT(TYPE, EXTRACTOR) \ @@ -943,22 +940,6 @@ } static int -warn_empty_list_elements (void) -{ - Vwarn_empty_list_elements = check_preference ("warn_empty_list_elements"); - - return 0; -} - -static int -warn_string_concat (void) -{ - Vwarn_string_concat = check_preference ("warn_string_concat"); - - return 0; -} - -static int string_fill_char (void) { int status = 0; @@ -1004,29 +985,6 @@ @end group\n\ @end example\n\ @end defvr"); - - DEFVAR (warn_empty_list_elements, false, warn_empty_list_elements, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_empty_list_elements\n\ -If the value of @code{warn_empty_list_elements} is nonzero, print a\n\ -warning when an empty matrix is found in a matrix list. For example,\n\ -\n\ -@example\n\ -a = [1, [], 3, [], 5]\n\ -@end example\n\ -\n\ -@noindent\n\ -The default value is 0.\n\ -@end defvr"); - - DEFVAR (warn_string_concat, false, warn_string_concat, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_string_concat\n\ -If the value of @code{warn_string_concat} is nonzero, print a\n\ -warning when concatenating a mixture of double and single quoted strings.\n\ -The default value is 1.\n\ -@end defvr"); - } /*
--- a/src/pt-misc.cc +++ b/src/pt-misc.cc @@ -35,10 +35,6 @@ #include "pt-walk.h" #include "utils.h" -// If TRUE, print a warning if a function does not define all the -// values in the return list which are expected. -static bool Vwarn_undefined_return_values; - // Parameter lists. tree_parameter_list::~tree_parameter_list (void) @@ -79,11 +75,14 @@ if (! elt->is_defined ()) { - if (Vwarn_undefined_return_values && ! warned) + if (! warned) { warned = true; - warning ("%s: some elements in list of return values are undefined", - warnfor.c_str ()); + + warning_with_id + ("Octave:undefined-return-values", + "%s: some elements in list of return values are undefined", + warnfor.c_str ()); } octave_lvalue tmp = elt->lvalue (); @@ -219,27 +218,6 @@ tw.visit_return_list (*this); } -static int -warn_undefined_return_values (void) -{ - Vwarn_undefined_return_values - = check_preference ("warn_undefined_return_values"); - - return 0; -} - -void -symbols_of_pt_misc (void) -{ - DEFVAR (warn_undefined_return_values, true, warn_undefined_return_values, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_undefined_return_values\n\ -If the value of @code{warn_undefined_return_values} is nonzero,\n\ -print a warning if a function does not define all the values in\n\ -the return list which are expected. The default value is 1.\n\ -@end defvr"); -} - /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/utils.cc +++ b/src/utils.cc @@ -68,12 +68,6 @@ #include "utils.h" #include "variables.h" -// If TRUE, print a warning for expressions like -// -// ones (-1, 5) -// -static int Vwarn_neg_dim_as_zero; - // Return TRUE if S is a valid identifier. bool @@ -796,8 +790,8 @@ { if (nr < 0 || nc < 0) { - if (Vwarn_neg_dim_as_zero) - warning ("%s: converting negative dimension to zero", warnfor); + warning_with_id ("Octave:neg-dim-as-zero", + "%s: converting negative dimension to zero", warnfor); nr = (nr < 0) ? 0 : nr; nc = (nc < 0) ? 0 : nc; @@ -818,8 +812,9 @@ } } - if (neg && Vwarn_neg_dim_as_zero) - warning ("%s: converting negative dimension to zero", warnfor); + if (neg) + warning_with_id ("Octave:neg-dim-as-zero", + "%s: converting negative dimension to zero", warnfor); } @@ -1124,32 +1119,6 @@ } } -static int -warn_neg_dim_as_zero (void) -{ - Vwarn_neg_dim_as_zero = check_preference ("warn_neg_dim_as_zero"); - - return 0; -} - -void -symbols_of_utils (void) -{ - DEFVAR (warn_neg_dim_as_zero, false, warn_neg_dim_as_zero, - "-*- texinfo -*-\n\ -@defvr {Built-in Variable} warn_neg_dim_as_zero\n\ -If the value of @code{warn_neg_dim_as_zero} is nonzero, print a warning\n\ -for expressions like\n\ -\n\ -@example\n\ -eye (-1)\n\ -@end example\n\ -\n\ -@noindent\n\ -The default value is 0.\n\ -@end defvr"); -} - /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/variables.cc +++ b/src/variables.cc @@ -698,11 +698,9 @@ unwind_protect::begin_frame ("looks_like_struct"); - unwind_protect_str (Vwarning_option); unwind_protect_bool (discard_error_messages); unwind_protect_int (error_state); - Vwarning_option = "off"; discard_error_messages = true; octave_value tmp = eval_string (text, true, parse_status);
--- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,12 @@ +2006-04-29 John W. Eaton <jwe@octave.org> + + * Makefile.in (check): Use run-octave script. + +2006-04-28 John W. Eaton <jwe@octave.org> + + * test_prefer.m: Adjust tests for new way of handling warning state. + * build_sparse_tests.sh: Likewise. + 2006-04-11 John W. Eaton <jwe@octave.org> * test_system.m, test_struct.m, test_string.m, test_quad.m,
--- a/test/Makefile.in +++ b/test/Makefile.in @@ -36,8 +36,7 @@ .PHONY: all check: test_sparse.m - $(SET_LD_LIBRARY_PATH) $(OCTAVE_BINARY) \ - -f -q -H -p $(OCTAVE_SCRIPT_PATH) $(srcdir)/fntests.m $(srcdir) + ../run-octave --no-site-file --silent --no-history $(srcdir)/fntests.m $(srcdir) .PHONY: check test_sparse.m: build_sparse_tests.sh
--- a/test/build_sparse_tests.sh +++ b/test/build_sparse_tests.sh @@ -195,10 +195,10 @@ %!assert(nnz(sparse(eye(3))-sparse(eye(3))),0); %!test -%! wdbz=warn_divide_by_zero; -%! warn_divide_by_zero=0; +%! wdbz = warning ("query", "Octave:divide-by-zero"); +%! warning ("off", "Octave:divide-by-zero"); %! assert(sparse(eye(3))/0,sparse(eye(3)/0,1)); -%! warn_divide_by_zero=wdbz; +%! warning (wdbz.state, "Octave:divide-by-zero"); EOF } @@ -411,12 +411,12 @@ print_real_mapper_test() { cat >>$TESTS <<EOF %!test -%! wn2s = warn_num_to_str; -%! warn_num_to_str = 0; +%! wn2s = warning ("query", "Octave:num-to-str"); +%! warning ("off", "Octave:num-to-str"); %! if isreal(af) %! assert($1(as),sparse($1(af),1)) %! endif -%! warn_num_to_str = wn2s; +%! warning (wn2s.state, "Octave:num-to-str"); EOF } @@ -488,14 +488,14 @@ %% These mapper functions always return a full matrix %!test -%! wn2s = warn_num_to_str; -%! warn_num_to_str = 0; +%! wn2s = warning ("query", "Octave:num-to-str"); +%! warning ("off", "Octave:num-to-str"); %! if isreal(af) %! assert(toascii(as),toascii(af)) %! assert(tolower(as),tolower(af)) %! assert(toupper(as),toupper(af)) %! endif -%! warn_num_to_str = wn2s; +%! warning (wn2s.state, "Octave:num-to-str"); EOF }
--- a/test/fntests.m +++ b/test/fntests.m @@ -5,7 +5,7 @@ currdir = canonicalize_file_name ("."); if (nargin == 1) - xdir = argv{1}; + xdir = argv(){1}; else xdir = "."; endif @@ -60,7 +60,7 @@ endfunction function [dp, dn] = runtestscript (fid, d); - global topsrcdir + global topsrcdir; lst = dir(d); dp = dn = 0; for i=1:length(lst) @@ -149,4 +149,3 @@ warning(warn_state.state,"quiet"); disp(lasterr()); end_try_catch -
--- a/test/test_index-wfi-f.m +++ b/test/test_index-wfi-f.m @@ -2,318 +2,318 @@ %% test/octave.test/index-wfi-f/s-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = []; %! assert(isempty (a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! assert(a(1),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! assert(a(:),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! assert(a(:,:),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-5.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! assert(a(1,:),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-6.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! assert(a(:,1),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-7.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! assert(isempty (a(logical (0)))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-8.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a(-1)"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-9.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a(2);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-10.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a(2,:);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-11.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a(:,2);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-12.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a(-1,:);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-13.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a(:,-1);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-14.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a([1,2,3]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-15.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a([1;2;3]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-16.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a([1,2;3,4]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-17.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a([0,1]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-18.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a([0;1]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-19.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a([-1,0]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/s-20.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 1; %! fail("a([-1;0]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(a(1),4); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(a(2),3); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(:) == a_prime)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(1,:) == a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-5.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(a(:,3),2); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-6.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(:,:) == a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-7.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(logical ([0,1,1,0])) == mid_a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-8.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-9.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(5);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-10.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(0,1);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-11.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a(logical (0),:))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-12.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(:,0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-13.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a([]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-14.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a([],:))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/v-15.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a(:,[]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/m-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -321,12 +321,12 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! assert(all (all (a(:,:) == a))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/m-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -334,12 +334,12 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! assert(all (a(:) == a_fvec)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/m-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -347,12 +347,12 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! fail("a(0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/m-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -360,12 +360,12 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! assert(a(2),3); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-f/misc.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! b = a; %! b(:,:,2) = [5,6;7,8]; @@ -425,5 +425,4 @@ %! assert(b(1,1:4), b9); %! assert(b(1,[],:), b10); %! assert(b(1,[]), b11); -%! warn_fortran_indexing = wfi; - +%! warning ("wfi.state", "Octave:fortran-indexing");
--- a/test/test_index-wfi-t.m +++ b/test/test_index-wfi-t.m @@ -2,319 +2,318 @@ %% test/octave.test/index-wfi-t/s-1.m %!test -%! wfi = warn_fortran_indexing; +%! wfi = warning ("query", "Octave:fortran-indexing"); %! warn_fortran_indexing = 1; %! a = []; %! assert(isempty (a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! assert(a(1),1); -%! warn_fortran_indexing = wfi; -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! assert(a(:),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! assert(a(:,:),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-5.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! assert(a(1,:),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-6.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! assert(a(:,1),1); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-7.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! assert(isempty (a(logical (0)))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-8.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a(-1);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-9.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a(2);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-10.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a(2,:);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-11.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a(:,2);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-12.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a(-1,:);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-13.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a(:,-1);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-14.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a([1,2,3]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-15.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a([1;2;3]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-16.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a([1,2;3,4]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-17.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a([0,1]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-18.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a([0;1]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-19.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a([-1,0]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/s-20.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 1; %! fail("a([-1;0]);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(a(1),4); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(a(2),3); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(:) == a_prime)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(1,:) == a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-5.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(a(:,3),2); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-6.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(:,:) == a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-7.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(all (a(logical ([0,1,1,0])) == mid_a)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-8.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-9.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(5);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-10.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(0,1);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-11.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a(logical (0),:))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-12.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! fail("a(:,0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-13.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a([]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-14.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a([],:))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/v-15.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [4,3,2,1]; %! a_prime = [4;3;2;1]; %! mid_a = [3,2]; %! assert(isempty (a(:,[]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/m-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -322,12 +321,12 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! assert(all (all (a(:,:) == a))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/m-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -335,12 +334,12 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! assert(all (a(:) == a_fvec)); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/m-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -348,12 +347,12 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! fail("a(0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/index-wfi-t/m-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [1,2;3,4]; %! a_fvec = [1;3;2;4]; %! a_col_1 = [1;3]; @@ -361,5 +360,4 @@ %! a_row_1 = [1,2]; %! a_row_2 = [3,4]; %! fail("a(2);","warning"); -%! warn_fortran_indexing = wfi; - +%! warning ("wfi.state", "Octave:fortran-indexing");
--- a/test/test_logical-wfi-f.m +++ b/test/test_logical-wfi-f.m @@ -2,353 +2,353 @@ %% test/octave.test/logical-wfi-f/s-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = []; %! fail("a(0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/s-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 2; %! assert(a(1) == 2); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/s-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 2; %! assert(a(1) == 2); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/s-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = 2; %! assert(all (a(logical ([1,1])) == [2,2])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/v-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(isempty (a(logical ([0,0,0,0])))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/v-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(all (a(logical ([1,1,1,1])) == [9,8,7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/v-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(all (a(logical ([0,1,1,0])) == [8,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/v-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(all (a(logical ([1,1])) == [9,9])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(isempty (a(logical ([0,0,0,0])))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([1,1,1,1])) == [9;7;8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1,1,0])) == [7;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical (0:1),logical (0:1)) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-5.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),2:-1:1) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-6.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical (0:1),logical ([0,1])) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-7.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),[2,1]) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-8.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),:) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-9.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical (0:1),1) == 7); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-10.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),logical ([1,1])) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-11.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(2:-1:1,logical (0:1)) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-12.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(2:-1:1,logical ([0,1])) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-13.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(2:-1:1,logical ([1,1])) == [7,6;9,8]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-14.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical ([0,1]),logical (0:1)) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-15.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),2:-1:1) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-16.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical ([0,1]),logical ([0,1])) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-17.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),[2,1]) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-18.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),:) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-19.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical ([0,1]),1) == 7); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-20.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),logical ([1,1])) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-21.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a([2,1],logical (0:1)) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-22.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a([2,1],logical ([0,1])) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-23.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a([2,1],logical ([1,1])) == [7,6;9,8]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-24.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(:,logical (0:1)) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-25.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(:,logical ([0,1])) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-26.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(:,logical ([1,1])) == [9,8;7,6]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-27.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(1,logical (0:1)) == 8); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-28.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(1,logical ([0,1])) == 8); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-29.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(1,logical ([1,1])) == [9,8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-30.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([1,1]),logical (0:1)) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-31.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),2:-1:1) == [8,9;6,7]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-32.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([1,1]),logical ([0,1])) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-33.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),[2,1]) == [8,9;6,7]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-34.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),:) == [9,8;7,6]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-35.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([1,1]),1) == [9;7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-f/m-36.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 0; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("off", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),logical ([1,1])) == [9,8;7,6]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing");
--- a/test/test_logical-wfi-t.m +++ b/test/test_logical-wfi-t.m @@ -2,353 +2,353 @@ %% test/octave.test/logical-wfi-t/s-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = []; %! fail("a(0);"); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/s-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 2; %! assert(a(1) == 2); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/s-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 2; %! assert(a(1) == 2); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/s-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = 2; %! assert(all (a(logical ([1,1])) == [2,2])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/v-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(isempty (a(logical ([0,0,0,0])))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/v-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(all (a(logical ([1,1,1,1])) == [9,8,7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/v-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(all (a(logical ([0,1,1,0])) == [8,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/v-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8,7,6]; %! assert(all (a(logical ([1,1])) == [9,9])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-1.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! isempty (a(logical ([0,0,0,0]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-2.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! all (a(logical ([1,1,1,1])) == [9;7;8;6]); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-3.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! all (a(logical ([0,1,1,0])) == [7;8]); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-4.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical (0:1),logical (0:1)) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-5.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),2:-1:1) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-6.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical (0:1),logical ([0,1])) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-7.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),[2,1]) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-8.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),:) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-9.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical (0:1),1) == 7); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-10.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical (0:1),logical ([1,1])) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-11.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(2:-1:1,logical (0:1)) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-12.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(2:-1:1,logical ([0,1])) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-13.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(2:-1:1,logical ([1,1])) == [7,6;9,8]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-14.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical ([0,1]),logical (0:1)) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-15.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),2:-1:1) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-16.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical ([0,1]),logical ([0,1])) == 6); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-17.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),[2,1]) == [6,7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-18.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),:) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-19.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(logical ([0,1]),1) == 7); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-20.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([0,1]),logical ([1,1])) == [7,6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-21.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a([2,1],logical (0:1)) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-22.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a([2,1],logical ([0,1])) == [6;8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-23.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a([2,1],logical ([1,1])) == [7,6;9,8]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-24.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(:,logical (0:1)) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-25.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(:,logical ([0,1])) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-26.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(:,logical ([1,1])) == [9,8;7,6]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-27.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(1,logical (0:1)) == 8); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-28.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(a(1,logical ([0,1])) == 8); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-29.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(1,logical ([1,1])) == [9,8])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-30.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([1,1]),logical (0:1)) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-31.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),2:-1:1) == [8,9;6,7]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-32.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([1,1]),logical ([0,1])) == [8;6])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-33.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),[2,1]) == [8,9;6,7]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-34.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),:) == [9,8;7,6]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-35.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (a(logical ([1,1]),1) == [9;7])); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing"); %% test/octave.test/logical-wfi-t/m-36.m %!test -%! wfi = warn_fortran_indexing; -%! warn_fortran_indexing = 1; +%! wfi = warning ("query", "Octave:fortran-indexing"); +%! warning ("on", "Octave:fortran-indexing"); %! a = [9,8;7,6]; %! assert(all (all (a(logical ([1,1]),logical ([1,1])) == [9,8;7,6]))); -%! warn_fortran_indexing = wfi; +%! warning ("wfi.state", "Octave:fortran-indexing");
--- a/test/test_prefer.m +++ b/test/test_prefer.m @@ -54,40 +54,40 @@ %% test/octave.test/prefer/prefer-12.m %!test -%! wsn = warn_str_to_num; -%! warn_str_to_num = 0; +%! wsn = warning ("query", "Octave:str-to-num"); +%! warning ("off", "Octave:str-to-num"); %! assert("d" + 0,100); -%! warn_str_to_num = wsn; +%! warning (wsn.state, "Octave:str-to-num"); %% test/octave.test/prefer/prefer-13.m %!test -%! wsn = warn_str_to_num; -%! warn_str_to_num = 1; +%! wsn = warning ("query", "Octave:str-to-num"); +%! warning ("on", "Octave:str-to-num"); %! fail("'d' + 0","warning"); -%! warn_str_to_num = wsn; +%! warning (wsn.state, "Octave:str-to-num"); %% test/octave.test/prefer/prefer-14.m %!test -%! wir = warn_imag_to_real; -%! warn_imag_to_real = 0; +%! wir = warning ("query", "Ocave:imag-to-real"); +%! warning ("off", "Ocave:imag-to-real"); %! assert(eye (1+i),1); -%! warn_imag_to_real = wir; +%! warning (wir.state, "Ocave:imag-to-real"); %% test/octave.test/prefer/prefer-15.m %!test -%! wir = warn_imag_to_real; -%! warn_imag_to_real = 1; +%! wir = warning ("query", "Ocave:imag-to-real"); +%! warning ("on", "Ocave:imag-to-real"); %! fail("eye (1+i)","warning"); -%! warn_imag_to_real = wir; +%! warning (wir.state, "Ocave:imag-to-real"); %% test/octave.test/prefer/prefer-17.m %!test -%! wrre = warn_resize_on_range_error; -%! warn_resize_on_range_error = 0; +%! wrre = warning ("query", "Octave:resize-on-range-error"); +%! warning ("off", "Octave:resize-on-range-error"); %! clear a; %! a(2) = 1; a(3) = 2; %! assert(all (a == [0,1,2])); -%! warn_resize_on_range_error = wrre; +%! warning (wrre.state, "Octave:resize-on-range-error"); %% test/octave.test/prefer/prefer-18.m %!test @@ -191,45 +191,45 @@ %% test/octave.test/prefer/prefer-32.m %!test -%! wndz = warn_neg_dim_as_zero; -%! warn_neg_dim_as_zero = 1; +%! wndz = warning ("query", "Octave:neg-dim-as-zero"); +%! warning ("on", "Octave:neg-dim-as-zero"); %! fail("eye (-1) == []","warning"); -%! warn_neg_dim_as_zero = wndz; +%! warning (wndz.state, "Octave:neg-dim-as-zero"); %% test/octave.test/prefer/prefer-33.m %!test -%! wndz = warn_neg_dim_as_zero; -%! warn_neg_dim_as_zero = 0; +%! wndz = warning ("query", "Octave:neg-dim-as-zero"); +%! warning ("off", "Octave:neg-dim-as-zero"); %! assert(all (size (eye (-1)) == [0, 0])); -%! warn_neg_dim_as_zero = wndz; +%! warning (wndz.state, "Octave:neg-dim-as-zero"); %% test/octave.test/prefer/prefer-34.m %!test -%! watv = warn_assign_as_truth_value; -%! warn_assign_as_truth_value = 0; +%! watv = warning ("query", "Octave:assign-as-truth-value"); +%! warning ("off", "Octave:assign-as-truth-value"); %! if (x = 1) 1; endif -%! warn_assign_as_truth_value = watv; +%! warning (watv.state, "Octave:assign-as-truth-value"); %% test/octave.test/prefer/prefer-35.m %!test -%! watv = warn_assign_as_truth_value; -%! warn_assign_as_truth_value = 1; +%! watv = warning ("query", "Octave:assign-as-truth-value"); +%! warning ("on", "Octave:assign-as-truth-value"); %! fail("if (x = 1) 1; endif","warning"); -%! warn_assign_as_truth_value = watv; +%! warning (watv.state, "Octave:assign-as-truth-value"); %% test/octave.test/prefer/prefer-38.m %!test -%! wdbz = warn_divide_by_zero; -%! warn_divide_by_zero = 0; +%! wdbz = warning ("query", "Octave:divide-by-zero"); +%! warning ("off", "Octave:divide-by-zero"); %! assert(isinf (1/0)); -%! warn_divide_by_zero = wdbz; +%! warning (wdbz.state, "Octave:divide-by-zero"); %% test/octave.test/prefer/prefer-39.m %!test -%! wdbz = warn_divide_by_zero; -%! warn_divide_by_zero = 1; +%! wdbz = warning ("query", "Octave:divide-by-zero"); +%! warning ("on", "Octave:divide-by-zero"); %! a = 1; %! b = 0; %! fail("isinf (a/b);","warning") -%! warn_divide_by_zero = wdbz; +%! warning (wdbz.state, "Octave:divide-by-zero");
--- a/test/test_system.m +++ b/test/test_system.m @@ -424,10 +424,10 @@ %% test/octave.test/system/getenv-4.m %!test -%! wns = warn_num_to_str; -%! warn_num_to_str = 1; +%! wns = warning ("query", "Octave:num-to-str"); +%! warning ("on", "Octave:num-to-str"); %! fail("getenv (1)","warning"); -%! warn_num_to_str = wns; +%! warning (wns.state, "Octave:num-to-str"); %% test/octave.test/system/putenv-1.m %!test @@ -442,10 +442,10 @@ %% test/octave.test/system/putenv-4.m %!test -%! wns = warn_num_to_str; -%! warn_num_to_str = 1; +%! wns = warning ("query", "Octave:num-to-str"); +%! warning ("on", "Octave:num-to-str"); %! fail("putenv (1, 2)","warning"); -%! warn_num_to_str = wns; +%! warning (wns.state, "Octave:num-to-str"); %% test/octave.test/system/cd-1.m %!test