allow strong generic buffers in stack.

This commit is contained in:
Vitor Santos Costa
2011-07-21 02:24:21 -07:00
parent 2c8e6cf2d1
commit 7a33b8ebbf
4 changed files with 47 additions and 5 deletions

View File

@@ -86,7 +86,7 @@ typedef enum
CLAUSE_LIST = 0x40,
BLOB_STRING = 0x80, /* SWI style strings */
BLOB_WIDE_STRING = 0x81, /* SWI style strings */
EXTERNAL_BLOB = 0x100 /* for SWI emulation */
EXTERNAL_BLOB = 0x100 /* generic data */
}
big_blob_type;
@@ -438,6 +438,25 @@ IsLargeNumTerm (Term t)
&& (FunctorOfTerm (t) >= FunctorLongInt)));
}
inline EXTERN int IsExternalBlobTerm (Term);
inline EXTERN int
IsExternalBlobTerm (Term t)
{
return (int) (IsApplTerm (t) &&
FunctorOfTerm (t) == FunctorBigInt &&
RepAppl(t)[1] == EXTERNAL_BLOB);
}
inline EXTERN void *ExternalBlobFromTerm (Term);
inline EXTERN void *
ExternalBlobFromTerm (Term t)
{
MP_INT *base = (MP_INT *)(RepAppl(t)+2);
return (void *) (base+1);
}