###############################################################################
#
# this file contains user preferences for GNU APL.
#
# It should be placed into
#
# (1) in sub-directory gnu-apl.d of the system configuration directory, and/or
# (2) in folder .config/gnu-apl/ in the user's home directory.
#
# In both cases the file name must be 'preferences'.
#
# The system configuration directory is usually /etc or /usr/local/etc
# It can be overridden by  ./configure --sysconfdir=something-else
#
# If both files are present then (1) is read before (2) so that in case of
# contradicting settings in both files (2) prevails.
#
# Many settings can also be changed by command line options; the command line
# options take precedence over settings in (1) or (2).
#
# The initial content of this files contains all possible settings, but
# commented out. You should not remove lines but rather comment or
# uncomment them.
#
# The meaning of most settings should be obvious; if not, then please refer to
# the more detailed description in the file README-9-Post-Installation, located
# in the top-level directory of the GNU APL package.

###############################################################################
#
# WELCOME MESSAGE
#
# Print (or don't) a welcome message on start-up
#
# The corresponding command line options is --silent
#
  Welcome       Yes	(default)
# Welcome       No
#


###############################################################################
#
# OUTPUT COLORING
#
# Output coloring can cause problems when, for example:
#
# (a) you run GNU APL as script
# (b) you use a black background
# (c) you run GNU APL from emacs
# (d) you run GNU APL from a different terminal than color xterm
#
# In case (a) you should use the --script command line option and
# leave Color as is.
#
# In cases (b), (c), and (d) you can uncomment the 'Color No' line below.
# This only affects the initial state of output coloring; you can
# re-enable colors later with APL command ]XTERM ON.
#
# The corresponding command line options are --Color and --noColor
#
# If your terminal does not understand the ANSI escape sequences,
# or if you don't like to provide escape sequences, then you can set Color
# to "curses" and set color numbers instead of escape sequences below. This
# requires that certain environment variables (e.g. TERM) are set properly
# and that your terminfo database contains the terminal you use.
#
# Color         ANSI (default)
# Color 	CURSES
Color 	No
#
# If you want to disable coloring initially, but switch to curses if the
# command ]COLOR (or the equivalent but now obsolete command ]XTERM)
# is given later on, then you can give the color command twice:
#
# Color 	CURSES
# Color 	No
#


###############################################################################
#
# OUTPUT COLOR ESCAPE SEQUENCES FOR ANSI TERMINALS
#
# Output coloring is implemented as follows:
#
# There are 4 output channels called CIN, COUT, CERR, and UERR
#
# CIN  is the echo of the input typed by the user,
# COUT is the normal output of the APL interpreter,
# CERR is additional error information, in particular logging.
# UERR is output of the APL interpreter containing error messages,
#
# CIN, COUT, and UERR appear on stdout while CERR appears on stderr.
# Normally stdout and stderr are both displayed on the same terminal,
# but output redirection in the shell can make a difference.
#
# When the interpreter changes from one output channel to another, for
# instance from CIN to COUT after the user has entered a line, then an
# escape sequence (actually, any short sequence of characters) is sent
# to the real output channel (i,e. stdout or stderr). The new channel
# determines which sequence is sent:
#
# CIN:   CIN-SEQUENCE  CLEAR-EOL
# COUT:  COUT-SEQUENCE CLEAR-EOL
# CERR:  CERR-SEQUENCE CLEAR-EOL
#UCERR:  UERR-SEQUENCE CLEAR-EOL
#
# In addition, when the interpreter exists, then a sequence
#
#	RESET-SEQUENCE CLEAR-EOL
#
# is sent which should set the colors to their initial state.
#
# The reason for sending CLEAR-EOL (i.e. clear to end of line) is to color
# the entire next line not only the chars printed on the next line.
#
# Unfortunately it is difficult, if not impossible, to read the current
# color setting from the terminal. Therefore the following is assumed:
#
# "GNU APL is started in a color xterm with white background".
#
# Color xterm is a VT100 (or ANSI) compatible terminal emulation.
# If this assumption is correct, then everything should be fine. Otherwise
# you may want to change the escape sequence sent to the terminal below.
# The numbers below are the decimal values of the bytes sent to the terminal;
# 27 is the escape character, for example. In order to change some or all
# sequences, uncomment the corresponding line and change the hex numbers
# (most likely the columns background and foreground).
# Each sequence can be up to 20 characters long.
#
# The default setting in GNU APL assumes a VT100 terminal with a white
# background, which correspnds to the following setup:
#
#               VT100:     foreground       background
#                          color    |       |    color
#                                   V       V
# general color format; ESC [ 0 ; 3 fg ; 4 bg m
# CIN-SEQUENCE          ESC [ 0 ; 3 0  ; 4 7  m
# COUT-SEQUENCE         ESC [ 0 ; 3 9  ; 4 9  m
# CERR-SEQUENCE         ESC [ 0 ; 3 5  ; 4 9  m
# UERR-SEQUENCE         ESC [ 0 ; 3 5  ; 4 9  m
# RESET-SEQUENCE        ESC [ 0 ; 3 9  ; 4 9  m
# CLEAR-EOL-SEQUENCE    ESC [ K
# CLEAR-EOS-SEQUENCE    ESC [ J
#
# On a black background (still assuming VT100 so that the CLEAR-EOL-SEQUENCE
# does not need to be re-defined), the following may be more suitable:
#
# CIN-SEQUENCE           1b 5b 30 3b 33 32 3b 34 30 6d    // ESC [0;32;40m
# COUT-SEQUENCE          1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;40m
# CERR-SEQUENCE          1b 5b 30 3b 33 31 3b 34 30 6d    // ESC [0;31;40m
# UERR-SEQUENCE          1b 5b 30 3b 33 31 3b 34 30 6d    // ESC [0;31;40m
# RESET-SEQUENCE         1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;48m
#
#


###############################################################################
#
# OUTPUT COLOR NUMBER FOR CURSES
#
# There is second way of specifying colors that uses the curses library.
# Instead of specifying the escape sequences sent to the terminal you
# only need to specify the colors wanted and curses will provide the escape
# sequences needed.
#
# Numbers for colors seem to be (nota bene: the author is color-blind):
#
# 0: black
# 1: blue
# 2: green
# 3: cyan
# 4: red
# 5: magenta
# 6: yellow
# 7: white
#
# The colors are specified as numbers like this:
#
# CIN-FOREGROUND  0
# CIN-BACKGROUND  7
# COUT-FOREGROUND 2
# COUT-BACKGROUND 7
# CERR-FOREGROUND 5
# CERR-BACKGROUND 8
# UERR-FOREGROUND 5
# UERR-BACKGROUND 8
#
# or, for dark background:
#
# CIN-FOREGROUND  2
# CIN-BACKGROUND  0
# COUT-FOREGROUND 7
# COUT-BACKGROUND 0
# CERR-FOREGROUND 5
# CERR-BACKGROUND 0
# UERR-FOREGROUND 5
# UERR-BACKGROUND 0
#
# Normally the two methods (escape sequences vs. color numbers) shall not
# be mixed. If they are mixed then the last entry in this file determines
# which method will be used. Also, the numbers for colors are different
# in both methods.
#

###############################################################################
#
# INPUT ESC SEQUENCES
#
# Below you can configure the ESC (or other) sequence send by the cursor-up,
# cursor-down, cursor-left, cursor-right, Home, End, Ins, and Del keys of
# your keyboard.
#
# KEY-CURSOR-UP          1b 5b 41
# KEY-CURSOR-DOWN        1b 5b 42
# KEY-CURSOR-RIGHT       1b 5b 43
# KEY-CURSOR-LEFT        1b 5b 44
# KEY-CURSOR-END         1b 5b 46
# KEY-CURSOR-HOME        1b 5b 48
# KEY-INSMODE            1b 5b 32 7e
# KEY-DELETE             1b 5b 33 7e
#

###############################################################################
#
# SHARED VARIABLES
#
# shared variables ⎕SVO, ⎕SVR, ... fork a helper process (APserver) to
# communicate with other APL processors. If you do not need these functions
# then you can prevent starting of APserver by setting SharedVars to Disabled.
# If SharedVars are disabled then GNU APL starts a little faster and, of
# course, ⎕SVO and friends won't work.
#
# The corresponding command line options are --SV and --noSV
#
# SharedVars    Enabled	    (default)
SharedVars    Disabled


###############################################################################
#
# LOGGING FACILITIES
#
# If dynamic logging is disabled then these settings have no effect.
#
# Otherwise you can specify the Logging facilities (numbered 1-37 or more)
# that shall be turned on when the APL interpreter starts, This option can
# be used several times.
#
# See command ]LOG for available logging facilities
#
# The corresponding command line option is -l <num>
#
# Logging 1
# Logging 2
# ...
# Logging 37


###############################################################################
#
# GNU APL uses library numbers from 0 to 9 in commands )LOAD, )SAVE, and )COPY,
# for example:
#
# )LOAD 1 workspace
#
# Commands )IN and )OUT use library number 0 implicitly;
# )LOAD, )SAVE, and )COPY use  library number 0 implicitly when no
# library number is given.
#
# The directories corresponding to the library numbers can be configured below.
# library numbers 3, 4, and 5 are used (and overridden) libraries shipped with
# GNU APL
#
# LIBREF-0 /home/xyz/my-own-libs
# LIBREF-1 /home/xyz/my-group-libs
# LIBREF-2 /group/abc/other-libs
  LIBREF-3 /usr/local/lib/apl/wslib3
  LIBREF-4 /usr/local/lib/apl/wslib4
  LIBREF-5 /usr/local/lib/apl/wslib5
# LIBREF-6 /usr/lib/gnu-apl/lib-6
# LIBREF-7 /usr/lib/gnu-apl/lib-7
# LIBREF-8 /usr/lib/gnu-apl/lib-8
# LIBREF-9 /usr/lib/gnu-apl/lib-9
#


###############################################################################
#
# READLINE HISTORY PARAMETERS
#
# GNU APL provides a history of lines entered by the user in immediate
# execution mode and ∇-edit mode.
#
# Below the number of history lines and the location of the history file 
# can be configured.
#
READLINE_HISTORY_LEN  500
READLINE_HISTORY_PATH .apl.history

# The history can serve two purposes:
#
# 1. to recall lines that were previously entered, or
# 2. to list what was done (with command )HISTORY).
#
# For purpose 2. it is normally more convenient to show the entire ⎕CR
# of a function that was edited instead of only the command that started
# the ∇-editor. For purpose 1, however, recalling the lines of entire
# functions can become annoying if the functions are long.
#
# The following parameter controls whether the history shall contain:
#
# A. only the editor command (like ∇foo) that has started the ∇-editor, but
#    not the entire ⎕CR of the function that was edited, or else
#
# B. the entire new ⎕CR of the function that was edited.
#
# The default (modified) is a compromise that inserts only the editor
# command if the function was opened but not changed (e.g. ∇FOO[⎕]∇ )
# and the entire new ⎕CR if the function was changed or (newly created).
#
# NABLA-TO-HISTORY  Never
  NABLA-TO-HISTORY  Modified (default)
# NABLA-TO-HISTORY  Always


###############################################################################
#
# CREATE BACKUP BEFORE )SAVE or )DUMP WORKSPACE
#
BACKUP_BEFORE_SAVE  yes


###############################################################################
#
# GNU APL assumes a particular layout of your keyboard (and assumes that you
# do your best to obtain that layout). That assumed layout is shown when you
# give the ]KEYB command.
#
# If your keyboard layout differs from the assumed keyboard for some reason,
# then the ]KEYB command will show the wrong layout. You can fix this by
# providing your own keyboard file which (when specified) is shown by the
# ]KEYB command instead of the assumed layout.
#
# You can use one of the files called 'keyboard*.txt' somewhere below the
# directory named 'support-files' as a starting point for your own layout
# and uncomment the following setting:
#
# KEYBOARD_LAYOUT_FILE  /usr/local/etc/gnu-apl.d/keyboard1.txt
# KEYBOARD_LAYOUT_FILE  /usr/local/etc/gnu-apl.d/keyboard2.txt
#

###############################################################################
#
# Normally you exit GNU APL by issuing the command )OFF and hitting
# ^D (aka. end-of-input) has no effect.
#
# You can make GNU APL exit after a number of ^Ds in a row by specifying
# a (small) positive number below. Note thsat the interpreter will always
# exit if a large number of ^Ds (or EOFs) are read within a short while.
#
CONTROL-Ds-TO-EXIT 1


###############################################################################
#
# Normally GNU APL starts with a ⎕PW of 80
#
# If the terminal that you normally use has fewer or more columns, then you
# may want to specify a different initial value for ⎕PW below.
#
# INITIAL-⎕PW 80


###############################################################################
#
# Setting Old-Multi-Line-Strings to No disables Strings that start with " and
# span multiple lines. Such strings are converted to a nested vector where each
# line is one (nested) vector element (discarding the trailing \n, if any).
#
# Setting New-Multi-Line-Strings to No disables new-style multi line strings
# (similar to old-style but using """ to delimit multiple lines).
#
# Old=Multi-Line-Strings are only allowed inside ∇-defined functions; in
# immediate execution the effect of multi-line functions can be achieved
# with ⎕INP.
#
# New-Multi-Line-Strings can be used inside ∇-defined functions and also in
# immediate execution mode.
#
# By default both old-style and new-style multi line strings are enabled, but
# old-style multi line strings will disappear in the near future. To disable
# multi line strings, uncomment the following line(s).
#
# Old-Multi-Line-Strings No
# New-Multi-Line-Strings No

###############################################################################
#
# With the option below you can cause the WINCH signal to change ⎕PW. The
# intended effect is that resizing of the terminal window causes GNU APL
# to adapt itself to the new window size. This seems to work on GNU/Linux but
# may not work on other platforms! USE AT YOUR OWN RISK.
#
# WINCH-SETS-⎕PW  Yes

###############################################################################
#
# with the option below you can perform an automatic )OFF after the last
# input file (from the -f command line option) was processed.
#
# AUTO-OFF  Yes

###############################################################################
#
# with the option below you force GNU APL to discard leading spaces in defined
# functions (standard APL behaviour), or to leave them as they are. Discarding
# primarily affects the behaviour of the ∇-editor.
#
# DISCARD-INDENTATION Yes

###############################################################################
#
# with the option below GNU APL writes to file descriptor 1 (aka. stdout)
# instead of file descriptor 2 (aka. stderr)
# OUTPUT-TO-COUT  Yes

###############################################################################
#
# The following lines show examples of GNU APL capabilities that can be
# disabled. The security settings are put into profile [1] which means that
# they only have an effect if:
#
# (1) GNU APL was ./configured with SECURITY_LEVEL_WANTED=1 and
# (2) the profile with which GNU APL was started matches the profile for
#     which the setting was made (if any)
#
# If a disabled capability is being used then it will throw a DOMAIN_ERROR
# and )MORE will indicate a security violation.
#
Profile 1
  disable_Quad_GTK          yes    # disable ⎕cwGTK
  disable_Quad_FIO          no     # do not disable ⎕FIO
  disable_native_functions  yes    # disable A ⎕FX B (native fnctions)
  disable_Quad_PLOT         yes    # disable ⎕PLOT
  disable_Quad_SQL          yes    # disable ⎕SQL
  disable_SAVE_command      yes    # disable )SAVE and )DUMP ws

# a profile suitable for the web sockets stuff shipped with GNU APL
Profile 2

CIN-SEQUENCE           E2 93 AA   // ⓪
COUT-SEQUENCE          E2 91 A0   // ①
CERR-SEQUENCE          E2 91 A1   // ②
UERR-SEQUENCE          E2 91 A1   // ② like CERR
RESET-SEQUENCE         //
CLEAR-EOL-SEQUENCE     //
CLEAR-EOS-SEQUENCE     //

  disable_Quad_GTK          yes    # disable ⎕cwGTK
  disable_Quad_FIO          no     # do not disable ⎕FIO
  disable_native_functions  yes    # disable A ⎕FX B (native fnctions)
  disable_Quad_PLOT         yes    # disable ⎕PLOT
  disable_Quad_SQL          yes    # disable ⎕SQL
  disable_SAVE_command      yes    # disable )SAVE and )DUMP ws

