be more struct; better support fir encodings.
This commit is contained in:
parent
fb966536a9
commit
05a978ce82
2
C/save.c
2
C/save.c
@ -1460,7 +1460,7 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
|
||||
}
|
||||
|
||||
FILE *
|
||||
Yap_OpenRestore(char *inpf, char *YapLibDir)
|
||||
Yap_OpenRestore(const char *inpf, char *YapLibDir)
|
||||
{
|
||||
FILE *stream = NULL;
|
||||
|
||||
|
28
C/text.c
28
C/text.c
@ -258,21 +258,21 @@ Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *l
|
||||
if ( !(inp->type & (YAP_STRING_CHARS|YAP_STRING_WCHARS)))
|
||||
{
|
||||
if ( !(inp->type & YAP_STRING_TERM)) {
|
||||
if (IsVarTerm(inp->val.t)) {
|
||||
LOCAL_Error_TYPE = INSTANTIATION_ERROR;
|
||||
} else if (!IsAtomTerm(inp->val.t) && inp->type == YAP_STRING_ATOM) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_ATOM;
|
||||
} else if (!IsStringTerm(inp->val.t) && inp->type == YAP_STRING_STRING) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_STRING;
|
||||
}else if (!IsPairTerm(inp->val.t) &&
|
||||
!IsStringTerm(inp->val.t) &&
|
||||
inp->type == (YAP_STRING_ATOMS_CODES|YAP_STRING_STRING)) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_LIST;
|
||||
} else if (!IsNumTerm(inp->val.t) && (inp->type & ( YAP_STRING_INT|YAP_STRING_FLOAT| YAP_STRING_BIG)) == inp->type) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_NUMBER;
|
||||
if (IsVarTerm(inp->val.t)) {
|
||||
LOCAL_Error_TYPE = INSTANTIATION_ERROR;
|
||||
} else if (!IsAtomTerm(inp->val.t) && inp->type == YAP_STRING_ATOM) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_ATOM;
|
||||
} else if (!IsStringTerm(inp->val.t) && inp->type == YAP_STRING_STRING) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_STRING;
|
||||
}else if (!IsPairTerm(inp->val.t) &&
|
||||
!IsStringTerm(inp->val.t) &&
|
||||
inp->type == (YAP_STRING_ATOMS_CODES|YAP_STRING_STRING)) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_LIST;
|
||||
} else if (!IsNumTerm(inp->val.t) && (inp->type & ( YAP_STRING_INT|YAP_STRING_FLOAT| YAP_STRING_BIG)) == inp->type) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_NUMBER;
|
||||
}
|
||||
LOCAL_Error_Term = inp->val.t;
|
||||
}
|
||||
LOCAL_Error_Term = inp->val.t;
|
||||
}
|
||||
}
|
||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR)
|
||||
return NULL;
|
||||
|
@ -326,10 +326,10 @@ real_path( EPath, File),
|
||||
exists_directory(F).
|
||||
'$check_file'(_F, _Type, none) :- !.
|
||||
'$check_file'(F, _Type, exist) :-
|
||||
'$access_file'(F, exist). % if it has a type cannot be a directory..
|
||||
'$access_file'(F, exist). % if it has a type cannot be a directory..
|
||||
'$check_file'(F, _Type, Access) :-
|
||||
'$access_file'(F, Access),
|
||||
\+ exists_directory(F). % if it has a type cannot be a directory..
|
||||
'$access_file'(F, Access),
|
||||
\+ exists_directory(F). % if it has a type cannot be a directory..
|
||||
|
||||
'$suffix'(Last, _Opts) -->
|
||||
{ lists:append(_, [0'.|Alphas], Last), '$id'(Alphas, _, [] ) },
|
||||
|
@ -422,7 +422,8 @@ stream_position_data(Prop, Term, Value) :-
|
||||
'$stream_position_field'(line_position, 3).
|
||||
'$stream_position_field'(byte_count, 4).
|
||||
|
||||
|
||||
'$set_encoding'(Enc) :-
|
||||
stream_property(loop_stream, Enc).
|
||||
|
||||
%! @}
|
||||
|
||||
|
Reference in New Issue
Block a user