• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

HOWTOs/H03-May-2022-568486

build/H23-Jun-2019-603491

debian/H07-May-2022-1,2551,046

doc/H03-May-2022-21,29218,020

erlang/H23-Jun-2019-2,4471,918

gnu-apl.d/H03-May-2022-1,4601,319

m4/H23-Jun-2019-601534

rpm/H23-Jun-2019-648556

src/H03-May-2022-136,59696,596

support-files/H23-Jun-2019-24,04722,805

tools/H23-Jun-2019-2,8362,154

websock/H23-Jun-2019-1,8521,596

workspaces/H23-Jun-2019-2,0011,702

wslib3/H23-Jun-2019-608515

wslib4/H23-Jun-2019-535461

wslib5/H23-Jun-2019-4,9554,208

AUTHORSH A D23-Jun-20192 KiB10295

COPYINGH A D23-Jun-201934.3 KiB675553

ChangeLogH A D23-Jun-2019214 83

DoxyfileH A D23-Jun-201997.4 KiB2,2921,767

INSTALLH A D23-Jun-201915.2 KiB366284

MakefileH A D23-Jun-2019944 307

Makefile.amH A D23-Jun-20193.6 KiB144101

Makefile.inH A D23-Jun-201936.5 KiB1,150984

Makefile.inclH A D23-Jun-20193.5 KiB10064

NEWSH A D23-Jun-201922 41

READMEH A D23-Jun-20191.1 KiB2618

README-1-prerequisitesH A D23-Jun-2019738 2715

README-10-pythonH A D23-Jun-20191.5 KiB4734

README-2-configureH A D23-Jun-201911.4 KiB278205

README-3-keyboardH A D23-Jun-201924.6 KiB559403

README-4-complianceH A D23-Jun-20191.8 KiB6938

README-5-WINDOWSH A D23-Jun-20192.2 KiB5435

README-6-portingH A D23-Jun-20192.7 KiB7954

README-7-more-infoH A D23-Jun-20195.5 KiB205170

README-8-parallelH A D23-Jun-20199.9 KiB242178

README-9-post-installationH A D23-Jun-201927.3 KiB674512

aclocal.m4H A D23-Jun-2019342.9 KiB9,7608,790

compileH A D23-Jun-20197.2 KiB348258

config.guessH A D23-Jun-201944.5 KiB1,5341,318

config.hH A D23-Jun-20199.1 KiB33581

config.h.inH A D23-Jun-20198.6 KiB334233

config.rpathH A D23-Jun-201917.9 KiB667563

config.subH A D23-Jun-201933.3 KiB1,6941,549

configureH A D23-Jun-2019663.6 KiB22,25218,724

configure.acH A D23-Jun-201922.6 KiB664575

depcompH A D23-Jun-201918.2 KiB631407

install-shH A D23-Jun-201913.3 KiB521344

ltmain.shH A D23-Jun-2019277 KiB9,6627,310

missingH A D23-Jun-20196.7 KiB216143

texinfo.texH A D23-Jun-2019315.5 KiB10,0809,328

README

1
2			    GNU APL
3
4is a free version of the programming language APL and is intended to
5be a full implementation of what is known as "Programming Language APL,
6Extended", "APL with nested arrays", or "ISO/IEC13751".
7
8GNU APL is distributed under the terms of the GPL, see file "COPYING"
9for details.
10
11More information about the installation of GNU APL can be found in the
12following files in the same directory as this file:
13
14INSTALL:		     general installation information (aka. ./configure)
15README-1-prerequisites:      what else is needed to install GNU APL
16README-2-configure:          GNU APL specific ./configure options
17README-3-keyboard:           how to set up your keyboard for APL characters
18README-4-compliance:         compliance information
19README-5-WINDOWS:            notes for Windows users
20README-6-porting:            notes for various operating systems
21README-7-more-info:          some pointers to other information related to APL
22README-8-parallel:           notes for parallel (multi-core) execution
23README-9-post-installation:  things to do after GNU APL was installed
24
25
26

README-1-prerequisites

1
2Before you can build GNU APL, make sure that the following
3libraries/packages have been installed:
4
5gcc/g++		from a GNU mirror (directory: gcc, file: gcc-?.?.?.tar.gz)
6make		from a GNU mirror (directory: gcc, file: make-?.?.tar.gz)
7
8If you are using Ubuntu, then the following commands may do the trick:
9
10    apt-get install g++
11
12For Fedora:
13
14    dnf -y group install  "C Development Tools and Libraries"
15
16For Centos replace dnf by yum
17
18On Linux Mint 16 (and possibly some other GNU/Linux distributions) you may
19need to install package ncurses-dev in order to uses curses functions,
20for example:
21
22    apt-get install libncurses-dev
23
24On Linux Mint 14.1, GNU APL compiled out-of--the-box.
25On Fedora 25, GNU APL compiled out-of-the-box.
26
27

README-10-python

1
2GNU APL can be compiled as a Python module.
3The basic build procedure is this:
4
5    configure --with-libpython_apl [ other ./configure optionsi ...]
6    make
7    sudo make install
8
9This installs a shared object file named 'libgnu_apl.so' in the place where
10GNU APL installs its libraries (typically /usr/local/lib/apl or
11/usr/lib/apl)
12
13The shared object file must then be copied to the directory where Python
14keeps its libraries (e.g. /usr/lib/python3.4/lib-dynload/). For example (if
15your Python version is 3.4, and NOTICE THE DIFFERENT NAME OF THE .so FILE):
16
17    sudo cp /usr/local/lib/apl/lib_gnu_apl.so \
18            /usr/lib/python3.4/lib-dynload/gnu_apl.cpython-34m.so
19
20After that, one can import GNU APL in Python and call Python functions
21provided by gnu_apl:
22
23>>> import gnu_apl
24>>> gnu_apl.exec("4 4⍴1+2")
253 3 3 3
263 3 3 3
273 3 3 3
283 3 3 3
290
30>>> gnu_apl.command(")WSID")
31'IS CLEAR WS\n'
32
33
34The output above is a mix of APL output and Python output, which is more often
35than not a bad idea. A better approach is to generate no APL output (i,e, the
36results of APL computations should be assigned to variables and variables ⎕
37and ⍞ should not be used). Alternatively, you can change the default print
38behaviour in Python with gnu_apl.set_display(mode). See, for example,
39gnu_apl.help('set_display').
40
41After a sucessful installation you can display the documentation of all Python
42functions in an interactive Python session like this:
43
44>>> import gnu_apl
45>>> gnu_apl.help('all')
46
47

README-2-configure

1The GNU APL interpreter can be configured by means of ./configure options.
2The standard ./configure options are described in file INSTALL in this directory.
3In addition to the standard options provided by ./configure the following GNU
4APL specific ./configure options are recognized. If an option is NOT given
5on the ./configure command line, then either the default value for the option
6is used (if the option has one), or else the behavior described below for
7the option will not occur.
8
9--with-android
10   This option prevents the instantiation of CIN, COUT, and CERR. This may
11   be needed when GNU APL is compiled for Android, since Android applications
12   are using a different I/O model than are standard C++ programs.
13
14--with-libapl
15   This option builds GNU APL as a shared library (libapl.so) rather than an
16   integrated executable. This option is often combined with option
17   --with-android, and is automatically set by option --with-Eng. The
18   --with-libapl option not only builds approproate Makefiles, but it also
19   changes the GNU APL code in some places.
20
21
22--with-sqlite3=[ARG]
23   Build the native function for SQL using sqlite3. ARG may provide the
24   non-default location of the sqlite3 library.
25
26--with-postgresql=[ARG]
27   Build the native function for SQL using PostgreSQL. ARG may provide the
28   non-default location of the postgresql library.
29
30ASSERT_LEVEL_WANTED=n
31   There are numerous Assert() and Assert1() macros in the source code of the
32   APL interpreter. These macros check more (Assert1) or less (Assert)
33   obvious assumptions that throw exceptions if they turn out to be wrong.
34   Like for dynamic logging, these macros have negative performance impacts
35   and they can be disabled.
36
37   By default, ASSERT_LEVEL_WANTED=1 and that disables the Assert1() macro
38   and enables the Assert() macro
39
40   ASSERT_LEVEL_WANTED=2 enables both macros.
41   ASSERT_LEVEL_WANTED=1 (default) enable Assert(), but disable Assert1().
42   ASSERT_LEVEL_WANTED=0 disable both macros; this gives the maximum
43   performance, but at the same time bears the risk that internal errors
44   of the APL interpreter are not being detected. Example:
45
46    ./configure ASSERT_LEVEL_WANTED=2
47
48SECURITY_LEVEL_WANTED=n
49   Some capabilities of the APL intepreter can be disabled in order to improve
50   the security of, for example, a web server that uses CGI scripts written
51   in APL.
52   SECURITY_LEVEL_WANTED=2 disables all capabilities that can be disabled
53   SECURITY_LEVEL_WANTED=1 disables those capabilities that are configured in
54                           one of the preferences files.
55   SECURITY_LEVEL_WANTED=0 enables all capabilities. This level is the default
56                           and gives the maximum performance of the interpreter.
57
58APSERVER_TRANSPORT
59APSERVER_PORT
60APSERVER_PATH
61   APserver is a program that is needed to support shared variables. APserver
62   is started automatically and has a communication channel to every APL
63   interpreter instance and to every AP started (manually or automatically
64   by an APL interpreter instance). The communication channel can be TCP,
65   abstract Unix domain sockets, or normal Unix domain sockets.
66
67   1. TCP communication is the default communication channel that is also
68      use when APSERVER_TRANSPORT is not ./configured. APserver listens on
69      port number 16366 by default; this can be changed via APSERVER_PORT
70      like this:
71
72      ./configure APSERVER_TRANSPORT=TCP   APSERVER_PORT=40000
73
74   2. Abstract Unix domain sockets are a GNU/linux specific variant that
75      allows for sockets without a corresponding file in the file system.
76      APserver listens on socket named "/tmp/GNU-APL/APserver" by default;
77      the name can be changed with APSERVER_PATH like this:
78
79      ./configure APSERVER_TRANSPORT=LINUX   APSERVER_PATH=my-APserver-path
80
81   3. Normal Unix domain sockets are a GNU/linux specific variant that requires
82      a file in the file system to work. The permissions of that file control
83      which programs can connect to APserver (BUT MAY ALSO PREVENT APserver
84      FROM OPERATING PROPERLY!). Due to the many different possibilities for
85      the ownership and permissions for the file, GNU APL does not create the
86      file but leaves that to the user. By default APserver listens on the
87      socket named "/tmp/GNU-APL/APserver" (and a file with that name
88      should exist before APL is started); the name can be changed with
89      APSERVER_PATH like this:
90
91      ./configure APSERVER_TRANSPORT=UNIX   APSERVER_PATH=my-APserver-path
92
93CORE_COUNT_WANTED
94   This experimental option specifies the number of CPU cores the
95   intepreter is to use. The value is a number, 'all', 'argv', or 'syl'.
96   The interpreter has sequential code and parallel code which is selected
97    as follows:
98
99   value    code
100         0  sequential  (default, one core is used)
101         1  parallel    one core is used
102         N  parallel    N > 0 cores are used
103   all  -1  parallel    all existing cores are being used,
104   argv -2  parallel    the number of cores can be set by command line option
105                        -cc N (same as all if -cc is not given).
106   syl  -3  parallel    the number of cores can be changed in APL via ⎕SYL,
107                        initially 1.
108
109   Example:
110
111   ./configure CORE_COUNT_WANTED=4
112
113
114   CIN_COLOR_WANTED
115  CERR_COLOR_WANTED
116  COUT_COLOR_WANTED
117RESET_COLORS_WANTED
118   CLEAR_EOL_WANTED
119   These options were used in GNU APL 1.0 to configure output coloring.
120   Output coloring can now specified in GNU APL's preference file. This
121   is more flexible than configuring the colors at compile time.
122
123DYNAMIC_LOG_WANTED=yes
124    The APL interpreter has more than 30 log categories. Each log category can
125    be turned on or off if needed in order to troubleshoot the APL interpreter.
126    There are two ways to control the logging categories: statically or
127    dynamically.
128
129    Statically means that it is decided at compile time if a log category
130    shall be on or off. Dynamically means that a log category can be turned
131    on and off at run-time (with the command ]LOG).
132
133    Dynamic logging has a performance penalty since every potential log
134    printout has an if () statement that checks if the log category is turned
135    on or off. With static logging this if () statement has a constant value
136    that will be optimized away by the C++ compiler. Dynamic logging also
137    slightly increases the size of the APL interpreter.
138
139   In both cases (static or dynamic logging), the file src/Logging.def defines
140   the logging categories at start-up of the APL interpreter. If the first
141   argument of the log_def() macro is 0 then the log category is initially
142   disabled (and remains disabled if static logging is used); if it is 1
143   then the log category is initially enabled. The default for this option
144   is static logging. Example:
145
146    ./configure DYNAMIC_LOG_WANTED=yes
147
148CXX_WERROR=yes/no
149    Do (not) add -Werror to the compiler flags. By default GNU APL is being
150    compiled with -Werror, which turns compiler warnings into compiler errors
151    so that the  build fails if the compiler issues warnings. However, some
152    older compilers produce lots of bogus warnings that cannot be fixed in a
153    reasonable way. In such cases you can, for example:
154
155    ./configure CXX_WERROR=no
156
157DEVELOP_WANTED
158    This option enables a number of internal checks in the GNU APL interpreter
159    that are useful for maintainers of GNU APL.
160
161    Example:
162    ./configure DEVELOP_WANTED=yes
163
164MAX_RANK_WANTED=n
165    Set the maximum rank of APL values to n. The default value is 8. Ranks
166    smaller than 4 should be avoided. There is no performance penalty for
167    increasing the max. rank, but every additional dimension takes 4-8 bytes
168    of memory for every APL value (even those with a smaller rank), Example:
169
170    ./configure MAX_RANK_WANTED=10
171
172
173PRINT_SEMA_WANTED=yes
174   This option is now obsolete.
175
176
177VALUE_CHECK_WANTED=yes
178    There is a function called check_value() that checks every new APL value
179    for completeness. This check helps finding faults in the interpreter, but
180    decreases the performance of the interpreter. Example:
181
182    ./configure VALUE_CHECK_WANTED=yes
183
184VALUE_HISTORY_WANTED=yes
185    There is a macro called ADD_EVENT that records the history of APL values.
186    This history helps finding faults in the interpreter, but
187    decreases the performance of the interpreter. Example:
188
189    ./configure VALUE_HISTORY_WANTED=yes
190
191
192PERFORMANCE_COUNTERS_WANTED=yes
193    GNU APL has some build-in counters for performace measurements. These counters
194    are normally disabled, but can be enabled via this option. Example:
195
196    ./configure PERFORMANCE_COUNTERS_WANTED=yes
197
198
199VF_TRACING_WANTED=yes
200   You can enable tracing of changes to value flags. This creates a lot of
201   debug output and consequently has considerable performance impacts. Example:
202
203    ./configure VF_TRACING_WANTED=yes
204
205
206SHORT_VALUE_LENGTH_WANTED=12
207   The interpreter distinguishes long values and short APL values. Short values
208   are allocated with a single call to "new" that allocates the Shape of the
209   value and its ravel. Long values allocate the value header with one call to
210   "new" and then the ravel with another call to "new". Long values are
211   therefore a little slower than short values. By increasing
212   SHORT_VALUE_LENGTH_WANTED you get fewer new calls (and consequently better
213   performance) at the cost of more memory. Example:
214
215    ./configure SHORT_VALUE_LENGTH_WANTED=42
216
217
218GPROF_WANTED=yes
219   Setting GPROF_WANTED adds the flag -pg to CXXFLAGS and LDFLAGS and that
220   enables support for gprof profiling of the apl interpreter. Example:
221
222    ./configure GPROF_WANTED=yes
223
224GCOV_WANTED=yes
225   Setting GCOV_WANTED adds the flags -fprofile-arcs and -ftest-coverage flags
226   to CXXFLAGS and that enables support for gcov coverage testing of the apl
227   interpreter. Example:
228
229    ./configure GCOV_WANTED=yes
230
231VISIBLE_MARKERS_WANTED=yes
232   GNU APL uses a handful of Unicode characters as internal pad characters
233   when formatting its output. Normally these pad characters are in a private
234   Unicode range in order to minimize the chance that they are output on
235   purpose. Unfortunately that makes debugging of the output formatting
236   difficult. With VISIBLE_MARKERS_WANTED=yes, visible characters ⁰, ¹, ...
237   are used as internal pad characters. The internal pad characters are always
238   replaced by blanks in normal APL output, but using visible pad characters
239   simplifies the debugging of the internal APL formatting considerably.
240
241    ./configure VISIBLE_MARKERS_WANTED=yes
242
243RATIONAL_NUMBERS_WANTED=yes
244   This enables support for rational numbers in GNU APL. The precision of some
245   computations is increased while the performance is normally impacted
246   negatively. This feature is currently experimental. Example:
247
248    ./configure RATIONAL_NUMBERS_WANTED=yes
249
250-------------------------------------------------------------------------------
251
252The typical setting for users not interested in troubleshooting the APL
253interpreter is to not use any options, i.e:
254
255    ./configure
256
257
258The typical setting for software development of the APL interpreter is:
259
260    ./configure DEVELOP_WANTED=yes
261
262which is a shortcut for:
263
264    ./configure VALUE_CHECK_WANTED=yes          \
265                VALUE_HISTORY_WANTED=yes        \
266		PERFORMANCE_COUNTERS_WANTED=yes	\
267                DYNAMIC_LOG_WANTED=yes          \
268                ASSERT_LEVEL_WANTED=2
269
270After the first ./configure run (which creates the top level Makefile)
271you can do:
272
273    make develop
274
275which runs ./configure with the typical development options above.
276
277
278

README-3-keyboard

1About APL
2=========
3
4In addition to ASCII characters found on most keyboards,
5APL needs additional "APL characters". This README file
6explains how GNU APL works and how to enable APL characters on
7a number of different machines.
8
9
101. How GNU APL works
11====================
12
13The GNU APL binary is a standard process that receives its input (normally,
14but not necessarily from what you type on your keyboard). It reads a file descriptor
15called "standard input (stdin) and prints its output on two other file
16descriptors called standard output (stdout) for normal APL output, and
17standard error (stderr) for additional diagnostic output.
18
19This means that the GNU APL binary has no concept of what a keyboard is,
20nor, on output is it concerned with fonts and the like. All the binary sees is a byte
21stream on input and all it produces is a bytes stream out its output
22channels stdout and stderr.
23
24GNU APL expects that the byte sequences on stdin, stdout, and stderr are
25"UTF8-encoded". UTF8-encoding is an extension of ASCII encoding that is used
26in many places, including most Web pages. It is defined in the international
27standard STD 63 (aka. "RFC 3629 - UTF-8, a transformation format of ISO 10646")
28and is supported on most operating systems.
29
30A second standard - Unicode - describes how characters will appear on the
31terminal.  This standard includes all the APL characters used by GNU APL.
32Normally Unicode  characters are UTF8 encoded when transmitted over serial lines,
33file descriptors, in IP packets, or when displayed on web pages.
34
35There are many advantages to using UTF8-encoded Unicodes for APL:
36
37- You can copy/paste APL programs and expressions from web pages,
38- You can print them on modern printers,
39- You can telnet or ssh to remote computers that run APL,
40- You can redirect UTF8 encoded files into the APL interpreter, This redirection
41  gives you access to scripts written in APL.
42- You can exchange such files with APL users using APL interpreters from other
43  vendors, or copy APL code snippets into documents.
44
45The downside of UTF8-encoded Unicodes is that GNU APL can not (and will not)
46take care of how your keyboard, screen, and printers work. You have to set that
47up yourself and outside GNU APL.
48
49There is no single standard way of setting things up for GNU APL. The rest of
50this README file describes a number of different methods to enable APL characters
51on your machine. The information that follows has made GNU APL work on most
52(but nor all) machines and operating systems around. As different approaches were
53used these methods may conflict with each other. Use only one of them at a time.
54
55GNU APL includes a directory called "support-files". This directory
56contains various configuration files needed by the methods described below.
57
58Most of the problems in getting UTF8-encoded Unicodes working with the APL interpretor
59is with the input side (from the keyboard to GNU APL). The output side from APL
60is most often already working (thanks to Unicode).
61
62
632. Structure of the support-files directory
64===========================================
65
66At one time, there was only one keyboard layout assumed for GNU APL. At that
67time all support files for this keyboard layout (now called "old") were
68located in the included support-files directory.
69
70Then a number of different keyboard layouts were contributed by GNU APL users.
71
72As of GNU APL 1.4 there is now one directory for every keyboard interface
73option, currently:
74
75    support-files/Dirk,
76    support-files/Dyalog-Keyboard,
77    support-files/Jürgen-Mint-19,
78    support-files/old-Keyboard,
79    support-files/OS-X-Keyboard,
80    support-files/Unicomp-Keyboard, and
81    support-files/WASD-Keyboard
82
83The file names mentioned in the following are generic (independent of a
84particular keyboard layout) whereas the support files provided, live in
85one or more of the keyboard layout directories. For example:
86
87    support-files/old-Keyboard/apl.xmodmap and
88    support-files/Dyalog-Keyboard/apl.xmodmap
89
90are the different instances of apl.xmodmap files for different keyboard
91layouts.
92
93If no support file exists for your actual combination of keyboard layout
94and method, then usually the support file of some other layout works or
95can be made working easily. If you adapt support files, feel free
96to mail the changed file to bug-apl@gnu.org so that we can include it.
97
98Note: Not all support files are fully tested - they should work. The layouts
99change from time to time and given the number of methods and the number
100of layouts there is no easy way to track these changes for all methods and layout
101
102The standard layout assumed for GNU APL is that of the APL keyboards shipped
103by Dyalog. The standard method assumed for GNU APL is xmodmap.
104
105
1063. xmodmap
107==========
108
109If your operating system runs X (which is the case for most "Desktop"
110variants of GNU/Linux) then it is quite simple to make your keyboard produce
111APL characters.
112
113
114The program xmodmap comes with X, and is already installed on your machine.
115It defines a mapping between the keys you type and the character
116that is being produced (taking into account modifiers like Shift or Alt).
117
118There are two common physical hardware keyboards in common use. One is titled
119pc104 and the other, pc105. The pc104 is the standard USA keyboard.
120The pc105 has two additional keys and may contain more characters than are
121found on the pc104 keyboard.The pc105 has a font selection key.
122The APL character placement for the respective keyboard is shown below.
123
124There are four character cases with your X system. Lower case, Upper case,
125alt (ALT) case and shift-alt (shift-ALT) case. Usually the alt key is the one
126to the right of the space bar. However, depending on the keyboard
127xmod interface, the alt key may be the one to the left of the space bar.
128
129The file "support-files/Dyalog-Keyboard/apl.xmodmap" (that comes with GNU APL)
130provides such a mapping; the normal keys produce ASCII characters while the ALT
131(and Shift-ALT) cases contains all APL character used by GNU APL. The
132mapping is enabled with the following command (we use "$ " to indicate the
133prompt of your shell):
134
135    $ xmodmap support-files/Dyalog-Keyboard/apl.xmodmap
136
137After that execution, your keyboard will produce APL characters when
138the "Alt" key is held down. The keyboard layout defined in file
139"apl.xmodmap" is similar to the following for pc104 and pc105 layouts:
140
141PC104 USA Domestic APL Keyboard Layout
142=====================================
143╔════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦═════════╗
144║ ~  ║ !⌶ ║ @⍫ ║ #⍒ ║ $⍋ ║ %⌽ ║ ^⍉ ║ &⊖ ║ *⍟ ║ (⍱ ║ )⍲ ║ _! ║ +⌹ ║         ║
145║ `◊ ║ 1¨ ║ 2¯ ║ 3< ║ 4≤ ║ 5= ║ 6≥ ║ 7> ║ 8≠ ║ 9∨ ║ 0∧ ║ -× ║ =÷ ║ BACKSP  ║
146╠════╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦══════╣
147║       ║ Q  ║ W⍹ ║ E⋸ ║ R  ║ T⍨ ║ Y¥ ║ U  ║ I⍸ ║ O⍥ ║ P⍣ ║ {⍞ ║ }⍬ ║  |⊣  ║
148║  TAB  ║ q? ║ w⍵ ║ e∈ ║ r⍴ ║ t∼ ║ y↑ ║ u↓ ║ i⍳ ║ o○ ║ p⋆ ║ [← ║ ]→ ║  \⊢  ║
149╠═══════╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩══════╣
150║ (CAPS   ║ A⍶ ║ S  ║ D  ║ F  ║ G  ║ H⍙ ║ J⍤ ║ K  ║ L⌷ ║ :≡ ║ "≢ ║         ║
151║  LOCK)  ║ a⍺ ║ s⌈ ║ d⌊ ║ f_ ║ g∇ ║ h∆ ║ j∘ ║ k' ║ l⎕ ║ ;⍎ ║ '⍕ ║ RETURN  ║
152╠═════════╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═════════╣
153║             ║ Z  ║ Xχ ║ C¢ ║ V  ║ B£ ║ N  ║ M  ║ <⍪ ║ >⍙ ║ ?⍠ ║          ║
154║  SHIFT      ║ z⊂ ║ x⊃ ║ c∩ ║ v∪ ║ b⊥ ║ n⊤ ║ m| ║ ,⍝ ║ .⍀ ║ /⌿ ║  SHIFT   ║
155╚═════════════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩══════════╝
156
157PC105 USA and International Keyboards
158=====================================
159╔════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════════════╗
160║ ~  ║ !⌶ ║ @⍫ ║ #⍒ ║ $⍋ ║ %⌽ ║ ^⍉ ║ &⊖ ║ *⍟ ║ (⍱ ║ )⍲ ║ _! ║ +⌹ ║            ║
161║ `◊ ║ 1¨ ║ 2¯ ║ 3< ║ 4≤ ║ 5= ║ 6≥ ║ 7> ║ 8≠ ║ 9∨ ║ 0∧ ║ -× ║ =÷ ║ BACKSP     ║
162╠════╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═════════╣
163║       ║ Q  ║ W⍹ ║ E⍷ ║ R  ║ T⍨ ║ Y¥ ║ U€ ║ I⍸ ║ O⍥ ║ P⍣ ║ {⍞ ║ }⍬ ║         ║
164║  TAB  ║ q? ║ w⍵ ║ e∈ ║ r⍴ ║ t∼ ║ y↑ ║ u↓ ║ i⍳ ║ o○ ║ p⋆ ║ [← ║ ]→ ║ RETURN  ║
165╠═══════╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╗       ║
166║ (CAPS   ║ A⍶ ║ S  ║ D  ║ F  ║ G  ║ H  ║ J⍤ ║ K⌸ ║ L⌷ ║ :≡ ║ "≢ ║ |⊣ ║       ║
167║  LOCK)  ║ a⍺ ║ s⌈ ║ d⌊ ║ f_ ║ g∇ ║ h∆ ║ j∘ ║ k' ║ l⎕ ║ ;⍎ ║ '⍕ ║ \⊢ ║       ║
168╠════════╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩════╩═══════╣
169║        ║ < ¦║ Z  ║ Xχ ║ C¢ ║ V  ║ B£ ║ N  ║ M  ║ <⍪ ║ >⍙ ║ ?⍠ ║             ║
170║  SHIFT ║ > °║ z⊂ ║ x⊃ ║ c∩ ║ v∪ ║ b⊥ ║ n⊤ ║ m| ║ ,⍝ ║ .⍀ ║ /⌿ ║  SHIFT      ║
171╚════════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩═════════════╝
172
173Three files within "support-files/Dyalog-Keyboard/", keyboard.txt, keyboard1.txt
174and pc105.txt contain the above images. If you want to print it
175(keyboard1 is < 80 characters wide).
176
177If you don't like this particular layout, then you can modify "apl.xmodmap"
178to fit your preferences.
179
180If you are Finnish then you may want to have a look here:
181
182  http://www.oksman.eu/apl/gnu_apl_installation_with_finnish_keyboard_layout.txt
183
184LATEST NEWS: as of Mint-19 xmodmap is no longer working (at least with the
185GNOME desktop). For those who used xmodmap with a Dyalog keyboard layout,
186a 1:1 replacement based on setxkbmap exists, see file README in directory
187support-files/Jürgen-Mint-19. This file is a hack that is somewhat easier
188to use than "proper" setxkbmap/xkbcomp setup explained in the next section.
189
1904. setxkbmap/xkbcomp
191====================
192
193Another program that can be used to make your keyboard produce APL
194characters is setxkbmap. Like xmodmap it requires that you are running X,
195and setxkbmap should not be mixed with xmodmap.
196
197setxkbmap is more modern and more powerful than xmodmap, but we had some
198problems with older GNU/Linux versions (an setxkbmap config file produced
199on a newer GNU/Linux did fix these problems).
200
201The file support-files/old-Keyboard/apl.xkm provides such a mapping (the
202file was kindly provided by David De La Harpe and produced with the command
203xkbcomp on his machine).
204
205The mapping is installed as follows:
206
207    $ xkbcomp support-files/old-Keyboard/apl.xkm :0
208
209Unlike the xmodmap approach, the APL characters are now produced with
210the AltGr modifier key but not with the Alt modifier key. This was to
211better support emacs which uses the Alt keys for other purposes.
212
213on those systems one of the following command may do (the syntax and file names
214of setxkbmap appear to have changed over time):
215
216    $ setxkbmap -layout "apl(sax)"
217    $ setxkbmap -layout "apl" -variant ",sax"
218    $ setxkbmap -layout "apl" -variant "sax"
219
220The file support-files/apl.xkb is the text file from which apl.xkm was
221generated. If you modify apl.xkb according to your preferences then you
222can generate your own apl.xkm file (see man pages for setxkbmap and xkbcomp).
223
224See also Blake's notes in support-files/Unicomp-Keyboard/apl.unicomp.xkb.txt
225
226Another description (also using setxkbmap) and files supporting it was kindly
227provided by Dirk Laurie and is contained in directory support-files/Dirk.
228
229WARNING: the description above is merely the "Theory of Operation" for
230setxkbmap and friends (according to their man pages). Over the years, window
231managers have become increasingly intrusive (some call it "convenient")
232into the keyboard setup. There exist a number of description below the
233directory support-files/ that may look contradictory and/or may not work on
234a given platform. These descriptions were, to the best of our knowledge,
235valid and working at the time when they were contributed, but may have stopped
236working on some platforms in the meantime. Therefore please consider them as
237mere ideas how keyboard layouts could be adapted to APL rather than fool-proof
238recipies.
239
2405. loadkeys
241===========
242
243If you are not running X then the above methods will complain about
244"unable to open display". In that case you can use command "loadkeys" to
245set up the keyboard layout, and command "unicode_start" to set up an APL
246font.
247
248    $ sudo loadkeys support-files/old-Keyboard/apl.loadkeys
249    $ unicode_start Unifont-APL8x16.psf
250
251The console font Unifont-APL8x16.psf will be contained in the next official
252release of GNU Unifont (maintained by Paul Hardy). In the meantime it can
253be downloaded from:
254
255    http://unifoundry.com
256
257
2586. Editing APL files
259====================
260
261Instead of using APL interactively, you may, like the author, find it more
262convenient to write a text file (an APL script) with all APL function
263definitions and variable assignments and to then run "apl -f" or "apl -s"
264with that file.
265
266The editor of choice for editing such files is vi (actually, vim). Recent
267versions of vim come with Unicode support and require no further changes
268to work with APL characters (assuming, of course, that one of the methods
269above is in place to make the keyboard generate APL characters).
270
271To further improve on that, there is a syntax file support-files/apl.vim
272that supports syntax coloring of vim.
273
274
2757. Emacs Mode
276=============
277
278Unlike vim, which runs out-of-the-box with APL characters, emacs needs
279a little more setup work. We cannot describe this here but would like to
280refer you to the web page of Elias Mårtenson who has put a lot of effort
281into developing an emacs mode for GNU APL. This is a must for every
282emacs user:
283
284    https://github.com/lokedhs/gnu-apl-mode
285
286
2878. Vim Plugins
288==============
289
290If your favorite editor is vim, then you will like the following plugin
291for vim, written by Thomas Baruchel:
292
293    http://www.vim.org/scripts/script.php?script_id=4887
294
295Another useful vim plugin, also written by Thomas Baruchel, lets you
296pick APL characters from a menu inside vim. It is here:
297
298    http://apl-adventures.tumblr.com/post/76528148239/an-apl-character-picker-for-vim
299
300
3019. The APL Keyboard Translator (akt)
302=====================================
303
304David Lamkins has written a keyboard translator called akt. You can
305use it for generating APL characters with your keyboard. In contrast to e,g.
306the xmodmap method, the mapping is on a per program basis so that other
307programs are not affected. Obtain a copy from:
308
309    https://github.com/TieDyedDevil/akt
310
311David's akt program is simple to use. In its most useful form the line is
312
313   akt apl <optional-apl-parameters>
314
315If you would like to write APL code using vim, doing so with akt is
316as simple as:
317
318    akt vi        or   akt vi your-apltext
319
320The left alt key is used to provide the apl characters.
321
322Certain older terminal emulators may offer an "Alt sets MSB" option. This
323is incompatible with `akt`.
324
325
326
32710. Keyboard Wrapper
328====================
329
330If the methods described above cannot be used for whatever reason then
331you can write your own program that reads keystrokes from the keyboard
332and produces UTF8 bytes sequences on its stdout. The program can then
333be 'piped' into GNU APL, We refer to such a program as a 'keyboard wrapper'.
334
335This technique is demonstrated by 3 programs called APL_keyboard_show,
336APL_keyboard_learn, and APL_keyboard, which are all located in the 'tools'
337subdirectory.
338
33910.1 Introduction to Defining your own layout.
340=============================================
341When you wish to use APL with your own keyboard and/or keyboard arrangement.
342
343Use these programs as in succession as follows:
344
345o   APL_keyboard_show   to  display the keycodes
346
347o  APL_keyboard_learn   to   create a file with the keycodes
348
349o  APL_keyboard         to use the file from APL_keyboard_learn
350
351o  make                 to transform output from learn to program
352
353Details follow in sections 10.2 through 10.4 below.
354
35510.2 APL_keyboard_show
356----------------------
357
358APL_keyboard_show is a simple program that displays the byte sequences
359produced by your keyboard. The following sequences are, as an example,
360sent by an Ubuntu system without having xmodmap or any other method applied.
361The characters typed were 'qwerty' and then 'qwerty' with ALT held down:
362
363$ ./APL_keyboard_show
364
365hit key ^C to quit...
366
367key_seq_1(0x71))
368key_seq_1(0x77))
369key_seq_1(0x65))
370key_seq_1(0x72))
371key_seq_1(0x74))
372key_seq_1(0x79))
373key_seq_2(0xC3, 0xB1))
374key_seq_2(0xC3, 0xB7))
375key_seq_2(0xC3, 0xA5))
376key_seq_2(0xC3, 0xB2))
377key_seq_2(0xC3, 0xB4))
378key_seq_2(0xC3, 0xB9))
379
380After running support-files/Dyalog/apl.xmodmap the following byte
381sequences are sent:
382
383hit keys, ESC to quit...
384
385key_seq_1(0x71))
386key_seq_1(0x77))
387key_seq_1(0x65))
388key_seq_1(0x72))
389key_seq_1(0x74))
390key_seq_1(0x79))
391key_seq_1(0x3F))
392key_seq_3(0xE2, 0x8D, 0xB5))
393key_seq_3(0xE2, 0x88, 0x88))
394key_seq_3(0xE2, 0x8D, 0xB4))
395key_seq_3(0xE2, 0x88, 0xBC))
396key_seq_3(0xE2, 0x86, 0x91))
397
398The alert reader will have noticed that in both cases UTF8 encoded characters
399were sent; they were different and just wrong for APL before running xmodmap.
400
401
40210.3 APL_keyboard_learn
403-----------------------
404
405The next program is APL_keyboard_learn which is derived from APL_keyboard_show.
406
407APL_keyboard_learn asks you to hit the keys for all APL characters and writes
408them into file APL_keyboard.def. For example:
409
410./APL_keyboard_learn
411
412hit keys, ESC to quit...
413
414hit key (0 of 94) for APL character ◊ :  0xC3 0xA0 (2 bytes)
415hit key (1 of 94) for APL character ¨ :  0xC2 0xB1 (2 bytes)
416hit key (2 of 94) for APL character ¯ :  0xC2 0xB2 (2 bytes)
417hit key (3 of 94) for APL character < :  0xC2 0xB3 (2 bytes)
418hit key (4 of 94) for APL character ≤ :  0xC2 0xB4 (2 bytes)
419hit key (5 of 94) for APL character = :  0xC2 0xB5 (2 bytes)
420hit key (6 of 94) for APL character ≥ :
421
422...
423
424If a key shall produce the same APL character regardless of the state of
425the SHIFT key, then you will be asked twice:
426
427hit key (0 of 94) for APL character ◊ :  0xC3 0xA0 (2 bytes)
428hit key (13 of 94) for APL character ◊ (shift):  0xC3 0xBE (2 bytes)
429
430APL_keyboard_learn writes a file APL_keyboard.def which is needed by the
431third program, APL_keyboard. The order of the keys that you are asked for
432is defined in file APL_keyboard.orig.def (which is identical to
433APL_keyboard.def when GNU APL is installed).
434
435After running APL_keyboard_learn, you should do 'make' in the tools directory,
436in order incorporate the newly created APL_keyboard.def into the program
437APL_keyboard.
438
439
44010.4 APL_keyboard
441-----------------
442
443The keyboard wrapper itself is APL_keyboard. The file APL_keyboard.def is
444#included by APL_keyboard.cc and defines the mapping from bytes sequences
445produced by you keyboard to UTF8 sequenced to be fed into GNU APL.
446
447Once APL_keyboard is made, you can start GNU APL like this:
448
449$ APL_keyboard | apl
450
451
452
45311. aplwrap
454===========
455
456There  is a cool GTK-based keyboard wrapper written by Chris Moller.
457You can reach it via the GNU APL Community web page:
458
459     http://www.gnu.org/software/apl/Community.html
460
461When invoked, it opens the apl interpretor in a window. The left alt key
462is used to provide the apl characters.
463
46412. Remote Login
465================
466
467Suppose GNU APL is started on machine A and you connect to it by means
468of ssh or telnet from machine B. In that case the keyboard setup
469discussed above is only needed on machine B,  and not on machine A.
470
471The same applies if machine A is a web server using APL for CGI scripting;
472in this case machine B does not normally need the above setup because these
473days, browsers are aware of UTF8 encoding (which is a standard encoding for
474HTML pages).
475
476If you telnet to a machine A, then verify that 8-bit operation is enabled
477(-8 command line option) or else UTF8 encoding will not work.
478
479If you ssh, make sure that the TERM variable is properly set on machine A
480or else output coloring of GNU APL may send incorrect ESC sequences for
481switching between colors (or use apl -noColor).
482
483
48413. Pitfalls and Troubleshooting
485================================
486
487There are other pieces of software that may intercept the byte stream on its
488way from the keyboard, via GNU APL, to the screen (or printer). A prime
489example is "locales" that can change the encoding of the byte streams involved.
490
491Locales interfere with APL characters in multiple ways: they can install new
492keyboard mappings, change encoding to something other than UTF8, and currently
493also impact the file format of saved workspaces, for example by changing the
494decimal point from . to , in the printf() functions. One thing to avoid the
495latter is to run ./configure with --disable-nls.
496
497If you need to troubleshoot APL characters, proceed as follows:
498
4991. determine if the problem is on input (between the keyboard and GNU APL),
500   or on output (between GNU APL and the screen (or printer), or both.
501
5022. To check the output, start GNU APL and issue the debug command:
503
504   ]KEYB
505
506   In GNU APL there are the classical APL commands starting with ) like
507   )FNS or )VARS, and debug commands starting with ] instead of ).
508   If ]KEYB shows a keyboard layout like the one in the xmodmap section
509   above, then the output is working. If not then something is wrong with
510   either the encoding, or with your fonts.
511
5123. For the input you can use commands like "xev" to see which Unicodes are
513   sent when you press a key. If the wrong Unicode is shown then your
514   key mapping is wrong; otherwise the encoding is more likely to be
515   the problem.
516
517
51814. APL Keyboards
519=================
520
521If you are new to APL or use it only infrequently, then you may have
522problems remembering the locations of all the APL characters on your
523keyboard. In that situation an APL keyboard may be a great help.
524
525Technically, an APL keyboard is not different from a normal keyboard. It
526produces the same keycodes as a normal keyboard. It does therefore not
527replace the methods for setting up your keyboard that were discussed above.
528
529However, it has the common APL symbols engraved on its keycaps in addition to
530the normal ASCII characters. There are not many vendors around that sell APL
531keyboards (it took a while for the author to find one). Therefore it may be
532worthwhile to mention a few:
533
534a. www.dyalog.com (send an email to sales@dyalog.com to obtain a quote).
535b. www.wasdkeyboards.com
536c. www.unicomp.com seems to have APL keyboards every now and then.
537
538An inquiry sent to a. was answered promptly; an inquiry sent to c. never.
539
540Blake McBride has contributed a few files and installation instructions
541for c. (WASD keyboards) which are contained in the support-files/WASD
542directory.
543
544Stickers
545==========
546Stickers may be created by printing the keyboard1.txt onto a
547gummed paper, and subsequently cutting the sticker and peeling it
548to the keytop. This is not a durable solution, but would help you
549to remember the APL key locations.
550
551Another help for those that keep forgetting the APL key locations of their
552keyboard is the ]KEYB command of GNU APL. It displays the layout of a standard
553US keyboard with APL characters. Under X, if your keyboard is not yet up
554and running properly got APL, you can run the ]KEYB command in one window and
555then copy-and-paste APL characters from that window to another one running APL
556with your mouse.  This approach is not useful for normal programming work, but
557can be handy in special situations.
558
559

README-4-compliance

1
2The following features are NOT planned to be supported
3------------------------------------------------------
4
5* ⎕NLT
6
7
8The following features MAY be added (if requested):
9---------------------------------------------------
10
11* more shared variables / auxiliary processors
12
13* ⎕NA
14
15* more ⎕L and ⎕R testcases
16
17
18The following features are planned or will be investigated:
19-----------------------------------------------------------
20
21* Support for SCAR format (to exchange data with Dyalog APL and APL2000).
22
23* operators from NARS2000 (email from Bob Smith, Dec-14-2013)
24
25* versioning of .so files
26
27
28The following issues are known and maybe fixed mid-term:
29--------------------------------------------------------
30
31
32The following extensions are provided:
33--------------------------------------
34
35* various debug commands, see )HELP
36
37* dyadic ⎕CR   (DISPLAY-like value output,
38                several conversions of bytes and characters).
39                Canonical Representation)
40
41* ⎕DLT         (Knuth's Dancing links algorithm, aka Algorithm X)
42
43* ⎕ENV B       (environment variables)
44               return the values of environment variables whose names starts
45               with B. The result is a N by 2 matrix, with column 1 containing
46               environment variable names and column 2 their values.
47
48* ⎕FIO         (several FILE I/O functions)
49
50* ⎕SQL         (access to SQL databases)
51
52* 3 ⎕TF        (⎕TF with CDR format)
53
54* APL scripting
55    text files beginning with:
56
57    #!apl
58
59    run the interpreter as a shell with the subsequent lines as input.
60
61* ⎕INP
62     HERE-document like input for long texts
63
64* Native APL functions
65    User defined APL functions written in C++
66
67* )DUMP command (save workspace in a format that can be read back with apl -f
68
69

README-5-WINDOWS

1
2You can run GNU APL on windows by means of CYGWIN:
3
41. install CYGWIN (see http://www.cygwin.org)
5
62. Install additional libraries as needed (look for error messages in 3. below)
7
83. Follow the standard installation procedure for GNU APL in INSTALL,
9  README-2-configure, and README-3-keyboard.
10
11WARNING: If you are not familiar with CYGWIN (which provides a GNU/Linux look
12         and feel on WINDOWS) then your health is at risk! You may suffer
13         serious depressions after returning to WINDOWS. The only known cure
14         is to permanently stay away from WINDOWs.
15
16The procedure above has been tested with WINDOWS XP and a CYGWIN version
17that has identified itself (via uname -a) as:
18
19	CYGWIN_NT-5.1 Server 1.7.25(0.270/5/3) 2013-08-31 20:39 i686 Cygwin
20
21
22LIMITATIONS: backtraces (Stack dumps after fatal errors) may not work
23because they use a GNU extension that may or may not be supported on CYGWIN.
24
25NOTE: The procedure described in README-3-keyboard uses the program xmodmap,
26 which only works when xmodmap and GNU APL are started under X (which is
27normally the case for Desktop GNU/Linux distributions). In CYGWIN you can
28start a "Cygwin Terminal" which does NOT run under X. If you run xmodmap
29in the Cygwin Terminal then it complains like this:
30
31 xmodmap: unable to open display ''
32
33This is an indication that X is not running and that your keyboard will
34not produce APL characters. You can still start GNU APL (to check that it
35has compiled properly), but you will be lacking almost all functions.
36
37A case where it makes sense to run GNU APL without X is APL scripts,
38for example CGI scripts for web servers written in APL. These scripts do
39not read input from the keyboard, so it does not matter that the keyboard
40setup is wrong.
41
42Another case is a remote login from machine A to machine B using ssh. In this
43case X should run on machine A (so that the keyboard on A works), but a GNU
44APL on machine B can run without X.
45
46
47Yet another possibility for Windows users is to install some GNU/Linux
48distribution, for example Ubuntu or Linux Mint, in a virtual machine.
49Installing virtual machines as well as installing GNU/Linux on a virtual
50machine has become rather simple these days. Needless to say that the
51WARNING above also applies in thius case!
52
53
54

README-6-porting

1
2GNU APL has been compiled successfully on non-GNU/Linux systems.
3Some of these systems may require additional settings.
4
5Below are notes from GNU APL users with non-GNU/Linux systems (in
6almost alphabetical order of the OSs)
7
8===============================================================================
9====									   ====
10====			    BSD (FreeBSD)				   ====
11====									   ====
12===============================================================================
13
14We have the following problem building GNU APL in FreeBSD.
15It can be solved by ./configure'ing GNU APL as shown below.
16
171. Non-standard library locations. Some of the libraries used by GNU APL.
18   for example libexecinfo, live in /usr/local/lib and not in /usr/lib and
19   may not be found by ./configure. This can be solved by setting LDFLAGS
20   BEFORE running ./configure.
21
22After compiling GNU APL you may want to enable UTF-8 encoding for your
23terminal. For example, in xterm you need enable UTF-8 encoding and
24UTF-8 Fonts in xterm's VT menu (Ctrl + right mouse). It may be possible
25to set this permanently in your terminal's configuration file(s).
26
27Freebsd 8.4
28-------------------------------------------------------------------------------
29
30Many thanks to Sam Sirlin for providing this!
31
32for configure:
33--------------
34
35setenv CC gcc46
36setenv CXX g++46
37setenv LDFLAGS '-L/usr/local/lib -L/usr/local/lib/gcc46 -R/usr/local/lib -R/usr/local/lib/gcc46'
38setenv LIBS ' -lexecinfo '
39
40Freebsd 9
41-------------------------------------------------------------------------------
42
43setenv LDFLAGS '-L/usr/local/lib'
44
45
46===============================================================================
47====									   ====
48====			    BSD (OpenBSD)				   ====
49====									   ====
50===============================================================================
51
52Giuseppe Cocomazzi has created an open BSD port of GNU APL. See:
53
54http://sbudella.altervista.org/blog/20170821-apl-openbsd.html
55
56
57===============================================================================
58====									   ====
59====			    CYGWIN 5.1 (aka. Windows)			   ====
60====									   ====
61===============================================================================
62
63GNU APL compiles on CYGWIN, see README-5-WINDOWS for details
64
65
66===============================================================================
67====									   ====
68====			    OS-X					   ====
69====									   ====
70===============================================================================
71
72The latest version (SVN) of GNU APL was reported to compile and run on OS-X
73without special measures.
74
75For Macintosh users, Peter Teeson has contributed a very nice installation
76instructions that can be found in the doc/ subdirectory (file
77APL-on-Macintosh.pdf).
78
79

README-7-more-info

1
2If you have reached this file, then GNU APL is hopefully running well for
3you. You may have more questions that are related to APL in general
4rather than to GNU APL in particular.
5
6The following is a list of web links that may be used as starting points
7for more information about APL. This list is admittedly rather arbitrary
8and by no means complete.
9
10
11ISO Standard 13751
12------------------
13
14The ISO standard implemented by GNU APL can be found here:
15
16    www.math.uwaterloo.ca/~ljdickey/apl-rep/docs/is13751.pdf
17
18Note that this file is, despite of its .pdf extension, a gzip compressed
19PDF file. You have to fetch it, rename it, and then gunzip it:
20
21    wget www.math.uwaterloo.ca/~ljdickey/apl-rep/docs/is13751.pdf
22    mv is13751.pdf is13751.pdf.gz
23    gunzip is13751.pdf.gz
24
25
26IBM Documentation
27-----------------
28
29In cases where the ISO 13751 standard was not clear, the IBM documents
30for APL2 were consulted as a second opinion:
31
32    www.catpad.net/michael/apl/ibmapl2/apl2lrm.pdf
33
34
35Dyalog APL Manual
36-----------------
37
38Dyalog Ltd. a commercial APL vendor, has published a book describing
39their APL in great detail. Not all features described there are implemented
40in GNU APL, but this book is a good starting point for beginners.
41
42    www.dyalog.com/mastering-dyalog-apl.htm
43
44
45comp.lang.apl
46-------------
47
48An always interesting APL related newsgroup which has been around for
49many years is:
50
51    groups.google.com/forum/#!forum/comp.lang.apl
52
53
54Sam Sirlin's FAQ
55----------------
56
57Much more information about APL can be found at Sam Sirlin's APL FAQ at:
58
59    home.earthlink.net/~swsirlin/apl.faq.html
60
61
62The doc directory in the GNU APL package
63----------------------------------------
64The doc directory contains some more files in different formats. Most of them
65are installed in other places, for example in the info system, or (in HTML) at:
66https://www.gnu.org/software/apl/apl.html.  Some of the filesin the doc
67directory are targeting specific platforms, for example the file
68APL-on-Macintosh.pdf written by Peter Teeson.
69
70The GNU APL info
71----------------
72
73GNU APL installs an info file which can be viewed with:
74
75info apl
76
77The GNU APL )HELP command output
78--------------------------------
79)HELP
80APL Commands:
81      )CHECK
82      )CLEAR
83      )CONTINUE
84      )COPY [lib] wsname [object ...]
85      )DROP [[lib] wsname]
86      )ERASE symbol ...
87      )DUMP-HTML [[lib] wsname]
88      )DUMPV [[lib] wsname]
89      )DUMP [[lib] wsname]
90      )FNS [from-to]
91      )HELP
92      )HIST [CLEAR]
93      )HOST command
94      )IN filename [object ...]
95      )LIBS [[lib] path]
96      )LIB [lib|path]
97      )LOAD [lib] wsname
98      )MORE
99      )NMS [from-to]
100      )OFF
101      )OPS [from-to]
102      )OUT filename [object ...]
103      )PCOPY [lib] wsname [object ...]
104      )PIN filename [object ...]
105      )QLOAD [lib] wsname
106      )RESET
107      )SAVE [[lib] wsname]
108      )SIC
109      )SINL
110      )SIS
111      )SI
112      )SYMBOLS [count]
113      )VALUES
114      )VARS [from-to]
115      )WSID [wsname]
116      ]BOXING [OFF|2|3|4|7|8|9]
117      ]COLOR [ON|OFF]
118      ]NEXTFILE
119      ]EXPECT error_count
120      ]HELP
121      ]KEYB
122      ]LIB [lib|path]
123      ]LOG [facility [ON|OFF]]
124      ]OWNERS
125      ]PSTAT [CLEAR|SAVE]
126      ]SIS
127      ]SI
128      ]SVARS
129      ]SYMBOL symbol
130      ]USERCMD [ ]ucmd APL_fun [mode]
131               | ]ucmd { ... }
132               | REMOVE ]ucmd
133               | REMOVE-ALL
134               ]
135      ]XTERM [ON|OFF]
136
137System variables:
138      ⎕AI     Account Information
139      ⎕ARG    command line ARGuments of the interpreter
140      ⎕AV     Atomic Vector
141      ⎕CT     Comparison Tolerance
142      ⎕EM     Event Message
143      ⎕ET     Event Type
144      ⎕FC     Format Control
145      ⎕IO     Index Origin
146      ⎕L      Left Argument
147      ⎕LC     Line Counters
148      ⎕LX     Latent Expression
149      ⎕PP     Printing Precision
150      ⎕PR     Prompt Replacement
151      ⎕PS     Print Style
152      ⎕PW     Print Width
153      ⎕R      Right Argment
154      ⎕RL     Random Link
155      ⎕SVE    Shared Variable Event
156      ⎕SYL    SYstem Limits
157      ⎕TC     Terminal Control characters
158      ⎕TS     Time Stamp
159      ⎕TZ     Time Zone
160      ⎕UL     User Load
161      ⎕X      aXis Argument
162      ⎕WA     Workspace Available
163      λ       { ... } result
164      ⍺       { ... } left value argument
165      ⍵       { ... } right value argument
166      χ       { ... } axis argument
167      ⍶       { ... } left function argument
168      ⍹       { ... } right function argument
169
170System functions:
171      ⎕AF     Atomic Function
172      ⎕AT     Attributes
173      ⎕CR     Character Representation
174      ⎕DL     Delay
175      ⎕DLX    D. Knuth's Dancing Links
176      ⎕EA     Execute Alternate
177      ⎕EB     Execute Both
178      ⎕EC     Execute Controlled
179      ⎕ENV    ENvironment Variables
180      ⎕ES     Event Simulate
181      ⎕EX     EXpunge
182      ⎕FIO    File I/O
183      ⎕FX     FiX
184      ⎕INP    INPut from script
185      ⎕NA     Name Association
186      ⎕NC     Name Class
187      ⎕NL     Name List
188      ⎕SI     State Indicator
189      ⎕SQL    SQL functions
190      ⎕SVC    Shared Variable Control
191      ⎕SVO    Shared Variable Offer
192      ⎕SVQ    Shared Variable Query
193      ⎕SVR    Shared Variable Retraction
194      ⎕SVS    Shared Variable State
195      ⎕STOP   STOP vector
196      ⎕TF     Transfer Form
197      ⎕TRACE  TRACE vector
198      ⎕UCS    Universal Character Set (aka. Unicode)
199
200Other Documentation
201-------------------
202The distribution has a doc subdirectory in which you will find
203html formatted documentation and *.info documentation.
204
205

README-8-parallel

1
2GNU APL supports, to some extent, execution of APL programs on multiple
3CPU cores in parallel.
4
51. Supported Platforms
6======================
7
8As of SVN 484 parallel execution in GNU APL requires the following:
9
10a.	POSIX thread (pthread) support
11
12b.	functions pthread_getaffinity_np() and pthread_setaffinity_np() to
13	set core affinities (i.e. which thread runs on which CPU core) of the
14	threads created by GNU APL for parallel execution.
15
16c.	an atomic fetch-and-add function
17
18While a. is normally available on all platforms supported by GNU APL, b. and
19c. may not be available. Recent Linux versions provide a., b., and c., Other
20platforms may be added later.
21
222. ./configure Options
23======================
24
25Parallel execution is currently experimental and must be ./configure'd
26explicitly (see also README-2-configure). There are two ./configure options
27related to parallel execution:
28
29   CORE_COUNT_WANTED and
30   PERFORMANCE_COUNTERS_WANTED
31
32The first option, CORE_COUNT_WANTED, controls how many cores shall be used
33for parallel execution, while the second option, PERFORMANCE_COUNTERS_WANTED,
34enables performance counters in GNU APL. Performance counters are needed for
35fine-tuning the parallelism as explained in the following.
36
37There are also two top-level make targets called 'parallel' and 'parallel1'
38'make parallel' calls ./configure with CORE_COUNT_WANTED=syl while
39'make parallel1 calls ./configure with CORE_COUNT_WANTED=syl and
40PERFORMANCE_COUNTERS_WANTED=yes.
41
423. Parallelized Functions
43=========================
44
45As of SVN 484 the following APL functions were parallelized:
46
47a. all monadic and dyadic scalar functions
48b. inner products of all dyadic scalar functions
49c. outer products of all dyadic scalar functions
50
51More APL functions may be parallelized later.
52
53
544. Performance measurements and Fine-tuning
55===========================================
56
57The first benchmarks performed with the parallelized scalar functions have
58shown that 'light-weight' scalar functions such as + , -, or ⌈ may execute
59faster than their sequential counterparts on one platform but slower on another
60platform. The difference between platforms can be dramatic.
61
62For that reason there is a possibility to fine-tune the break-even points
63where parallel execution is performed in favor of sequential execution.
64There is a break-even point for every monadic and for every dyadic scalar
65function.
66
67
684.1 Theory
69-----------
70
71The sequential execution time of a scalar function is:
72
73	A0 + (B0 × N) cycles,
74
75where A0 is the 'start-up time' for the function, B0 is the 'per-item time
76for the function, and N is the vector length. The actual shape does not matter
77for scalar functions, so adding 1 2 3 4 to itself takes the same time as
78adding 2 2⍴1 2 3 4 to itself.
79
80The sequential start-up time A0 is the same for all monadic scalar functions
81and for all dyadic scalar functions; the start-up time for dyadic functions
82is a little longer than for monadic scalar functions.
83
84Now let c be the number of cores. The parallel execution time on c cores
85is then:
86
87	Ac + (Bc × N) cycles,
88
89at least when N is a multiple of c. The difference when N is a not a multiple
90of c can be neglected. Again the parallel start-up time Ac is the same for
91all monadic scalar functions and for all dyadic scalar functions. And Ac ≥ A0;
92the difference (Ac - A0) is the additional start-up and join time for the
93thread pool computing the function in parallel.
94
95From the 4 numbers A0, B0, Ac, and Bc one can compute the break-even point BE,
96which is the vector length at which parallel execution becomes faster than
97sequential execution. The break-even point is:
98
99	BE ← (Ac - A0) ÷ (B0 - Bc)
100
101The break-even point only exists if Bc < B0, that is if the parallel per-item
102cost Bc is smaller than than the sequential per-item cost B0. On some
103architectures Bc = B0 ÷ c (and then (Ac - A0) is the only concern) but
104unfortunately for multi-core CPUs with a shared memory this is not the case.
105
1064.2 Measuring A0, Ac, B0, and Bc
107--------------------------------
108
109There is a workspace 'ScalarBenchmark.apl' shipped with GNU APL that measures
110the parameters A0, Ac, B0, and Bc and writes a file 'parallel_thresholds; that
111can be fed back to GNU APL in order to set the break-even points for all
112scalar functions. The workspace can also plot the results using aplplot.
113
114The workspace is used as  follows:
115
116a.	'make parallel1' as discussed above
117b.	adjust some parameters at the beginning of ScalarBenchmark.apl (number
118	of cores, plotting yes/no, and loop counts.
119c.	run, e.g.: src/apl -f workspaces/ScalarBenchmark.apl
120
121The last step c. creates a file 'parallel_thresholds' in the current directory.
122If that file is placed in one of the directories used for the 'preferences'
123file (/etc/gnu-apl.d/ or /usr/local/etc/gnu-apl.d/ depending on ./configure
124prefix, or $HOME/.gnu-apl.d, or $HOME/.config/gnu-apl.d) the GNU APL reads
125it on start-up and sets the break-even points for the scalar functions
126accordingly.
127
128The 'ScalarBenchmark.apl' first determines A0 and Ac using small vector
129lengths N. With today's CPUs the measurement results vary considerably,
130Therefore several iterations are performed for each vector length and the
131minimum of all iterations is taken. From these minimums the least-square
132regression line for all lengths is computed.
133
134Then 'ScalarBenchmark.apl' determines the per-item costs B0 and Bc using a
135fairly large vector length N.
136
1374.3 Example 1: Intel 4-core i5-4570 CPU using 3 cores on 64-bit linux
138---------------------------------------------------------------------
139
140We discuss only two dyadic functions, + and ⋆. + is 'light-weight' and ⋆
141is not. The summary shown by 'ScalarBenchmark.apl' for + and ⋆ is:
142
143-------------- + Mix_IRC --------------
144average sequential startup cost:      58 cycles
145average parallel startup cost:       690 cycles
146per item cost sequential:             61 cycles
147per item cost parallel:               95 cycles
148parallel break-even length:          not reached
149
150The good news is that the extra cost for parallel start-up and join of
151(690 - 58) = 632 cycles are fairly low. We had earlier made benchmarks with
152other parallel libraries which were semaphore based and showed start-up cost
153in the 10000-20000 cycle ballpark.
154
155The bad news is that the parallel per-item cost for + are higher than the
156sequential per-item cost and therefore there is no break-even point for +.
157The per-item cost of 61 cycles is rather close to the values of a separate
158benchmark that measured the main memory access times alone (see
159tools/memory_benchmark). Our best explanation for not reaching a break-even
160for + (on this machine) is that there are more extra cycles caused by
161main-memory access conflicts of the different cores than cycles saved
162by parallelizing +.
163
164For ⋆ the result is different because ⋆ is not as light-weight as +:
165
166-------------- ⋆ Mix_IRC --------------
167average sequential startup cost:      58 cycles
168average parallel startup cost:       690 cycles
169per item cost sequential:            147 cycles
170per item cost parallel:               91 cycles
171parallel break-even length:           12
172
173
1744.4 Example 2: Intel 2-core E6550 CPU using 2 cores on 32-bit linux
175-------------------------------------------------------------------
176
177On this older machine the results were rather different:
178
179-------------- Mix_IRC + Mix1_IRC --------------
180average sequential startup cost:    2027 cycles
181average parallel startup cost:      2340 cycles
182per item cost sequential:            362 cycles
183per item cost parallel:              210 cycles
184parallel break-even length:            3
185
186-------------- Mix_IRC ⋆ Mix_IRC --------------
187average sequential startup cost:    2027 cycles
188average parallel startup cost:      2340 cycles
189per item cost sequential:            647 cycles
190per item cost parallel:              340 cycles
191parallel break-even length:            2
192
193All functions were faster when executed parallel. The per-item cost were
194considerably higher (in part due to the 32-bit linux) but the parallel
195start-up penalty (2340 - 2027) = 313 was smaller.
196
197Note that the start up cost vary considerably between different runs of
198the same benchmark on the same machine. Therefore you should run several
199measurements before trusting the result.
200
2014.5 Other observations
202----------------------
203
204Another, somewhat unexpected observation made when looking at several
205benchmarks is that the optimal number of cores seems to be N-1 (i.e. not N)
206on an N-core CPU.
207
208The reason is that other regular operating system activities such
209as timer interrupts occur during the APL execution. The threads used by GNU
210APL get an almost even amount of work and the threads are running at 100%
211load unless the interpreter is blocked on user input. [This is a consequence
212of using a fetch-and-add function instead of semaphores for synchronizing the
213threads.]
214
215If all N cores of a CPU are used by APL then the CPU schedules its activities
216on one of the busy cores (and most likely the same core all the time).
217That core then takes more time than the others and the entire computation\
218of the APL function is delayed accordingly.
219
220If, however, only N-1 of N cores are used then the OS sees an idle core and
221will most likely perform its activities on that core. These effects are best
222visualized when using the plotting option of ScalarBenchmark.apl.
223
2245. Summary
225==========
226
227The above discussion shows that some speedup can be achieved by parallelizing
228scalar APL functions. However the speedup is not as significant as a naive
229observer might expect (i.e. B0÷Bc = c) and varies considerably between OS
230variants and hardware platforms.
231
232While the start-up cost of the current implementation in GNU APL look good
233compared to other approaches, the per-item cost are somewhat disappointing
234on some machines (and this is due to effects outside GNU APL). A corollary
235of this could be that APL operations with little computational complexity
236(such as A⍴B) will suffer as well and will not show good speedups when
237executed in parallel.
238
239In any case is it worthwhile to fine-tune the break-even points of the
240different scalar functions.
241
242

README-9-post-installation

1Post Installation Setup
2=======================
3
4by Leslie S. Satenstein
5
61.0   Introduction
7==================
8Following the execution of GNU-APL's "make install" (which is conceptually
9performed by a system administrator with access permissions to directories like
10/etc or /usr/), some additional setup activities by the user are normally
11required. The user can try out GNU APL before this additional setup, but some
12APL commands such as )SAVE will not work because the creation and specification
13of directories that are used for storing for files created by the user are the
14responsibility of the user and not of the system administrator.
15
16The description below assume that ./configure of GNU APL was executed without a
17prefix= option. If the prefix option was used then some of the paths further
18down in this document may differ accordingly.
19
20The "make install" procedure should have created a directory
21
22        /usr/local/etc/gnu-apl.d
23
24        or
25
26        /etc/gnu-apl.d
27
28
29This directory contains:
30
31        keyboard1.txt           a default USA PC104 keyboard layout
32        keyboard2.txt           a default International PC105 layout
33        parallel_thresholds     a presentation settings for apl  multitasking
34        preferences             a file to tailor apl for your system
35
36This next section describes configuring GNU-APL using the preferences file.
37The preference file comes pre-configured, but in some instances, the
38global contents may not suit your requirements. One example, is that
39you need to maintain a private copy of some workspaces, or modify apl actions.
40
41In this situation you may choose to create a directory with a copy of above
42directory contents below your home directory. If so, then the name of that
43directory should be $(HOME)/.config/gnu-apl/. The easiest way of creating
44this directory and its initial content is the shell command:
45
46    cp -dR /etc/gnu-apl.d $HOME/.config/gnu-apl
47
48The command may be somewhat different, for example if you used non-default
49directories in your ./configure command.
50
51
521.1   KEYBOARDS
53===============
54There are two physical keyboards predominately in use. One is the popular
55American  keyboard layout, model pc104, shown below as Keyboard1.txt:
56
57PC104 USA Standard Keyboard:
58===========================
59╔════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦═════════╗
60║ ~  ║ !⌶ ║ @⍫ ║ #⍒ ║ $⍋ ║ %⌽ ║ ^⍉ ║ &⊖ ║ *⍟ ║ (⍱ ║ )⍲ ║ _! ║ +⌹ ║         ║
61║ `◊ ║ 1¨ ║ 2¯ ║ 3< ║ 4≤ ║ 5= ║ 6≥ ║ 7> ║ 8≠ ║ 9∨ ║ 0∧ ║ -× ║ =÷ ║ BACKSP  ║
62╠════╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦══════╣
63║       ║ Q  ║ W⍹ ║ E⍷ ║ R  ║ T⍨ ║ Y¥ ║ U  ║ I⍸ ║ O⍥ ║ P⍣ ║ {⍞ ║ }⍬ ║  |⊣  ║
64║  TAB  ║ q? ║ w⍵ ║ e∈ ║ r⍴ ║ t∼ ║ y↑ ║ u↓ ║ i⍳ ║ o○ ║ p⋆ ║ [← ║ ]→ ║  \⊢  ║
65╠═══════╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩══════╣
66║ (CAPS   ║ A⍶ ║ S  ║ D  ║ F  ║ G  ║ H  ║ J⍤ ║ K  ║ L⌷ ║ :≡ ║ "≢ ║         ║
67║  LOCK)  ║ a⍺ ║ s⌈ ║ d⌊ ║ f_ ║ g∇ ║ h∆ ║ j∘ ║ k' ║ l⎕ ║ ;⍎ ║ '⍕ ║ RETURN  ║
68╠═════════╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═════════╣
69║             ║ Z  ║ Xχ ║ C¢ ║ V  ║ B£ ║ N  ║ M  ║ <⍪ ║ >⍙ ║ ?⍠ ║          ║
70║  SHIFT      ║ z⊂ ║ x⊃ ║ c∩ ║ v∪ ║ b⊥ ║ n⊤ ║ m| ║ ,⍝ ║ .⍀ ║ /⌿ ║  SHIFT   ║
71╚═════════════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩══════════╝
72
73The second physical layout, based on the international keyboard layout pc105
74is the following, shown as keyboard2.txt
75
76PC105 International standard Keyboard
77=====================================
78╔════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════╦════════════╗
79║ ~  ║ !⌶ ║ @⍫ ║ #⍒ ║ $⍋ ║ %⌽ ║ ^⍉ ║ &⊖ ║ *⍟ ║ (⍱ ║ )⍲ ║ _! ║ +⌹ ║            ║
80║ `◊ ║ 1¨ ║ 2¯ ║ 3< ║ 4≤ ║ 5= ║ 6≥ ║ 7> ║ 8≠ ║ 9∨ ║ 0∧ ║ -× ║ =÷ ║ BACKSP     ║
81╠════╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═╩══╦═════════╣
82║       ║ Q  ║ W⍹ ║ E⍷ ║ R  ║ T⍨ ║ Y¥ ║ U  ║ I⍸ ║ O⍥ ║ P⍣ ║ {⍞ ║ }⍬ ║         ║
83║  TAB  ║ q? ║ w⍵ ║ e∈ ║ r⍴ ║ t∼ ║ y↑ ║ u↓ ║ i⍳ ║ o○ ║ p⋆ ║ [← ║ ]→ ║ RETURN  ║
84╠═══════╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╦══╩═╗       ║
85║ (CAPS   ║ A⍶ ║ S  ║ D  ║ F  ║ G  ║ H  ║ J⍤ ║ K⌸ ║ L⌷ ║ :≡ ║ "≢ ║ |⊣ ║       ║
86║  LOCK)  ║ a⍺ ║ s⌈ ║ d⌊ ║ f_ ║ g∇ ║ h∆ ║ j∘ ║ k' ║ l⎕ ║ ;⍎ ║ '⍕ ║ \⊢ ║       ║
87╠════════╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩═══╦╩════╩═══════╣
88║        ║ < ¦║ Z  ║ Xχ ║ C¢ ║ V  ║ B£ ║ N  ║ M  ║ <⍪ ║ >⍙ ║ ?⍠ ║             ║
89║  SHIFT ║ > °║ z⊂ ║ x⊃ ║ c∩ ║ v∪ ║ b⊥ ║ n⊤ ║ m| ║ ,⍝ ║ .⍀ ║ /⌿ ║  SHIFT      ║
90╚════════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩════╩═════════════╝
91
92The 'preference' file will have a parameter setting to select one or other
93layout. More about this later.
94
95
962.0 The preferences file(s)
97===========================
98
992.1  Introduction
100=================
101The 'preferences' files contain parameters settings that control the behavior
102of the GNU APL interpreter. Most of the setting can also be controlled by
103corresponding command line options, but for most settings it is more convenient
104to specify them once in one of the preferences files than by command line
105options in every invocation of GNU APL.
106
107The settings will allow you to:
108
109    o   set text and background colors,
110    o   assign directories and workspace locations,
111    o   location of logs and history file(s), and
112    o   other operational parameters.
113
114
115The 'preferences' file should reside:
116
117 (1) in directory GNU-APL.d of the system configuration directory. or
118 (2) in directory .GNU-APL in the user's home directory.
119 (3) in both mentioned directories (see below)
120
121 In both cases the configuration file name within each must be 'preferences'
122
123The system configuration directory is usually for GNU/Linux is /usr/local/etc/
124or  /etc. During the setup of GNU-APL (refer to README-2-configuration) you have
125the  opportunity to choose a different location. It can be overridden at compile
126time by
127
128  (a)  ./configure --sysconfdir=somewhere-else
129  (b)  ./configure --sysconfdir=/home(yourlogon)/.GNU-APL
130
131
1322.2 Local version of preferences.
133=================================
134To create your own preference file, create the following directory.
135
136     /home(yourlogon)/.gnu-apl
137
138copy the system installed /usr/local/etc/gnu-apl.d  to
139
140     /home(yourlogon)/.gnu-apl
141
142
143If both your own preference file and the "gnu-apl.d" are present
144in their respective directories then the local copy overrides
145the settings common to both files.
146
147Command line options take precedence over settings made in any of these files.
148
149The initial content of this 'preference. file contains a commented list of all
150possible settings. You should not remove parameter setting lines but rather
151comment or uncomment them.
152
153The balance of this README-9 file describes the parameter setting for GNU-APL.
154
1553.0   WELCOME MESSAGE
156=====================
157By default GNU-APL displays a welcome message on start-up.
158Usually you will set it once and forget about it.
159
160The corresponding command line option for no welcome message is --silent.
161
162The default setting in the preferences file(s) is:
163#
164  Welcome       Yes     (default)
165# Welcome       No
166#
167
168
1693.1   OUTPUT COLORING
170======================
171The default GNU-APL configuration as delivered, is tailored for terminals
172displaying a white background. The background colors that APL will use can be
173overwritten.
174
175There are options to switch to black background, to no colors,
176or to even allow coloring of GNU-APL displayed output.
177
178Output coloring will cause problems when, for example:
179
180 (a) you run GNU APL as script
181 (b) you use a black background
182 (c) you run GNU APL from emacs
183 (d) you run GNU APL from a different terminal than color xterm
184
185In case (a) you should use the --script command line option and
186leave the Color setting as defaulted (see #2 below).
187
188In cases (b), (c), and (d) you can uncomment the 'Color No' line below.
189This only affects the initial state of output coloring; you can
190re-enable colors later with APL command ]XTERM ON.
191
192The corresponding command line options are --Color and --noColor
193
194If your terminal does not understand the ANSI escape sequences,
195or if you prefer not to provide escape sequences, then you can set the
196color parameter to CURSES. and set color numbers to escape sequences as shown
197below.  This setting  requires that certain environment variables (e.g. TERM)
198are set properly and that your system's terminfo database contains correct
199terminal type definitions for  your choice.
200
201The default setting in the preferences file(s) is:
202#
203  Color         ANSI (default)
204# Color         CURSES
205# Color         No
206#
207
208
209After starting APL you may want to disable coloring initially, but switch
210to curses the command ]COLOR  can be given later on. you can enter the
211color command twice:
212
213        ]color
214        ]COLOR ON
215        ]color off
216        ]color
217        ]COLOR/XTERM OFF
218
219
2203.2  GNU-APL Terminal handling
221==============================
222GNU-APL has one input and 4 output channels called CIN, COUT, CERR, and UERR
223
224 -  CIN  is the input channel and output. It echos the input typed by the user,
225 -  COUT is the normal output of the APL interpreter,
226 -  CERR is additional error information, in particular logging.
227 -  UERR is output of the APL interpreter containing error messages,
228
229CIN, COUT, and UERR write to default stdout while CERR writes to stderr.
230Normally stdout and stderr are both displayed on the same terminal,
231but output redirection as shown can make a difference. An example
232of CERR redirection is:
233
234           apl 2>MyErrorLog.txt
235
236
237When the interpreter changes from one output channel to another, for
238instance from CIN to COUT after the user has entered a line, then an
239escape sequence (actually, any short sequence of characters) is sent
240to the real output channel (i,e. stdout or stderr). The new channel
241determines which sequence is sent:
242
243 -  CIN:   CIN-SEQUENCE  CLEAR-EOL
244 -  COUT:  COUT-SEQUENCE CLEAR-EOL
245 -  CERR:  CERR-SEQUENCE CLEAR-EOL
246 - UCERR:  UERR-SEQUENCE CLEAR-EOL
247
248
249
2503.3   OUTPUT COLOR ESCAPE SEQUENCES FOR ANSI TERMINALS
251======================================================
252
253Output coloring is implemented as described below,
254When the interpreter exists, then the sequence
255
256        RESET-SEQUENCE CLEAR-EOL
257
258is sent to the terminal to cause it to set its the display colors
259to their initial state.
260
261The reason for sending CLEAR-EOL (i.e. clear to end of line) is to color
262the entire next line not only the chars printed on the next line.
263
264Unfortunately it is difficult, if not impossible, to read the current
265color setting from the terminal. Therefore the following is assumed:
266
267GNU-APL is started in a color xterm with white background".
268
269Color xterm is a VT100 (or ANSI) compatible terminal emulation.
270If this assumption is correct, then everything should be fine. Otherwise
271you may want to change the escape sequence sent to the terminal.
272
273The numbers below are the hexadecimal values of the bytes sent to the terminal;
27427 (hexadecimal 1b) is the escape character, for example. In order to
275change some or all sequences, uncomment the corresponding line
276and change the hex numbers (most likely the columns background
277and foreground).  Each sequence can be up to 20 characters long.
278By the way  // refers to the start of comments placed to the right
279of the terminal control sequence. The octothorpe (#) is the
280character placed at the left margin.
281
282The default setting in the preferences file(s) is:
283#
284#               VT100:          foreground        background
285#                               color    |        |    color
286#                                        V        V
287# //                    ESC  [  0  ;  3 fg  ;  4 bg  m
288# CIN-SEQUENCE           1b 5b 30 3b 33 30 3b 34 37 6d    // ESC [0;30;47m
289# COUT-SEQUENCE          1b 5b 30 3b 33 30 3b 34 38 6d    // ESC [0;30;48m
290# CERR-SEQUENCE          1b 5b 30 3b 33 35 3b 34 38 6d    // ESC [0;35;48m
291# UERR-SEQUENCE          1b 5b 30 3b 33 35 3b 34 38 6d    // ESC [0;35;48m
292# RESET-SEQUENCE         1b 5b 30 3b 33 39 3b 34 39 6d    // ESC [0;39;49m
293# CLEAR-EOL-SEQUENCE     1b 5b 4B                         // ESC [K
294# CLEAR-EOS-SEQUENCE     1b 5b 4A                         // ESC [J
295#
296# On a black background (still assuming VT100 so that the CLEAR-EOL-SEQUENCE
297# does not need to be re-defined), the following may be more suitable:
298#
299# CIN-SEQUENCE           1b 5b 30 3b 33 32 3b 34 30 6d    // ESC [0;32;40m
300# COUT-SEQUENCE          1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;40m
301# CERR-SEQUENCE          1b 5b 30 3b 33 31 3b 34 30 6d    // ESC [0;31;40m
302# UERR-SEQUENCE          1b 5b 30 3b 33 31 3b 34 30 6d    // ESC [0;31;40m
303# RESET-SEQUENCE         1b 5b 30 3b 33 37 3b 34 30 6d    // ESC [0;37;48m
304#
305#
306Since all lines are commented out, the ESC sequences assumed by the interpreter
307are used. The lines are only shown as template the ESC sequences of the actual
308terminal.
309
310
3113.4   OUTPUT COLOR NUMBER FOR CURSES
312====================================
313There is second way of specifying colors that uses the curses library.
314Instead of specifying the escape sequences sent to the terminal you
315only need to specify the colors wanted and curses will provide the escape
316sequences needed.
317
318The default setting in the preferences file(s) is:
319# Numbers for colors seem to be (nota bene: the author is color-blind):
320#
321# 0: black
322# 1: blue
323# 2: green
324# 3: cyan
325# 4: red
326# 5: magenta
327# 6: yellow
328# 7: white
329#
330# The colors are specified as numbers like this:
331#
332# CIN-FOREGROUND  0
333# CIN-BACKGROUND  7
334# COUT-FOREGROUND 2
335# COUT-BACKGROUND 7
336# CERR-FOREGROUND 5
337# CERR-BACKGROUND 8
338# UERR-FOREGROUND 5
339# UERR-BACKGROUND 8
340#
341# or, for dark background:
342#
343# CIN-FOREGROUND  2
344# CIN-BACKGROUND  0
345# COUT-FOREGROUND 7
346# COUT-BACKGROUND 0
347# CERR-FOREGROUND 5
348# CERR-BACKGROUND 0
349# UERR-FOREGROUND 5
350# UERR-BACKGROUND 0
351#
352
353Do not mix the two methods (escape sequences vs. color numbers).
354If they are mixed then the last entry processed in this file determines
355which method will be used. Also, the numbers for colors are different
356in each method.
357
358
3593.5   INPUT ESC SEQUENCES
360=========================
361
362Below is a brief explanation of how you can configure the ESC (escape or other)
363sequence sent by the terminal's  cursor-up,  cursor-down, cursor-left,
364cursor-right, Home, End, Ins, and Del keys.
365
366The sequences can be set explicitly (in the following) or via CURSES
367The latter (CURSES) may fail to work because the sequences reported by
368CURSES may be different from the sequences sent by the keyboard.
369
370The default setting in the preferences file(s) is:
371#
372  Keyboard      NOCURSES (default)
373# Keyboard      CURSES
374#
375# KEY-CURSOR-UP          1b 5b 41
376# KEY-CURSOR-DOWN        1b 5b 42
377# KEY-CURSOR-RIGHT       1b 5b 43
378# KEY-CURSOR-LEFT        1b 5b 44
379# KEY-CURSOR-END         1b 5b 46
380# KEY-CURSOR-HOME        1b 5b 48
381# KEY-INSMODE            1b 5b 32 7e
382# KEY-DELETE             1b 5b 33 7e
383#
384
385
3863.6   SHARED VARIABLES
387======================
388Shared variables are perhaps a feature with which you may not be familiar.
389To work with certain software packages on the host computer, your program
390must follow a discipline. The variables involved with this discipline are
391listed below.
392
393Shared variables are represented by:
394offer to share          (⎕SVO),
395share var retraction    (⎕SVR),
396shared variable Control (⎕SVC),
397shared variable Query   (⎕SVQ),
398shared variable State   (⎕SVS)
399
400Using 'Shared variables' starts (forks) an independent helper process (APserver)
401to communicate with other APL processors.
402
403If you do not need all the above functions then you can (and should) prevent
404accidental starting of the APserver by setting SharedVars to Disabled. If
405SharedVars are disabled  then GNU APL starts a little faster and, of course,
406⎕SVO and friends won't work.
407
408The default setting in the preferences file(s) is:
409# The corresponding command line options are --SV and --noSV
410#
411  SharedVars    Enabled     (default)
412# SharedVars    Disabled
413
414
415
4163.7   LOGGING FACILITIES
417=========================
418By default, dynamic logging is disabled and the following settings have no
419effect.
420
421Logging is a facility that is occasionally used for debugging purposes. As
422a regular user, you should have no requirement to make use of dynamic logging.
423
424To enable dynamic logging, you must recompile the interpreter,specifying
425dynamic logging. The following three steps are required.
426
427  ./configure DYNAMIC_LOG_WANTED=yes <... other configure options>
428   make
429   make install (or try: src/apl)
430
431Otherwise you can specify the Logging facilities (numbered 1-43 or more)
432that can be enabled when the APL interpreter starts, This option can
433be used several times.
434
435Checkout the GNU-APL command ]LOG for available logging facilities
436
437The corresponding command line option is -l <num>
438
439 Logging 1
440 Logging 2
441 ...
442 Logging 37
443
444
4453.7    APL LIBRARIES
446====================
447
448GNU-APL uses library numbers from 0 to 9 in commands )LOAD, )SAVE, and )COPY,
449library 0, if enabled (see below) refers to our own collection of apl
450workspaces.
451
452For
453example 1:
454
455 )LOAD 1 workspace
456
457example 2:
458  Interpreter commands )IN and )OUT use library number 0 implicitly;
459  )LOAD, )SAVE, and )COPY use  library number 0 implicitly when no
460  library number is given.
461
462WARNING: Each library(directory) assigned to LIBREF-0 must be unshared and
463unique.
464
465For example, issuing the  ")CONTINUE" command, results in storing the CONTINUE
466workspace therein. Storing CONTINUE will overwrite the previously one. Sharing
467the default LIBREF-0 library among different users will likely to have
468very undesirable effects.
469
470Within the preferences file, the directories corresponding to the
471library numbers can be configured as shown below.
472
473Library numbers 3, 4, and 5 are used (and often overridden!) to store libraries
474that are shipped with GNU APL. )SAVEing or )DUMPing workspaces into these
475directories is therefore a bad idea.
476
477If GNU APL is used by different programmers on the same machine, then the
478following scheme for library reference numbers is recommended:
479
4800  for workspaces that are only accessible by one user (or, in GNU/Linux terms,
481   by the owner of the file), This directory typically exists somewhere below
482   $HOME.
483
4841  for workspaces that are only accessible by the group (normally the GNU/Linux
485   group to which the user belongs).
486
4872  for workspaces that are readable by every user on the machine.
488
489In other words: the library numbers 0, 1, and 2 correspond to the 'owner',
490'group', and 'all' permissions of the files respectively. However,
491GNU APL does not set these permissions based on the library numbers (because
492all this is only a recommended convention), and the users or group members
493are responsible for setting permissions on workspace files or directories.
494
495For GNU/Linux machines that are only used by a single user, the user may
496set up the directories libraries 0-2 and 6-9 as needed.
497
498The default setting in the preferences file(s) reflects the above scheme
499(although commented out) and only sets up the directories for libraries that
500are installed by GNU APL itself. For example (details may vary due to
501./configure options):
502#
503# LIBREF-0 /home/xyz/my-own-libs
504# LIBREF-1 /home/xyz/my-group-libs
505# LIBREF-2 /group/abc/other-libs
506  LIBREF-3 /usr/local/lib/apl/wslib3
507  LIBREF-4 /usr/local/lib/apl/wslib4
508  LIBREF-5 /usr/local/lib/apl/wslib5
509# LIBREF-6 /usr/lib/gnu-apl/lib-6
510# LIBREF-7 /usr/lib/gnu-apl/lib-7
511# LIBREF-8 /usr/lib/gnu-apl/lib-8
512# LIBREF-9 /usr/lib/gnu-apl/lib-9
513#
514
5153.8   READLINE HISTORY PARAMETERS
516=================================
517
518GNU APL can provide a history of lines entered by the user in immediate
519execution mode and ∇-edit mode.
520
521As shown below, the number of history lines and the location of the history
522file can be configured. Some users prefer to have only one history file (and
523in that case $HOME/.config/gnu-apl/apl.history might be a suitable file name).
524
525Other users prefer to have a history file in the current directory so that they
526can work in different APL projects in parallel and have separate histories,
527one for each project. In that case, .apl.history is a better choice for the
528file name, because the file is hidden and relative. This is also the
529default in the poreference file(s):
530
531READLINE_HISTORY_LEN  500
532READLINE_HISTORY_PATH .apl.history
533
534
535The history can serve two purposes: to recall lines that were previously
536entered and to list what was recently done (with the apl )HISTORY command).
537For the latter purpose it is normally convenient to show the new ⎕CR of a
538function  that was edited instead of the command that started the editor.
539The following  parameter controls whether the editor command (like ∇foo )
540or the new ⎕CR of the function shall be inserted into the history.
541
5423.9   EDITOR OPTIONS
543====================
544GNU-APL comes with a built-in editor. The following setting controls which
545of the lines that were entered in function editing mode are being inserted
546into the history.
547
548The default ('Modified') line setting causes only modified lines to be inserted.
549With that setting, one can cut-and-paste from a history file into an
550interactive session in order to 'redo' a function modification. The 'Always'
551setting restores the edited function regardless of its current state. The
552'Never' setting is useful for automated test scripts because it avoids
553redundancy in the log files produced.
554
555was opened for editing, but not changed and the new ⎕CR if the function was
556changed.
557
558The default setting in the preferences file(s) is:
559#
560# NABLA-TO-HISTORY  Never
561  NABLA-TO-HISTORY  Modified (default)
562# NABLA-TO-HISTORY  Always
563#
564
565
5663.10   BACKUP OPERATIONS
567========================
568In general, if one is modifying a workspace, it is best to load it and
569immediately resave it under a new name. The GNU-APL options available are to
570create a backup before a )SAVE or )DUMP WORKSPACE command.
571The workspace created by )CONTINUE is saved, but not backed up.
572
573The default setting in the preferences file(s) is:
574#
575BACKUP_BEFORE_SAVE  yes
576#
577
578To recover a backup workspace, refer to the LIBREF-0 option chosen
579Change to the directory indicated. Therein you will see the workspace
580you were using and the same workspace with a .bak  appended
581example: consider a recovery action for the 'meta' workspace
582In the directory referred to by LIBREF-0 you would note
583
584    meta.xml   meta.xml.bak
585
586For example,  delete the meta.xml or rename it to something else.
587Restore the original  meta.xml  rename the meta.xml.bak to meta.xml
588
589
5903.11    KEYBOARD LAYOUT
591=======================
592GNU APL assumes a particular layout of your keyboard (and assumes that you
593do your best to obtain that layout). That assumed layout is shown when you
594give the ]KEYB command.
595
596If your physical keyboard layout differs from the assumed keyboard for some
597reason, then the ]KEYB command will show the wrong layout. You can correct
598this difference providing your own keyboard file which (when specified) is
599shown by the
600
601     ]KEYB command instead of the assumed layout.
602
603You can choose between one of the files called 'keyboard1.txt' or keyboard2.txt.
604If your computer has a different keyboard layout, you may create your own
605version as keyboard.txt and revise the parameter as shown in the following:
606
607#
608# KEYBOARD_LAYOUT_FILE  /etc/gnu-apl.d/keyboard1.txt
609#
610
61112.0  Abnormal Termination
612==========================
613
614Normally you exit GNU APL by issuing the command )OFF. Hitting ^D
615(aka. end-of-input) once can be used to end the execution of most other
616programs, but has no effect in GNU APL.
617
618You can make GNU APL exit after a number of consecutive ^Ds  by specifying
619a (small) positive number as shown below Note that the interpreter will always
620exit if a large number of ^Ds (or EOFs) are read-in in rapid succession.
621NB: ^Ds may exist within a script and need not be entered via the keyboard.
622Setting the value to zero establishes the system default.
623
624#CONTROL-Ds-TO-EXIT 7
625 CONTROL-Ds-TO-EXIT 0
626
62713.0    Default Print Width
628===========================
629
630GNU-APL defaults the ⎕PW to 80
631
632If the terminal that you normally use has fewer or more columns, then you
633may want to specify a different initial value for ⎕PW below. A further option
634is the Windows Change (WINCH setting).
635
636With the WINCH-Setting option, on startup you can cause the Window Change
637(WINCH) signal (which is sent, for example, if the size of a window is
638changed) to set ⎕PW to the terminal width setting contained in the WINCH signal.
639
640The intended effect is that re-sizing of the terminal window will cause GNU-APL
641to adapt itself to the new window size. This appears to work on  GNU/Linux but
642may not work on other platforms! USE AT YOUR OWN RISK.
643
644# INITIAL-⎕PW 80
645# WINCH-SETS-⎕PW  Yes
646
647
648
64914.0  Security Settings
650=======================
651
652Under certain circumstances, for example if GNU APL is used as a CGI script
653for publicly accessible web pages, it may be desireable to disable certain
654capabilities that could otherwise be abused to access system resources via
655the GNU APL capabilities.
656
657The following lines show examples of GNU APL capabilities that can be
658disabled. The security settings are put into profile [1] which means that
659they only have an effect if:
660
661 (1) GNU APL was ./configured with SECURITY_LEVEL_WANTED=1, and
662 (2) the profile (i.e the -p command line option) with which GNU APL was
663     started matches the profile for which the setting was made (if any)
664
665If a disabled capability is being used then it will throw a DOMAIN_ERROR
666and the )MORE command will indicate a security violation. For example:
667
668#
669Profile 1
670  disable_Quad_SQL          yes    # disable ⎕SQL
671  disable_Quad_FIO          no     # do not disable ⎕FIO
672  disable_native_functions  yes    # disable A ⎕FX B (native fnctions)
673
674