Merge branch 'master' of ../yap-6.2
This commit is contained in:
18
C/agc.c
18
C/agc.c
@@ -74,6 +74,7 @@ CleanAtomMarkedBit(Atom a)
|
||||
return (Atom)c;
|
||||
}
|
||||
|
||||
|
||||
static inline Functor
|
||||
FuncAdjust(Functor f)
|
||||
{
|
||||
@@ -111,6 +112,22 @@ AtomAdjust(Atom a)
|
||||
return(a);
|
||||
}
|
||||
|
||||
static Term AdjustDBTerm(Term, Term *);
|
||||
|
||||
static Term
|
||||
CodeComposedTermAdjust(Term t)
|
||||
{
|
||||
Term *base;
|
||||
|
||||
if (IsApplTerm(t)) {
|
||||
base = RepAppl(t);
|
||||
} else {
|
||||
base = RepPair(t);
|
||||
}
|
||||
return AdjustDBTerm(t, base);
|
||||
}
|
||||
|
||||
|
||||
#define IsOldCode(P) FALSE
|
||||
#define IsOldCodeCellPtr(P) FALSE
|
||||
#define IsOldDelay(P) FALSE
|
||||
@@ -145,7 +162,6 @@ AtomAdjust(Atom a)
|
||||
#define AtomEntryAdjust(P) (P)
|
||||
#define GlobalEntryAdjust(P) (P)
|
||||
#define BlobTermAdjust(P) (P)
|
||||
#define CodeComposedTermAdjust(P) (P)
|
||||
#define CellPtoHeapAdjust(P) (P)
|
||||
#define PtoAtomHashEntryAdjust(P) (P)
|
||||
#define CellPtoHeapCellAdjust(P) (P)
|
||||
|
@@ -792,11 +792,13 @@ ConstantTermAdjust (Term t)
|
||||
return AtomTermAdjust(t);
|
||||
else if (IsIntTerm(t))
|
||||
return t;
|
||||
else if (IsApplTerm(t))
|
||||
else if (IsApplTerm(t) && IsBlobFunctor(FunctorOfTerm(t))) {
|
||||
return BlobTermAdjust(t);
|
||||
else if (IsPairTerm(t))
|
||||
} else if (IsApplTerm(t) || IsPairTerm(t)) {
|
||||
return CodeComposedTermAdjust(t);
|
||||
else return t;
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
22
C/iopreds.c
22
C/iopreds.c
@@ -3489,9 +3489,17 @@ CheckStream (Term arg, int kind, char *msg)
|
||||
sname = AtomUserOut;
|
||||
}
|
||||
}
|
||||
if (kind & SWI_Stream_f) {
|
||||
struct io_stream *swi_stream;
|
||||
|
||||
if (Yap_get_stream_handle(arg, &swi_stream)) {
|
||||
sno = LookupSWIStream(swi_stream);
|
||||
return sno;
|
||||
}
|
||||
}
|
||||
if ((sno = CheckAlias(sname)) == -1) {
|
||||
Yap_Error(EXISTENCE_ERROR_STREAM, arg, msg);
|
||||
return(-1);
|
||||
return -1;
|
||||
}
|
||||
} else if (IsApplTerm (arg) && FunctorOfTerm (arg) == FunctorStream) {
|
||||
arg = ArgOfTerm (1, arg);
|
||||
@@ -4089,7 +4097,15 @@ static Int
|
||||
p_write2_prio (void)
|
||||
{ /* '$write'(+Stream,+Flags,?Term) */
|
||||
int old_output_stream = Yap_c_output_stream;
|
||||
Yap_c_output_stream = CheckStream (ARG1, Output_Stream_f, "write/2");
|
||||
Int flags = IntegerOfTerm(Deref(ARG2));
|
||||
int stream_f;
|
||||
|
||||
if (flags & Use_SWI_Stream_f) {
|
||||
stream_f = Output_Stream_f|SWI_Stream_f;
|
||||
} else {
|
||||
stream_f = Output_Stream_f;
|
||||
}
|
||||
Yap_c_output_stream = CheckStream (ARG1, stream_f, "write/2");
|
||||
if (Yap_c_output_stream == -1) {
|
||||
Yap_c_output_stream = old_output_stream;
|
||||
return(FALSE);
|
||||
@@ -4098,7 +4114,7 @@ p_write2_prio (void)
|
||||
/* notice: we must have ASP well set when using portray, otherwise
|
||||
we cannot make recursive Prolog calls */
|
||||
Yap_StartSlots();
|
||||
Yap_plwrite (ARG4, Stream[Yap_c_output_stream].stream_wputc, (int) IntOfTerm (Deref (ARG2)), (int) IntOfTerm (Deref (ARG3)));
|
||||
Yap_plwrite (ARG4, Stream[Yap_c_output_stream].stream_wputc, (int) flags, (int) IntOfTerm (Deref (ARG3)));
|
||||
Yap_CloseSlots();
|
||||
Yap_c_output_stream = old_output_stream;
|
||||
if (EX != 0L) {
|
||||
|
@@ -68,7 +68,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
strcpy(Yap_ErrorSay," Load Failed: in AIX you must load a single object file");
|
||||
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 ");
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
|
@@ -154,7 +154,7 @@ LoadForeign(StringList ofiles,
|
||||
|
||||
while(tmp != NULL) {
|
||||
strcat(o_files," ");
|
||||
strcat(o_files,tmp->s);
|
||||
strcat(o_files,AtomName(tmp->name));
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ LoadForeign(StringList ofiles,
|
||||
|
||||
while(tmp != NULL) {
|
||||
strcat(l_files," ");
|
||||
strcat(l_files,tmp->s);
|
||||
strcat(l_files,AtomName(tmp->name));
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
|
@@ -155,7 +155,7 @@ LoadForeign(StringList ofiles,
|
||||
|
||||
while(tmp != NULL) {
|
||||
strcat(o_files," ");
|
||||
strcat(o_files,tmp->s);
|
||||
strcat(o_files,AtomName(tmp->name));
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ LoadForeign(StringList ofiles,
|
||||
|
||||
while(tmp != NULL) {
|
||||
strcat(l_files," ");
|
||||
strcat(l_files,tmp->s);
|
||||
strcat(l_files,AtomName(tmp->name));
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
|
@@ -92,9 +92,9 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
|
||||
while (libs) {
|
||||
|
||||
if (!Yap_TrueFileName(libs->s, Yap_FileNameBuf, TRUE)) {
|
||||
if (!Yap_TrueFileName(AtomName(libs->name), Yap_FileNameBuf, TRUE)) {
|
||||
/* use LD_LIBRARY_PATH */
|
||||
strncpy(Yap_FileNameBuf, libs->s, YAP_FILENAME_MAX);
|
||||
strncpy(Yap_FileNameBuf, AtomName(libs->name), YAP_FILENAME_MAX);
|
||||
}
|
||||
|
||||
#ifdef __osf__
|
||||
@@ -116,7 +116,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
other routines */
|
||||
|
||||
/* 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");
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
}
|
||||
|
||||
while (ofiles) {
|
||||
if((error=dld_link(ofiles->s)) !=0) {
|
||||
if((error=dld_link(AtomName(ofiles->name))) !=0) {
|
||||
strcpy(Yap_ErrorSay,dld_strerror(error));
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
while (ofiles) {
|
||||
HINSTANCE handle;
|
||||
|
||||
if (Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE) &&
|
||||
if (Yap_TrueFileName(AtomName(ofiles->name), Yap_FileNameBuf, TRUE) &&
|
||||
(handle=LoadLibrary(Yap_FileNameBuf)) != 0)
|
||||
{
|
||||
Yap_ErrorSay[0]=~'\0';
|
||||
@@ -84,12 +84,13 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
other routines */
|
||||
while (libs) {
|
||||
HINSTANCE handle;
|
||||
char * s = AtomName(libs->name);
|
||||
|
||||
if (libs->s[0] == '-') {
|
||||
strcat(Yap_FileNameBuf,libs->s+2);
|
||||
if (s[0] == '-') {
|
||||
strcat(Yap_FileNameBuf,s+2);
|
||||
strcat(Yap_FileNameBuf,".dll");
|
||||
} else {
|
||||
strcpy(Yap_FileNameBuf,libs->s);
|
||||
strcpy(Yap_FileNameBuf,s);
|
||||
}
|
||||
|
||||
if((handle=LoadLibrary(Yap_FileNameBuf)) == 0)
|
||||
|
@@ -145,7 +145,7 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
void *handle;
|
||||
|
||||
/* 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");
|
||||
return LOAD_FAILLED;
|
||||
}
|
||||
@@ -163,13 +163,14 @@ LoadForeign(StringList ofiles, StringList libs,
|
||||
/* load libraries first so that their symbols are available to
|
||||
other routines */
|
||||
while (libs) {
|
||||
|
||||
if (libs->s[0] == '-') {
|
||||
char *s = AtomName(lib->name);
|
||||
|
||||
if (ls[0] == '-') {
|
||||
strcpy(Yap_FileNameBuf,"lib");
|
||||
strcat(Yap_FileNameBuf,libs->s+2);
|
||||
strcat(Yap_FileNameBuf,s+2);
|
||||
strcat(Yap_FileNameBuf,".so");
|
||||
} else {
|
||||
strcpy(Yap_FileNameBuf,libs->s);
|
||||
strcpy(Yap_FileNameBuf,s);
|
||||
}
|
||||
|
||||
if((libs->handle=mydlopen(Yap_FileNameBuf)) == NULL)
|
||||
|
@@ -57,7 +57,7 @@ p_load_foreign(void)
|
||||
t = TailOfTerm(t);
|
||||
new = (StringList) Yap_AllocCodeSpace(sizeof(StringListItem));
|
||||
new->next = ofiles;
|
||||
new->s = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
||||
new->name = AtomOfTerm(t1);
|
||||
ofiles = new;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ p_load_foreign(void)
|
||||
t = TailOfTerm(t);
|
||||
new = (StringList) Yap_AllocCodeSpace(sizeof(StringListItem));
|
||||
new->next = libs;
|
||||
new->s = RepAtom(AtomOfTerm(t1))->StrOfAE;
|
||||
new->name = AtomOfTerm(t1);
|
||||
libs = new;
|
||||
}
|
||||
|
||||
|
11
C/load_shl.c
11
C/load_shl.c
@@ -61,7 +61,7 @@ LoadForeign( StringList ofiles, StringList libs,
|
||||
int valid_fname;
|
||||
|
||||
/* 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 ) {
|
||||
strcpy( Yap_ErrorSay, "%% Trying to open non-existing file in LoadForeign" );
|
||||
@@ -89,14 +89,15 @@ LoadForeign( StringList ofiles, StringList libs,
|
||||
}
|
||||
|
||||
while( libs ) {
|
||||
|
||||
if( libs->s[0] == '-' ) {
|
||||
char *s = AtomName(lib->s);
|
||||
|
||||
if( s[0] == '-' ) {
|
||||
strcpy( Yap_FileNameBuf, "lib" );
|
||||
strcat( Yap_FileNameBuf, libs->s+2 );
|
||||
strcat( Yap_FileNameBuf, s+2 );
|
||||
strcat( Yap_FileNameBuf, ".sl" );
|
||||
}
|
||||
else {
|
||||
strcpy( Yap_FileNameBuf, libs->s );
|
||||
strcpy( Yap_FileNameBuf, s );
|
||||
}
|
||||
|
||||
*(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;
|
||||
do_trace_primitives = TRUE;
|
||||
fprintf(stderr,"vsc_count = %I64d\n",vsc_count);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user