MLTestUTF32Head()
This feature is not supported on the Wolfram Cloud.

has been replaced by WSTestUTF32Head.

int MLTestUTF32Head(MLINK l, const unsigned int *h, int v, int *n)
tests that the next expression to be read from l is an expression with the head h, a UTF-32 encoded name of length v, and stores the number of arguments of the expression in n.

DetailsDetails

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

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "mathlink.h"

/* A function for testing whether the next expression on the link is a ReturnPacket[] */

void f(MLINK l)
{
    const unsigned int packet[13];
    int arguments;

    packet[0] = 0xFEFF;
    packet[1] = 'R';
    packet[2] = 'e';
    packet[3] = 't';
    packet[4] = 'u';
    packet[5] = 'r';
    packet[6] = 'n';
    packet[7] = 'P';
    packet[8] = 'a';
    packet[9] = 'c';
    packet[10] = 'k';
    packet[11] = 'e';
    packet[12] = 't';

    if(! MLTestUTF32Head(l, (const unsigned short *)packet, 13,
        &arguments))
    { /* read the contents of the ReturnPacket[] */ }
    else
    { /* the head of the incoming expression is not ReturnPacket */ }
}
Introduced in 2014
(10.0)