RAPI
R_ext/PrtUtil.h
Go to the documentation of this file.
00001 /*
00002  *  R : A Computer Language for Statistical Data Analysis
00003  *  Copyright (C) 1998-2014    The R Core Team
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU Lesser General Public License as published by
00007  *  the Free Software Foundation; either version 2.1 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public License
00016  *  along with this program; if not, a copy is available at
00017  *  https://www.R-project.org/Licenses/
00018  */
00019 
00020 /*
00021  *  These functions are not part of the API.
00022  */
00023 #ifndef PRTUTIL_H_
00024 #define PRTUTIL_H_
00025 
00026 #include <Rinternals.h> // for R_xlen_t
00027 #include <R_ext/Complex.h>
00028 
00029 #define formatLogical      Rf_formatLogical
00030 #define formatInteger      Rf_formatInteger
00031 #define formatReal         Rf_formatReal
00032 #define formatComplex      Rf_formatComplex
00033 #define EncodeLogical      Rf_EncodeLogical
00034 #define EncodeInteger      Rf_EncodeInteger
00035 #define EncodeReal         Rf_EncodeReal
00036 #define EncodeReal0        Rf_EncodeReal0
00037 #define EncodeComplex      Rf_EncodeComplex
00038 #define VectorIndex        Rf_VectorIndex
00039 #define printIntegerVector Rf_printIntegerVector
00040 #define printRealVector    Rf_printRealVector
00041 #define printComplexVector Rf_printComplexVector
00042 
00043 #ifdef  __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 /* Computation of printing formats */
00048 void formatLogical(int * x, R_xlen_t n, int * fieldwidth);
00049 void formatInteger(int * x, R_xlen_t n, int * fieldwidth);
00050 void formatReal(double * x, R_xlen_t n, int * w, int * d, int * e, int nsmall);
00051 void formatComplex(Rcomplex * x, R_xlen_t n, int * wr, int * dr, int * er, int * wi, int * di, int * ei, int nsmall);
00052 
00053 /* Formating of values */
00054 const char *EncodeLogical(int x, int w);
00055 const char *EncodeInteger(int x, int w);
00056 const char *EncodeReal0(double x, int w, int d, int e, const char * dec);
00057 const char *EncodeComplex(Rcomplex x, int wr, int dr, int er, int wi, int di, int ei, const char * dec);
00058 
00059 /* Legacy, misused by packages RGtk2 and qtbase */
00060 const char *EncodeReal(double x, int w, int d, int e, char cdec);
00061 
00062 
00063 /* Printing */
00064 int IndexWidth(R_xlen_t n);
00065 void VectorIndex(R_xlen_t i, int w);
00066 
00067 //void printLogicalVector(int *, R_xlen_t, int);
00068 void printIntegerVector(int *, R_xlen_t, int);
00069 void printRealVector   (double *, R_xlen_t, int);
00070 void printComplexVector(Rcomplex *, R_xlen_t, int);
00071 
00072 #ifdef  __cplusplus
00073 }
00074 #endif
00075 
00076 #endif /* PRTUTIL_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines