|
SOLUTIONS
|
MATHEMATICA MATHLINK C 関数
MLPutNext()
int MLPutNext(MLINK link, int type)
link 上に指定された型のオブジェクトを置く準備をする.
詳細詳細
- すべてのtype の値はMLTKで始まる.
- 次の型がよく使われる:
-
MLTKERR エラー MLTKINT 整数 MLTKFUNC 合成関数 MLTKREAL 近似実数 MLTKSTR 文字列 MLTKSYM 記号 MLTKOLDINT 古いバージョンのMathLink ライブラリからの整数 MLTKOLDREAL 古いバージョンのMathLink ライブラリからの近似実数 MLTKOLDSTR 古いバージョンのMathLink ライブラリからの文字列 MLTKOLDSYM 古いバージョンのMathLink ライブラリからの記号 - MLTKINTとMLTKREALは,必ずしもC言語のint型とdouble型の変数で保持できる数字を意味する訳ではない.
- MLPutNext()はエラーがあると0を返し, 関数が成功すると0以外の値を返す.
- MLError()を使うと,MLPutNext()が不成功の場合にエラーコードを引き出すことができる.
- MLPutNext()はMathLink ヘッダファイルmathlink.hの中で宣言される.
例題例題すべて開くすべて閉じる
例 (1)例 (1)
#include "mathlink.h"
/* send a function using tokens and argument counts to a link */
void f(MLINK lp)
{
if(! MLPutNext(lp, MLTKFUNC))
{ /* unable to put the function type to lp */ }
if(! MLPutArgCount(lp, 2))
{ /* unable to put the number of arguments to lp */ }
if(! MLPutSymbol(lp, "Plus"))
{ /* unable to put the symbol to lp */ }
if(! MLPutInteger32(lp, 2))
{ /* unable to put the integer to lp */ }
if(! MLPutInteger32(lp, 3))
{ /* unable to put the integer to lp */ }
if(! MLFlush(lp))
{ /* unable to flush any buffered outgoing data to lp */ }
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
