GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
pt-misc.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1994-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include "pt-idx.h"
31 #include "pt-misc.h"
32 
34 
35 // Parameter lists.
36 
38 {
39  while (! empty ())
40  {
41  auto p = begin ();
42  delete *p;
43  erase (p);
44  }
45 }
46 
47 void
49 {
50  for (tree_decl_elt *elt : *this)
52 }
53 
54 std::list<std::string>
56 {
57  std::list<std::string> retval;
58 
59  for (tree_decl_elt *elt : *this)
60  retval.push_back (elt->name ());
61 
62  if (m_marked_for_varargs)
63  retval.push_back (varargs_symbol_name ());
64 
65  return retval;
66 }
67 
70 {
71  tree_parameter_list *new_list = new tree_parameter_list (m_in_or_out);
72 
73  new_list->m_marked_for_varargs = m_marked_for_varargs;
74 
75  for (const tree_decl_elt *elt : *this)
76  new_list->append (elt->dup (scope));
77 
78  return new_list;
79 }
80 
81 OCTAVE_END_NAMESPACE(octave)
void append(const elt_type &s)
Definition: base-list.h:92
tree_decl_elt * dup(symbol_scope &scope) const
Definition: pt-decl.cc:61
std::string name() const
Definition: pt-decl.h:86
void mark_as_formal_parameter()
Definition: pt-decl.h:66
tree_parameter_list(in_or_out io)
Definition: pt-misc.h:55
tree_parameter_list * dup(symbol_scope &scope) const
Definition: pt-misc.cc:69
std::list< std::string > variable_names() const
Definition: pt-misc.cc:55
void mark_as_formal_parameters()
Definition: pt-misc.cc:48
std::string varargs_symbol_name() const
Definition: pt-misc.h:91
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn