next up previous index
Next: Lists Library Predicates Up: The Built-in Predicates Previous: Compiler Directives

Operating System Built-Ins

The following UNIX Operating System related predicates exist:

ECLiPSe Operating System built-in.

alarm(+Clock)

The operating system will send the signal 14 to the ECLiPSe system Clock seconds after the command was entered.  
argc(?Number)

Succeeds if Number is the number of arguments given on the command line to invoke ECLiPSe .  
argv(+N, ?Argument)

Succeeds if the Nth argument given on the command line when invoking ECLiPSe is the string Argument.  
call_c(+Function, ?Code)

Invoke the C function Function and unify its return code with Code.  
cd(+Directory)

Directory is made the current working directory. Equivalent to set_flag(cwd, Directory).  
cputime(?Time)

Succeeds if Time is the elapsed user cpu time in seconds.  
date(?Date)

Date is bound to the string giving the date and time.  
delete(+File)

The file File (with absolute or relative pathname) is deleted.  
exec(+Command, ?Streams)

A child process Command is forked, its standard streams are connected to Streams and the ECLiPSe process waits until it terminates.  
exec(+Command, ?Streams, ?Pid)

A child process Command is forked, its standard streams are connected to Streams and its process ID is Pid.  
exec_group(+Command, ?Streams, ?Pid)

A child process Command is forked in a new process group, its standard streams are connected to Streams and its process ID is Pid.  
exists(+File)

Succeeds if the file File (with absolute or relative pathname) exists. File can be a directory.  
exit(+Status)

The Prolog session is ended and the specified status returned to the operating system.  
get_file_info(+File, ?Attr, ?Value)

Succeeds if the file File (with absolute or relative pathname) exists and the value of its attribute Attr unfies with Value.  
get_timer(+Timer, ?Interval)

Succeed if the specified Timer is running and sends signals in intervals of Interval seconds.  
getcwd(?Cwd)

Unifies the current working directory with Cwd.  
getenv(+EnvVar, ?Value)

Succeeds if the string EnvVar corresponds to a variable set in the UNIX environment, and it unifies Value with the string which is the value of that variable.  
halt

The Prolog session is ended (the same as Control-D at the top-level loop).  
kill(+Pid, +Signal)

Send the signal Signal to the process number Pid  
pathname(+FilePath, ?Path)

Succeeds if the pathname FilePath, if stripped of its file name, gives Path, the path up to the parent directory of the file.  
pathname(+FilePath, ?Path, ?Name)

If FilePath is a pathname of a file, succeed if Path is the pathname of its parent directory and Name is the local file name.  
pause

The ECLiPSe session is suspended (the same as Control-Z at the top-level loop).  
random(?N)

Generates a random integer N.  
read_directory(+Directory, +Pattern, ?SubdirList, ?FileList)

Unifies SubdirList with a list of subdirectories and FileList with a list of matching files in the specified directory.  
rename(+OldName, +NewName)

Renames the file OldName to NewName.  
seed(+Seed)

Sets the initial seed Seed for generating random numbers with random/1.  
set_timer(+Timer, +Interval)

Start (or stop) the specified Timer to send signals in intervals of Interval seconds.  
sh(+ShellCommand)

The string or atom ShellCommand is passed as a command to the operating system, and the command is executed there (it is a synonym for system/1).  
sleep(+Seconds)

The execution of ECLiPSe is suspended for Seconds number of seconds.  
suffix(+FileName, ?Suffix)

Succeeds if the string Suffix is the extension part of the input string FileName.  
system(+ShellCommand)

The string or atom ShellCommand is passed as a command to the operating system, and the command is executed there (it is a synonym for sh/1).  
wait(?Pid, ?Status)

Wait for a child process to terminate and report its process ID and status.  



next up previous index
Next: Lists Library Predicates Up: The Built-in Predicates Previous: Compiler Directives



Micha Meier
Mon Mar 4 12:11:45 MET 1996