MLTestUTF16HeadWithArgCount has been replaced by WSTestUTF16HeadWithArgCount.

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

tests that the next object to be read from the MathLink connection specified by l is an expression with head s, an UTF-16 encoded character string of length v, and that the number of arguments of the expression is n.


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


Basic Examples  (1)

#include "mathlink.h"

/* A function to test whether the next expression on the Link is Plus[a,b] */

void f(MLINK l)
    unsigned short symbol[5];
    int args = 2;
    const char *symbol;

    symbol[0] = 0xFEFF;
    symbol[1] = 'P';
    symbol[2] = 'l';
    symbol[3] = 'u';
    symbol[4] = 's';

    if(! MLTestUTF16HeadWithArgCount(l, (const unsigned short *)symbol, 5, &args))
    { /* Next expression is not Plus, or does not have two args */ }

    if(! MLGetSymbol(l, &symbol))
    { /* Unable to read symbol */ }

    /* Check if symbol is 'a' */

    MLReleaseSymbol(l, symbol);

    if(! MLGetSymbol(l, &symbol))
    { /* Unable to read symbol */ }

    /* Check if the symbol is 'b' */

    MLReleaseSymbol(l, symbol);

See Also

MLGetArgCount()  MLTestHead()  MLTestHeadWithArgCount()  MLTestUCS2HeadWithArgCount()  MLTestUTF32HeadWithArgCount()  MLTestUTF8HeadWithArgCount()