1:- module(canny_arch,
2 [ current_arch/1,
3 current_arch_os/2,
4 current_os/1
5 ]).
The Prolog arch flag combines both the architecture and the
operating system as a dash-separated pair. The predicate splits
these two components apart by reading the underlying atom as a
Prolog term. This makes an assumption about the format of the arch
flag.
19current_arch(Arch) :-
20 current_prolog_flag(arch, Arch0),
21 atom_to_term(Arch0, Arch, []).win32 or
win64 for Windows, darwin for macOS, or linux for Linux. Maps
architecture bit-width to an atomic Arch token for contemporary
64-bit hosts, one of: x64, x86_64. Darwin and Linux report the
latter, Windows the former.
33current_arch_os(Arch, OS) :- current_arch(Arch-OS).win32win64darwinlinux
44current_os(OS) :- current_arch_os(_, OS)