RAPI
R_ext/Utils.h
Go to the documentation of this file.
00001 /*
00002  *  R : A Computer Language for Statistical Data Analysis
00003  *  Copyright (C) 1998-2016    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  * Generally useful  UTILITIES  *NOT* relying on R internals (from Defn.h)
00021  */
00022 
00023 /* Included by R.h: API */
00024 
00025 #ifndef R_EXT_UTILS_H_
00026 #define R_EXT_UTILS_H_
00027 
00028 #include <R_ext/Boolean.h>
00029 #include <R_ext/Complex.h>
00030 
00031 #ifndef NO_C_HEADERS
00032 # if defined(__cplusplus) && !defined(DO_NOT_USE_CXX_HEADERS)
00033 #  include <cstddef>
00034 using std::size_t;
00035 # else
00036 #  include <stddef.h>
00037 # endif
00038 #endif
00039 
00040 #define revsort       Rf_revsort
00041 #define iPsort        Rf_iPsort
00042 #define rPsort        Rf_rPsort
00043 #define cPsort        Rf_cPsort
00044 #define IndexWidth    Rf_IndexWidth
00045 #define setIVector    Rf_setIVector
00046 #define setRVector    Rf_setRVector
00047 #define StringFalse   Rf_StringFalse
00048 #define StringTrue    Rf_StringTrue
00049 #define isBlankString Rf_isBlankString
00050 
00051 #ifdef  __cplusplus
00052 extern "C" {
00053 #endif
00054 
00055 /* ../../main/sort.c : */
00056 void    R_isort(int* x, int n);
00057 void    R_rsort(double* x, int n);
00058 void    R_csort(Rcomplex* x, int n);
00059 void    rsort_with_index(double * x, int * indx, int n);
00060 void    revsort(double* a, int* ib, int n);/* reverse; sort i[] alongside */
00061 void    iPsort(int* x,    int n, int k);
00062 void    rPsort(double* x, int n, int k);
00063 void    cPsort(Rcomplex* x, int n, int k);
00064 
00065 /* ../../main/qsort.c : */
00066 /* dummy renamed to II to avoid problems with g++ on Solaris */
00067 void R_qsort    (double *v,         size_t i, size_t j);
00068 void R_qsort_I  (double *v, int *II, int i, int j);
00069 void R_qsort_int  (int *iv,         size_t i, size_t j);
00070 void R_qsort_int_I(int *iv, int *II, int i, int j);
00071 #ifdef R_RS_H
00072 void F77_NAME(qsort4)(double *v, int *indx, int *ii, int *jj);
00073 void F77_NAME(qsort3)(double *v,            int *ii, int *jj);
00074 #endif
00075 
00076 /* ../../main/util.c  and others : */
00077 const char *R_ExpandFileName(const char *);
00078 void    setIVector(int* vec, int len, int val);
00079 void    setRVector(double* vec, int len, double val);
00080 Rboolean StringFalse(const char * name);
00081 Rboolean StringTrue(const char * name);
00082 Rboolean isBlankString(const char * s);
00083 
00084 /* These two are guaranteed to use '.' as the decimal point,
00085    and to accept "NA".
00086  */
00087 double R_atof(const char *str);
00088 double R_strtod(const char *c, char **end);
00089 
00090 char *R_tmpnam(const char *prefix, const char *tempdir);
00091 char *R_tmpnam2(const char *prefix, const char *tempdir, const char *fileext);
00092 
00093 void R_CheckUserInterrupt(void);
00094 void R_CheckStack(void);
00095 void R_CheckStack2(size_t extra);
00096 
00097 
00098 /* ../../appl/interv.c: also in Applic.h */
00099 int findInterval(double *xt, int n, double x,
00100          Rboolean rightmost_closed,  Rboolean all_inside, int ilo,
00101          int *mflag);
00102 int findInterval2(double *xt, int n, double x,
00103           Rboolean rightmost_closed,  Rboolean all_inside, Rboolean left_open,
00104           int ilo, int *mflag);
00105 #ifdef R_RS_H
00106 int F77_SUB(interv)(double *xt, int *n, double *x,
00107             Rboolean *rightmost_closed, Rboolean *all_inside,
00108             int *ilo, int *mflag);
00109 #endif
00110 void find_interv_vec(double *xt, int *n,    double *x,   int *nx,
00111              int *rightmost_closed, int *all_inside, int *indx);
00112 
00113 /* ../../appl/maxcol.c: also in Applic.h */
00114 void R_max_col(double *matrix, int *nr, int *nc, int *maxes, int *ties_meth);
00115 
00116 #ifdef  __cplusplus
00117 }
00118 #endif
00119 
00120 #endif /* R_EXT_UTILS_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines