2001-04-09 20:54:03 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* YAP Prolog *
|
|
|
|
* *
|
|
|
|
* Yap Prolog was developed at NCCUP - Universidade do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: load_foreign.yap *
|
|
|
|
* Last rev: 8/2/88 *
|
|
|
|
* mods: *
|
|
|
|
* comments: Utility predicates for load_foreign *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
load_foreign_files(Objs,Libs,Entry) :-
|
|
|
|
'$check_objs_for_load_foreign_files'(Objs,NewObjs,load_foreign_files(Objs,Libs,Entry)),
|
2001-12-17 18:31:11 +00:00
|
|
|
'$check_libs_for_load_foreign_files'(Libs,load_foreign_files(Objs,Libs,Entry)),
|
2001-04-09 20:54:03 +01:00
|
|
|
'$check_entry_for_load_foreign_files'(Entry,load_foreign_files(Objs,Libs,Entry)),
|
|
|
|
'$load_foreign_files'(NewObjs,Libs,Entry).
|
|
|
|
|
|
|
|
'$check_objs_for_load_foreign_files'(V,_,G) :- var(V), !,
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(instantiation_error,G).
|
2001-04-09 20:54:03 +01:00
|
|
|
'$check_objs_for_load_foreign_files'([],[],_) :- !.
|
|
|
|
'$check_objs_for_load_foreign_files'([Obj|Objs],[NObj|NewObjs],G) :- !,
|
|
|
|
'$check_obj_for_load_foreign_files'(Obj,NObj,G),
|
|
|
|
'$check_objs_for_load_foreign_files'(Objs,NewObjs,G).
|
|
|
|
'$check_objs_for_load_foreign_files'(Objs,_,G) :-
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(type_error(list,Objs),G).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
'$check_obj_for_load_foreign_files'(V,_,G) :- var(V), !,
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(instantiation_error,G).
|
2001-04-09 20:54:03 +01:00
|
|
|
'$check_obj_for_load_foreign_files'(Obj,NewObj,_) :- atom(Obj), !,
|
|
|
|
atom_codes(Obj,ObjCodes),
|
|
|
|
'$process_obj_suffix'(ObjCodes,NewObjCodes),
|
|
|
|
atom_codes(NewObj,NewObjCodes).
|
|
|
|
'$check_obj_for_load_foreign_files'(Obj,_,G) :-
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(type_error(atom,Obj),G).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
'$check_libs_for_load_foreign_files'(V,G) :- var(V), !,
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(instantiation_error,G).
|
2001-04-09 20:54:03 +01:00
|
|
|
'$check_libs_for_load_foreign_files'([],_) :- !.
|
|
|
|
'$check_libs_for_load_foreign_files'([Lib|Libs],G) :- !,
|
|
|
|
'$check_lib_for_load_foreign_files'(Lib,G),
|
|
|
|
'$check_libs_for_load_foreign_files'(Libs,G).
|
|
|
|
'$check_libs_for_load_foreign_files'(Libs,G) :-
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(type_error(list,Libs),G).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
'$check_lib_for_load_foreign_files'(V,G) :- var(V), !,
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(instantiation_error,G).
|
2001-04-09 20:54:03 +01:00
|
|
|
'$check_lib_for_load_foreign_files'(Lib,_) :- atom(Lib), !.
|
|
|
|
'$check_lib_for_load_foreign_files'(Lib,G) :-
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(type_error(atom,Lib),G).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
'$check_entry_for_load_foreign_files'(V,G) :- var(V), !,
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(instantiation_error,G).
|
2001-04-09 20:54:03 +01:00
|
|
|
'$check_entry_for_load_foreign_files'(Entry,_) :- atom(Entry), !.
|
|
|
|
'$check_entry_for_load_foreign_files'(Entry,G) :-
|
2002-09-09 18:40:12 +01:00
|
|
|
'$do_error'(type_error(atom,Entry),G).
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
'$process_obj_suffix'(ObjCodes,ObjCodes) :-
|
|
|
|
'$obj_suffix'(ObjSuffix),
|
|
|
|
'$append'(ObjCodes,ObjSuffix,ObjCodes), !.
|
|
|
|
'$process_obj_suffix'(ObjCodes,NewObjCodes) :-
|
|
|
|
'$obj_suffix'(ObjSuffix),
|
|
|
|
'$append'(ObjCodes,ObjSuffix,NewObjCodes).
|
|
|
|
|
|
|
|
|