bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] Workspace and wslib? search path


From: Juergen Sauermann
Subject: Re: [Bug-apl] Workspace and wslib? search path
Date: Mon, 26 Jun 2017 18:05:11 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

Hi Fred,

correct. In APL_LIB_ROOT is not set and no preferences override any library paths, then
the first library above ./ that contains two files or sub-dirs named workspaces and wslib1 is
chosen as the library root.

The code is in file LibPaths.cc function LibPaths::search_APL_lib_root()

Hope it works,
/// Jürgen


On 06/26/2017 05:27 PM, Frederick Pitts wrote:
Hello Jürgen,

My bad. In my original post, I should have typed `)load' where I typed ')lib'. Thanks for the detailed reply. I can
)save and )load workspaces now.

But I'm still confused about the following three sentences from `apl.html':

If an environment variable APL_LIB_ROOT is defined, then its value is used as library-root. Otherwise the path from the current directory (".") up to the root directory ("/") is searched until a directory containing two files ’workspaces’ and ’wslib1’ is found. Normally ’workspaces’ and ’wslib1’are directories, but for the computation of library-root files suffice.
This passage plus your explanation implies to me that if APL_LIB_ROOT is unset and there are no overrides in the preference
files, an attempt is made to determine the library-root by searching from the current directory '.' up to the root directory '/', stopping when the two directories or files `workspaces' and `wslib1' are found in the same directory. If this mechanism were to work the way I interpret the passage, as long as one works in subdirectories below one's library-root directory, the 0 .. 9 library numbers are meaningful without having to set APL_LIB_ROOT or preference override entries. And one would not have to use paths on the )lib and )load commands.

Regards,

Fred

On Mon, 2017-06-26 at 12:11 +0200, Juergen Sauermann wrote:
Hi Fred,

conceptually the )libs command shows the directories that will be used
for the different library numbers (ranging from 0-9 with 0 being the default
library number of none is given).

The other (non-library number) argument of the lib command is a directory, and
to be distinguished from a library reference number it should contain a /.

I suppose the first thing going wrong in your examples below is that the )lib argument
seems to be a workspace name while the )lib command expects either a library reference
number like 0..9 or the path to a directory.

So if ../workspaces/ contains workspace plotsincos.xml then the command

)lib ../workspaces

should display it. For example:

      )host pwd
/home/eedjsa/projects/juergen/apl-1.7/src

0

      )lib ../
autom4te.cache/     debian/     debian_tmp/     devel_doc/
doc/                erlang/     ftp-upload/     gnu-apl.d/
html/               m4/         rpm/            src/
support-files/      tools/      web-home/       workspaces/
wslib1/             wslib2/     wslib3/         wslib4/
wslib5/
      )lib ../workspaces
APL_CGI             LSQRL       RU1     RU2         RUBIK   SCRIPT
ScalarBenchmark     XSudoku     sudoku  sudoku_DLX  test    tt



Now the locations of library directories can be specified in different ways. The library root mechanism
assumes a single directory that contains (at least) two subdirectories named workspaces and wslib1.
These names come from the IBM APL2 interpreter which is using a similar scheme (but without giving
any rules for it).

GNU APL starts with this library root scheme, but each directory can be overridden by either the system's
preference file and/or the user's preference file. the )LIBS command then tells how the library paths for
the different library reference numbers were computed. For example:
---------------------------------------------------------------------------
Ref Conf  Path                                                State   Err
---------------------------------------------------------------------------
 0 BIN   /home/eedjsa/projects/juergen/apl-1.7/src/workspaces present
 1 BIN   /home/eedjsa/projects/juergen/apl-1.7/src/wslib1     present
 2 BIN   /home/eedjsa/projects/juergen/apl-1.7/src/wslib2     missing (2)
 3 PSYS  /usr/local/lib/apl/wslib3                            present
 4 PSYS  /usr/local/lib/apl/wslib4                            present
 5 PSYS  /usr/local/lib/apl/wslib5                            present
 6 BIN   /home/eedjsa/projects/juergen/apl-1.7/src/wslib6     missing (2)
 7 BIN   /home/eedjsa/projects/juergen/apl-1.7/src/wslib7     missing (2)
 8 BIN   /home/eedjsa/projects/juergen/apl-1.7/src/wslib8     missing (2)
 9 BIN   /home/eedjsa/projects/juergen/apl-1.7/src/wslib9     missing (2)
===========================================================================


This tells us that libraries 3, 4, and 5 were specified by PSYS (system preferences file, e.g.
/usr/local/etc/gnu-apl.d/preferences) while the others are computed from the current directory (BIN).
The State and Err columns tell if the directory is accessible and the errno if not.

If I remember correctly then the )lib command wants either a library reference number (0-9) or a
path, but not both. If it fails, then )more tells which directory was tried (I fixed the spelling mistake)
and the strerror(errno) of the failed operation:

      )lib xxx
IMPROPER LIBRARY REFERENCE 'xxx': No such file or directory
      )more
path 'xxx' could not be openend as directory: No such file or directory

Best Regards,
/// Jürgen


On 06/26/2017 06:07 AM, Frederick Pitts wrote:
Hello Jürgen,

	The apl.html doc indicates that if environment variable
APL_LIB_ROOT is not defined, the subject search path will be from the
current directory '.' up to the root directory '/' stopping when a
directory containing two directories ’workspaces’ and ’wslib1’ is
found.

	The above does not work on my platform, Fedora 25. For
instance, 'plotsincos.xml' is in ../workspaces relative the current
directory.

	)lib plotsincos

yields

IMPROPER LIBRARY REFERENCE 'plotsincos': No such file or directory

and

	)lib 0 plotsincos

yields

IMPROPER LIBRARY REFERENCE '0': No such file or directory.

Is this a bug or has the feature been removed and the documentation is
out of date.

	A related question is if the feature were to work correctly,
would the )libs command use the feature so its output reflects the
location of the library directory paths that will be used by the )lib
command.  Currently, it does not.

Regards,

Fred





reply via email to

[Prev in Thread] Current Thread [Next in Thread]