CXXR (C++ R) API
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
current-release
include
CXXR
ArgList.hpp
Go to the documentation of this file.
1
/*CXXR $Id: ArgList.hpp 1348 2013-02-25 17:49:03Z arr $
2
*CXXR
3
*CXXR This file is part of CXXR, a project to refactor the R interpreter
4
*CXXR into C++. It may consist in whole or in part of program code and
5
*CXXR documentation taken from the R project itself, incorporated into
6
*CXXR CXXR (and possibly MODIFIED) under the terms of the GNU General Public
7
*CXXR Licence.
8
*CXXR
9
*CXXR CXXR is Copyright (C) 2008-13 Andrew R. Runnalls, subject to such other
10
*CXXR copyrights and copyright restrictions as may be stated below.
11
*CXXR
12
*CXXR CXXR is not part of the R project, and bugs and other issues should
13
*CXXR not be reported via r-bugs or other R project channels; instead refer
14
*CXXR to the CXXR website.
15
*CXXR */
16
17
/*
18
* R : A Computer Language for Statistical Data Analysis
19
*
20
* This program is free software; you can redistribute it and/or modify
21
* it under the terms of the GNU General Public License as published by
22
* the Free Software Foundation; either version 2.1 of the License, or
23
* (at your option) any later version.
24
*
25
* This program is distributed in the hope that it will be useful,
26
* but WITHOUT ANY WARRANTY; without even the implied warranty of
27
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
* GNU Lesser General Public License for more details.
29
*
30
* You should have received a copy of the GNU General Public License
31
* along with this program; if not, a copy is available at
32
* http://www.r-project.org/Licenses/
33
*/
34
39
#ifndef ARGLIST_HPP
40
#define ARGLIST_HPP 1
41
42
#include "
CXXR/GCStackRoot.hpp
"
43
#include "
CXXR/PairList.h
"
44
#include "
CXXR/Symbol.h
"
45
46
namespace
CXXR {
47
class
DottedArgs;
48
58
class
ArgList
{
59
public
:
62
enum
Status
{
63
RAW
,
64
PROMISED
,
69
EVALUATED
72
};
73
85
ArgList
(
const
PairList
* args,
Status
status
)
86
: m_orig_list(args),
87
m_list(
PairList
::cons(0, const_cast<
PairList
*>(args))),
88
m_status(status)
89
{}
90
147
void
evaluate
(
Environment
* env,
bool
allow_missing =
false
);
148
183
std::pair<bool, RObject*>
firstArg
(
Environment
* env);
184
190
const
PairList
*
list
()
const
191
{
192
return
m_list->
tail
();
193
}
194
219
void
merge
(
const
ConsCell
* extraargs);
220
225
Status
status
()
const
226
{
227
return
m_status;
228
}
229
236
void
stripTags
();
237
261
inline
static
const
Symbol
*
tag2Symbol
(
const
RObject
* tag)
262
{
263
return
((!tag || tag->
sexptype
() ==
SYMSXP
)
264
? static_cast<const Symbol*>(tag)
265
: coerceTag(tag));
266
}
267
311
void
wrapInPromises
(
Environment
* env);
312
private
:
313
const
PairList
*
const
m_orig_list;
// Pointer to the argument
314
// list supplied to the constructor.
315
GCStackRoot<PairList>
m_list;
// The current argument list,
316
// preceded by a dummy element to simplify coding. The
317
// class code should never modify the PairList supplied as
318
// an argument to the constructor, even though the
319
// constructor casts const away when it initialises this
320
// data member.
321
GCStackRoot<>
m_first_arg;
// If the first argument needed to
322
// be evaluated in a call to firstArg(), this is a pointer
323
// to the resulting value, and m_first_arg_env points to the
324
// Environment in which evaluation took place. Both
325
// pointers are reset to null once the first argument has
326
// been processed in a subsequent call to evaluate() or
327
// wrapInPromises().
328
GCStackRoot<Environment>
m_first_arg_env;
329
Status
m_status;
330
331
// Not implemented. Declared private to suppress
332
// compiler-generated versions:
333
ArgList
(
const
ArgList
&);
334
ArgList
& operator=(
const
ArgList
&);
335
336
// Coerce a tag that is not already a Symbol into Symbol form:
337
static
const
Symbol
* coerceTag(
const
RObject
* tag);
338
};
339
}
340
341
#endif // ARGLIST_HPP
Generated by
1.8.1