Go to the first, previous, next, last section, table of contents.

# Operating System

## Command Line

The variable si::*command-args* is set to the list of strings passed in when gcl is invoked.

Various flags are understood.

`-eval`
  Call read and then eval on the command argument following `-eval`
`-load`
  Load the file whose pathname is specified after `-load`.
`-f`
  Replace si::*command-args* by the the list starting after `-f`. Open the file following `-f` for input, skip the first line, and then read and eval the rest of the forms in the file. This can be used as with the shells to write small shell programs:

      #!/usr/local/bin/gcl.exe -f
      (format t "hello world ~a~%" (nth 1 si::*command-args*))

  The value si::*command-args* will have the appropriate value. Thus if the above 2 line file is made executable and called ``foo'` then

      tutorial% foo billy
      hello world billy

  NOTE: On many systems (eg SunOs) the first line of an executable script file such as:

      #!/usr/local/bin/gcl.exe -f

  only reads the first 32 characters! So if your pathname where the executable together with the '-f' amount to more than 32 characters the file will not be recognized. Also the executable must be the actual large binary file, [or a link to it], and not just a `/bin/sh` script. In latter case the `/bin/sh` interpreter would get invoked on the file. Alternately one could invoke the file ``foo'` without making it executable:

      tutorial% gcl -f foo "from bill"
      hello world from bill

  Finally perhaps the best way (why do we save the best for last.. I guess because we only figure it out after all the others..) The following file ``myhello'` has 4 lines:

      #!/bin/sh
      #| Lisp will skip the next 2 lines on reading
      exec gcl   -f "$0" $
      |#
      (format t "hello world ~a~%" (nth 1 si::*command-args*))

      marie% chmod a+x myhello
      marie% myhello bill
      hello world bill

  The advantage of this method is that ``gcl'` can itself be a shell script, which sets up environment and so on. Also the normal path will be searched to find ``gcl'` The disadvantage is that this would cause 2 invocations of ``sh'` and one invocation of ``gcl'`. The plan using ``gcl.exe'` bypasses the ``sh'` entirely. Inded invoking ``gcl.exe'` to print ``hello world'` is faster on most systems than a similar ``csh'` or ``bash'` script, but slightly slower than the old ``sh'`.
`-batch`
  Do not enter the command print loop. Useful if the other command line arguments do something. Do not print the License and acknowledgement information. Note if your program does print any License information, it must print the GCL header information also.
`-dir`
  Directory where the executable binary that is running is located. Needed by save and friends. This gets set as si::*system-directory*
`-libdir`

         -libdir `/d/wfs/gcl-2.0/'

  would mean that the files like gcl-tk/tk.o would be found by concatting the path to the libdir path, ie in

      `/d/wfs/gcl-2.0/gcl-tk/tk.o'

`-compile`
  Invoke the compiler on the filename following `-compile`. Other flags affect compilation.
`-o-file`
  If nil follows `-o-file` then do not produce an `.o` file.
`-c-file`
  If `-c-file` is specified, leave the intermediate `.c` file there.
`-h-file`
  If `-h-file` is specified, leave the intermediate `.h` file there.
`-data-file`
  If `-data-file` is specified, leave the intermediate `.data` file there.
`-system-p`
  If `-system-p` is specified then invoke `compile-file` with the `:system-p t` keyword argument, meaning that the C init function will bear a name based on the name of the file, so that it may be invoked by name by C code.

## Operating System Definitions

Function: GET-DECODED-TIME ()
  Package:LISP

  Returns the current time in decoded time format. Returns nine values: second, minute, hour, date, month, year, day-of-week, daylight-saving-time-p, and time-zone.

Function: HOST-NAMESTRING (pathname)
  Package:LISP

  Returns the host part of PATHNAME as a string.

Function: RENAME-FILE (file new-name)
  Package:LISP

  Renames the file FILE to NEW-NAME. FILE may be a string, a pathname, or a stream.

Function: FILE-AUTHOR (file)
  Package:LISP

  Returns the author name of the specified file, as a string. FILE may be a string or a stream

Function: PATHNAME-HOST (pathname)
  Package:LISP

  Returns the host slot of PATHNAME.

Function: FILE-POSITION (file-stream &optional position)
  Package:LISP

  Sets the file pointer of the specified file to POSITION, if POSITION is given. Otherwise, returns the current file position of the specified file.

Function: DECODE-UNIVERSAL-TIME (universal-time &optional (timezone -9))
  Package:LISP

  Converts UNIVERSAL-TIME into a decoded time at the TIMEZONE. Returns nine values: second, minute, hour, date, month (1 - 12), year, day-of-week (0 - 6), daylight-saving-time-p, and time-zone. TIMEZONE in GCL defaults to 6, the time zone of Austin, Texas.

Function: USER-HOMEDIR-PATHNAME (&optional host)
  Package:LISP

  Returns the home directory of the logged in user as a pathname. HOST is ignored.

Variable: *MODULES*
  Package:LISP A list of names of the modules that have been loaded into GCL.

Function: SHORT-SITE-NAME ()
  Package:LISP

  Returns a string that identifies the physical location of the current GCL.

Function: DIRECTORY (name)
  Package:LISP

  Returns a list of files that match NAME. NAME may be a string, a pathname, or a file stream.

Function: SOFTWARE-VERSION ()
  Package:LISP

  Returns a string that identifies the software version of the software under which GCL is currently running.

Constant: INTERNAL-TIME-UNITS-PER-SECOND
  Package:LISP The number of internal time units that fit into a second.

Function: ENOUGH-NAMESTRING (pathname &optional (defaults *default-pathname-defaults*))
  Package:LISP

  Returns a string which uniquely identifies PATHNAME with respect to DEFAULTS.

Function: REQUIRE (module-name &optional (pathname))
  Package:LISP

  If the specified module is not present, then loads the appropriate file(s). PATHNAME may be a single pathname or it may be a list of pathnames.

Function: ENCODE-UNIVERSAL-TIME (second minute hour date month year &optional (timezone ))
  Package:LISP

  Does the inverse operation of DECODE-UNIVERSAL-TIME.

Function: LISP-IMPLEMENTATION-VERSION ()
  Package:LISP

  Returns a string that tells you when the current GCL implementation is brought up.

Function: MACHINE-INSTANCE ()
  Package:LISP

  Returns a string that identifies the machine instance of the machine on which GCL is currently running.

Function: ROOM (&optional (x t))
  Package:LISP

  Displays information about storage allocation in the following format.

  - for each type class
    - the number of pages so-far allocated for the type class
    - the maximum number of pages for the type class
    - the percentage of used cells to cells so-far allocated
    - the number of times the garbage collector has been called to collect cells of the type class
    - the implementation types that belongs to the type class
  - the number of pages actually allocated for contiguous blocks
  - the maximum number of pages for contiguous blocks
  - the number of times the garbage collector has been called to collect contiguous blocks
  - the number of pages in the hole
  - the maximum number of pages for relocatable blocks
  - the number of times the garbage collector has been called to collect relocatable blocks
  - the total number of pages allocated for cells
  - the total number of pages allocated
  - the number of available pages
  - the number of pages GCL can use. The number of times the garbage collector has been called is not shown, if the number is zero. The optional X is ignored.

Function: GET-UNIVERSAL-TIME ()
  Package:LISP

  Returns the current time as a single integer in universal time format.

Function: GET-INTERNAL-RUN-TIME ()
  Package:LISP

  Returns the run time in the internal time format. This is useful for finding CPU usage. If the operating system allows, a second value containing CPU usage of child processes is returned.

Variable: *DEFAULT-PATHNAME-DEFAULTS*
  Package:LISP The default pathname-defaults pathname.

Function: LONG-SITE-NAME ()
  Package:LISP

  Returns a string that identifies the physical location of the current GCL.

Function: DELETE-FILE (file)
  Package:LISP Deletes FILE.

Function: GET-INTERNAL-REAL-TIME ()
  Package:LISP

  Returns the real time in the internal time format. This is useful for finding elapsed time.

Function: MACHINE-TYPE ()
  Package:LISP

  Returns a string that identifies the machine type of the machine on which GCL is currently running.

Macro: TIME
  Package:LISP

  Syntax:

      (time form)

  Evaluates FORM and outputs timing statistics on *TRACE-OUTPUT*.

Function: SOFTWARE-TYPE ()
  Package:LISP

  Returns a string that identifies the software type of the software under which GCL is currently running.

Function: LISP-IMPLEMENTATION-TYPE ()
  Package:LISP

  Returns a string that tells you that you are using a version of GCL.

Function: SLEEP (n)
  Package:LISP

  This function causes execution to be suspended for N seconds. N may be any non-negative, non-complex number.

Go to the first, previous, next, last section, table of contents.