WSPutFunction (C 函数)
int WSPutFunction(WSLINK link,const char *s,int n)
把一个标头由名称为 s,并带有 n 个自变量的符号给定的函数写入由 link 指定的 WSTP 连接.
范例
基本范例 (1)
#include "wstp.h"
/* put an Integrate[] expression to a link */
void f(WSLINK lp)
{
if(! WSPutFunction(lp, "Integrate", 2))
{ /* unable to put the function to lp */ }
if(! WSPutFunction(lp, "Times", 2))
{ /* unable to put the function to lp */ }
if(! WSPutFunction(lp, "Power", 2))
{ /* unable to put the function to lp */ }
if(! WSPutSymbol(lp, "x", 1))
{ /* unable to put the symbol to lp */ }
if( ! WSPutInteger(lp, 2))
{ /* unable to put the integer to lp */ }
if(! WSPutFunction(lp, "Power", 2))
{ /* unable to put the function to lp */ }
if(! WSPutFunction(lp, "Sqrt", 1))
{ /* unable to put the function to lp */ }
if(! WSPutSymbol(lp, "x", 1))
{ /* unable to put the symbol to lp */ }
if(! WSPutInteger(lp, -1))
{ /* unable to put the integer to lp */ }
if(! WSPutSymbol(lp, "x", 1))
{ /* unable to put the symbol to lp */ }
if(! WSEndPacket(lp))
{ /* unable to send the end-of-packet sequence to lp */ }
if(! WSFlush(lp))
{ /* unable to flush any buffered output data in lp */ }
}