MLTestUTF16Symbol (C Function)

MLTestUTF16Symbol has been replaced by WSTestUTF16Symbol.

int MLTestUTF16Symbol(MLINK l, const unsigned short *s, int n)

tests that the next expression on the MathLink connection specified by l is a symbol with the value s, a UTF-16 encoded string of length n.

Details

  • MLTestUTF16Symbol() fails if the current expression on the link l is not a symbol or if the value of the symbol does not match s.
  • MLTestUTF16Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLTestUTF16Symbol() fails.
  • MLTestUTF16Symbol() will reset the stream pointer to the expression on the link just prior to calling MLTestUTF16Symbol()if the function fails. This operation behaves as if the programmer called MLCreateMark(link); MLTestUTF16Symbol(); MLSeekToMark().
  • The UTF-16 encoded symbol s must include a byte order mark.
  • The length n of the UTF-16 symbol s must include the byte order mark.
  • MLTestUTF16Symbol() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

/* A function for testing the next symbol on the link */

void f(MLINK l)
{
    const unsigned short theSymbol[5];

    theSymbol[0] = 0xFEFF;
    theSymbol[1] = 'L';
    theSymbol[2] = 'i';
    theSymbol[3] = 's';
    theSymbol[4] = 't';

    if(! MLTestUTF16Symbol(l, (const unsigned short *)theSymbol,
        5))
    { /* The next expression on the link is not List */ }
    else
    { /* The next expression on the link is List */ }
}