MLTestSymbol (C Function)

MLTestSymbol has been replaced by WSTestSymbol.

int MLTestSymbol(MLINK l, const char *s)

tests that the next expression on the MathLink connection specified by l is a symbol with the value s.

Details

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

Examples

Basic Examples  (1)

#include "mathlink.h"

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

void f(MLINK l)
{
    if(! MLTestSymbol(l, "List"))
    { /* The next expression on the link is not List */ }
    else
    { /* The next expression on the link is List */ }
}