improve C-interface and SWI comptaibility a bit.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2292 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc
2008-07-24 16:02:04 +00:00
parent 778215b85c
commit e1866e2917
12 changed files with 489 additions and 26 deletions

View File

@@ -28,11 +28,13 @@
#include <time.h>
#endif
#ifndef X_API
#if defined(_MSC_VER) && defined(YAP_EXPORTS)
#define X_API __declspec(dllexport)
#else
#define X_API
#endif
#endif
typedef unsigned long fid_t;
typedef unsigned long term_t;
@@ -115,6 +117,8 @@ typedef void *PL_engine_t;
#define CVT_ALL (CVT_ATOMIC|CVT_LIST)
#define CVT_MASK 0x00ff
#define CVT_EXCEPTION 0x10000
#define BUF_DISCARDABLE 0x0000
#define BUF_RING 0x0100
#define BUF_MALLOC 0x0200
@@ -216,6 +220,7 @@ extern X_API int PL_unify_nil(term_t);
extern X_API int PL_unify_pointer(term_t, void *);
extern X_API int PL_unify_string_chars(term_t, const char *);
extern X_API int PL_unify_term(term_t,...);
extern X_API int PL_unify_wchars(term_t, int, size_t, const pl_wchar_t *);
/* end PL_unify_* functions =============================*/
/* begin PL_is_* functions =============================*/
extern X_API int PL_is_atom(term_t);

View File

@@ -2,6 +2,14 @@
#ifndef _PL_STREAM_H
#define _PL_STREAM_H
#ifndef X_API
#if defined(_MSC_VER) && defined(YAP_EXPORTS)
#define X_API __declspec(dllexport)
#else
#define X_API
#endif
#endif
/* This appears to make the wide-character support compile and work
on HPUX 11.23. There really should be a cleaner way ...
*/
@@ -138,5 +146,8 @@ typedef struct io_stream
intptr_t reserved[3]; /* reserved for extension */
} IOSTREAM;
#define PL_EXPORT(type) extern X_API type
extern X_API int PL_unify_stream(term_t t, IOSTREAM *s);
#endif /*_PL_STREAM_H*/

View File

@@ -287,7 +287,7 @@ extern X_API YAP_Term PROTO(YAP_Read,(int (*)(void)));
/* void YAP_Write(YAP_Term,void (*)(int),int) */
extern X_API void PROTO(YAP_Write,(YAP_Term,void (*)(int),int));
/* void YAP_WriteBuffer(YAP_Term,char *,unsgined int,int) */
/* void YAP_WriteBufffer(YAP_Term,char *,unsgined int,int) */
extern X_API void PROTO(YAP_WriteBuffer,(YAP_Term,char *,unsigned int,int));
/* void YAP_Term(YAP_Term) */
@@ -323,12 +323,42 @@ extern X_API int PROTO(YAP_StringToBuffer,(YAP_Term,char *,unsigned int));
/* int BufferToString(const char *) */
extern X_API YAP_Term PROTO(YAP_BufferToString,(CONST char *));
/* YAP_Term BufferToTerm(const char *) */
extern X_API YAP_Term PROTO(YAP_ReadBuffer,(CONST char *,YAP_Term *));
/* int BufferToString(const char *) */
extern X_API YAP_Term PROTO(YAP_NBufferToString,(CONST char *, size_t len));
/* int BufferToString(const char *) */
extern X_API YAP_Term PROTO(YAP_WideBufferToString,(CONST wchar_t *));
/* int BufferToString(const char *) */
extern X_API YAP_Term PROTO(YAP_NWideBufferToString,(CONST wchar_t *, size_t len));
/* int BufferToAtomList(const char *) */
extern X_API YAP_Term PROTO(YAP_BufferToAtomList,(CONST char *));
/* int BufferToAtomList(const char *) */
extern X_API YAP_Term PROTO(YAP_NBufferToAtomList,(CONST char *, size_t len));
/* int BufferToAtomList(const char *) */
extern X_API YAP_Term PROTO(YAP_WideBufferToAtomList,(CONST wchar_t *));
/* int BufferToAtomList(const char *) */
extern X_API YAP_Term PROTO(YAP_NWideBufferToAtomList,(CONST wchar_t *, size_t len));
/* int BufferToDiffList(const char *) */
extern X_API YAP_Term PROTO(YAP_BufferToDiffList,(CONST char *));
/* int BufferToDiffList(const char *) */
extern X_API YAP_Term PROTO(YAP_NBufferToDiffList,(CONST char *, size_t len));
/* int BufferToDiffList(const char *) */
extern X_API YAP_Term PROTO(YAP_WideBufferToDiffList,(CONST wchar_t *));
/* int BufferToDiffList(const char *) */
extern X_API YAP_Term PROTO(YAP_NWideBufferToDiffList,(CONST wchar_t *, size_t len));
/* YAP_Term BufferToTerm(const char *) */
extern X_API YAP_Term PROTO(YAP_ReadBuffer,(CONST char *,YAP_Term *));
/* void YAP_InitSocks(const char *,long) */
extern X_API int PROTO(YAP_InitSocks,(CONST char *,long));