Merge branch 'master' of ../yap-6.2
This commit is contained in:
commit
eeb6ef1d17
@ -68,7 +68,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
strcpy(Yap_ErrorSay," Load Failed: in AIX you must load a single object file");
|
strcpy(Yap_ErrorSay," Load Failed: in AIX you must load a single object file");
|
||||||
return LOAD_FAILLED;
|
return LOAD_FAILLED;
|
||||||
}
|
}
|
||||||
if (!Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE)) {
|
if (!Yap_TrueFileName(AtomName(ofiles->name), Yap_FileNameBuf, TRUE)) {
|
||||||
strcpy(Yap_ErrorSay, " Trying to open unexisting file in LoadForeign ");
|
strcpy(Yap_ErrorSay, " Trying to open unexisting file in LoadForeign ");
|
||||||
return LOAD_FAILLED;
|
return LOAD_FAILLED;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ LoadForeign(StringList ofiles,
|
|||||||
|
|
||||||
while(tmp != NULL) {
|
while(tmp != NULL) {
|
||||||
strcat(o_files," ");
|
strcat(o_files," ");
|
||||||
strcat(o_files,tmp->s);
|
strcat(o_files,AtomName(tmp->name));
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +165,7 @@ LoadForeign(StringList ofiles,
|
|||||||
|
|
||||||
while(tmp != NULL) {
|
while(tmp != NULL) {
|
||||||
strcat(l_files," ");
|
strcat(l_files," ");
|
||||||
strcat(l_files,tmp->s);
|
strcat(l_files,AtomName(tmp->name));
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ LoadForeign(StringList ofiles,
|
|||||||
|
|
||||||
while(tmp != NULL) {
|
while(tmp != NULL) {
|
||||||
strcat(o_files," ");
|
strcat(o_files," ");
|
||||||
strcat(o_files,tmp->s);
|
strcat(o_files,AtomName(tmp->name));
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ LoadForeign(StringList ofiles,
|
|||||||
|
|
||||||
while(tmp != NULL) {
|
while(tmp != NULL) {
|
||||||
strcat(l_files," ");
|
strcat(l_files," ");
|
||||||
strcat(l_files,tmp->s);
|
strcat(l_files,AtomName(tmp->name));
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,9 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
|
|
||||||
while (libs) {
|
while (libs) {
|
||||||
|
|
||||||
if (!Yap_TrueFileName(libs->s, Yap_FileNameBuf, TRUE)) {
|
if (!Yap_TrueFileName(AtomName(libs->name), Yap_FileNameBuf, TRUE)) {
|
||||||
/* use LD_LIBRARY_PATH */
|
/* use LD_LIBRARY_PATH */
|
||||||
strncpy(Yap_FileNameBuf, libs->s, YAP_FILENAME_MAX);
|
strncpy(Yap_FileNameBuf, AtomName(libs->name), YAP_FILENAME_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __osf__
|
#ifdef __osf__
|
||||||
@ -116,7 +116,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
other routines */
|
other routines */
|
||||||
|
|
||||||
/* dlopen wants to follow the LD_CONFIG_PATH */
|
/* dlopen wants to follow the LD_CONFIG_PATH */
|
||||||
if (!Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE)) {
|
if (!Yap_TrueFileName(AtomName(ofiles->name), Yap_FileNameBuf, TRUE)) {
|
||||||
strcpy(Yap_ErrorSay, "%% Trying to open unexisting file in LoadForeign");
|
strcpy(Yap_ErrorSay, "%% Trying to open unexisting file in LoadForeign");
|
||||||
return LOAD_FAILLED;
|
return LOAD_FAILLED;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (ofiles) {
|
while (ofiles) {
|
||||||
if((error=dld_link(ofiles->s)) !=0) {
|
if((error=dld_link(AtomName(ofiles->name))) !=0) {
|
||||||
strcpy(Yap_ErrorSay,dld_strerror(error));
|
strcpy(Yap_ErrorSay,dld_strerror(error));
|
||||||
return LOAD_FAILLED;
|
return LOAD_FAILLED;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
while (ofiles) {
|
while (ofiles) {
|
||||||
HINSTANCE handle;
|
HINSTANCE handle;
|
||||||
|
|
||||||
if (Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE) &&
|
if (Yap_TrueFileName(AtomName(ofiles->name), Yap_FileNameBuf, TRUE) &&
|
||||||
(handle=LoadLibrary(Yap_FileNameBuf)) != 0)
|
(handle=LoadLibrary(Yap_FileNameBuf)) != 0)
|
||||||
{
|
{
|
||||||
Yap_ErrorSay[0]=~'\0';
|
Yap_ErrorSay[0]=~'\0';
|
||||||
@ -84,12 +84,13 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
other routines */
|
other routines */
|
||||||
while (libs) {
|
while (libs) {
|
||||||
HINSTANCE handle;
|
HINSTANCE handle;
|
||||||
|
char * s = AtomName(libs->name);
|
||||||
|
|
||||||
if (libs->s[0] == '-') {
|
if (s[0] == '-') {
|
||||||
strcat(Yap_FileNameBuf,libs->s+2);
|
strcat(Yap_FileNameBuf,s+2);
|
||||||
strcat(Yap_FileNameBuf,".dll");
|
strcat(Yap_FileNameBuf,".dll");
|
||||||
} else {
|
} else {
|
||||||
strcpy(Yap_FileNameBuf,libs->s);
|
strcpy(Yap_FileNameBuf,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((handle=LoadLibrary(Yap_FileNameBuf)) == 0)
|
if((handle=LoadLibrary(Yap_FileNameBuf)) == 0)
|
||||||
|
@ -145,7 +145,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
void *handle;
|
void *handle;
|
||||||
|
|
||||||
/* mydlopen wants to follow the LD_CONFIG_PATH */
|
/* mydlopen wants to follow the LD_CONFIG_PATH */
|
||||||
if (!Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE)) {
|
if (!Yap_TrueFileName(AtomName(ofiles->name), Yap_FileNameBuf, TRUE)) {
|
||||||
strcpy(Yap_ErrorSay, "%% Trying to open unexisting file in LoadForeign");
|
strcpy(Yap_ErrorSay, "%% Trying to open unexisting file in LoadForeign");
|
||||||
return LOAD_FAILLED;
|
return LOAD_FAILLED;
|
||||||
}
|
}
|
||||||
@ -163,13 +163,14 @@ LoadForeign(StringList ofiles, StringList libs,
|
|||||||
/* load libraries first so that their symbols are available to
|
/* load libraries first so that their symbols are available to
|
||||||
other routines */
|
other routines */
|
||||||
while (libs) {
|
while (libs) {
|
||||||
|
char *s = AtomName(lib->name);
|
||||||
|
|
||||||
if (libs->s[0] == '-') {
|
if (ls[0] == '-') {
|
||||||
strcpy(Yap_FileNameBuf,"lib");
|
strcpy(Yap_FileNameBuf,"lib");
|
||||||
strcat(Yap_FileNameBuf,libs->s+2);
|
strcat(Yap_FileNameBuf,s+2);
|
||||||
strcat(Yap_FileNameBuf,".so");
|
strcat(Yap_FileNameBuf,".so");
|
||||||
} else {
|
} else {
|
||||||
strcpy(Yap_FileNameBuf,libs->s);
|
strcpy(Yap_FileNameBuf,s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((libs->handle=mydlopen(Yap_FileNameBuf)) == NULL)
|
if((libs->handle=mydlopen(Yap_FileNameBuf)) == NULL)
|
||||||
|
@ -57,7 +57,7 @@ p_load_foreign(void)
|
|||||||
t = TailOfTerm(t);
|
t = TailOfTerm(t);
|
||||||
new = (StringList) Yap_AllocCodeSpace(sizeof(StringListItem));
|
new = (StringList) Yap_AllocCodeSpace(sizeof(StringListItem));
|
||||||
new->next = ofiles;
|
new->next = ofiles;
|
||||||
new->s = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
new->name = AtomOfTerm(t1);
|
||||||
ofiles = new;
|
ofiles = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ p_load_foreign(void)
|
|||||||
t = TailOfTerm(t);
|
t = TailOfTerm(t);
|
||||||
new = (StringList) Yap_AllocCodeSpace(sizeof(StringListItem));
|
new = (StringList) Yap_AllocCodeSpace(sizeof(StringListItem));
|
||||||
new->next = libs;
|
new->next = libs;
|
||||||
new->s = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
new->name = AtomOfTerm(t1);
|
||||||
libs = new;
|
libs = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ LoadForeign( StringList ofiles, StringList libs,
|
|||||||
int valid_fname;
|
int valid_fname;
|
||||||
|
|
||||||
/* shl_load wants to follow the LD_CONFIG_PATH */
|
/* shl_load wants to follow the LD_CONFIG_PATH */
|
||||||
valid_fname = Yap_TrueFileName( ofiles->s, Yap_FileNameBuf, TRUE );
|
valid_fname = Yap_TrueFileName( AtomName(ofiles->name), Yap_FileNameBuf, TRUE );
|
||||||
|
|
||||||
if( !valid_fname ) {
|
if( !valid_fname ) {
|
||||||
strcpy( Yap_ErrorSay, "%% Trying to open non-existing file in LoadForeign" );
|
strcpy( Yap_ErrorSay, "%% Trying to open non-existing file in LoadForeign" );
|
||||||
@ -89,14 +89,15 @@ LoadForeign( StringList ofiles, StringList libs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
while( libs ) {
|
while( libs ) {
|
||||||
|
char *s = AtomName(lib->s);
|
||||||
|
|
||||||
if( libs->s[0] == '-' ) {
|
if( s[0] == '-' ) {
|
||||||
strcpy( Yap_FileNameBuf, "lib" );
|
strcpy( Yap_FileNameBuf, "lib" );
|
||||||
strcat( Yap_FileNameBuf, libs->s+2 );
|
strcat( Yap_FileNameBuf, s+2 );
|
||||||
strcat( Yap_FileNameBuf, ".sl" );
|
strcat( Yap_FileNameBuf, ".sl" );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
strcpy( Yap_FileNameBuf, libs->s );
|
strcpy( Yap_FileNameBuf, s );
|
||||||
}
|
}
|
||||||
|
|
||||||
*(shl_t *)libs->handle = shl_load( Yap_FileNameBuf, BIND_DEFERRED, 0 );
|
*(shl_t *)libs->handle = shl_load( Yap_FileNameBuf, BIND_DEFERRED, 0 );
|
||||||
|
@ -391,7 +391,6 @@ static Int p_stop_low_level_trace(void)
|
|||||||
{
|
{
|
||||||
Yap_do_low_level_trace = FALSE;
|
Yap_do_low_level_trace = FALSE;
|
||||||
do_trace_primitives = TRUE;
|
do_trace_primitives = TRUE;
|
||||||
fprintf(stderr,"vsc_count = %I64d\n",vsc_count);
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@
|
|||||||
#define LOAD_FAILLED -1
|
#define LOAD_FAILLED -1
|
||||||
|
|
||||||
typedef struct StringListItem {
|
typedef struct StringListItem {
|
||||||
char *s;
|
Atom name;
|
||||||
void *handle;
|
void *handle;
|
||||||
struct StringListItem *next;
|
struct StringListItem *next;
|
||||||
} StringListItem, *StringList;
|
} StringListItem, *StringList;
|
||||||
|
@ -960,8 +960,7 @@ RestoreForeignCode(void)
|
|||||||
while (objs != NULL) {
|
while (objs != NULL) {
|
||||||
if (objs->next != NULL)
|
if (objs->next != NULL)
|
||||||
objs->next = (StringList)AddrAdjust((ADDR)objs->next);
|
objs->next = (StringList)AddrAdjust((ADDR)objs->next);
|
||||||
if (objs->s != NULL)
|
objs->name = AtomAdjust(objs->name);
|
||||||
objs->s = (char *)AddrAdjust((ADDR)objs->s);
|
|
||||||
objs = objs->next;
|
objs = objs->next;
|
||||||
}
|
}
|
||||||
if (f_code->libs != NULL)
|
if (f_code->libs != NULL)
|
||||||
@ -970,8 +969,7 @@ RestoreForeignCode(void)
|
|||||||
while (libs != NULL) {
|
while (libs != NULL) {
|
||||||
if (libs->next != NULL)
|
if (libs->next != NULL)
|
||||||
libs->next = (StringList)AddrAdjust((ADDR)libs->next);
|
libs->next = (StringList)AddrAdjust((ADDR)libs->next);
|
||||||
if (libs->s != NULL)
|
libs->name = AtomAdjust(libs->name);
|
||||||
libs->s = (char *)AddrAdjust((ADDR)libs->s);
|
|
||||||
libs = libs->next;
|
libs = libs->next;
|
||||||
}
|
}
|
||||||
if (f_code->f != NULL)
|
if (f_code->f != NULL)
|
||||||
|
@ -225,6 +225,8 @@ goal_expansion(file_base_name(A,B),system:swi_file_base_name(A,B)) :- swi_io.
|
|||||||
goal_expansion(file_directory_name(A,B),system:swi_file_directory_name(A,B)) :- swi_io.
|
goal_expansion(file_directory_name(A,B),system:swi_file_directory_name(A,B)) :- swi_io.
|
||||||
goal_expansion('$mark_executable'(A), system:'swi_is_absolute_file_name'(A)) :- swi_io.
|
goal_expansion('$mark_executable'(A), system:'swi_is_absolute_file_name'(A)) :- swi_io.
|
||||||
goal_expansion('$absolute_file_name'(A,B),system:'swi_$absolute_file_name'(A,B)) :- swi_io.
|
goal_expansion('$absolute_file_name'(A,B),system:'swi_$absolute_file_name'(A,B)) :- swi_io.
|
||||||
|
goal_expansion(nl(A),system:swi_nl(A)) :- swi_io.
|
||||||
|
goal_expansion(nl,system:swi_nl) :- swi_io.
|
||||||
|
|
||||||
|
|
||||||
% make sure we also use
|
% make sure we also use
|
||||||
|
@ -4215,6 +4215,7 @@ PRED_IMPL("copy_stream_data", 2, copy_stream_data2, 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************
|
/*******************************
|
||||||
* PUBLISH PREDICATES *
|
* PUBLISH PREDICATES *
|
||||||
*******************************/
|
*******************************/
|
||||||
@ -4312,8 +4313,34 @@ static pl_Sgetc(IOSTREAM *s)
|
|||||||
return Sgetc(s);
|
return Sgetc(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* copied by VSC */
|
||||||
|
|
||||||
|
static word
|
||||||
|
pl_nl1(term_t stream)
|
||||||
|
{ IOSTREAM *s;
|
||||||
|
|
||||||
|
if ( getOutputStream(stream, &s) )
|
||||||
|
{ Sputcode('\n', s);
|
||||||
|
return streamStatus(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
static word
|
||||||
|
pl_nl()
|
||||||
|
{ return pl_nl1(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const PL_extension foreigns[] = {
|
||||||
|
FRG("swi_nl", 0, pl_nl, ISO),
|
||||||
|
FRG("swi_nl", 1, pl_nl1, ISO),
|
||||||
|
/* DO NOT ADD ENTRIES BELOW THIS ONE */
|
||||||
|
FRG((char *)NULL, 0, NULL, 0)
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_yap_extras()
|
init_yap_extras(void)
|
||||||
{
|
{
|
||||||
swi_io_struct swiio;
|
swi_io_struct swiio;
|
||||||
|
|
||||||
@ -4329,6 +4356,7 @@ init_yap_extras()
|
|||||||
initFiles();
|
initFiles();
|
||||||
initGlob();
|
initGlob();
|
||||||
PL_register_extensions(PL_predicates_from_file);
|
PL_register_extensions(PL_predicates_from_file);
|
||||||
|
PL_register_extensions(foreigns);
|
||||||
fileerrors = TRUE;
|
fileerrors = TRUE;
|
||||||
SinitStreams();
|
SinitStreams();
|
||||||
}
|
}
|
||||||
|
11
pl/boot.yap
11
pl/boot.yap
@ -461,9 +461,14 @@ true :- true.
|
|||||||
'$$compile'(G1, G0, N, HeadMod).
|
'$$compile'(G1, G0, N, HeadMod).
|
||||||
|
|
||||||
'$prepare_term'(G, V, Pos, G0, G1, BodyMod, SourceMod, Source) :-
|
'$prepare_term'(G, V, Pos, G0, G1, BodyMod, SourceMod, Source) :-
|
||||||
( get_value('$syntaxcheckflag',on) ->
|
'$precompile_term'(G, G0, G1, BodyMod, SourceMod),
|
||||||
'$check_term'(Source, V, Pos, BodyMod) ; true ),
|
(
|
||||||
'$precompile_term'(G, G0, G1, BodyMod, SourceMod).
|
get_value('$syntaxcheckflag',on)
|
||||||
|
->
|
||||||
|
'$check_term'(G0, V, Pos, Source, BodyMod)
|
||||||
|
;
|
||||||
|
true
|
||||||
|
).
|
||||||
|
|
||||||
% process an input clause
|
% process an input clause
|
||||||
'$$compile'(G, G0, L, Mod) :-
|
'$$compile'(G, G0, L, Mod) :-
|
||||||
|
@ -120,20 +120,22 @@ no_style_check([H|T]) :- no_style_check(H), no_style_check(T).
|
|||||||
'$values'('$syntaxcheckmultiple',O,N).
|
'$values'('$syntaxcheckmultiple',O,N).
|
||||||
|
|
||||||
|
|
||||||
'$check_term'(T,_,P,M) :-
|
'$check_term'(T,_,P,_Source,M) :-
|
||||||
get_value('$syntaxcheckdiscontiguous',on),
|
get_value('$syntaxcheckdiscontiguous',on),
|
||||||
'$xtract_head'(T,M,NM,_,F,A),
|
'$xtract_head'(T,M,NM,_,F,A),
|
||||||
'$handle_discontiguous'(F,A,NM), fail.
|
'$handle_discontiguous'(F,A,NM), fail.
|
||||||
'$check_term'(T,_,P,M) :-
|
'$check_term'(T,_,P,_Source,M) :-
|
||||||
get_value('$syntaxcheckmultiple',on),
|
get_value('$syntaxcheckmultiple',on),
|
||||||
'$xtract_head'(T,M,NM,_,F,A),
|
'$xtract_head'(T,M,NM,_,F,A),
|
||||||
'$handle_multiple'(F,A,NM), fail.
|
'$handle_multiple'(F,A,NM), fail.
|
||||||
'$check_term'(T,VL,P,_) :-
|
'$check_term'(T,VL,P,_Source,_) :-
|
||||||
get_value('$syntaxchecksinglevar',on),
|
get_value('$syntaxchecksinglevar',on),
|
||||||
( '$chk_binding_vars'(T),
|
( '$chk_binding_vars'(T),
|
||||||
'$sv_list'(VL,Sv) ->
|
'$sv_list'(VL,Sv)
|
||||||
'$sv_warning'(Sv,T) ), fail.
|
->
|
||||||
'$check_term'(_,_,_,_).
|
'$sv_warning'(Sv,T)
|
||||||
|
), fail.
|
||||||
|
'$check_term'(_,_,_,_,_).
|
||||||
|
|
||||||
'$chk_binding_vars'(V) :- var(V), !, V = '$V'(_).
|
'$chk_binding_vars'(V) :- var(V), !, V = '$V'(_).
|
||||||
'$chk_binding_vars'('$V'(off)) :- !.
|
'$chk_binding_vars'('$V'(off)) :- !.
|
||||||
|
Reference in New Issue
Block a user