#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum SystemClauseType {
- // AbolishClause,
- // AbolishModuleClause,
- // AssertDynamicPredicateToBack,
- // AssertDynamicPredicateToFront,
- // AtEndOfExpansion,
AtomChars,
AtomCodes,
AtomLength,
DynamicModuleResolution(usize),
EnqueueAttributeGoal,
EnqueueAttributedVar,
-// ExpandGoal,
-// ExpandTerm,
FetchGlobalVar,
FetchGlobalVarWithOffset,
FirstStream,
GetAttrVarQueueDelimiter,
GetAttrVarQueueBeyond,
GetBValue,
-// GetClause,
GetContinuationChunk,
-// GetModuleClause,
GetNextDBRef,
GetNextOpDBRef,
IsPartialString,
LookupDBRef,
LookupOpDBRef,
Halt,
-// ModuleHeadIsDynamic,
GetLiftedHeapFromOffset,
GetLiftedHeapFromOffsetDiff,
GetSCCCleaner,
InstallInferenceCounter,
LiftedHeapLength,
LoadLibraryAsStream,
- // ModuleAssertDynamicPredicateToFront,
- // ModuleAssertDynamicPredicateToBack,
ModuleExists,
- // ModuleRetractClause,
NextEP,
NoSuchPredicate,
NumberToChars,
ResetContinuationMarker,
ResetGlobalVarAtKey,
ResetGlobalVarAtOffset,
- // RetractClause,
RestoreCutPolicy,
SetCutPoint(RegType),
SetInput,
%% If use_module is invoked in an existing load context, use its
%% directory. Otherwise, use the relative path of Path.
+
load_context_path(Module, Path) :-
( prolog_load_context(directory, CurrentDir) ->
atom_concat(CurrentDir, Path, Module)
- ;
- Module = Path
+ ; atom_concat(_, '.pl', Module) ->
+ Module = Path
+ ; atom_concat(Module, '.pl', Path)
).
( atom(Library) ->
( '$load_compiled_library'(Library, Evacuable) -> %% TODO: What about Exports?
true
- ;
- '$load_library_as_stream'(Library, Stream, Path),
- file_load(Stream, Path, Subevacuable),
- '$use_module'(Evacuable, Subevacuable, Exports)
+ ; '$load_library_as_stream'(Library, Stream, Path),
+ file_load(Stream, Path, Subevacuable),
+ '$use_module'(Evacuable, Subevacuable, Exports)
)
; var(Library) ->
instantiation_error(load/1)
- ;
- type_error(atom, Library, load/1)
- )
- ; atom(Module) ->
- load_context_path(Module, Path),
- open(Path, read, Stream),
- file_load(Stream, Path, Subevacuable),
- '$use_module'(Evacuable, Subevacuable, Exports)
- ;
- type_error(atom, Library, load/1)
+ ; type_error(atom, Library, load/1)
+ )
+ ; ( atom(Module) ->
+ load_context_path(Module, Path),
+ open(Path, read, Stream),
+ file_load(Stream, Path, Subevacuable),
+ '$use_module'(Evacuable, Subevacuable, Exports)
+ ; type_error(atom, Library, load/1)
+ )
).
; M0 = M1,
G0 = G1
).
-
strip_module(Goal, M, G) :-
strip_module_(_, Goal, M, G).