MLTestUCS2Symbol (C Function)

MLTestUCS2Symbol has been replaced by WSTestUCS2Symbol.

int MLTestUCS2Symbol(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 UCS2 encoded string of length n.

Details

  • MLTestUCS2Symbol() fails if the current expression on the link l is not a symbol, or if the value of the symbol does not match s.
  • MLTestUCS2Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLTestUCS2Symbol() fails.
  • MLTestUCS2Symbol() will reset the stream pointer to the expression on the link just prior to calling MLTestUCS2Symbol()if the function fails. This operation behaves as if the programmer called MLCreateMark(link); MLTestUCS2Symbol(); MLSeekToMark().
  • MLTestUCS2Symbol() 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[4];

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

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