CXXR (C++ R)
Parse.h
1 /*CXXR $Id: Parse.h 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  * Copyright (C) 1998-2005 R Core Team
20  *
21  * This program is free software; you can redistribute it and/or modify
22  * it under the terms of the GNU General Public License as published by
23  * the Free Software Foundation; either version 2 of the License, or
24  * (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29  * GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License
32  * along with this program; if not, a copy is available at
33  * http://www.r-project.org/Licenses/
34  */
35 
36 #ifndef R_PARSE_H
37 #define R_PARSE_H
38 
39 #include <R_ext/Parse.h>
40 #include <IOStuff.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /* Public interface */
47 /* SEXP R_ParseVector(SEXP, int, ParseStatus *, SEXP); in R_ext/Parse.h */
48 
49 /* Private interface */
50 
51 typedef struct {
52 
53  Rboolean keepSrcRefs; /* Whether to attach srcrefs to objects as they are parsed */
54  Rboolean didAttach; /* Record of whether a srcref was attached */
55  SEXP SrcFile; /* The srcfile object currently being parsed */
56  SEXP Original; /* The underlying srcfile object */
57  PROTECT_INDEX SrcFileProt; /* The SrcFile may change */
58  PROTECT_INDEX OriginalProt; /* ditto */
59  /* Position information about the current parse */
60  int xxlineno; /* Line number according to #line directives */
61  int xxcolno; /* Character number on line */
62  int xxbyteno; /* Byte number on line */
63  int xxparseno; /* Line number ignoring #line directives */
64 } SrcRefState;
65 
66 void R_InitSrcRefState(SrcRefState *state);
67 void R_FinalizeSrcRefState(SrcRefState *state);
68 
69 SEXP R_Parse1Buffer(IoBuffer*, int, ParseStatus *); /* in ReplIteration,
70  R_ReplDLLdo1 */
71 SEXP R_ParseBuffer(IoBuffer*, int, ParseStatus *, SEXP, SEXP); /* in source.c */
72 SEXP R_Parse1File(FILE*, int, ParseStatus *, SrcRefState *); /* in R_ReplFile */
73 SEXP R_ParseFile(FILE*, int, ParseStatus *, SEXP); /* in edit.c */
74 
75 #ifndef HAVE_RCONNECTION_TYPEDEF
76 typedef struct Rconn *Rconnection;
77 #define HAVE_RCONNECTION_TYPEDEF
78 #endif
79 SEXP R_ParseConn(Rconnection con, int n, ParseStatus *status, SEXP srcfile);
80 
81  /* Report a parse error */
82 
83 void parseError(SEXP call, int linenum);
84 
85 #ifdef __cplusplus
86 }
87 #endif
88 
89 #endif /* not R_PARSE_H */