view libinterp/corefcn/variables.h @ 30390:a61e1a0f6024 stable

maint: style check C++ files in libinterp/ ahead of 7.1 release. * Cell.cc, __eigs__.cc, __ichol__.cc, __ilu__.cc, __magick_read__.cc, __qp__.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.h, ccolamd.cc, cellfun.cc, data.cc, debug.cc, defun-int.h, dlmread.cc, event-manager.cc, fftn.cc, file-io.cc, ft-text-renderer.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, gzfstream.cc, gzfstream.h, jsondecode.cc, jsonencode.cc, latex-text-renderer.cc, ls-mat5.cc, lu.cc, mex.cc, oct-stream.cc, oct-strstrm.cc, ordqz.cc, pager.h, pr-output.cc, qz.cc, schur.cc, sparse-xdiv.cc, sparse-xpow.cc, sparse.cc, stack-frame.h, strfns.cc, svd.cc, symrcm.cc, symscope.h, sysdep.cc, text-engine.h, text-renderer.h, tril.cc, variables.h, xdiv.h, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __voronoi__.cc, audiodevinfo.cc, cdef-class.cc, cdef-class.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-object.cc, ov-base-diag.cc, ov-base-diag.h, ov-base-int.cc, ov-base-int.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.h, ov-base-sparse.cc, ov-base-sparse.h, ov-base.h, ov-bool-mat.cc, ov-cell.cc, ov-cell.h, ov-class.cc, ov-class.h, ov-dld-fcn.cc, ov-intx.h, ov-lazy-idx.cc, ov-lazy-idx.h, ov-mex-fcn.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-re-mat.cc, ov-re-mat.h, ov-str-mat.h, ov-struct.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov.h, parse.h, pt-cell.cc, pt-stmt.cc, pt-tm-const.cc, pt-walk.cc: Style check C++ files in libinterp/ ahead of 7.1 release.
author Rik <rik@octave.org>
date Sun, 28 Nov 2021 21:52:08 -0800
parents 428cccc75cc9
children fe6d1711feea 796f54d4ddbf
line wrap: on
line source

////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 1993-2021 The Octave Project Developers
//
// See the file COPYRIGHT.md in the top-level directory of this
// distribution or <https://octave.org/copyright/>.
//
// This file is part of Octave.
//
// Octave is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Octave is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Octave; see the file COPYING.  If not, see
// <https://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////

#if ! defined (octave_variables_h)
#define octave_variables_h 1

#include "octave-config.h"

class octave_function;
class octave_user_function;

class octave_value;
class octave_value_list;
class octave_builtin;
class string_vector;

namespace octave
{
  class tree_identifier;
}

#include <limits>
#include <string>

#include "lo-ieee.h"

#include "ov-builtin.h"

// The following two functions should be removed or the return type
// should be changed when we remove octave_function from the interpreter
// interface.  See the discussion about this topic here:
// https://octave.discourse.group/t/refactoring-octave-value-function-objects-backward-incompatible-change/971

extern OCTINTERP_API octave_function *
is_valid_function (const octave_value&, const std::string& = "",
                   bool warn = false);

extern OCTINTERP_API octave_function *
is_valid_function (const std::string&, const std::string& = "",
                   bool warn = false);

OCTAVE_NAMESPACE_BEGIN

extern OCTINTERP_API int
symbol_exist (const std::string& name, const std::string& type = "any");

extern OCTINTERP_API std::string
unique_symbol_name (const std::string& basename);

extern OCTINTERP_API octave_value
set_internal_variable (bool& var, const octave_value_list& args,
                       int nargout, const char *nm);

extern OCTINTERP_API octave_value
set_internal_variable (char& var, const octave_value_list& args,
                       int nargout, const char *nm);

extern OCTINTERP_API octave_value
set_internal_variable (int& var, const octave_value_list& args,
                       int nargout, const char *nm,
                       int minval = std::numeric_limits<int>::min (),
                       int maxval = std::numeric_limits<int>::max ());

extern OCTINTERP_API octave_value
set_internal_variable (double& var, const octave_value_list& args,
                       int nargout, const char *nm,
                       double minval = -octave::numeric_limits<double>::Inf (),
                       double maxval = octave::numeric_limits<double>::Inf ());

extern OCTINTERP_API octave_value
set_internal_variable (std::string& var, const octave_value_list& args,
                       int nargout, const char *nm, bool empty_ok = true);

extern OCTINTERP_API octave_value
set_internal_variable (std::string& var, const octave_value_list& args,
                       int nargout, const char *nm, const char **choices);

extern OCTINTERP_API octave_value
set_internal_variable (int& var, const octave_value_list& args,
                       int nargout, const char *nm, const char **choices);

extern OCTINTERP_API std::string
maybe_missing_function_hook (const std::string& name);

OCTAVE_NAMESPACE_END

#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)

OCTAVE_DEPRECATED (7, "use 'octave::symbol_exist' instead")
inline int
symbol_exist (const std::string& name, const std::string& type = "any")
{
  return octave::symbol_exist (name, type);
}

OCTAVE_DEPRECATED (7, "use 'octave::unique_symbol_name' instead")
inline std::string
unique_symbol_name (const std::string& basename)
{
  return octave::unique_symbol_name (basename);
}

OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
inline octave_value
set_internal_variable (bool& var, const octave_value_list& args, int nargout, const char *nm)
{
  return octave::set_internal_variable (var, args, nargout, nm);
}

OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
inline octave_value
set_internal_variable (char& var, const octave_value_list& args, int nargout, const char *nm)
{
  return octave::set_internal_variable (var, args, nargout, nm);
}

OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
inline octave_value
set_internal_variable (int& var, const octave_value_list& args, int nargout, const char *nm,
                       int minval = std::numeric_limits<int>::min (), int maxval = std::numeric_limits<int>::max ())
{
  return octave::set_internal_variable (var, args, nargout, nm, minval, maxval);
}

OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
inline octave_value
set_internal_variable (double& var, const octave_value_list& args, int nargout, const char *nm,
                       double minval = -octave::numeric_limits<double>::Inf (),
                       double maxval = octave::numeric_limits<double>::Inf ())
{
  return octave::set_internal_variable (var, args, nargout, nm, minval, maxval);
}

OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
inline octave_value
set_internal_variable (std::string& var, const octave_value_list& args, int nargout, const char *nm,
                       bool empty_ok = true)
{
  return octave::set_internal_variable (var, args, nargout, nm, empty_ok);
}

OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
inline octave_value
set_internal_variable (std::string& var, const octave_value_list& args, int nargout, const char *nm,
                       const char **choices)
{
  return octave::set_internal_variable (var, args, nargout, nm, choices);
}

OCTAVE_DEPRECATED (7, "use 'octave::set_internal_variable' instead")
inline octave_value
set_internal_variable (int& var, const octave_value_list& args, int nargout, const char *nm,
                       const char **choices)
{
  return octave::set_internal_variable (var, args, nargout, nm, choices);
}

OCTAVE_DEPRECATED (7, "use 'octave::maybe_missing_function_hook' instead")
inline std::string
maybe_missing_function_hook (const std::string& name)
{
  return octave::maybe_missing_function_hook (name);
}

OCTAVE_DEPRECATED (6, "use 'octave::get_function_handle' instead")
extern OCTINTERP_API octave_function *
extract_function (const octave_value& arg, const std::string& warn_for,
                  const std::string& fname, const std::string& header,
                  const std::string& trailer);

#endif

// The following macros should also be considered obsolete.

#define SET_INTERNAL_VARIABLE(NM)                       \
  set_internal_variable (V ## NM, args, nargout, #NM)

#define SET_NONEMPTY_INTERNAL_STRING_VARIABLE(NM)               \
  set_internal_variable (V ## NM, args, nargout, #NM, false)

#define SET_INTERNAL_VARIABLE_WITH_LIMITS(NM, MINVAL, MAXVAL)           \
  set_internal_variable (V ## NM, args, nargout, #NM, MINVAL, MAXVAL)

// in the following, CHOICES must be a C string array terminated by null.
#define SET_INTERNAL_VARIABLE_CHOICES(NM, CHOICES)              \
  set_internal_variable (V ## NM, args, nargout, #NM, CHOICES)

#endif