找回密码
 注册
查看: 2087|回复: 0

R语言:getNativeSymbolInfo()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 17:25:03 | 显示全部楼层 |阅读模式
getNativeSymbolInfo(base)
getNativeSymbolInfo()所属R语言包:base

                                         Obtain a Description of one or more Native (C/Fortran) Symbols
                                         获得一个或多个本地人(的C / Fortran)符号说明

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

This finds and returns as comprehensive a description of one or more dynamically loaded or "exported" built-in native symbols.  For each name, it returns information about the name of the symbol, the library in which it is located and, if available, the number of arguments it expects and by which interface it should be called (i.e .Call, .C, .Fortran, or .External). Additionally, it returns the address of the symbol and this can be passed to other C routines which can invoke.  Specifically, this provides a way to explicitly share symbols between different dynamically loaded package libraries.  Also, it provides a way to query where symbols were resolved, and aids diagnosing strange behavior associated with dynamic resolution.
这一发现,并返回作为全面描述一个或多个动态加载或“出口”内置的本地符号。对于每一个名字,它返回的符号的名称,它位于库的信息和参数的数量,如果可用,它希望由哪个接口,它应该被称为(即.Call,.C,.Fortran或.External)。此外,它返回的符号的地址,这可以通过其他C例程可以调用。具体来说,这提供了一种方法,明确不同的动态加载的包库之间共享的符号。此外,它提供了一种方法来查询符号被解决,有助于诊断奇怪的行为与动态分辨率。

This is vectorized in the name argument so can process multiple symbols in a single call.  The result is a list that can be indexed by the given symbol names.
这是在name参数量化,因此可以在一个单一的通话处理多个符号。其结果是,可以通过给定的符号名索引的列表。


用法----------Usage----------


getNativeSymbolInfo(name, PACKAGE, unlist = TRUE,
                    withRegistrationInfo = FALSE)



参数----------Arguments----------

参数:name
the name(s) of the native symbol(s) as used in a call to is.loaded, etc.  Note that Fortran symbols should be supplied as-is, not wrapped in symbol.For.  
用于在调用Fortran语言符号应提供的是,不裹is.loadedsymbol.For,等等。注意的本土符号(S)(S)的名称。


参数:PACKAGE
an optional argument that specifies to which DLL we restrict the search for this symbol.  If this is "base", we search in the R executable itself.
一个可选的参数指定的DLL我们限制此符号的搜索。如果这是"base",我们在R可执行文件本身的搜索。


参数:unlist
a logical value which controls how the result is returned if the function is called with the name of a single symbol. If unlist is TRUE and the number of symbol names in name is one, then the NativeSymbolInfo object is returned.  If it is FALSE, then a list of NativeSymbolInfo objects is returned. This is ignored if the number of symbols passed in name is more than one.  To be compatible with earlier versions of this function, this defaults to TRUE.  
一个逻辑值,它控制返回结果如何,如果函数被称为一个符号的名称。如果unlist是TRUE和符号名称name是一个,然后的NativeSymbolInfo对象返回。如果是的话FALSE,NativeSymbolInfo对象名单返回。这是被忽略的,如果name通过符号数是多个。为了兼容早期版本的这个功能,这个默认TRUE。


参数:withRegistrationInfo
a logical value indicating whether, if TRUE, to return information that was registered with R about the symbol and its parameter types if such information is available, or if FALSE to return the address of the symbol.  
一个逻辑值,该值指示是否,如果TRUE,返回符号和其参数类型与R注册,如果这些信息是可用的信息,或如果FALSE返回符号的地址。


Details

详情----------Details----------

This uses the same mechanism for resolving symbols as is used in all the native interfaces (.Call, etc.). If the symbol has been explicitly registered by the DLL in which it is contained, information about the number of arguments and the interface by which it should be called will be returned. Otherwise, a generic native symbol object is returned.
这将使用相同的机制,为解决在所有本地接口(的.Call,等)中使用的符号。如果符号已明确由包含它的DLL注册,有关数量的参数,它应该被称为接口的信息将被退回。否则,返回一个通用的本地符号对象。


值----------Value----------

Generally, a list of NativeSymbolInfo elements whose elements can be indexed by the elements of name  in the call.  Each NativeSymbolInfo object is a list containing the following elements:
一般而言,了NativeSymbolInfoname在通话的元素可以通过索引的元素,其元素的列表。每个NativeSymbolInfo对象是一个列表,其中包含下列元素:


参数:name
the name of the symbol, as given by the name argument.
符号的名称,由name论点。


参数:address
if withRegistrationInfo is FALSE, this is the native memory address of the symbol which can be used to invoke the routine, and also to compare with other symbol addresses.  This is an external pointer object and of class NativeSymbol. If withRegistrationInfo is TRUE and registration information is available for the symbol, then this is an object of class RegisteredNativeSymbol and is a reference to an internal data type that has access to the routine pointer and registration information.  This too can be used in calls to .Call, .C, .Fortran and .External.  
如果withRegistrationInfo是FALSE,这是本机内存可用于调用常规的符号地址,也与其他符号的地址。这是一个外部指针对象和类NativeSymbol。如果withRegistrationInfo是TRUE和登记信息是可用的符号,那么这是一个类RegisteredNativeSymbol“是一个内部的数据类型有常规指针访问的参考对象注册信息。这也可以用于在调用.Call,.C,.Fortran和.External。


参数:package
a list containing 3 elements:     
一个列表,其中包含3个元素:

namethe short form of the library name which can be used as the value of the PACKAGE argument in the different native interface functions.  
namethePACKAGE参数值在不同的原生接口功能,可作为使用库的名称的缩写形式。

paththe fully qualified name of the DLL.  
paththe完全合格的DLL的名称。

dynamicLookupa logical value indicating whether dynamic resolution is used when looking for symbols in this library, or only registered routines can be located.         
dynamicLookupa逻辑值,指明是否使用动态分辨率寻找这个库中的符号时,或仅注册的程序可以位于。

If the routine was explicitly registered by the dynamically loaded library, the list contains a fourth field
如果该例程是明确的动态加载库登记,列表中包含了第四场


参数:numParameters
the number of arguments that should be passed in a call to this routine.
应通过调用这个例程的参数的数量。

Additionally, the list will have an additional class, being CRoutine, CallRoutine, FortranRoutine or ExternalRoutine corresponding to the R interface by which it should be invoked.
此外,名单将有一个额外的类,CRoutine,CallRoutine,FortranRoutine或ExternalRoutine相应的R接口,它应调用。

If any of the symbols is not found, an error is immediately raised.
如果没有发现任何符号,一个错误立即提出。

If name contains only one symbol name and unlist is TRUE, then the single NativeSymbolInfo is returned rather than the list containing that one element.
如果name只包含一个符号名称和unlist是TRUE,然后单NativeSymbolInfo返回,而不是列表,其中包含一个元素。


注意----------Note----------

One motivation for accessing this reflectance information is to be able to pass native routines to C routines as function pointers in C. This allows us to treat native routines and R functions in a similar manner, such as when passing an R function to C code that makes callbacks to that function at different points in its computation (e.g., nls).  Additionally, we can resolve the symbol just once and avoid resolving it repeatedly or using the internal cache.  In the future, one may be able to treat NativeSymbol objects directly as callback objects.
访问此反射信息的动机之一是要能够通过原生的C程序例程在C函数指针,这使我们能够处理本地程序和R函数以类似的方式,如传递一个R函数的C代码时,在其计算的不同点(例如,nls)这个函数的回调。此外,我们可以解决的象征,只有一次,避免反复解决或使用内部缓存。在将来,人们也许能够治疗NativeSymbol对象直接作为回调对象。


作者(S)----------Author(s)----------


Duncan Temple Lang



参考文献----------References----------

see “In Search of C/C++ & FORTRAN Routines”, R-News, volume 1, number 3, 2001, p20–23 (http://CRAN.R-project.org/doc/Rnews/).  

参见----------See Also----------

getDLLRegisteredRoutines, is.loaded, .C, .Fortran, .External, .Call, dyn.load.  
getDLLRegisteredRoutines,is.loaded,.C,.Fortran,.External,.Call,dyn.load。


举例----------Examples----------


library(stats) # normally loaded[通常加载]
getNativeSymbolInfo("dansari")

getNativeSymbolInfo("hcass2")  # a Fortran symbol[一个Fortran符号]

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-2-2 16:47 , Processed in 0.028552 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表