56 #ifndef R_INTERNALS_H_
57 #define R_INTERNALS_H_
70 #include <R_ext/Arith.h>
71 #include <R_ext/Error.h>
72 #include <R_ext/Memory.h>
73 #include <R_ext/PrtUtil.h>
74 #include <R_ext/Utils.h>
76 #include <R_ext/libextern.h>
110 #define CHAR(x) R_CHAR(x)
165 #define CONS(a, b) Rf_cons((a), (b))
166 #define LCONS(a, b) Rf_lcons((a), (b))
177 int (MISSING)(
SEXP x);
178 void (SET_MISSING)(
SEXP x,
int v);
195 void (SET_RSTEP)(
SEXP x,
int v);
204 void (SET_DDVAL)(
SEXP x,
int v);
219 void SET_PRSEEN(
SEXP x,
int v);
222 int (HASHVALUE)(
SEXP x);
226 #define EXTPTR_PTR(x) R_ExternalPtrAddr(x)
227 #define EXTPTR_PROT(x) R_ExternalPtrProtected(x)
228 #define EXTPTR_TAG(x) R_ExternalPtrTag(x)
230 #define isByteCode(x) (TYPEOF(x)==BCODESXP)
233 #define PROTECT(s) Rf_protect(s)
234 #define UNPROTECT(n) Rf_unprotect(n)
235 #define UNPROTECT_PTR(s) Rf_unprotect_ptr(s)
241 #define PROTECT_WITH_INDEX(x,i) R_ProtectWithIndex(x,i)
242 #define REPROTECT(x,i) R_Reprotect(x,i)
245 LibExtern
SEXP R_GlobalEnv;
247 LibExtern
SEXP R_EmptyEnv;
249 LibExtern
SEXP R_BaseEnv;
250 LibExtern
SEXP R_BaseNamespace;
251 LibExtern
SEXP R_NamespaceRegistry;
253 LibExtern
SEXP R_Srcref;
258 #define R_NilValue NULL
260 LibExtern
SEXP R_UnboundValue;
261 LibExtern
SEXP R_MissingArg;
264 LibExtern
SEXP R_Bracket2Symbol;
265 LibExtern
SEXP R_BracketSymbol;
266 LibExtern
SEXP R_BraceSymbol;
267 LibExtern
SEXP R_ClassSymbol;
268 LibExtern
SEXP R_DeviceSymbol;
269 LibExtern
SEXP R_DimNamesSymbol;
270 LibExtern
SEXP R_DimSymbol;
271 LibExtern
SEXP R_DollarSymbol;
272 LibExtern
SEXP R_DotsSymbol;
273 LibExtern
SEXP R_DropSymbol;
274 LibExtern
SEXP R_LastvalueSymbol;
275 LibExtern
SEXP R_LevelsSymbol;
276 LibExtern
SEXP R_ModeSymbol;
277 LibExtern
SEXP R_NameSymbol;
278 LibExtern
SEXP R_NamesSymbol;
279 LibExtern
SEXP R_NaRmSymbol;
280 LibExtern
SEXP R_PackageSymbol;
281 LibExtern
SEXP R_QuoteSymbol;
282 LibExtern
SEXP R_RowNamesSymbol;
283 LibExtern
SEXP R_SeedsSymbol;
284 LibExtern
SEXP R_SourceSymbol;
285 LibExtern
SEXP R_TspSymbol;
287 LibExtern
SEXP R_dot_defined;
288 LibExtern
SEXP R_dot_Method;
289 LibExtern
SEXP R_dot_target;
292 #define NA_STRING R_NaString
293 LibExtern
SEXP R_NaString;
294 LibExtern
SEXP R_BlankString;
297 SEXP R_GetCurrentSrcref(
int);
309 int Rf_asLogical(
SEXP x);
310 int Rf_asInteger(
SEXP x);
311 double Rf_asReal(
SEXP x);
312 Rcomplex Rf_asComplex(
SEXP x);
318 char * Rf_acopy_string(
const char *);
326 int Rf_any_duplicated(
SEXP x, Rboolean from_last);
327 int Rf_any_duplicated3(
SEXP x,
SEXP incomp, Rboolean from_last);
332 void Rf_copyMatrix(
SEXP,
SEXP, Rboolean);
350 void Rf_GetMatrixDimnames(
SEXP,
SEXP*,
SEXP*,
const char**,
const char**);
353 int Rf_GetOptionDigits(
void);
354 int Rf_GetOptionWidth(
void);
358 Rboolean Rf_isFree(
SEXP);
359 Rboolean Rf_isOrdered(
SEXP);
360 Rboolean Rf_isUnordered(
SEXP);
361 Rboolean Rf_isUnsorted(
SEXP, Rboolean);
369 Rboolean Rf_NonNullStringMatch(
SEXP,
SEXP);
374 Rboolean Rf_pmatch(
SEXP,
SEXP, Rboolean);
375 Rboolean Rf_psmatch(
const char *,
const char *, Rboolean);
376 void Rf_PrintValue(
SEXP);
379 void Rf_setSVector(
SEXP*,
int,
SEXP);
382 Rboolean Rf_StringBlank(
SEXP);
384 const char * Rf_translateChar(
SEXP);
385 const char * Rf_translateChar0(
SEXP);
396 const char *R_curErrorBuf();
398 Rboolean Rf_isS4(
SEXP);
401 int Rf_isBasicClass(
const char *);
403 cetype_t Rf_getCharCE(
SEXP);
406 const char *Rf_reEnc(
const char *x, cetype_t ce_in, cetype_t ce_out,
int subst);
409 #define error_return(msg) { Rf_error(msg); return R_NilValue; }
410 #define errorcall_return(cl,msg){ Rf_errorcall(cl, msg); return R_NilValue; }
428 void R_RegisterFinalizer(
SEXP s,
SEXP fun);
429 void R_RegisterCFinalizer(
SEXP s, R_CFinalizer_t fun);
430 void R_RegisterFinalizerEx(
SEXP s,
SEXP fun, Rboolean onexit);
431 void R_RegisterCFinalizerEx(
SEXP s, R_CFinalizer_t fun, Rboolean onexit);
435 SEXP R_MakeWeakRefC(
SEXP key,
SEXP val, R_CFinalizer_t fin, Rboolean onexit);
438 void R_RunWeakRefFinalizer(
SEXP w);
441 void R_initialize_bcode(
void);
442 #define BODY_EXPR(e) R_ClosureExpr(e)
445 Rboolean R_ToplevelExec(
void (*fun)(
void *),
void *
data);
448 void R_RestoreHashCount(
SEXP rho);
449 Rboolean R_IsPackageEnv(
SEXP rho);
452 Rboolean R_IsNamespaceEnv(
SEXP rho);
455 void R_LockEnvironment(
SEXP env, Rboolean bindings);
456 Rboolean R_EnvironmentIsLocked(
SEXP env);
457 void R_LockBinding(
SEXP sym,
SEXP env);
458 void R_unLockBinding(
SEXP sym,
SEXP env);
460 Rboolean R_BindingIsLocked(
SEXP sym,
SEXP env);
461 Rboolean R_BindingIsActive(
SEXP sym,
SEXP env);
462 Rboolean R_HasFancyBindings(
SEXP rho);
467 void Rf_errorcall(
SEXP,
const char *, ...);
468 void Rf_warningcall(
SEXP,
const char *, ...);
469 void Rf_warningcall_immediate(
SEXP,
const char *, ...);
472 #define R_XDR_DOUBLE_SIZE 8
473 #define R_XDR_INTEGER_SIZE 4
475 void R_XDREncodeDouble(
double d,
void *buf);
476 double R_XDRDecodeDouble(
void *buf);
477 void R_XDREncodeInteger(
int i,
void *buf);
478 int R_XDRDecodeInteger(
void *buf);
480 typedef void *R_pstream_data_t;
483 R_pstream_any_format,
484 R_pstream_ascii_format,
485 R_pstream_binary_format,
487 } R_pstream_format_t;
489 typedef struct R_outpstream_st *R_outpstream_t;
490 struct R_outpstream_st {
491 R_pstream_data_t
data;
492 R_pstream_format_t type;
494 void (*OutChar)(R_outpstream_t, int);
495 void (*OutBytes)(R_outpstream_t,
const void *, int);
497 SEXP OutPersistHookData;
500 typedef struct R_inpstream_st *R_inpstream_t;
501 struct R_inpstream_st {
502 R_pstream_data_t
data;
503 R_pstream_format_t type;
504 int (*InChar)(R_inpstream_t);
505 void (*InBytes)(R_inpstream_t,
void *, int);
507 SEXP InPersistHookData;
510 void R_InitInPStream(R_inpstream_t stream, R_pstream_data_t
data,
511 R_pstream_format_t type,
512 int (*inchar)(R_inpstream_t),
513 void (*inbytes)(R_inpstream_t,
void *,
int),
515 void R_InitOutPStream(R_outpstream_t stream, R_pstream_data_t data,
516 R_pstream_format_t type,
int version,
517 void (*outchar)(R_outpstream_t,
int),
518 void (*outbytes)(R_outpstream_t,
const void *,
int),
521 void R_InitFileInPStream(R_inpstream_t stream, FILE *fp,
522 R_pstream_format_t type,
524 void R_InitFileOutPStream(R_outpstream_t stream, FILE *fp,
525 R_pstream_format_t type,
int version,
528 #ifdef NEED_CONNECTION_PSTREAMS
532 #ifndef HAVE_RCONNECTION_TYPEDEF
533 typedef struct Rconn *Rconnection;
534 #define HAVE_RCONNECTION_TYPEDEF
536 void R_InitConnOutPStream(R_outpstream_t stream, Rconnection con,
537 R_pstream_format_t type,
int version,
539 void R_InitConnInPStream(R_inpstream_t stream, Rconnection con,
540 R_pstream_format_t type,
544 void R_Serialize(
SEXP s, R_outpstream_t ops);
545 SEXP R_Unserialize(R_inpstream_t ips);
550 int R_has_slot(
SEXP obj,
SEXP name);
553 SEXP R_do_MAKE_CLASS(
const char *what);
554 SEXP R_getClassDef (
const char *what);
555 SEXP R_do_new_object(
SEXP class_def);
557 int R_check_class_and_super(
SEXP x,
const char **valid,
SEXP rho);
558 int R_check_class_etc (
SEXP x,
const char **valid);
565 void R_dot_Last(
void);
566 void R_RunExitFinalizers(
void);
570 FILE *R_popen(
const char *,
const char *);
572 int R_system(
const char *);
582 Rboolean R_compute_identical(
SEXP,
SEXP,
int);
591 #define acopy_string Rf_acopy_string
592 #define alloc3DArray Rf_alloc3DArray
593 #define allocArray Rf_allocArray
594 #define allocList Rf_allocList
595 #define allocMatrix Rf_allocMatrix
596 #define allocS4Object Rf_allocS4Object
597 #define allocSExp Rf_allocSExp
598 #define allocVector Rf_allocVector
599 #define any_duplicated Rf_any_duplicated
600 #define any_duplicated3 Rf_any_duplicated3
601 #define arraySubscript Rf_arraySubscript
602 #define asChar Rf_asChar
603 #define asCharacterFactor Rf_asCharacterFactor
604 #define asComplex Rf_asComplex
605 #define asInteger Rf_asInteger
606 #define asLogical Rf_asLogical
607 #define asReal Rf_asReal
609 #define classgets Rf_classgets
610 #define coerceVector Rf_coerceVector
611 #define conformable Rf_conformable
613 #define copyMatrix Rf_copyMatrix
614 #define copyMostAttrib Rf_copyMostAttrib
615 #define copyVector Rf_copyVector
616 #define CreateTag Rf_CreateTag
617 #define defineVar Rf_defineVar
618 #define dimgets Rf_dimgets
619 #define dimnamesgets Rf_dimnamesgets
620 #define DropDims Rf_DropDims
621 #define duplicate Rf_duplicate
622 #define duplicated Rf_duplicated
624 #define errorcall Rf_errorcall
626 #define findFun Rf_findFun
627 #define findVar Rf_findVar
628 #define findVarInFrame Rf_findVarInFrame
629 #define findVarInFrame3 Rf_findVarInFrame3
630 #define GetArrayDimnames Rf_GetArrayDimnames
631 #define getAttrib Rf_getAttrib
632 #define getCharCE Rf_getCharCE
633 #define GetColNames Rf_GetColNames
634 #define GetMatrixDimnames Rf_GetMatrixDimnames
635 #define GetOption1 Rf_GetOption1
636 #define GetOptionDigits Rf_GetOptionDigits
637 #define GetOptionWidth Rf_GetOptionWidth
638 #define GetOption Rf_GetOption
639 #define GetRowNames Rf_GetRowNames
640 #define gsetVar Rf_gsetVar
641 #define inherits Rf_inherits
642 #define install Rf_install
643 #define isArray Rf_isArray
644 #define isBasicClass Rf_isBasicClass
645 #define isComplex Rf_isComplex
646 #define isEnvironment Rf_isEnvironment
647 #define isExpression Rf_isExpression
648 #define isFactor Rf_isFactor
649 #define isFrame Rf_isFrame
650 #define isFree Rf_isFree
651 #define isFunction Rf_isFunction
652 #define isInteger Rf_isInteger
653 #define isLanguage Rf_isLanguage
654 #define isList Rf_isList
655 #define isLogical Rf_isLogical
656 #define isSymbol Rf_isSymbol
657 #define isMatrix Rf_isMatrix
658 #define isNewList Rf_isNewList
659 #define isNull Rf_isNull
660 #define isNumeric Rf_isNumeric
661 #define isNumber Rf_isNumber
662 #define isObject Rf_isObject
663 #define isOrdered Rf_isOrdered
664 #define isPairList Rf_isPairList
665 #define isPrimitive Rf_isPrimitive
666 #define isReal Rf_isReal
668 #define isString Rf_isString
670 #define isUnordered Rf_isUnordered
671 #define isUnsorted Rf_isUnsorted
672 #define isUserBinop Rf_isUserBinop
673 #define isValidString Rf_isValidString
674 #define isValidStringF Rf_isValidStringF
675 #define isVector Rf_isVector
676 #define isVectorAtomic Rf_isVectorAtomic
677 #define isVectorizable Rf_isVectorizable
678 #define isVectorList Rf_isVectorList
679 #define lang1 Rf_lang1
680 #define lang2 Rf_lang2
681 #define lang3 Rf_lang3
682 #define lang4 Rf_lang4
683 #define lang5 Rf_lang5
684 #define lang6 Rf_lang6
685 #define lastElt Rf_lastElt
686 #define lcons Rf_lcons
694 #define length Rf_length
697 #define lengthgets Rf_lengthgets
698 #define list1 Rf_list1
699 #define list2 Rf_list2
700 #define list3 Rf_list3
701 #define list4 Rf_list4
702 #define list5 Rf_list5
703 #define listAppend Rf_listAppend
704 #define match Rf_match
705 #define matchE Rf_matchE
706 #define mkChar Rf_mkChar
707 #define mkCharCE Rf_mkCharCE
708 #define mkCharLen Rf_mkCharLen
709 #define mkCharLenCE Rf_mkCharLenCE
710 #define mkNamed Rf_mkNamed
711 #define mkString Rf_mkString
712 #define namesgets Rf_namesgets
713 #define ncols Rf_ncols
714 #define nlevels Rf_nlevels
715 #define NonNullStringMatch Rf_NonNullStringMatch
716 #define nrows Rf_nrows
717 #define nthcdr Rf_nthcdr
718 #define PairToVectorList Rf_PairToVectorList
719 #define pmatch Rf_pmatch
720 #define psmatch Rf_psmatch
721 #define PrintValue Rf_PrintValue
722 #define protect Rf_protect
723 #define reEnc Rf_reEnc
724 #define rownamesgets Rf_rownamesgets
725 #define S3Class Rf_S3Class
726 #define ScalarComplex Rf_ScalarComplex
727 #define ScalarInteger Rf_ScalarInteger
728 #define ScalarLogical Rf_ScalarLogical
729 #define ScalarReal Rf_ScalarReal
730 #define ScalarString Rf_ScalarString
731 #define ScalarRaw Rf_ScalarRaw
732 #define setAttrib Rf_setAttrib
733 #define setSVector Rf_setSVector
734 #define setVar Rf_setVar
735 #define str2type Rf_str2type
736 #define StringBlank Rf_StringBlank
737 #define substitute Rf_substitute
738 #define translateChar Rf_translateChar
739 #define translateChar0 Rf_translateChar0
740 #define translateCharUTF8 Rf_translateCharUTF8
741 #define type2char Rf_type2char
742 #define type2str Rf_type2str
743 #define unprotect Rf_unprotect
744 #define unprotect_ptr Rf_unprotect_ptr
745 #define VectorToPairList Rf_VectorToPairList
746 #define warningcall Rf_warningcall
747 #define warningcall_immediate Rf_warningcall_immediate
750 #if defined(CALLED_FROM_DEFN_H) && !defined(__MAIN__) && (defined(COMPILING_R) || ( __GNUC__ && !defined(__INTEL_COMPILER) ))
751 #include "Rinlinedfuns.h"
760 Rboolean Rf_conformable(
SEXP,
SEXP);
762 Rboolean Rf_inherits(
SEXP,
const char *);
763 Rboolean Rf_isArray(
SEXP);
764 Rboolean Rf_isFactor(
SEXP);
765 Rboolean Rf_isFrame(
SEXP);
766 Rboolean Rf_isFunction(
SEXP);
767 Rboolean Rf_isInteger(
SEXP);
768 Rboolean Rf_isLanguage(
SEXP);
769 Rboolean Rf_isList(
SEXP);
770 Rboolean Rf_isMatrix(
SEXP);
771 Rboolean Rf_isNewList(
SEXP);
772 Rboolean Rf_isNumber(
SEXP);
773 Rboolean Rf_isNumeric(
SEXP);
774 Rboolean Rf_isPairList(
SEXP);
775 Rboolean Rf_isPrimitive(
SEXP);
776 Rboolean Rf_isTs(
SEXP);
777 Rboolean Rf_isUserBinop(
SEXP);
778 Rboolean Rf_isValidString(
SEXP);
779 Rboolean Rf_isValidStringF(
SEXP);
781 Rboolean Rf_isVectorAtomic(
SEXP);
782 Rboolean Rf_isVectorList(
SEXP);
783 Rboolean Rf_isVectorizable(
SEXP);
792 R_len_t Rf_length(
SEXP);
800 SEXP Rf_mkString(
const char *);
801 int Rf_nlevels(
SEXP);
802 SEXP Rf_ScalarComplex(Rcomplex);
803 SEXP Rf_ScalarInteger(
int);
804 SEXP Rf_ScalarLogical(
int);
805 SEXP Rf_ScalarRaw(Rbyte);
806 SEXP Rf_ScalarReal(
double);