Mercurial > octave
comparison libinterp/octave-value/ov-fcn-handle.cc @ 30896:c9788d7f6e65
maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
* __eigs__.cc, bsxfun.cc, cellfun.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
debug.cc, error.cc, graphics.cc, graphics.in.h, gzfstream.h, ls-hdf5.cc,
lsode.cc, max.cc, oct-opengl.h, quad.cc, strfns.cc, utils.cc, utils.h,
variables.cc, __ode15__.cc, gzip.cc, cdef-manager.cc, ov-fcn-handle.cc,
ov-java.cc, ov-usr-fcn.cc, bp-table.cc, bp-table.h, lex.h, lex.ll,
oct-parse.yy, pt-eval.cc:
Replace "func", "fun", "fn" in documentation and variable names with "fcn".
author | Rik <rik@octave.org> |
---|---|
date | Tue, 05 Apr 2022 08:33:58 -0700 |
parents | 32d2b6604a9f |
children | a4a010d40459 |
comparison
equal
deleted
inserted
replaced
30895:360d330cc30e | 30896:c9788d7f6e65 |
---|---|
1681 std::string oct_home = config::octave_exec_home (); | 1681 std::string oct_home = config::octave_exec_home (); |
1682 | 1682 |
1683 if (file_name.substr (0, oct_home.size ()) == oct_home) | 1683 if (file_name.substr (0, oct_home.size ()) == oct_home) |
1684 file_name = file_name.substr (oct_home.size ()); | 1684 file_name = file_name.substr (oct_home.size ()); |
1685 | 1685 |
1686 octave_value subfun = fcn->find_subfunction (m_name); | 1686 octave_value subfcn = fcn->find_subfunction (m_name); |
1687 | 1687 |
1688 if (subfun.is_defined ()) | 1688 if (subfcn.is_defined ()) |
1689 m_fcn = subfun; | 1689 m_fcn = subfcn; |
1690 } | 1690 } |
1691 } | 1691 } |
1692 } | 1692 } |
1693 } | 1693 } |
1694 | 1694 |
2213 if (m_name.length () > anl) | 2213 if (m_name.length () > anl) |
2214 { | 2214 { |
2215 std::istringstream nm_is (m_name.substr (anl)); | 2215 std::istringstream nm_is (m_name.substr (anl)); |
2216 nm_is >> len; | 2216 nm_is >> len; |
2217 | 2217 |
2218 // Anonymous functons don't have names. We just used this | 2218 // Anonymous functions don't have names. We just used this |
2219 // string as temporary storage to pass the number of local | 2219 // string as temporary storage to pass the number of local |
2220 // variable values. | 2220 // variable values. |
2221 | 2221 |
2222 m_name = ""; | 2222 m_name = ""; |
2223 } | 2223 } |
2519 | 2519 |
2520 // we have to pull some shenanigans here to make sure | 2520 // we have to pull some shenanigans here to make sure |
2521 // HDF5 doesn't print out all sorts of error messages if we | 2521 // HDF5 doesn't print out all sorts of error messages if we |
2522 // call H5Aopen for a non-existing attribute | 2522 // call H5Aopen for a non-existing attribute |
2523 | 2523 |
2524 H5E_auto_t err_func; | 2524 H5E_auto_t err_fcn; |
2525 void *err_func_data; | 2525 void *err_fcn_data; |
2526 | 2526 |
2527 // turn off error reporting temporarily, but save the error | 2527 // turn off error reporting temporarily, but save the error |
2528 // reporting function: | 2528 // reporting function: |
2529 #if defined (HAVE_HDF5_18) | 2529 #if defined (HAVE_HDF5_18) |
2530 H5Eget_auto (octave_H5E_DEFAULT, &err_func, &err_func_data); | 2530 H5Eget_auto (octave_H5E_DEFAULT, &err_fcn, &err_fcn_data); |
2531 H5Eset_auto (octave_H5E_DEFAULT, nullptr, nullptr); | 2531 H5Eset_auto (octave_H5E_DEFAULT, nullptr, nullptr); |
2532 #else | 2532 #else |
2533 H5Eget_auto (&err_func, &err_func_data); | 2533 H5Eget_auto (&err_fcn, &err_fcn_data); |
2534 H5Eset_auto (nullptr, nullptr); | 2534 H5Eset_auto (nullptr, nullptr); |
2535 #endif | 2535 #endif |
2536 | 2536 |
2537 octave_hdf5_id attr_id = H5Aopen_name (group_hid, "SYMBOL_TABLE"); | 2537 octave_hdf5_id attr_id = H5Aopen_name (group_hid, "SYMBOL_TABLE"); |
2538 | 2538 |
2544 H5Aclose (attr_id); | 2544 H5Aclose (attr_id); |
2545 } | 2545 } |
2546 | 2546 |
2547 // restore error reporting: | 2547 // restore error reporting: |
2548 #if defined (HAVE_HDF5_18) | 2548 #if defined (HAVE_HDF5_18) |
2549 H5Eset_auto (octave_H5E_DEFAULT, err_func, err_func_data); | 2549 H5Eset_auto (octave_H5E_DEFAULT, err_fcn, err_fcn_data); |
2550 #else | 2550 #else |
2551 H5Eset_auto (err_func, err_func_data); | 2551 H5Eset_auto (err_fcn, err_fcn_data); |
2552 #endif | 2552 #endif |
2553 | 2553 |
2554 // Set up temporary scope to use for evaluating the text that | 2554 // Set up temporary scope to use for evaluating the text that |
2555 // defines the anonymous function. | 2555 // defines the anonymous function. |
2556 | 2556 |
3540 { | 3540 { |
3541 // Unlike the anonymous_fcn_handle::parse method, don't set up | 3541 // Unlike the anonymous_fcn_handle::parse method, don't set up |
3542 // temporary scope to use for evaluating the text that defines | 3542 // temporary scope to use for evaluating the text that defines |
3543 // the anonymous function. Here we want | 3543 // the anonymous function. Here we want |
3544 // | 3544 // |
3545 // str2fun ("@(args) expr") | 3545 // str2func ("@(args) expr") |
3546 // | 3546 // |
3547 // to behave the same as if | 3547 // to behave the same as if |
3548 // | 3548 // |
3549 // @(args) expr | 3549 // @(args) expr |
3550 // | 3550 // |
3585 | 3585 |
3586 %!error <FCN_NAME must be a string> str2func ({"sin"}) | 3586 %!error <FCN_NAME must be a string> str2func ({"sin"}) |
3587 */ | 3587 */ |
3588 | 3588 |
3589 /* | 3589 /* |
3590 %!function y = __testrecursionfunc (f, x, n) | 3590 %!function y = __testrecursionfcn (f, x, n) |
3591 %! if (nargin < 3) | 3591 %! if (nargin < 3) |
3592 %! n = 0; | 3592 %! n = 0; |
3593 %! endif | 3593 %! endif |
3594 %! if (n > 2) | 3594 %! if (n > 2) |
3595 %! y = f (x); | 3595 %! y = f (x); |
3596 %! else | 3596 %! else |
3597 %! n++; | 3597 %! n++; |
3598 %! y = __testrecursionfunc (@(x) f (2*x), x, n); | 3598 %! y = __testrecursionfcn (@(x) f (2*x), x, n); |
3599 %! endif | 3599 %! endif |
3600 %!endfunction | 3600 %!endfunction |
3601 %! | 3601 %! |
3602 %!assert (__testrecursionfunc (@(x) x, 1), 8) | 3602 %!assert (__testrecursionfcn (@(x) x, 1), 8) |
3603 */ | 3603 */ |
3604 | 3604 |
3605 DEFUN (is_function_handle, args, , | 3605 DEFUN (is_function_handle, args, , |
3606 doc: /* -*- texinfo -*- | 3606 doc: /* -*- texinfo -*- |
3607 @deftypefn {} {@var{tf} =} is_function_handle (@var{x}) | 3607 @deftypefn {} {@var{tf} =} is_function_handle (@var{x}) |