The R Project SVN R

Rev

Rev 19500 | Rev 34744 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19500 Rev 22931
Line 29... Line 29...
29
 
29
 
30
/* S Like Error Handling */
30
/* S Like Error Handling */
31
 
31
 
32
#include <R_ext/Error.h>	/* for error and warning */
32
#include <R_ext/Error.h>	/* for error and warning */
33
 
33
 
-
 
34
#ifndef STRICT_R_HEADERS
-
 
35
 
34
#define R_PROBLEM_BUFSIZE	4096
36
#define R_PROBLEM_BUFSIZE	4096
35
#define PROBLEM			{char R_problem_buf[R_PROBLEM_BUFSIZE];sprintf(R_problem_buf,
37
#define PROBLEM			{char R_problem_buf[R_PROBLEM_BUFSIZE];sprintf(R_problem_buf,
36
#define MESSAGE                 {char R_problem_buf[R_PROBLEM_BUFSIZE];sprintf(R_problem_buf,
38
#define MESSAGE                 {char R_problem_buf[R_PROBLEM_BUFSIZE];sprintf(R_problem_buf,
37
#define ERROR			),error(R_problem_buf);}
39
#define ERROR			),error(R_problem_buf);}
38
#define RECOVER(x)		),error(R_problem_buf);}
40
#define RECOVER(x)		),error(R_problem_buf);}
39
#define WARNING(x)		),warning(R_problem_buf);}
41
#define WARNING(x)		),warning(R_problem_buf);}
40
#define LOCAL_EVALUATOR		/**/
42
#define LOCAL_EVALUATOR		/**/
41
#define NULL_ENTRY		/**/
43
#define NULL_ENTRY		/**/
42
#define WARN			WARNING(NULL)
44
#define WARN			WARNING(NULL)
43
 
45
 
-
 
46
#endif
-
 
47
 
44
/* S Like Memory Management */
48
/* S Like Memory Management */
45
 
49
 
46
extern void *R_chk_calloc(size_t, size_t);
50
extern void *R_chk_calloc(size_t, size_t);
47
extern void *R_chk_realloc(void *, size_t);
51
extern void *R_chk_realloc(void *, size_t);
48
extern void R_chk_free(void *);
52
extern void R_chk_free(void *);
49
 
53
 
50
#define Calloc(n, t)   (t *) R_chk_calloc( (size_t) (n), sizeof(t) )
54
#define Calloc(n, t)   (t *) R_chk_calloc( (size_t) (n), sizeof(t) )
51
#define Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (size_t)((n) * sizeof(t)) )
55
#define Realloc(p,n,t) (t *) R_chk_realloc( (void *)(p), (size_t)((n) * sizeof(t)) )
52
/* S-PLUS 3.x but not 5.x NULLs the pointer in the following */
56
/* S-PLUS 3.x but not 5.x NULLs the pointer in the following */
-
 
57
#ifndef STRICT_R_HEADERS
53
#define Free(p)        (R_chk_free( (void *)(p) ), (p) = NULL)
58
#define Free(p)        (R_chk_free( (void *)(p) ), (p) = NULL)
-
 
59
#endif
-
 
60
#define R_Free(p)      (R_chk_free( (void *)(p) ), (p) = NULL)
54
 
61
 
55
#define Memcpy(p,q,n)  memcpy( p, q, (size_t)( (n) * sizeof(*p) ) )
62
#define Memcpy(p,q,n)  memcpy( p, q, (size_t)( (n) * sizeof(*p) ) )
56
 
63
 
57
/* S Like Fortran Interface */
64
/* S Like Fortran Interface */
58
/* These may not be adequate everywhere. Convex had _ prepending common
65
/* These may not be adequate everywhere. Convex had _ prepending common