klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

system.texi (3609B)


      1 @c -*-texinfo-*-
      2 @setfilename ../src/system
      3 
      4 @node System, Alphabetical Index, Libraries, Top
      5 @comment  node-name,  next,  previous,  up
      6 
      7 @chapter System
      8 @cindex system
      9 
     10 Module System contains some useful features for interacting with the
     11 host environment.
     12 
     13 SOURCE NOTE: most of these come from r7rs.
     14 
     15 @deffn Applicative get-current-second (get-current-second)
     16 Applicative @code{get-current-second} returns the number of seconds
     17 elapsed since the UNIX/POSIX epoch (that is midnight January 1st,
     18 1970, UTC).  
     19 
     20 NOTE: r7rs specifies TAI seconds, but for now we are sticking to POSIX
     21 here.
     22 @end deffn
     23 
     24 @deffn Applicative get-current-jiffies (get-current-jiffies)
     25 Applicative @code{get-current-jiffies} returns the number of jiffies
     26 (fractions of a second) elapsed since an arbitrary epoch that may
     27 change in each run of the klisp interpreter.  Applicative
     28 @code{get-jiffies-per-second} can be used to determine which fraction
     29 of a second a jiffy represents.
     30 @end deffn
     31 
     32 @deffn Applicative get-jiffies-per-second (get-jiffies-per-second)
     33 Applicative @code{get-jiffies-per-second} returns a constant
     34 representing the number of jiffies that correspond to one second.
     35 @end deffn
     36 
     37 @deffn Applicative file-exists (file-exists string)
     38 Predicate @code{file-exists?} checks to see if a file named
     39 @code{string} exists.
     40 @end deffn
     41 
     42 @deffn Applicative delete-file (delete-file string)
     43 @code{string} should be the name/path for an existing file.
     44 
     45 Applicative @code{delete-file} deletes the file named @code{string}.
     46 If it doesn't exists or can't be deleted, an error is signaled. The
     47 result returned by @code{delete-file} is inert.
     48 @end deffn
     49 
     50 @deffn Applicative rename-file (rename-file string1 string2)
     51 @code{string1} should be the name/path for an existing file,
     52 @code{string2} should be the name/path for a non existing file.
     53 
     54 Applicative @code{rename-file} renames the file named @code{string1}
     55 to @code{string2}. If the file doesn't exists or can't be renamed for
     56 any reason, an error is signaled. The result returned by
     57 @code{rename-file} is inert.
     58 
     59 SOURCE NOTE: this is missing from r7rs, it is taken from C, being
     60 quite similar to @code{delete-file}.
     61 @end deffn
     62 
     63 @deffn Applicative get-script-arguments (get-script-arguments)
     64 @deffnx Applicative get-interpreter-arguments (get-interpreter-arguments)
     65 These applicatives return respectively the script and interpreter
     66 arguments.  The script arguments are a list of the arguments passed to
     67 the klisp interpreter starting from (and including) the script name.
     68 The interpreter arguments are the complete list of arguments passed to
     69 the klisp interpreter (including the name of the interpreter as the
     70 first item in the list, the interpreter flag arguments and the script
     71 name and arguments.
     72 @end deffn
     73 
     74 @deffn Applicative defined-environment-variable? (defined-environment-variable? string)
     75 Predicate @code{defined-environment-variable?} returns true iff
     76 @code{string} represents a defined envrionment variable.
     77 @end deffn
     78 
     79 @deffn Applicative get-environment-variable (get-environment-variable string)
     80 Applicative @code{get-environment-variable} returns the value of the
     81 environment variable represented by @code{string}.  If @code{string}
     82 doesn't represent a defined environment variable an error is signaled.
     83 @end deffn
     84 
     85 @deffn Applicative get-environment-variables (get-environment-variables)
     86 @c TODO xref to alist
     87 Applicative @code{get-environment-variable} returns an alist
     88 representing the defined environment variables and their values.  The
     89 alist is a list of @code{(variable . value)} entries, where both
     90 @code{variable} and @code{value} are strings.
     91 @end deffn