CXXR (C++ R)
Print.h
1 /*CXXR $Id: Print.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) 1995, 1996 Robert Gentleman and Ross Ihaka
20  * Copyright (C) 1997-2003 The R Core Team.
21  *
22  * This program is free software; you can redistribute it and/or modify
23  * it under the terms of the GNU General Public License as published by
24  * the Free Software Foundation; either version 2 of the License, or
25  * (at your option) any later version.
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU General Public License for more details.
31  *
32  * You should have received a copy of the GNU General Public License
33  * along with this program; if not, a copy is available at
34  * http://www.r-project.org/Licenses/
35  */
36 
37 #ifndef PRINT_H_
38 #define PRINT_H_
39 
40 #include <R_ext/PrtUtil.h>
41 #include "Defn.h"
42 
43 #ifdef __cplusplus
44 namespace CXXR {
45  unsigned int stringWidth(unsigned int minwidth,
46  const CXXR::String* string);
47  unsigned int stringWidthQuote(unsigned int minwidth,
48  const CXXR::String* string);
49 }
50 
51 extern "C" {
52 #endif
53 
54 #define formatRaw Rf_formatRaw
55 #define EncodeElement Rf_EncodeElement
56 #define EncodeEnvironment Rf_EncodeEnvironment
57 #define printArray Rf_printArray
58 #define printMatrix Rf_printMatrix
59 #define printNamedVector Rf_printNamedVector
60 #define printVector Rf_printVector
61 
62 typedef struct {
63  int width;
64  int na_width;
65  int na_width_noquote;
66  int digits;
67  int scipen;
68  int gap;
69  int quote;
70  int right;
71  int max;
72  SEXP na_string;
73  SEXP na_string_noquote;
74  int useSource;
75 } R_print_par_t;
76 extern R_print_par_t R_print;
77 
78 /* Computation of printing formats */
79 void formatRaw(Rbyte *, int, int *);
80 
81 /* Formating of values */
82 const char *EncodeElement(SEXP, int, int, char);
83 const char *EncodeEnvironment(SEXP);
84 
85 
86 /* In Rinternals.h (and MUST be there):
87  CustomPrintValue, PrintValue, PrintValueRec */
88 void printArray(SEXP, SEXP, int, int, SEXP);
89 void printMatrix(SEXP, int, SEXP, int, int, SEXP, SEXP,
90  const char*, const char*);
91 void printNamedVector(SEXP, SEXP, int, const char*);
92 void printVector(SEXP, int, int);
93 void PrintClosure(SEXP, Rboolean);
94 void PrintLanguage(SEXP, Rboolean);
95 
96 /* Utilities for S compatibility and debuggging */
97 int F77_SYMBOL(dblepr0)(const char *, int *, double *, int *);
98 int F77_SYMBOL(intpr0) (const char *, int *, int *, int *);
99 int F77_SYMBOL(realpr0)(const char *, int *, float *, int *);
100 void R_PV(SEXP s);
101 
102 /* Offset for rowlabels if there are named dimnames */
103 #define R_MIN_LBLOFF 2
104 
105 #define R_MIN_WIDTH_OPT 10
106 #define R_MAX_WIDTH_OPT 10000
107 #define R_MIN_DIGITS_OPT 1
108 #define R_MAX_DIGITS_OPT 22
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif /* PRINT_H_ */