Enhanced version
This commit is contained in:
@@ -264,6 +264,7 @@ pub enum SystemClauseType {
|
||||
WAMInstructions,
|
||||
WriteTerm,
|
||||
WriteTermToChars,
|
||||
ScryerPrologVersion,
|
||||
}
|
||||
|
||||
impl SystemClauseType {
|
||||
@@ -418,6 +419,7 @@ impl SystemClauseType {
|
||||
&SystemClauseType::WAMInstructions => clause_name!("$wam_instructions"),
|
||||
&SystemClauseType::WriteTerm => clause_name!("$write_term"),
|
||||
&SystemClauseType::WriteTermToChars => clause_name!("$write_term_to_chars"),
|
||||
&SystemClauseType::ScryerPrologVersion => clause_name!("$scryer_prolog_version"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,6 +554,7 @@ impl SystemClauseType {
|
||||
("$wam_instructions", 3) => Some(SystemClauseType::WAMInstructions),
|
||||
("$write_term", 6) => Some(SystemClauseType::WriteTerm),
|
||||
("$write_term_to_chars", 7) => Some(SystemClauseType::WriteTermToChars),
|
||||
("$scryer_prolog_version", 1) => Some(SystemClauseType::ScryerPrologVersion),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3515,6 +3515,15 @@ impl MachineState {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
&SystemClauseType::ScryerPrologVersion => {
|
||||
use crate::git_version::git_version;
|
||||
let version = self[temp_v!(1)];
|
||||
let buffer =
|
||||
git_version!(cargo_prefix = "cargo:", fallback = "unknown");
|
||||
let chars = buffer.chars().map(|c| Addr::Char(c));
|
||||
let result = Addr::HeapCell(self.heap.to_list(chars));
|
||||
self.unify(version, result);
|
||||
}
|
||||
};
|
||||
|
||||
return_from_clause!(self.last_call, self)
|
||||
|
||||
@@ -54,7 +54,8 @@ print_help(Args) :-
|
||||
halt.
|
||||
|
||||
print_version(Args) :-
|
||||
write('v0.8.120'), nl, % TODO: Something better is required here.
|
||||
'$scryer_prolog_version'(Version),
|
||||
write(Version), nl,
|
||||
halt.
|
||||
|
||||
gather_goal(Type, Args0, Goals) :-
|
||||
|
||||
Reference in New Issue
Block a user