1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) DIGITEO - Scilab Consortium
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2019 - Samuel GOUGEON
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
18 xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
19 xml:lang="en" xml:id="libraryinfo">
21 <refname>libraryinfo</refname>
22 <refpurpose>gets the path and the set of primary functions of a loaded library</refpurpose>
27 macros = libraryinfo(libraryname)
28 [macros, libpath] = libraryinfo(libraryname)
32 <title>Arguments</title>
35 <term>libraryname</term>
37 <para>string: name of the loaded library.</para>
45 <para>column of strings: names of main functions belonging to the library.</para>
53 <para>string: path to the lib file of the library.</para>
59 <title>Description</title>
61 gets the names of the functions (written in Scilab language) belonging to the given
62 library, and the path of the directory where their *.sci files and the lib file
63 are stored. Subsidiary functions that may follow the main ones in .sci files
64 are private and are not returned.
66 Only loaded libraries can be addressed by <literal>libraryinfo()</literal>.
70 <title>Getting some library info from its handle</title>
72 <literal>libraryinfo()</literal> works from the literal name of the library.
73 In some cases, we may have only its handle, defined when loading the library.
74 For instance, <literal>libraryinfo("iolib")</literal> works,
75 <literal>libraryinfo(iolib)</literal> does not.
76 How to use the handle to get any info? Let's go on with the <literal>iolib</literal>
80 <emphasis role="bold">Getting the path</emphasis>:
81 <literal>libpath = string(iolib)(1)</literal>
84 <emphasis role="bold">Getting the column vector of members functions</emphasis>:
85 <literal>functions = string(iolib)(2:$)</literal>
88 <emphasis role="bold">Getting the literal name of the library</emphasis>:
89 <literal>libraryname = xmlGetValues("//scilablib", "name", libpath)</literal>
95 <title>Unloaded library: getting info through its path</title>
97 If the considered library is not loaded, neither <literal>libraryinfo()</literal>
98 nor <literal>string()</literal> can work.
101 Provided that we know its libpath, we then can
104 <emphasis role="bold">get its literal name</emphasis>:
105 <literal>xmlGetValues("//scilablib", "name", libpath+"/lib")</literal>
108 <emphasis role="bold">get the column vector of members functions</emphasis>:
109 <literal>functions = xmlGetValues("//scilablib/macro", "name", libpath+"/lib")</literal>
116 <title>Examples</title>
118 With libraryinfo(), from the literal library name:
120 <programlisting role="example"><![CDATA[
121 [f, p] = libraryinfo("iolib")
124 --> [f, p] = libraryinfo("iolib")
126 SCI\modules\io\macros\
138 From the library handle:
140 <programlisting role="example"><![CDATA[
144 // Catch info into variables:
146 f = string(iolib)(2:$)
147 libname = xmlGetValues("//scilablib", "name", p+"/lib")
150 --> // Just for display:
154 Functions files location : SCI\modules\io\macros\.
155 input unix_g unix_w %_sodload unix_x unix_s
157 --> // Catch info into variables:
158 --> p = string(iolib)(1)
160 SCI\modules\io\macros\
162 --> f = string(iolib)(2:$)
171 --> libname = xmlGetValues("//scilablib", "name", p+"/lib")
177 For a not-loaded library, from its path:
179 <programlisting role="example"><![CDATA[
180 path = fullpath("SCI/modules/scicos_blocks/macros/Hydraulics");
181 libname = xmlGetValues("//scilablib", "name", path+"/lib")
182 functions = xmlGetValues("//scilablib/macro", "name", path+"/lib")
183 Hydraulicslib // not-loaded (Xcos must have not been run)
186 --> libname = xmlGetValues("//scilablib", "name", path+"/lib")
190 --> functions = xmlGetValues("//scilablib/macro", "name", path+"/lib")
200 Undefined variable: Hydraulicslib
203 <refsection role="see also">
204 <title>See also</title>
205 <simplelist type="inline">
207 <link linkend="string">string</link>
210 <link linkend="load">load</link>
213 <link linkend="librarieslist">librarieslist</link>
216 <link linkend="whereis">whereis</link>