OpenersNotesSection(Spacer1)Details

MLTestUTF32HeadWithArgCount() 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.

MLTestUTF32HeadWithArgCount() stores the actual number of arguments to the function in n when the function returns.

The symbol s encoded as an UTF-32 string must begin with a byte order mark.

The length of the symbol v must include the byte order mark.

MLTestUTF32HeadWithArgCount() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[MLError(), paclet:/ref/c/MLError]) to retrieve the error code if MLTestUTF32HeadWithArgCount() fails.

MLTestUTF32HeadWithArgCount() will reset the stream pointer to the expression on the link just prior to calling MLTestUTF32HeadWithArgCount() if the function fails. This operation behaves as if the programmer has called MLCreateMark(l); MLTestUTF32HeadWithArgCount(...); MLSeekToMark(...).

MLTestUTF32HeadWithArgCount() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)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 int symbol[5];
	int args = 2;
	const char *symbol;

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

	if(! MLTestUTF32HeadWithArgCount(l, (const unsigned int *)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);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLGetArgCount(), paclet:/ref/c/MLGetArgCount])  ▪  (NonWLLink[MLTestHead(), paclet:/ref/c/MLTestHead])  ▪  (NonWLLink[MLTestHeadWithArgCount(), paclet:/ref/c/MLTestHeadWithArgCount])  ▪  (NonWLLink[MLTestUCS2HeadWithArgCount(), paclet:/ref/c/MLTestUCS2HeadWithArgCount])  ▪  (NonWLLink[MLTestUTF16HeadWithArgCount(), paclet:/ref/c/MLTestUTF16HeadWithArgCount])  ▪  (NonWLLink[MLTestUTF8HeadWithArgCount(), paclet:/ref/c/MLTestUTF8HeadWithArgCount])}})}})