GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
pt-misc.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1994-2025 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
47void
49{
50 for (tree_decl_elt *elt : *this)
51 elt->mark_as_formal_parameter ();
52}
53
54std::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->push_back (elt->dup (scope));
77
78 return new_list;
79}
80
81OCTAVE_END_NAMESPACE(octave)
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:103
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn