The Predefined Variable libname
|
Description
|
|
•
|
This special name specifies the file-system location of the main Maple library and other libraries such as package libraries and user libraries. Its value is normally a single string. By setting libname to a sequence of strings, you can specify locations that are sequentially searched for routines. Each location must be a directory that contains a hierarchy of Maple .m files or Maple archives, or the full path of the .mla or .lib file of a Maple archive (see march).
|
•
|
A repository can be created using the command march('create',"filename"), where "filename" is a string specifying the location of a .mla or .lib file. Name/value pairs can be saved in a library by setting the global variable savelibname, and calling savelib('name') (see savelib). Values can be retrieved from a repository by assigning libname := (libname, "filename"). After "filename", or the directory containing "filename" is in your library search path, the name/value pairs stored in that repository are automatically assigned. For example, the following sequence of commands shows how to create a repository, save a procedure named dostuff, and access it after restart.
|
> march('create',"/home/user.mla");
|
> dostuff := proc(x) x^2; end proc:
|
> savelibname := "/home/user.mla":
|
> savelib('dostuff'):
|
> restart;
|
> libname := libname, "/home/user.mla":
|
> dostuff(3);
|
9
|
|
|
•
|
When the value of libname is a sequence of strings (directory paths or .mla and .lib file paths), Maple searches the specified libraries (in the order specified by the sequence) for the named routine or package of routines. If a directory contains more than one library, Maple searches the libraries in the priority order specified in the archive. For more details on archive priority, see march. For example, the commands:
|
> libname := "/usr/me/mylib/joe.mla","/usr/maple/lib";
|
> myexpand;
|
|
|
|
result in the two specified locations being searched for a definition of myexpand in a file or a member named myexpand.m. First the single library "joe.mla" in the directory "/user/me/mylib" is searched, and then, if necessary, the libraries in the directory "/usr/maple/lib" are searched. The search is terminated on its first success. In particular, this mechanism allows for easy additions or replacements to the main library.
|
•
|
To see its current value, enter libname; at the Maple prompt. Notice that any names assigned to libname are converted to strings.
|
•
|
The current directory, "." will appear in the default value of libname. Any .mla in the current directory will be found, and the things stored inside will be available for use. Using the currentdir command to change the working directory will cause an implicit update of libname, making the libraries in the new directory available instead of the ones from the prior path.
|
•
|
The libraries of any installed toolboxes are appended to libname in alphabetical order by toolbox directory name, based on the notion of ordering in a standard directory in the local operating system.
|
•
|
Users can assign an initial value for libname on the command line or in their initialization files. See maple for details. Automatic loading of Maple library functions is accomplished by using this global variable, so users are advised not to change it in the middle of a session.
|
|
|