6.2 fix to load_foreign atom.

This commit is contained in:
Vitor Santos Costa 2012-06-11 22:11:30 +01:00
parent c6ececc21a
commit f6de18cb09
4 changed files with 7 additions and 5 deletions

View File

@ -90,7 +90,7 @@ p_load_foreign( USES_REGS1 )
ForeignObj *f_code = (ForeignObj *)Yap_AllocCodeSpace(sizeof(ForeignObj)); ForeignObj *f_code = (ForeignObj *)Yap_AllocCodeSpace(sizeof(ForeignObj));
f_code->objs = ofiles; f_code->objs = ofiles;
f_code->libs = libs; f_code->libs = libs;
f_code->f = InitProcName; f_code->f = AtomOfTerm(t1);
f_code->next = ForeignCodeLoaded; f_code->next = ForeignCodeLoaded;
f_code->module = CurrentModule; f_code->module = CurrentModule;
ForeignCodeLoaded = f_code; ForeignCodeLoaded = f_code;
@ -248,7 +248,7 @@ Yap_ReOpenLoadForeign(void)
YapInitProc InitProc = NULL; YapInitProc InitProc = NULL;
CurrentModule = f_code->module; CurrentModule = f_code->module;
if(Yap_ReLoadForeign(f_code->objs,f_code->libs,f_code->f,&InitProc)==LOAD_SUCCEEDED) { if(Yap_ReLoadForeign(f_code->objs,f_code->libs,RepAtom(f_code->f)->StrOfAE,&InitProc)==LOAD_SUCCEEDED) {
if (InitProc) if (InitProc)
(*InitProc)(); (*InitProc)();
} }

View File

@ -92,7 +92,7 @@ typedef struct StringListItem {
typedef struct ForeignLoadItem { typedef struct ForeignLoadItem {
StringList objs; StringList objs;
StringList libs; StringList libs;
char *f; Atom f;
Term module; Term module;
struct ForeignLoadItem *next; struct ForeignLoadItem *next;
} ForeignObj; } ForeignObj;

View File

@ -994,8 +994,9 @@ RestoreForeignCode__( USES_REGS1 )
libs->name = AtomAdjust(libs->name); libs->name = AtomAdjust(libs->name);
libs = libs->next; libs = libs->next;
} }
if (f_code->f != NULL) if (f_code->f != NULL) {
f_code->f = (char *)AddrAdjust((ADDR)f_code->f); f_code->f = AtomAdjust(f_code->f);
}
if (f_code->next != NULL) if (f_code->next != NULL)
f_code->next = (ForeignObj *)AddrAdjust((ADDR)f_code->next); f_code->next = (ForeignObj *)AddrAdjust((ADDR)f_code->next);
f_code = f_code->next; f_code = f_code->next;

View File

@ -61,6 +61,7 @@ ground_all_keys([], _).
ground_all_keys([V|GVars], AllKeys) :- ground_all_keys([V|GVars], AllKeys) :-
clpbn:get_atts(V,[key(Key)]), clpbn:get_atts(V,[key(Key)]),
\+ ground(Key), !, \+ ground(Key), !,
wroteln(g:Key),
member(Key, AllKeys), member(Key, AllKeys),
ground_all_keys(GVars, AllKeys). ground_all_keys(GVars, AllKeys).
ground_all_keys([_V|GVars], AllKeys) :- ground_all_keys([_V|GVars], AllKeys) :-