MLGetInteger32Array (C 関数)

MLGetInteger32ArrayWSGetInteger32Arrayに置き換えられた.

int MLGetInteger32Array(MLINK link,int **a,int **dims,char ***heads,int *d)

link で指定されたMathLink接続から32ビットの整数の配列を得て,配列を a に,その次元を dims に,そしてその深さを d に保持しておく.

詳細

  • 配列 a と宣言されたC言語の配列のようにメモリにレイアウトされる.
  • heads は,配列の各レベルに頭部として現れる記号名に対応する文字列のリストを返す.
  • MLGetInteger32Array()は,MLReleaseInteger32Array()を呼び出して解放しなければならないメモリを割り当てる.MLGetInteger32Array()が不成功で関数の返す値がエラーを示す場合には,a のコンテンツについてMLReleaseInteger32Array()を呼び出してはならない.
  • MLGetInteger32Array()は不変のデータを返す.
  • MLGetInteger32Array()はエラーがあると0を返し,関数が成功すると0以外の値を返す.
  • MLError()を使うと,MLGetInteger32Array()が不成功の場合にエラーコードを引き出すことができる.
  • MLGetInteger32Array()は,MathLinkヘッダファイルmathlink.hの中で宣言される.

例題

  (1)

#include "mathlink.h"

/* read an array of 32-bit integers from a link */

void f(MLINK lp)
{
    int *data;
    int *dims;
    char **heads;
    int d;

    if(! MLGetInteger32Array(lp, &data, &dims, &heads, &d))
        {
            /* unable to read the array of integers from lp */
            return;
        }

    /* ... */

    MLReleaseInteger32Array(lp, data, dims, heads, d);
}