Command Reference

The slogan program provide a unified interface for accessing the Slogan interpeter, REPL and compiler. This program accept many command line options. This chapter document these options in detail.

The slogan command can be invoked in two ways as shown below:

$ slogan <options>

This will start the interactive REPL where you can interpret programs.

$ slogan <options> script

This will execute or compile a slogan script, depending on the options passed.

Valid options are:

-e Execute a script.
-c Compile a script into a dynamically loadable object file.
-x Compile a script into an executable binary.
-i Install a package.
-u Uninstall a package.
-ld-options Additional options that will be passed to the system linker.
-cc-options Additional options that will be passed to the system C compiler.
-r Launch REPL after performing other options.
-v Display version information and quit.
-h Print this help and quit.

Some of the options like -i take additional arguments. They are illustrated below:

# install a package from a local folder or compressed archive (a .zip, .tar.gz or a .tar.bz2 file).          
$ slogan -i "package_name,local,/path_to_package_folder_or_archive"

# install a package from a git repository.
$ slogan -i "package_name,git,https://github.com/gitusername/package_name.git"

# install a package hosted on a remote server.
$ slogan -i "package_name,remote,http://slogan-packages.com/package_name.tar.gz"

# uninstall a package.
$ slogan -u "package_name"

You can install and uninstall packages from within a program as well. This is accomplished by calling the install_package and uninstall_package functions.

Slogan programs runs on top of Gambit Scheme. Options meant for the Gambit virtual machine can also be passed as command line arguments for slogan. These options must be preceded by -: and each option must be separated by comma. The most useful options accepted by the virtual machine is given below:

m The minimum heap size in kilobytes.
h The maximum heap size in kilobytes.
l The heap live ratio after GC in percent.
-[OPT...] Set standard input and output options; see below for OPT.

OPT should be one of:

A|1|2|4|6|8|U Character encoding (ASCII|ISO-8859-1|UCS-2/4|UTF-16/8|UTF).
l|c|cl End-of-line encoding (LF|CR|CR-LF).
u|n|f Buffering (unbuffered|newline buffered|fully buffered).
r|R Enable character encoding errors (on|off).
e|E Enable line-editing (on|off), for terminals only.

Here are a few examples of passing command-line options to the VM:

# Evaluate a script after setting minimum heap-size of 500MB and maximum heap-size to 2GB:
$ slogan -:m500000,h2000000 -e script.sn

# Prepare the interpreter to read/write UTF-8 encoded files:
$ slogan -:-8
slogan> load("utf8_encoded_source_code.sn")

A standalone Slogan program can accept all VM options in addition to its own command line arguments.

For a full list of virtual machine command line arguments, run,

$ slogan -h

Previous | Contents