WSTransferExpression (C 関数)
詳細

- dst と src とが異なっている必要はない.
- dst と src は,ループバックリンクでもよいし,普通のリンクでもよい.
- WSTransferExpression()はエラーがあると0を返し,関数が成功するとゼロ以外の値を返す.
- WSTransferExpression()はリンクからの式を読み取って,それをループバックリンクに保持するためによく使われる.
- WSTransferExpression()では dst に対して(MLINK)0 が渡され,src 上の式が除去される.
- WSTransferExpression()は,WSTPヘッダファイルwstp.hの中で宣言される.
例題
例 (1)
#include "wstp.h"
/* transfer an expression to link 2 from loopback link 1 */
void f(WSLINK lp2, WSLINK lp1)
{
/* send EvaluatePacket[ToExpression[str]] to lp1 */
if(! WSPutFunction(lp1, "EvaluatePacket", 1))
{ /* unable to put function to lp1 */ }
if(! WSPutFunction(lp1, "ToExpression", 1))
{ /* unable to put function to lp1 */ }
if(! WSPutString(lp1, "a = Table[RandomInteger[2,12]];"))
{ /* unable to put the string to lp1 */ }
if(! WSEndPacket(lp1))
{ /* unable to put the end-of-packet indicator to lp1 */ }
if(! WSFlush(lp1))
{ /* unable to put flush any outgoing data buffered in lp1 */ }
/* now transfer to lp2 from lp1 */
if(! WSTransferExpression(lp2, lp1))
{ /* unable to transfer an expression from lp1 to lp2 */ }
}
関連項目
テクニカルノート
関連するガイド
履歴
1996 で導入 (3.0) | 2007 で更新 (6.0)