IO patches

simplify error handling
use get and inject
use wide support in OS
be stricter in checkin streams and arguments
This commit is contained in:
Vítor Santos Costa
2015-10-08 02:23:45 +01:00
parent b788dc131d
commit b3cc23ce64
30 changed files with 1224 additions and 1381 deletions

View File

@@ -96,6 +96,8 @@ typedef bool YAP_Bool;
#define YAP_agc_hook Agc_hook
#define YAP_encoding_t encoding_t
#else
/* Type definitions */
@@ -146,6 +148,10 @@ typedef int (*YAP_agc_hook)(void *_Atom);
#include "YapError.h"
#include <../os/encoding.h>
typedef encoding_t YAP_encoding_t;
#endif
typedef struct YAP_thread_attr_struct {
@@ -368,21 +374,6 @@ typedef enum stream_f {
typedef uint64_t stream_flags_t;
/********* encoding ***********************/
typedef enum
{ PL_ENC_UNKNOWN = 0, /* invalid/unknown */
PL_ENC_OCTET, /* raw 8 bit input */
PL_ENC_ASCII, /* US-ASCII (0..127) */
PL_ENC_ISO_LATIN_1, /* ISO Latin-1 (0..256) */
PL_ENC_ANSI, /* default (multibyte) codepage */
PL_ENC_UTF8,
PL_ENC_UNICODE_BE, /* big endian unicode file */
PL_ENC_UNICODE_LE, /* little endian unicode file */
PL_ENC_WCHAR /* pl_wchar_t */
} PL_IOENC;
/********* YAP C-Flags ***********************/
typedef enum

View File

@@ -46,6 +46,7 @@ BEGIN_ERRORS()
E(DOMAIN_ERROR_STREAM_POSITION, DOMAIN_ERROR, "stream_position")
E(DOMAIN_ERROR_TIMEOUT_SPEC, DOMAIN_ERROR, "timeout_spec")
E(DOMAIN_ERROR_SYNTAX_ERROR_HANDLER, DOMAIN_ERROR, "syntax_error_handler")
E(DOMAIN_ERROR_WRITE_OPTION, DOMAIN_ERROR, "write_option")
E(EVALUATION_ERROR_FLOAT_OVERFLOW, EVALUATION_ERROR, "float_overflow")
E(EVALUATION_ERROR_FLOAT_UNDERFLOW, EVALUATION_ERROR, "float_underflow")

View File

@@ -1868,7 +1868,7 @@ extern X_API void YAP_Error(int myerrno, YAP_Term t, const char *buf, ...);
extern X_API int YAP_WriteBuffer(YAP_Term,char *,size_t,int);
extern X_API char* YAP_WriteDynamicBuffer(YAP_Term t,char *buf,size_t sze, size_t *lengthp, int *encp, int flags);
extern X_API char* YAP_WriteDynamicBuffer(YAP_Term t,char *buf,size_t sze, size_t *lengthp, YAP_encoding_t *encp, int flags);
/* void YAP_Term(YAP_Term) */
extern X_API YAP_Term YAP_CopyTerm(YAP_Term);