make swi-yap io interface a structure.
This commit is contained in:
parent
7551f2b12e
commit
90f7504a76
@ -663,13 +663,17 @@ PL_EXPORT(int) PL_foreign_control(control_t);
|
||||
PL_EXPORT(intptr_t) PL_foreign_context(control_t);
|
||||
PL_EXPORT(void *) PL_foreign_context_address(control_t);
|
||||
|
||||
typedef struct SWI_IO {
|
||||
functor_t f;
|
||||
void *get_c;
|
||||
void *put_c;
|
||||
void *get_w;
|
||||
void *put_w;
|
||||
void *close_s;
|
||||
} swi_io_struct;
|
||||
|
||||
/* SWI stream info */
|
||||
PL_EXPORT(void) PL_YAP_InitSWIIO(functor_t f,
|
||||
void *gc,
|
||||
void *pc,
|
||||
void *cc);
|
||||
|
||||
PL_EXPORT(void) PL_YAP_InitSWIIO(struct SWI_IO *swio);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -3092,12 +3092,12 @@ PL_blob_data(term_t ts, size_t *len, PL_blob_t **type)
|
||||
|
||||
/* glue function to connect back PLStream to YAP IO */
|
||||
X_API void
|
||||
PL_YAP_InitSWIIO(functor_t f, void * gc, void * pc, void* cc)
|
||||
PL_YAP_InitSWIIO(struct SWI_IO *swio)
|
||||
{
|
||||
FSWIStream = SWIFunctorToFunctor(f);
|
||||
SWIGetc = gc;
|
||||
SWIPutc = pc;
|
||||
SWIClose = cc;
|
||||
FSWIStream = SWIFunctorToFunctor(swio->f);
|
||||
SWIGetc = swio->get_c;
|
||||
SWIPutc = swio->put_c;
|
||||
SWIClose = swio->close_s;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4315,7 +4315,14 @@ static pl_Sgetc(IOSTREAM *s)
|
||||
static void
|
||||
init_yap_extras()
|
||||
{
|
||||
PL_YAP_InitSWIIO(FUNCTOR_dstream1, pl_Sgetc, Sputc, Sclose);
|
||||
swi_io_struct swiio;
|
||||
swiio.f = FUNCTOR_dstream1;
|
||||
swiio.get_c = pl_Sgetc;
|
||||
swiio.put_c = Sputc;
|
||||
swiio.get_w = Sgetcode;
|
||||
swiio.put_w = Sputcode;
|
||||
swiio.close_s = Sclose;
|
||||
PL_YAP_InitSWIIO(&swiio);
|
||||
initCharTypes();
|
||||
initFiles();
|
||||
initGlob();
|
||||
|
Reference in New Issue
Block a user