1 #ifndef _HMISC_H_
2 #define _HMISC_H_
3 
4 #include <string.h>
5 #include <errno.h>
6 #include <S.h>
7 #include <R.h>
8 #include <Rdefines.h>
9 
10 #ifdef _SPLUS_
11 #  define STRING_ELT(x,i) (CHARACTER_POINTER(x)[i])
12 #  define TO_CHAR(x) (x)
13 #  define translateChar(x) (x)
14 #  define IS_NA_LGL(x) (is_na(&x, LGL))
15 #  define SET_NA_LGL(x) (na_set(&x, LGL))
16    typedef s_object *SEXP ;
17    typedef char *STR_ELT;
18 #else
19 #  define TO_CHAR(x) (CHAR(x))
20 #  define STR_ELT SEXP
21 #  define IS_NA_LGL(x) (x == NA_LOGICAL)
22 #  define SET_NA_LGL(x) (x = NA_LOGICAL)
23 #endif
24 
25 #define MAXELTSIZE 8192
26 
27 typedef struct
28 {
29      char *data;
30      size_t bufsize;
31      size_t defaultSize;
32 } Hmisc_StringBuffer;
33 
34 char *Hmisc_AllocStringBuffer(size_t blen, Hmisc_StringBuffer *buf);
35 
36 void Hmisc_FreeStringBuffer(Hmisc_StringBuffer *buf);
37 
38 #endif
39