add Yap_FileDescriptorFromStream at request from NF.
This commit is contained in:
parent
0a2c90a919
commit
7ed3b456ac
@ -511,6 +511,7 @@ X_API int STD_PROTO(YAP_CloseList,(Term, Term));
|
||||
X_API int STD_PROTO(YAP_IsAttVar,(Term));
|
||||
X_API Term STD_PROTO(YAP_AttsOfVar,(Term));
|
||||
X_API Term STD_PROTO(YAP_TermHash,(Term));
|
||||
X_API void *STD_PROTO(YAP_FileDescriptorFromStream,(Term));
|
||||
|
||||
static int (*do_getf)(void);
|
||||
|
||||
@ -2531,3 +2532,13 @@ YAP_TermHash(Term t)
|
||||
return attv->Atts;
|
||||
}
|
||||
|
||||
X_API void *
|
||||
YAP_FileDescriptorFromStream(Term t)
|
||||
{
|
||||
|
||||
t = Deref(t);
|
||||
if (IsVarTerm(t))
|
||||
return NULL;
|
||||
return Yap_FileDescriptorFromStream(t);
|
||||
}
|
||||
|
||||
|
15
C/iopreds.c
15
C/iopreds.c
@ -6104,6 +6104,21 @@ Yap_TermToString(Term t, char *s, unsigned int sz, int flags)
|
||||
return EX;
|
||||
}
|
||||
|
||||
FILE *
|
||||
Yap_FileDescriptorFromStream(Term t)
|
||||
{
|
||||
int sno = CheckStream (ARG1, Input_Stream_f, "get0/2");
|
||||
if (sno < 0)
|
||||
return(FALSE);
|
||||
if (Stream[sno].status & (Null_Stream_f|
|
||||
InMemory_Stream_f|
|
||||
Socket_Stream_f|
|
||||
Pipe_Stream_f|
|
||||
Free_Stream_f))
|
||||
return NULL;
|
||||
return Stream[sno].u.file.file;
|
||||
}
|
||||
|
||||
void
|
||||
Yap_InitBackIO (void)
|
||||
{
|
||||
|
@ -480,6 +480,9 @@ extern X_API int PROTO(YAP_CloseList,(YAP_Term, YAP_Term));
|
||||
extern X_API int PROTO(YAP_IsAttVar,(YAP_Term));
|
||||
extern X_API YAP_Term PROTO(YAP_AttsOfVar,(YAP_Term));
|
||||
|
||||
/* stream info */
|
||||
extern X_API void *PROTO(YAP_FileDescriptorFromStream,(YAP_Term));
|
||||
|
||||
#define YAP_InitCPred(N,A,F) YAP_UserCPredicate(N,F,A)
|
||||
|
||||
__END_DECLS
|
||||
|
Reference in New Issue
Block a user