MLReleaseUnicodeContainer (C 関数)

MLReleaseUnicodeContainerWSReleaseUnicodeContainerに置き換えられた.

void MLReleaseUnicodeContainer(MLUnicodeContainer *c)

MLUnicodeContainerオブジェクト c を保存するのに使われるメモリを解放する.

詳細

  • MLReleaseUnicodeContainer()は,MathLinkテンプレートファイルでMLUnicodeContainerオブジェクトを作成したり破壊したりするために,MLNewUnicodeContainer()と一緒に使われる.MLUnicodeContainerは,テンプレートファイル内の関数間でUnicodeの文字列とその長さを渡すのに便利なオブジェクトである.
  • ほとんどの場合,MathLinkテンプレートファイルのプロセッサプログラムmprepが,自動的にMLReleaseUnicodeContainer()を呼び出すコードを生成する.
  • MLReleaseUnicodeContainer()は,MathLinkヘッダファイルmathlink.hで宣言される.

例題

  (1)

#include "mathlink.h"

/* A simple function for sending a Unicode string using a MLUnicodeContainer object */

void f(MLUnicodeContainer *container, MLINK link)
{
    if(container == (MLUnicodeContainer *)0)
        return;

    switch(MLUnicodeStringType(container))
    {
        case UCS2ContainerType:
            if(! MLPutUCS2String(link, MLUCS2String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UCS-2 encoded string */ }
            break;
        case UTF8ContainerType:
            if(! MLPutUTF8String(link, MLUTF8String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UTF-8 encoded string */ }
            break;
        case UTF16ContainerType:
            if(! MLPutUTF16String(link, MLUTF16String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UTF-16 encoded string */ }
            break;
        case UTF32ContainerType:
            if(! MLPutUTF32String(link, MLUTF32String(container),
                MLUnicodeStringLength(container)))
            { /* Unable to send the UTF-32 encoded string */ }
            break;
    }

    MLReleaseUnicodeContainer(container);
}