Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский
Scilabヘルプ >> Functions > Libraries > libraryinfo

libraryinfo

マクロとscilabライブラリのパスを取得

呼び出し手順

macros = libraryinfo(libraryname)
[macros,path] = libraryinfo(libraryname)

引数

libraryname

文字列 (ライブラリ名)

macros

文字列行列 (ライブラリの全ての主関数)

path

文字列 (ライブラリのパス)

説明

指定したScilabライブラリの関数名とパスを取得します. 返される関数名は対応する .sci または .bin のファイルの名前 に一致します. その他の名前は補助関数です.

Only loaded libraries can be addressed by libraryinfo().

Getting some library info from its handle

libraryinfo() works from the literal name of the library. In some cases, we may have only its handle, defined when loading the library. For instance, libraryinfo("iolib") works, libraryinfo(iolib) does not. How to use the handle to get any info? Let's go on with the iolib example:

  • Getting the path: libpath = string(iolib)(1)
  • Getting the column vector of members functions: functions = string(iolib)(2:$)
  • Getting the literal name of the library: libraryname = xmlGetValues("//scilablib", "name", libpath)

Unloaded library: getting info through its path

If the considered library is not loaded, neither libraryinfo() nor string() can work.

Provided that we know its libpath, we then can

  • get its literal name: xmlGetValues("//scilablib", "name", libpath+"/lib")
  • get the column vector of members functions: functions = xmlGetValues("//scilablib/macro", "name", libpath+"/lib")

With libraryinfo(), from the literal library name:

[f, p] = libraryinfo("iolib")
--> [f, p] = libraryinfo("iolib")
 p  =
 SCI\modules\io\macros\

 f  =
!input      !
!unix_g     !
!unix_w     !
!%_sodload  !
!unix_x     !
!unix_s     !

From the library handle:

// Just for display:
iolib

// Catch info into variables:
p = string(iolib)(1)
f = string(iolib)(2:$)
libname = xmlGetValues("//scilablib", "name", p+"/lib")
--> // Just for display:
--> iolib

 iolib  =
Functions files location : SCI\modules\io\macros\.
input  unix_g  unix_w  %_sodload  unix_x  unix_s

--> // Catch info into variables:
--> p = string(iolib)(1)
 p  =
 SCI\modules\io\macros\

--> f = string(iolib)(2:$)
 f  =
!input      !
!unix_g     !
!unix_w     !
!%_sodload  !
!unix_x     !
!unix_s     !

--> libname = xmlGetValues("//scilablib", "name", p+"/lib")
 libname  =
 iolib

For a not-loaded library, from its path:

path = fullpath("SCI/modules/scicos_blocks/macros/Hydraulics");
libname = xmlGetValues("//scilablib", "name", path+"/lib")
functions = xmlGetValues("//scilablib/macro", "name", path+"/lib")
Hydraulicslib  // not-loaded (Xcos must have not been run)
--> libname = xmlGetValues("//scilablib", "name", path+"/lib")
 libname  =
 Hydraulicslib

--> functions = xmlGetValues("//scilablib/macro", "name", path+"/lib")
 functions  =
!Bache          !
!Flowmeter      !
!PerteDP        !
!PuitsP         !
!SourceP        !
!VanneReglante  !

--> Hydraulicslib
未定義の変数: Hydraulicslib

参照

  • librarieslist — scilabライブラリを取得
  • whereis — Returns the name of the loaded library/module a given function belongs to
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Jul 20 11:20:47 CEST 2021