Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 47 additions & 1 deletion src/builtin.elpi
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ triple_2 (triple _ B _) B.

func triple_3 triple A B C -> C.
triple_3 (triple _ _ C) C.



% The option type (aka Maybe)
Expand Down Expand Up @@ -344,12 +344,58 @@ external func eof in_stream.
% [gettimeofday T] sets T to the number of seconds elapsed since 1/1/1970
external func gettimeofday -> float.

% [sys.file_exists Path] is like [Sys.file_exists]. It succeeds if the file
% at [Path] exists
external func sys.file_exists string.

% [sys.is_directory Path Diagnostic] is like [Sys.is_directory]. It succeeds
% if [Diagnostic = ok] and [Path] is a directory or [Diagnostic = error Msg]
% and [Msg] describes an encountered system error.
external func sys.is_directory string -> diagnostic.

% [sys.remove Path Diagnostic] is like [Sys.remove]. It succeeds if
% [Diagnostic = ok] and the file at [Path] is removed or [Diagnostic = error
% Msg] and [Msg] describes an encountered system error.
external func sys.remove string -> diagnostic.

% [sys.rename OldPath NewPath Diagnostic] is like [Sys.rename]. It succeeds
% if [Diagnostic = ok] and the file at [OldPath] is renamed to [NewPath] or
% [Diagnostic = error Msg] and [Msg] describes an encountered system error.
external func sys.rename string, string -> diagnostic.

% [getenv VarName Value] Like Sys.getenv_opt
external func getenv string -> option string.

% [system Command RetVal] executes Command and sets RetVal to the exit code
external func system string -> int.

% [sys.chdir DirPath Diagnostic] is like [Sys.chdir]. It succeeds if
% [Diagnostic = ok] and the current working directory is updated to
% [DirPath] or [Diagnostic = error Msg] and [Msg] describes an encountered
% system error.
external func sys.chdir string -> diagnostic.

% [sys.mkdir DirPath Permissions Diagnostic] is like [Sys.mkdir]. It
% succeeds if [Diagnostic = ok] and the directory [DirPath] is created or
% [Diagnostic = error Msg] and [Msg] describes an encountered system error.
external func sys.mkdir string, int -> diagnostic.

% [sys.rmdir DirPath Diagnostic] is like [Sys.rmdir]. It succeeds if
% [Diagnostic = ok] and the directory [DirPath] is removed or [Diagnostic =
% error Msg] and [Msg] describes an encountered system error.
external func sys.rmdir string -> diagnostic.

% [sys.getcwd DirPath Diagnostic] is like [Sys.getcwd]. It succeeds if
% [Diagnostic = ok] and [DirPath] is the current working directory or
% [Diagnostic = error Msg] and [Msg] describes an encountered system error.
external func sys.getcwd -> string, diagnostic.

% [sys.readdir DirPath Contents Diagnostic] is like [Sys.readdir]. It
% succeeds if [Diagnostic = ok] and [Contents] is the list of files in
% [DirPath] or [Diagnostic = error Msg] and [Msg] describes an encountered
% system error.
external func sys.readdir string -> list string, diagnostic.

% -- Unix --

% gathers the standard file descriptors or a process
Expand Down
Loading
Loading