make load_context_path/2 handle .pl file extensions, remove commented out code

This commit is contained in:
Mark Thom
2021-02-05 13:13:54 -07:00
parent 2d7f31a60d
commit 1bc8e9aebf
4 changed files with 16 additions and 42 deletions

View File

@@ -150,11 +150,6 @@ impl InlinedClauseType {
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum SystemClauseType {
// AbolishClause,
// AbolishModuleClause,
// AssertDynamicPredicateToBack,
// AssertDynamicPredicateToFront,
// AtEndOfExpansion,
AtomChars,
AtomCodes,
AtomLength,
@@ -189,8 +184,6 @@ pub enum SystemClauseType {
DynamicModuleResolution(usize),
EnqueueAttributeGoal,
EnqueueAttributedVar,
// ExpandGoal,
// ExpandTerm,
FetchGlobalVar,
FetchGlobalVarWithOffset,
FirstStream,
@@ -207,16 +200,13 @@ pub enum SystemClauseType {
GetAttrVarQueueDelimiter,
GetAttrVarQueueBeyond,
GetBValue,
// GetClause,
GetContinuationChunk,
// GetModuleClause,
GetNextDBRef,
GetNextOpDBRef,
IsPartialString,
LookupDBRef,
LookupOpDBRef,
Halt,
// ModuleHeadIsDynamic,
GetLiftedHeapFromOffset,
GetLiftedHeapFromOffsetDiff,
GetSCCCleaner,
@@ -225,10 +215,7 @@ pub enum SystemClauseType {
InstallInferenceCounter,
LiftedHeapLength,
LoadLibraryAsStream,
// ModuleAssertDynamicPredicateToFront,
// ModuleAssertDynamicPredicateToBack,
ModuleExists,
// ModuleRetractClause,
NextEP,
NoSuchPredicate,
NumberToChars,
@@ -254,7 +241,6 @@ pub enum SystemClauseType {
ResetContinuationMarker,
ResetGlobalVarAtKey,
ResetGlobalVarAtOffset,
// RetractClause,
RestoreCutPolicy,
SetCutPoint(RegType),
SetInput,

View File

@@ -296,11 +296,13 @@ use_module(Module, Exports) :-
%% 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)
).
@@ -311,23 +313,21 @@ use_module(Module, Exports, Evacuable) :-
( 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)
; 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)
)
; 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)
).
@@ -387,7 +387,6 @@ strip_module_(M0, G0, M1, G1) :-
; M0 = M1,
G0 = G1
).
strip_module(Goal, M, G) :-
strip_module_(_, Goal, M, G).

View File

@@ -1098,13 +1098,6 @@ impl MachineState {
return Ok(());
}
}
/*
&SystemClauseType::AtEndOfExpansion => {
if self.cp == LocalCodePtr::TopLevel(0, 0) {
self.at_end_of_expansion = true;
}
}
*/
&SystemClauseType::AtomChars => {
let a1 = self[temp_v!(1)];

View File

@@ -1,9 +1,5 @@
:- module('$toplevel', [argv/1,
copy_term/3,
predicate_property/2,
prolog_load_context/2]).
:- use_module(library(loader)).
copy_term/3]).
:- use_module(library(charsio)).
:- use_module(library(iso_ext)).